1import{_ as Fe}from"./ZaGmxyI9.js";import{_ as Vt}from"./B2Qq9v0C.js";import{d as At,D as Gt,a as ge,e as r,h as c,j as e,x as E,J as St,z as n,A,B as b,o,O as kt,t as Yt,k as ze,v as qe,P as We,n as He,w as bt,i as ft,m as dt,F as rt,y as xt,l as Te,r as R,f as Me,c as Tt,K as Rt,Q as je,T as Xe,p as Ge,u as Ue,I as Ye,R as Ke,H as Se,S as Ze,q as Qe,s as Je,G as tn}from"./DDwdkoEU.js";import{_ as en}from"./CdNSyQgr.js";import{_ as Dt}from"./DlAUqK2U.js";import{handleImageError as ne,getCdnRawImage as Ae,getGridImage as Be,formatVNDWithComma as de,getBrandPath as nn,getBrandUrlSegment as rn}from"./SIigdREP.js";import{u as on}from"./B11kWRUb.js";import{r as Oe}from"./BQ-r9YJg.js";import{_ as Re,t as an}from"./LqAfBTsf.js";import{c as Xt}from"./CSavATbq.js";import{u as me}from"./BIa9lt4s.js";import{_ as sn}from"./DUHFuje3.js";import{u as ln}from"./DStWa_Ld.js";import"./CrumvLTd.js";import"./1QztIsMF.js";const cn={class:"rounded-[10px] bg-[#f9fafc] px-4 py-2 font-monasans text-[14px] text-grayPetpet"},un={class:"flex items-center space-x-2"},dn={key:0},pn={key:1},mn={key:2},gn={key:3},fn={key:4},xn={class:"font-bold text-grayPetpet"},hn=At({__name:"Product",props:{productTitle:{},category:{}},setup(P){const _=P,a=Gt(),{mode:F}=ge(),v=r(()=>(_.category?.display?.common||"").split(" > ")[0]||""),y=r(()=>(_.category?.display?.common||"").split(" > ")[1]||"");function N(B){return B.normalize("NFD").replace(/[\u0300-\u036F]/g,"").replace(/Ä/g,"d").replace(/Ä/g,"D").toLowerCase().replace(/[^a-z0-9\s-]/g," ").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}const V=r(()=>v.value?N(v.value):""),O=r(()=>y.value?N(y.value):"");return(B,st)=>{const k=Vt;return o(),c("nav",cn,[e("ul",un,[e("li",null,[E(k,{to:n(a)("/"),class:"notranslate text-grayPetpet hover:underline",translate:"no"},{default:St(()=>[...st[0]||(st[0]=[kt("Petpet",-1)])]),_:1},8,["to"])]),v.value?(o(),c("li",dn," / ")):A("",!0),v.value?(o(),c("li",pn,[E(k,{to:n(a)(`/product/${n(F)}/${encodeURIComponent(V.value)}`),class:"text-grayPetpet hover:underline"},{default:St(()=>[kt(b(v.value),1)]),_:1},8,["to"])])):A("",!0),y.value?(o(),c("li",mn," / ")):A("",!0),y.value?(o(),c("li",gn,[E(k,{to:n(a)(`/product/${n(F)}/${encodeURIComponent(V.value)}/${encodeURIComponent(O.value)}`),class:"text-grayPetpet hover:underline"},{default:St(()=>[kt(b(y.value),1)]),_:1},8,["to"])])):A("",!0),P.productTitle?(o(),c("li",fn," / ")):A("",!0),e("li",xn,b(P.productTitle),1)])])}}}),vn={key:0,class:"w-full"},bn={class:"absolute inset-x-0 mx-auto flex h-[52px] w-full items-center gap-[8px] px-[6px] min-[1100px]:h-[80px] min-[1100px]:max-w-[720px] min-[1100px]:gap-[20px] min-[1100px]:px-0",style:{to
1p:"calc(var(--header-top, 8px) + env(safe-area-inset-top, 0px))"}},yn={class:"flex h-[44px] w-[44px] shrink-0 items-center justify-center rounded-full bg-white min-[1100px]:h-[64px] min-[1100px]:w-[64px]"},_n=At({__name:"ProductHeader",props:{product:{type:Object,required:!0},loading:{type:Boolean,default:!1}},setup(P){const _=P,a=Yt("ssrIsDesktop"),F=r(()=>_.product?.name||"");return(v,y)=>{const N=en,V=Vt;return P.product?(o(),c("div",vn,[e("div",{class:"sticky top-0 z-50 w-full bg-primary",style:He({height:n(a)?"100px":"calc(var(--header-h, 68px) + env(safe-area-inset-top, 0px))"})},[e("div",bn,[e("div",yn,[E(N,{color:"black"})]),ze(e("input",{"onUpdate:modelValue":y[0]||(y[0]=O=>We(F)?F.value=O:null),type:"text",name:"product-header-search",autocomplete:"off","aria-label":"Tên sản phẩm",placeholder:"",class:"h-[52px] min-w-0 flex-1 gap-[4px] rounded-[12px] bg-white px-[10px] py-[10.5px] font-normal leading-[28px] focus:border-transparent focus:outline-none focus-visible:ring-2 focus-visible:ring-primary min-[1100px]:h-[80px] min-[1100px]:px-[20px] min-[1100px]:text-2xl"},null,512),[[qe,n(F)]]),E(V,{to:"/","aria-label":"VỠtrang chủ",class:"flex h-[44px] w-[44px] shrink-0 items-center justify-center rounded-full bg-white min-[1100px]:h-[64px] min-[1100px]:w-[64px]"},{default:St(()=>[...y[1]||(y[1]=[e("svg",{width:"34",height:"30",viewBox:"0 0 34 30",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",class:"min-[1100px]:scale-150"},[e("g",{"clip-path":"url(#clip0_36731_21733)"},[e("path",{d:"M2.11463 28.4365C1.92621 24.9864 2.11463 15.5255 2.11463 14.6629C2.00152 14.7426 1.87385 14.7991 1.73891 14.8294C1.60397 14.8596 1.46441 14.8629 1.32819 14.8392C1.19197 14.8154 1.06176 14.765 0.944993 14.6908C0.828229 14.6166 0.727196 14.5201 0.647664 14.4069C0.487041 14.1781 0.423745 13.8948 0.4717 13.6193C0.519655 13.3439 0.674933 13.0987 0.903374 12.9379C2.81447 11.1589 4.94089 9.56861 6.28673 8.43653C8.70925 6.49583 11.051 4.58208 13.4197 2.69529C15.0885 1.37454 17.188 -0.835708 19.0184 0.323322C20.485 1.39885 21.8871 2.55988 23.2174 3.80041C24.3479 4.74381 25.3977 5.76807 26.5013 6.73842C26.8512 5.12117 26.5013 3.3961 29.0583 3.69259C30.9156 3.93518 30.5926 6.14542 30.4042 7.574C30.4042 8.49044 30.2427 9.40688 30.0812 10.2694C30.5119 11.0241 33.0151 12.9648 33.3112 13.3961C34.011 14.7438 32.7729 15.8759 31.2117 15.0673C31.4539 19.4877 31.5078 23.9352 31.3732 28.3557C31.2117 30.3503 29.0045 30.4581 28.6815 28.3557C28.6815 27.6549 28.8968 15.5255 29.0583 13.2613C25.4909 9.42028 21.7264 5.76755 17.7802 2.31793L4.32181 13.2344C4.32181 13.2344 4.32181 27.1158 4.32181 29.4069C4.24106 30.0538 2.2223 30.6198 2.11463 28.4365Z",fill:"#414042"}),e("path",{d:"M25.5326 29.2722C25.2366 26.3073 25.3711 24.3935 25.0212 21.5633C24.7251 18.4367 23.8907 15.3639 19.9609 14.3396C18.2814 13.812 16.4885 13.762 14.7823 14.1951C13.076 14.6282 11.5235 15.5274 10.2977 16.7924C7.30997 19.9461 7.71372 24.2588 7.84831 28.0593C7.84831 29.7035 7.6868 29.9461 7.25614 29.9461C6.82547 29.9461 6.52938 28.3558 6.50247 27.8437C6.32186 24.645 6.76058 21.4416 7.79447 18.4097C9.81323 13.8275 16.031 11.752 21.2529 13.0189C22.7347 13.4664 24.0445 14.3569 25.0067 15.5709C25.9689 16.785 26.5375 18.2645 26.6362 19.8113C27.0045 22.8155 27.1663 25.8415 27.1207 28.8679C27.1743 29.0788 27.142 29.3024 27.0309 29.4894C26.9199 29.6764 26.7392 29.8116 26.5286 29.8652C26.318 29.9188 26.0947 29.8865 25.908 29.7753C25.7212 29.6641 25.5862 29.4831 25.5326 29.2722Z",fill:"#414042"})]),e("defs",null,[e("clipPath",{id:"clip0_36731_21733"},[e("rect",{width:"33",height:"30",fill:"white",transform:"translate(0.5)"})])])],-1)])]),_:1})])],4)])):A("",!0)}}}),wn=Dt(_n,[["__scopeId","data-v-d4f378cc"]]),kn=["aria-label"],$n={class:"relative flex flex-[2] items-center justify-center rounded-l-lg bg-white"},Pn=["src"],Sn={key:1,class:"relative flex h-full w-full items-center justify-center"},Cn=["src","alt"],In={key:0,class:"pointer-events-none absolute inset-0 z-[6] flex items-center justify-center"},Ln={class:"flex flex-[1.2] flex-col rounded-r-lg border-l border-gray-200 bg-white"},Tn={class:"px-4 pb-3 pt-14 font-monasans text-[24px] font-bold leading-[40px] text-grayPetpet"},An={class:"grid grid-cols-3 gap-x-4 gap-y-4 overflow-y-auto px-4 pb-4 pt-2"},Fn=["aria-label","onClick"],En=["src"],Nn=["src","alt","onError"],Dn={__name:"ProductMediaPreview",props:{product:{type:Object,required:!0},selectedUnit:{type:Object,default:null},isOpen:{type:Boolean,default:!1},initialMedia:{type:String,default:""},initialType:{type:String,default:"image"}},emits:["close","select-unit"],setup(P,{emit:_}){const a=P,F=_,v=R(0),y=C=>String(C??"").trim().replace(/^http:\/\//i,"https://").split("?")[0];function N(C){if(!C||C.type!=="image")return;const T=y(C.src),H=(Array.isArray(a.product?.units)?a.product.units:[]).findIndex(tt=>y(tt?.main_image)===T);H>=0&&F("select-unit",H)}function V(C){return Array.isArray(C)?C.map(T=>typeof T=="string"?T:T?.src||T?.url||T?.image).filter(T=>typeof T=="string"&&T.trim().length>0):typeof C=="string"&&C.trim().length>0?[C.trim()]:[]}const O=r(()=>{const C=[];a.product.video&&C.push({type:"video",src:a.product.video});const T=Array.isArray(a.product?.units)?a.product.units.map(H=>H?.main_image).filter(H=>typeof H=="string"&&H.trim().length>0):[],U=[a.initialType==="image"?a.initialMedia:"",a.product?.main_image,...T,...V(a.product?.images)].filter(H=>typeof H=="string"&&H.trim().length>0);
1return Array.from(new Set(U)).forEach(H=>{C.push({type:"image",src:H})}),C}),B=r(()=>O.value[v.value]),st=C=>{const T=C?.online_stock??C?.stock??C?.quantity??C?.inventory_quantity??C?.stock_quantity??C?.remaining_deal_stock;if(T==null||T==="")return null;const U=Number(T);return Number.isFinite(U)?U:null},k=r(()=>{if(!B.value||B.value.type!=="image")return null;const C=y(B.value.src);return(Array.isArray(a.product?.units)?a.product.units:[]).find(U=>y(U?.main_image)===C)||null}),D=r(()=>{const C=k.value||a.selectedUnit||a.product;return st(C)}),Z=r(()=>B.value?.type==="image"&&D.value!==null&&D.value<=0),et=C=>{v.value=C,N(O.value[C])};bt(()=>[a.isOpen,a.initialMedia,a.initialType,O.value.length],()=>{if(!a.isOpen||!O.value.length)return;const C=O.value.findIndex(T=>y(T.src)===y(a.initialMedia)&&T.type===a.initialType);v.value=C>=0?C:0,N(O.value[v.value])},{immediate:!0});const W=()=>{v.value=(v.value-1+O.value.length)%O.value.length,N(O.value[v.value])},j=()=>{v.value=(v.value+1)%O.value.length,N(O.value[v.value])},M=C=>String(C??"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().trim(),it=(C,T)=>{const U=`${M(C)} ${M(T)}`;return/(khoi.?luong|trong.?luong|weight|size|dung.?tich)/.test(U)?1:/(mui.?vi|huong.?vi|flavor|taste)/.test(U)?2:3},m=r(()=>(Array.isArray(a.product?.spu?.attribute_options)?a.product.spu.attribute_options:[]).slice().sort((T,U)=>(T?.display_order??0)-(U?.display_order??0))),z=r(()=>String(a.product?.title||a.product?.name||"").trim()),yt=r(()=>{const C=a.selectedUnit?.sku_attributes&&typeof a.selectedUnit.sku_attributes=="object"?a.selectedUnit.sku_attributes:{},T=Object.entries(C).filter(([,q])=>typeof q=="string"&&q.trim()),U=new Map((m.value||[]).map(q=>[String(q?.key_code??""),q])),H=T.map(([q,pt])=>{const ot=U.get(q);return{value:String(pt).trim(),priority:it(String(ot?.key_code??q),String(ot?.key_label??"")),displayOrder:Number(ot?.display_order??9999)}}).sort((q,pt)=>q.priority-pt.priority||q.displayOrder-pt.displayOrder).map(q=>q.value);if(H.length)return H;const tt=String(a.selectedUnit?.variant_unit_name??"").trim();return tt?[tt]:[]}),Y=r(()=>z.value?yt.value.length?`${z.value} - ${yt.value.join(" | ")}`:z.value:""),ht=()=>F("close");return(C,T)=>P.isOpen?(o(),c("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/70",role:"dialog","aria-modal":"true",tabindex:"-1","aria-label":Y.value||"Xem ảnh sản phẩm",onClick:ht,onKeydown:Te(ht,["esc"])},[e("div",{class:"relative flex h-[90%] w-[95%] max-w-5xl overflow-hidden rounded-lg bg-white shadow-lg",onClick:T[1]||(T[1]=dt(()=>{},["stop"]))},[e("div",$n,[B.value.type==="video"?(o(),c("video",{key:0,src:B.value.src,autoplay:"",controls:"",class:"max-h-full max-w-full object-contain"},null,8,Pn)):(o(),c("div",Sn,[e("img",{src:n(Ae)(B.value.src),alt:Y.value||"Ảnh sản phẩm",width:"900",height:"900",decoding:"async",fetchpriority:"high",onError:T[0]||(T[0]=U=>n(ne)(U,B.value.src)),class:ft(["max-h-full max-w-full object-contain transition",Z.value?"opacity-60":"opacity-100"])},null,42,Cn),Z.value?(o(),c("div",In,[...T[2]||(T[2]=[e("div",{class:"flex h-[150px] w-[150px] items-center justify-center rounded-full bg-black/55 px-5 text-center font-monasans text-[24px] font-semibold leading-[30px] text-white md:h-[190p
1x] md:w-[190px] md:text-[30px] md:leading-[36px] lg:h-[160px] lg:w-[160px] lg:text-[26px] lg:leading-[32px]"}," Tạm hết hà ng ",-1)])])):A("",!0)])),O.value.length>1?(o(),c("button",{key:2,type:"button","aria-label":"Xem ảnh trưá»c",class:"absolute left-6 top-1/2 z-[20] flex h-[92px] w-[92px] -translate-y-1/2 items-center justify-center rounded-full bg-[#F1F1F1]/95 text-[#4B5254] shadow-[0_10px_28px_rgba(0,0,0,0.10)] transition hover:bg-white",onClick:dt(W,["stop"])},[...T[3]||(T[3]=[e("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true"},[e("path",{d:"M15 6L9 12L15 18",stroke:"currentColor","stroke-width":"2.8","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])])):A("",!0),O.value.length>1?(o(),c("button",{key:3,type:"button","aria-label":"Xem ảnh tiếp theo",class:"absolute right-6 top-1/2 z-[20] flex h-[92px] w-[92px] -translate-y-1/2 items-center justify-center rounded-full bg-[#F1F1F1]/95 text-[#4B5254] shadow-[0_10px_28px_rgba(0,0,0,0.10)] transition hover:bg-white",onClick:dt(j,["stop"])},[...T[4]||(T[4]=[e("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true"},[e("path",{d:"M9 6L15 12L9 18",stroke:"currentColor","stroke-width":"2.8","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])])):A("",!0)]),e("div",Ln,[e("button",{type:"button","aria-label":"Äóng xem ảnh",class:"absolute right-3 top-3 z-10 rounded-full bg-white p-2 shadow hover:bg-gray-200",onClick:dt(ht,["self"])}," â "),e("div",Tn,b(Y.value),1),e("div",An,[(o(!0),c(rt,null,xt(O.value,(U,H)=>(o(),c("button",{key:`${U.type}-${y(U.src)}`,type:"button",class:ft(["group relative aspect-square cursor-pointer rounded-[10px] bg-white p-[2px] transition",H===v.value?"ring-2 ring-yellow-400 ring-offset-1 ring-offset-white":"ring-1 ring-transparent hover:ring-yellow-300"]),"aria-label":`Xem media ${H+1}`,onClick:tt=>et(H)},[U.type==="video"?(o(),c(rt,{key:0},[e("video",{src:U.src,class:"h-full w-full rounded-[8px] object-cover",muted:""},null,8,En),T[5]||(T[5]=e("span",{class:"absolute bottom-1 right-1 rounded bg-black/70 px-1 text-[10px] text-white"}," 0:45 ",-1))],64)):(o(),c("img",{key:1,src:n(Be)(U.src),alt:Y.value||"Ảnh sản phẩm",width:"160",height:"160",loading:"lazy",decoding:"async",onError:tt=>n(ne)(tt,U.src),class:"h-full w-full rounded-[8px] object-cover"},null,40,Nn))],10,Fn))),128))]),e("button",{type:"button","aria-label":"Äóng xem ảnh",class:"absolute right-3 top-3 rounded-full bg-white p-2 shadow hover:bg-gray-200",onClick:ht}," â ")])])],40,kn)):A("",!0)}},Mn={key:0,class:"mx-auto flex w-full flex-col gap-4"},jn={class:"flex gap-2"},Un=["src"],Bn=["onKeydown"],On={key:0,class:"pointer-events-none absolute inset-0 z-[5]"},Rn=["src","alt"],Vn=["src","alt"],zn={key:3,class:"pointer-events-none absolute inset-0 z-[6] flex items-center justify-center"},qn=["src"],Wn=["src"],Hn=["data-thumb-idx","aria-label","onClick"],Xn=["src","alt","onError"],Gn=["src","alt"],Yn={key:0,class:"absolute bottom-6 left-1/2 -translate-x-1/2 rounded-full bg-black/55 px-3 py-1 text-sm font-medium text-white"},Ne=40,De=30,Kn=8,ee=6,Zn=At({__name:"ProductGallery",props:{product:{type:Object,required:!0},selectedUnit:{type:Object,default:null},selectedUnitIndex:{type:Number,default:0},loading:{type:Boolean,default:!1}},emits:["select-unit"],setup(P,{emit:_}){const a=P,F=R(!1),v=R(null),y=R(!0);function N(){y.value=!1}const V=_,O=R(),B=R(null),{extractFrame:st}=on(),k=r(()=>O.value||a.selectedUnit?.main_image||a.product?.main_image||yt(a.product?.images)[0]||""),D=r(()=>{const u=a.selectedUnit?.online_stock??a.selectedUnit?.stock??a.selectedUnit?.quantity??a.product?.online_stock??a.product?.stock??a.product?.quantity??a.product?.inventory_quantity??a.product?.stock_quantity;if(u==null||u==="")return null;const i=Number(u);return Number.isFinite(i)?i:null}),Z=r(()=>D.value!==null&&D.value<=0),et=async()=>{if(a.product?.video&&!B.value)try{const u=await st(a.product.video,2);u&&(B.value=u)}catch(u){console.warn("Failed to extract video frame:",u)}};bt(()=>[a.product,a.selectedUnit?.main_image],([u,i])=>{O.value=i||u?.main_image,u?.video&&et()},{immediate:!0}),Me(()=>{a.product?.video&&et()});const W=R(!1),j=r(()=>!O.value&&B.value?B.value:k.value);bt(()=>[j.value,W.value,a.loading],async([u,i,h])=>{if(h||i||!u){y.value=!1;return}y.value=!0,await Rt();const S=()=>{const L=v.value;
1return L&&L.complete&&L.naturalWidth>0?(y.value=!1,!0):!1};S()||window.requestAnimationFrame(()=>{S()||window.setTimeout(()=>{S()},120)})},{immediate:!0});const M=u=>String(u??"").trim().replace(/^http:\/\//i,"https://").split("?")[0];function it(u){return!W.value&&M(k.value)===M(u)}function m(u){const i=M(u),h=M(k.value);if(!W.value&&i&&i===h)return;y.value=!0,W.value=!1,O.value=u;const S=Array.isArray(a.product?.units)?a.product.units.findIndex(L=>M(L?.main_image)===i):-1;S>=0&&S!==a.selectedUnitIndex&&(F.value=!0,V("select-unit",S))}function z(){y.value=!1,W.value=!0}function yt(u){return Array.isArray(u)?u.map(i=>typeof i=="string"?i:i?.src||i?.url||i?.image).filter(i=>typeof i=="string"&&i.trim().length>0):typeof u=="string"&&u.trim().length>0?[u.trim()]:[]}const Y=r(()=>{const u=yt(a.product?.images),i=Array.isArray(a.product?.units)?a.product.units.map(G=>G?.main_image).filter(G=>typeof G=="string"&&G.trim().length>0):[],h=[a.product?.main_image,...i,...u,a.selectedUnit?.main_image],S=new Set,L=[];for(const G of h){if(typeof G!="string"||!G.trim())continue;const lt=M(G);!lt||S.has(lt)||(S.add(lt),L.push(G))}return L}),ht=r(()=>a.product?.video),C=r(()=>!!ht.value?.trim?.()),T=r(()=>Y.value.length+(C.value?1:0)),U=r(()=>T.value>6),H=r(()=>Y.value.length>1),tt=r(()=>{const u=M(k.value);return Y.value.findIndex(i=>M(i)===u)}),q=R(!1),pt=R(null),ot=R("image");function mt(u,i){if(!gt.value){i==="image"&&u&&m(u),q.value=!0;return}pt.value=u,ot.value=i,q.value=!0}function _t(){q.value=!1,pt.value=null,ot.value="image"}function wt(u){u!==a.selectedUnitIndex&&V("select-unit",u)}function Ct(u){if(!Y.value.length)return;const i=Y.value.length,h=(u%i+i)%i,S=Y.value[h];S&&m(S)}function It(){const u=Y.value.length;if(!u)return;const i=tt.value>=0?tt.value:0;if(i<=0)return;const h=i-1,{leftEdge:S}=gt.value?Nt(i,u):ae(),L=gt.value?h<S:ve(i,80);Ct(h),L&&Rt(()=>
1{gt.value?jt(-1,ee,"smooth"):se(-1,"smooth")})}function I(){const u=Y.value.length;if(!u)return;const i=tt.value>=0?tt.value:0,h=(i+1)%u,S=i>=u-1,{rightEdge:L}=gt.value?Nt(i,u):ae(),G=!S&&(gt.value?h>L:he(i));if(Ct(h),S){Rt(()=>be("smooth"));return}G&&Rt(()=>{gt.value?jt(1,ee,"smooth"):se(1,"smooth")})}const g=R(null),$=R(null),d=R(!1),s=R(null),x=R(null);function f(u){s.value=u.clientX,x.value=u.clientY}function nt(u){if(s.value===null||x.value===null)return;const i=u.clientX-s.value,h=u.clientY-x.value;Math.abs(h)>De||Math.abs(i)<Ne||(i<0?I():It(),s.value=null,x.value=null)}function $t(){s.value=null,x.value=null}function Mt(u){g.value=u.clientX,$.value=u.clientY}function fe(u){if(g.value===null||$.value===null)return;const i=u.clientX-g.value,h=u.clientY-$.value;Math.abs(h)>De||Math.abs(i)<Ne||(d.value=!0,i<0?I():It(),g.value=null,$.value=null)}function zt(){g.value=null,$.value=null}function Kt(){if(d.value){d.value=!1;return}mt(k.value||B.value||"","image")}const gt=Yt("ssrIsDesktop"),Zt=r(()=>k.value||B.value||""),qt=r(()=>Y.value.length),xe=r(()=>qt.value?tt.value>=0?tt.value+1:1:0),Qt=R(!1),vt=R(null),Ft=R(null),re=R(0);function Et(u){const i=vt.value;i&&(Ft.value=u.clientX,re.value=i.scrollLeft)}function Nt(u,i){const S=Math.floor(u/ee)*ee,L=Math.min(i-1,S+ee-1);return{leftEdge:S,rightEdge:L}}function oe(u){const i=u.querySelector('[data-thumb-idx="0"]');if(!i)return 0;const h=getComputedStyle(u),S=Number.parseFloat(h.columnGap||h.gap||"0")||0;return i.offsetWidth+S}function jt(u,i,h="smooth"){const S=vt.value;if(!S)return;const L=oe(S);if(!L){se(u,h);return}const G=Math.max(0,S.scrollWidth-S.clientWidth),lt=S.scrollLeft+u*i*L,ut=Math.min(G,Math.max(0,lt));S.scrollTo({left:ut,behavior:h})}function ae(){const u=vt.value,i=Y.value.length;if(!u||i<=0)return{leftEdge:0,rightEdge:0};const h=u.scrollLeft,S=h+u.clientWidth;let L=-1,G=-1;const lt=1;for(let ut=0;ut<i;ut++){const te=u.querySelector(`[data-thumb-idx="${ut}"]`);if(!te)continue;const le=te.offsetLeft,ce=le+te.offsetWidth;Math.min(ce,S)-Math.max(le,h)>lt&&(L===-1&&(L=ut),G=ut)}if(L===-1||G===-1){const ut=tt.value>=0?tt.value:0;return{leftEdge:ut,rightEdge:ut}}return{leftEdge:L,rightEdge:G}}function he(u,i=2){const h=vt.value;if(!h)return!1;const S=h.querySelector(`[data-thumb-idx="${u}"]`);if(!S)return!1;const L=h.scrollLeft+h.clientWidth;return S.offsetLeft+S.offsetWidth>=L-i}function ve(u,i=2){const h=vt.value;if(!h)return!1;const S=h.querySelector(`[data-thumb-idx="${u}"]`);if(!S)return!1;const L=h.scrollLeft;return S.offsetLeft<=L+i}function se(u,i="smooth"){const h=vt.value;if(!h)return;const S=Math.max(0,h.scrollWidth-h.clientWidth),L=Math.min(S,Math.max(0,h.scrollLeft+u*h.clientWidth));h.scrollTo({left:L,behavior:i})}function be(u="smooth"){const i=vt.value;i&&i.scrollTo({left:0,behavior:u})}function Jt(){const u=M(a.selectedUnit?.main_image);return u?Y.value.findIndex(i=>M(i)===u):-1}function Wt(u,i="smooth"){const h=vt.value;if(!h||u<0||u>=Y.value.length)return;const S=Math.max(0,h.scrollWidth-h.clientWidth);if(gt.value){const{leftEdge:lt}=Nt(u,Y.value.length),ut=oe(h);if(!ut)return;h.scrollTo({left:Math.min(S,Math.max(0,lt*ut)),behavior:i});return}const L=h.querySelector(`[data-thumb-idx="${u}"]`);if(!L)return;const G=()=>{const ut=L.offsetLeft+L.offsetWidth/2-h.clientWidth/2;h.scrollTo({left:Math.min(S,Math.max(0,ut)),behavior:i})};G(),requestAnimationFrame(G)}function Ut(u){const i=vt.value;if(!i||Ft.value===null)return;const h=u.clientX-Ft.value;Math.abs(h)>=Kn&&(Qt.value=!0),i.scrollLeft=re.value-h}function Bt(){Ft.value=null}function ie(u){const i=vt.value;if(!i)return;const h=Math.abs(u.deltaX)>Math.abs(u.deltaY)?u.deltaX:u.deltaY;h&&(i.scrollLeft+=h)}function ye(u){if(Qt.value){Qt.value=!1;return}m(u)}return bt(()=>[a.selectedUnitIndex,a.selectedUnit?.main_image,a.loading],async([,,u])=>{if(u)return;if(await Rt(),F.value){F.value=!1;return}const i=Jt();i<0||Wt(i,"smooth")},{immediate:!0}),(u,i)=>{const h=Fe,S=Dn;return o(),c("div",null,[P.loading?(o(),c("div",Mn,[E(h,{height:"auto",width:"100%","custom-class":"aspect-square rounded-[8px] lg:rounded-[14px]",variant:"gold"}),e("div",jn,[(o(),c(rt,null,xt(5,L=>E(h,{key:L,height:"68px",width:"70px",class:"rounded-[6px]",variant:"gold"})),64))])])):(o(),c(rt,{key:1},[n(W)?(o(),c("video",{key:0,class:"flexRow-center mx-auto aspect-square w-full overflow-hidden rounded-[8px] bg-white lg:rounded-[14px]",controls:"",loop:"",autoplay:"",src:P.product.video,onClick:i[0]||(i[0]=L=>mt(P.product.video,"video"))}," Your browser does not support the video tag ",8,Un)):(o(),c("div",{key:1,role:"button",tabindex:"0","aria-label":"MỠxem ảnh sản phẩm",class:"flexRow-center relative isolate mx-auto aspect-square w-full overflow-hidden rounded-[8px] bg-white lg:rounded-[14px]",onClick:Kt,onKeydown:[Te(dt(Kt,["prevent"]),["enter"]),Te(dt(Kt,["prevent"]),["space"])],onPointerdown:Mt,onPointermove:fe,onPointerup:zt,onPointercancel:zt,onPointerleave:zt,onDragstart:i[2]||(i[2]=dt(()=>{},["prevent"])),style:{"touch-action":"pan-y"}},[n(y)?(o(),c("div",On,[E(h,{height:"100%",width:"100%","custom-class":"h-full w-full rounded-[8px] lg:rounded-[14px]",variant:"gold"})])):A("",!0),!n(O)&&n(B)?(o(),c("img",{key:1,ref_key:"mainImageEl",ref:v,src:n(B),alt:P.product.title||P.product.name,width:"900",height:"900",decoding:"async",fetchpriority:"high",onLoad:N,onError:N,class:ft(["h-full w-full object-contain transition lg:object-cover",n(y)?"opacity-0":n(Z)?"opacity-60":"opacity-100"])},null,42,Rn)):(o(),c("img",{key:2,ref_key:"mainImageEl",ref:v,src:n(Ae)(n(k)),alt:P.product.title||P.product.name,width:"900",height:"900",decoding:"async",fetchpriority:"high",onLoad:N,onError:i[1]||(i[1]=L=>{n(ne)(L,n(k)),N()}),class:ft(["h-full w-full object-contain transition lg:object-cover",n(y)?"opacity-0":n(Z)?"opacity-60":"opacity-100"])},null,42,Vn)),n(Z)&&!n(y)?(o(),c("div",zn,[...i[9]||(i[9]=[e("div",{class:"flex h-[150px] w-[150px] items-center justify-center rounded-full bg-black/55 px-5 text-center font-monasans text-[24px] font-semibold leading-[30px] text-white md:h-[190p
1x] md:w-[190px] md:text-[30px] md:leading-[36px] lg:h-[160px] lg:w-[160px] lg:text-[26px] lg:leading-[32px]"}," Tạm hết hà ng ",-1)])])):A("",!0),n(H)&&n(gt)?(o(),c("button",{key:4,type:"button","aria-label":"Xem ảnh trưá»c",class:"absolute left-3 top-1/2 z-[7] flex h-12 w-12 -translate-y-1/2 items-center justify-center rounded-full bg-white text-[#414545] shadow-[0_6px_18px_rgba(0,0,0,0.15)] hover:bg-white/95 md:h-14 md:w-14",onClick:dt(It,["stop","prevent"])},[...i[10]||(i[10]=[e("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true"},[e("path",{d:"M15 6L9 12L15 18",stroke:"currentColor","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])])):A("",!0),n(H)&&n(gt)?(o(),c("button",{key:5,type:"button","aria-label":"Xem ảnh tiếp theo",class:"absolute right-3 top-1/2 z-[7] flex h-12 w-12 -translate-y-1/2 items-center justify-center rounded-full bg-white text-[#414545] shadow-[0_6px_18px_rgba(0,0,0,0.15)] hover:bg-white/95 md:h-14 md:w-14",onClick:dt(I,["stop","prevent"])},[...i[11]||(i[11]=[e("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true"},[e("path",{d:"M9 6L15 12L9 18",stroke:"currentColor","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])])):A("",!0)],40,Bn)),e("div",{class:"mx-auto flex h-fit w-full items-center justify-start gap-[6px] bg-white px-4 py-[12px] md:gap-[12px] md:py-[24px]",onDragstart:i[5]||(i[5]=dt(()=>{},["prevent"]))},[n(U)?(o(),c("button",{key:0,type:"button","aria-label":"Cuá»n thumbnail trưá»c",class:"rounded-full bg-white p-2 shadow md:p-4",onClick:dt(It,["stop","prevent"])}," â¹ ")):A("",!0),e("div",{ref_key:"thumbStripEl",ref:vt,class:"thumb-strip flex min-w-0 flex-1 items-center justify-start gap-[6px] overflow-x-auto overflow-y-hidden md:gap-[12px]",onPointerdown:Et,onPointermove:Ut,onPointerup:Bt,onPointercancel:Bt,onPointerleave:Bt,onWheel:dt(ie,["prevent"]),onDragstart:i[4]||(i[4]=dt(()=>{},["prevent"])),style:{"touch-action":"pan-y"}},[n(C)?(o(),c("button",{key:0,type:"button","aria-label":"Xem video sản phẩm",class:ft(["relative flex h-12 w-12 shrink-0 cursor-pointer flex-col items-center justify-center overflow-hidden rounded-[6.38px] border md:h-24 md:w-24 lg:h-[68px] lg:w-[70px]",n(W)?"border-primary bg-primary":"border-transparent bg-primary"]),onClick:i[3]||(i[3]=L=>z())},[n(B)?(o(),c("img",{key:0,src:n(B),alt:"Video thumbnail",width:"96",height:"96",loading:"lazy",decoding:"async",class:"absolute inset-0 h-full w-full object-cover"},null,8,qn)):(o(),c("video",{key:1,controls:"",src:P.product.video,class:"h-full w-full object-cover"}," Your browser does not support the video tag ",8,Wn)),i[12]||(i[12]=e("div",{class:"absolute inset-0 flex items-center justify-center"},[e("div",{class:"rounded-full bg-black/50 p-1 md:p-2"},[e("svg",{class:"h-4 w-4 text-white md:h-8 md:w-8",fill:"currentColor",viewBox:"0 0 24 24"},[e("path",{d:"M8 5v14l11-7z"})])])],-1))],2)):A("",!0),(o(!0),c(rt,null,xt(n(Y),(L,G)=>(o(),c("button",{type:"button",key:M(L),"data-thumb-idx":G,"aria-label":`Xem ảnh sản phẩm ${G+1}`,class:ft(["aspect-square h-12 w-12 shrink-0 overflow-hidden rounded-[6.38px] border md:h-24 md:w-24 lg:h-[68px] lg:w-[70px]",it(L)?"border-primary":"border-transparent"]),onClick:lt=>ye(L)},[e("img",{src:n(Be)(L),alt:P.product?.title||P.product?.name,width:"96",height:"96",loading:"lazy",decoding:"async",onError:lt=>n(ne)(lt,L),class:"h-full w-full object-cover"},null,40,Xn)],10,Hn))),128))],544),n(U)?(o(),c("button",{key:1,type:"button","aria-label":"Cuá»n thumbnail tiếp theo",class:"rounded-full bg-white p-2 shadow md:p-4",onClick:dt(I,["stop","prevent"])}," ⺠")):A("",!0)],32),n(q)&&n(gt)?(o(),Tt(S,{key:2,product:P.product,"is-open":n(q),"selected-unit":P.selectedUnit,"initial-media":n(pt),"initial-type":n(ot),onClose:_t,onSelectUnit:wt},null,8,["product","is-open","selected-unit","initial-media","initial-type"])):A("",!0),n(q)&&!n(gt)?(o(),c("div",{key:3,class:"fixed inset-0 z-[80] bg-black/75",onClick:_t},[e("img",{onPointerdown:f,onPointermove:nt,onPointerup:$t,onPointercancel:$t,onPointerleave:$t,onDragstart:i[6]||(i[6]=dt(()=>{},["prevent"])),style:{"touch-action":"pan-y"},src:n(Ae)(n(Zt)),alt:P.product.title||P.product.name,width:"900",height:"900",decoding:"async",class:"absolute left-1/2 top-1/2 max-h-[82vh] w-auto max-w-[92vw] -translate-x-1/2 -translate-y-1/2 object-contain",onClick:i[7]||(i[7]=dt(()=>{},["stop"])),onError:i[8]||(i[8]=L=>n(ne)(L,n(Zt)))},null,40,Gn),n(qt)>0?(o(),c("div",Yn,b(n(xe))+"/"+b(n(qt)),1)):A("",!0)])):A("",!0)],64))])}}}),Qn=Dt(Zn,[["__scopeId","data-v-772027d8"]]),Jn=""+new URL("app.BdvmXLQx.svg",import.meta.url).href,tr=""+new URL("SEN.DkZ_9Pw3.svg",import.meta.url).href,er=""+new URL("QRDowload.3kt2i2VX.svg",import.meta.url).href,nr={__name:"Popup",props:{show:Boolean},emits:["close"],setup(P,{emit:_}){const a=_;return(F,v)=>P.show?(o(),c("div",{key:0,class:"fixed inset-0 z-40 flex items-center justify-center bg-black/50",onClick:v[0]||(v[0]=dt(y=>a("close"),["self"]))},[...v[1]||(v[1]=[je('<div class="relative flex h-[400px] w-[700px] items-center justify-between overflow-visible bg-[#FFD43B] shadow-lg md:h-[600px] md:w-[1000px]" style="border-radius:80px 80px 0px 60px;" data-v-b09c8cec><img src="'+Jn+'" alt="background" class="absolute inset-0 h-full w-full rounded-[80px_80px_0px_60px] object-cover" data-v-b09c8cec><div class="relative z-10 flex w-full flex-col justify-start pl-[10px] pt-[60px] md:pl-[20px] md:pt-[100px]" data-v-b09c8cec><div class="flex items-center" data-v-b09c8cec><img src="'+tr+'" alt="sen text" class="w-[230px] -translate-x-[110px] -translate-y-[10px] md:w-[400px] md:-translate-x-[180px] md:-translate-y-[20px]" data-v-b09c8cec><div class="-ml-[70px] flex flex-col justify-center md:-ml-[120px]" data-v-b09c8cec><p class="font-Longreach text-[32px] font-extrabold leading-tight text-[#414545] md:text-[56px]" data-v-b09c8cec> VÃO ỨNG DỤNG PETPET<br data-v-b09c8cec>Äá» TIẾP TỤC MUA SẮM NHAAAA </p><p class="mt-[8px] font-monasans text-[18px] text-[#414545] md:mt-[16px] md:text-[32px]" data-v-b09c8cec> Nhiá»u voucher và ưu Äãi hấp dẫn Äang chá» ð </p></div></div><div class="ml-[110px] mt-[20px] flex flex-col items-start md:ml-[200px] md:mt-[40px]" data-v-b09c8cec><img src="'+er+'" alt="qr-code" class="h-[180px] w-[180px] rounded-[16px] bg-white p-[8px] md:h-[280px] md:w-[280px] md:rounded-[24px] md:p-[12px]" data-v-b09c8cec><div class="mt-[14px] flex items-center gap-[8px] md:mt-[24px] md:gap-[16px]" data-v-b09c8cec><a href="https://play.google.com/store/apps/details?id=com.petpet" target="_blank" class="flex h-[44px] w-[100px] items-center justify-center gap-[6px] rounded-[10px] bg-[#FFF8D6] px-[10px] shadow md:h-[70px] md:w-[160px] md:rounded-[16px] md:px-[16px]" data-v-b09c8cec><svg class="h-[20px] w-[20px] md:h-[32px] md:w-[32px]" viewBox="0 0 36 37" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-b09c8cec>
1<path d="M2.10156 34.4047V3.5327C2.10176 3.46572 2.1212 3.4003 2.15744 3.34462C2.19367 3.28895 2.24509 3.24551 2.30525 3.21976C2.36541 3.194 2.43163 3.18708 2.4956 3.19984C2.55958 3.21261 2.61846 3.24451 2.66486 3.29154L18.3051 18.9679L2.66486 34.6459C2.61846 34.6929 2.55958 34.7248 2.4956 34.7376C2.43163 34.7504 2.36541 34.7434 2.30525 34.7177C2.24509 34.6919 2.19367 34.6485 2.15744 34.5928C2.1212 34.5372 2.10176 34.4717 2.10156 34.4047ZM24.8629 25.4094L5.25208 36.5139L5.23985 36.521C4.90202 36.7095 4.58101 36.2398 4.85769 35.9664L20.2304 20.8588L24.8629 25.4094ZM4.85922 1.96946C4.58101 1.69609 4.90202 1.22633 5.24138 1.41486L5.25361 1.42193L24.8629 12.5264L20.2304 17.0787L4.85922 1.96946ZM32.7797 20.9318L27.3034 24.0316L22.1542 18.9679L27.3034 13.9067L32.7797 17.0041C34.2694 17.8501 34.2694 20.0858 32.7797 20.9318Z" fill="#414545" data-v-b09c8cec></path></svg><div class="flex flex-col items-start leading-none" data-v-b09c8cec><span class="font-monasans text-[8px] text-[#414545] md:text-[12px]" data-v-b09c8cec>Download on the</span><span class="font-monasans text-[10px] font-semibold text-[#414545] md:text-[16px]" data-v-b09c8cec>Google Play</span></div></a><a href="https://apps.apple.com/vn/app/petpet/id6746782670?l=vi" target="_blank" class="flex h-[44px] w-[100px] items-center justify-center gap-[6px] rounded-[10px] bg-[#FFF8D6] px-[10px] shadow md:h-[70px] md:w-[160px] md:rounded-[16px] md:px-[16px]" data-v-b09c8cec><svg class="h-[20px] w-[20px] md:h-[32px] md:w-[32px]" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-b09c8cec><path d="M12.152 6.896c-.948 0-2.415-1.078-3.96-1.04-2.04.027-3.91 1.183-4.961 3.014-2.117 3.675-.546 9.103 1.519 12.09 1.013 1.454 2.208 3.09 3.792 3.039 1.52-.065 2.09-.987 3.935-.987 1.831 0 2.35.987 3.96.948 1.637-.026 2.676-1.48 3.676-2.948 1.156-1.688 1.636-3.325 1.662-3.415-.039-.013-3.182-1.221-3.22-4.857-.026-3.04 2.48-4.494 2.597-4.559-1.429-2.09-3.623-2.324-4.39-2.376-2.044-.156-3.03 1.091-3.91 1.091zm.065-1.675c.819-1.053 1.313-2.48 1.131-3.896-1.208.052-2.714.845-3.532 1.82-.74.871-1.391 2.325-1.208 3.702 1.352.104 2.714-.688 3.609-1.626z" fill="#414545" data-v-b09c8cec></path></svg><div class="flex flex-col items-start leading-none" data-v-b09c8cec><span class="font-monasans text-[8px] text-[#414545] md:text-[12px]" data-v-b09c8cec>Download on the</span><span class="font-monasans text-[10px] font-semibold text-[#414545] md:text-[16px]" data-v-b09c8cec>App Store</span></div></a></div></div></div></div>',1)])])):A("",!0)}},rr=Dt(nr,[["__scopeId","data-v-b09c8cec"]]),or={key:0,class:"flex h-full w-full flex-col gap-[20px]"},ar={key:0,class:"flex flex-col gap-[20px]"},sr={class:"flex items-center gap-[8px]"},ir={class:"flex items-center gap-[42px]"},lr={class:"flex items-center gap-[42px]"},cr={class:"flex items-center gap-[32px]"},ur={class:"flex items-center gap-[42px]"},dr={class:"font-monasans text-[24px] font-bold leading-[40px] text-grayPetpet"},pr={class:"flex items-center gap-[8px]"},mr={class:"flex gap-[6px]"},gr={class:"font-monasans text-[14px] font-normal leading-[150%]"},fr={class:"font-monasans text-[14px] font-normal leading-[150%]"},xr={class:"flex gap-[6px]"},hr={key:0,class:"fixed bottom-6 right-6 z-50 flex items-center gap-2 rounded-lg bg-[#333] px-4 py-3 text-sm text-white shadow-lg"},vr={class:"mb-[10px] flex h-fit w-full flex-col items-start gap-[4px]"},br={key:0,class:"flex items-center gap-[10px]"},yr={class:"rounded-br-[8px] rounded-tl-[8px] border border-[#FED519] px-[8px] py-[2px]"},_r={class:"font-monasans text-[16px] font-bold text-[#FF4B33]"},wr={class:"flex items-center"},kr={class:"font-monasans text-[18px] font-medium text-[#414545] line-through"},$r={key:1,class:"mb-1 rounded-br-[8px] rounded-tl-[8px] border border-[#FED519] px-[8px] py-[2px] text-[13px] font-bold text-[#FF4B33]"},Pr={class:"flex items-end"},Sr={class:"font-monasans text-[32px] font-bold leading-[100%] text-[#414545]"},Cr={key:0,class:"flex items-center gap-[30px]"},Ir={class:"flex items-center gap-[30px]"},Lr={class:"font-monasans text-[16px] font-bold leading-[100%] text-grayPetpet"},Tr={class:"shrink-0 font-monasans text-[16px] font-normal leading-[100%] text-grayPetpet"},Ar={class:"flex flex-wrap gap-[12px]"},Fr=["disabled","onClick"],Er={class:"flex items-center gap-[30px]"},Nr={class:"notranslate flex items-center",translate:"no"},Dr=["disabled"],Mr=["disabled"],jr={key:1,class:"px-[10px] pb-6 md:px-8 md:pb-12"},Ur={key:0,class:"flex flex-col gap-4"},Br={class:"flex gap-2"},Or={class:"flex items-start justify-between"},Rr={key:0,class:"text-[13px] text-[#414545] line-through md:text-[20px]"},Vr={key:1,class:"mb-1 rounded-br-[8px] rounded-tl-[8px] border border-[#FED519] px-2 py-1 text-[13px] font-bold text-[#FF4B33]"},zr={class:"mt-1 flex items-end gap-3 md:mt-2 md:gap-6"},qr={class:"text-[36px] font-bold leading-[1] text-textProduct md:text-[56px]"}
1,Wr={key:0,class:"ml-2 rounded-br-[8px] rounded-tl-[8px] border-[3px] border-[#FED519] bg-[white] px-2 py-1 text-sm font-bold text-[#FF4B33] md:ml-4 md:border-[4px] md:px-4 md:py-2 md:text-2xl"},Hr={class:"mt-3 md:mt-6"},Xr={class:"text-[18px] font-semibold text-[#2E2E2E] md:text-[32px]"},Gr={class:"mt-2 flex items-center gap-[8px] md:mt-4 md:gap-4"},Yr={class:"flex items-center gap-[2px]"},Kr={key:0,class:"mt-4 flex items-center gap-2 md:mt-6 md:gap-4"},Zr={class:"mt-4 flex items-start gap-2 md:mt-6 md:gap-4"},Qr={class:"min-w-0 text-[14px] font-semibold text-grayPetpet md:text-[24px]"},Jr={key:1,class:"mt-4"},to={class:"mb-3 text-[14px] font-medium text-grayPetpet md:text-[24px]"},eo={class:"flex flex-wrap gap-x-[12px] gap-y-[12px] pb-2"},no=["disabled","onClick"],ro=At({__name:"ProductPrice",props:{product:{type:Object,required:!0},selectedUnitIndex:{type:Number,default:0},loading:{type:Boolean,default:!1}},emits:["select-unit"],setup(P,{emit:_}){const a=P,F=_,v=R(!1),y=Yt("ssrIsDesktop"),N=(I,g=0)=>{const $=Number(I);return Number.isFinite($)?$:g},V=r(()=>a.product?.units??[]),O=r(()=>({price:N(a.product?.price??a.product?.deal_price??a.product?.price_promotion??a.product?.min_price),compare_at_price:N(a.product?.compare_at_price??a.product?.compareAtPrice??a.product?.selling_price),online_stock:a.product?.online_stock??a.product?.remaining_deal_stock,variant_unit_name:a.product?.variant_unit_name})),B=r(()=>!V.value.length||a.selectedUnitIndex<0?0:a.selectedUnitIndex>=V.value.length?V.value.length-1:a.selectedUnitIndex),st=r(()=>V.value[B.value]??O.value),k=r(()=>Oe(a.product,{selectedUnitIndex:B.value})),D=r(()=>k.value.price??0),Z=r(()=>k.value.compareAtPrice??D.value),et=r(()=>"SÄn voucher giảm phà váºn chuyá»n ná»i thà nh Tp.HCM"),W=r(()=>{const I=st.value?.online_stock??a.product?.online_stock;if(I==null||I==="")return null;const g=Number(I);return Number.isFinite(g)?g:null}),j=r(()=>W.value!==null),M=r(()=>W.value===null?"":W.value<=0?"Tạm Hết hà ng":`Còn ${new Intl.NumberFormat("vi-VN").format(W.value)} sản phẩm`),it=r(()=>W.value!==null&&W.value<=0),m=r(()=>(Array.isArray(a.product?.spu?.attribute_options)?a.product.spu.attribute_options:[]).slice().sort((g,$)=>(g?.display_order??0)-($?.display_order??0))),z=R({});bt(()=>st.value,I=>{const g=I?.sku_attributes;g&&typeof g=="object"&&(z.value={...g})},{immediate:!0});const yt=I=>String(I??"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().trim(),Y=(I,g)=>{const $=`${yt(I)} ${yt(g)}`;return/(khoi.?luong|trong.?luong|weight|size|dung.?tich)/.test($)?1:/(mui.?vi|huong.?vi|flavor|taste)/.test($)?2:3},ht=r(()=>String(a.product?.name??a.product?.title??"").trim()),C=r(()=>{const I=z.value||{},g=Object.entries(I).filter(([,f])=>typeof f=="string"&&f.trim()),$=new Map((m.value||[]).map(f=>[String(f?.key_code??""),f])),d=g.map(([f,nt])=>{const $t=$.get(f);return{value:String(nt).trim(),priority:Y(String($t?.key_code??f),String($t?.key_label??"")),displayOrder:Number($t?.display_order??9999)}}).sort((f,nt)=>f.priority-nt.priority||f.displayOrder-nt.displayOrder).map(f=>f.value);if(d.length)return d;const s=String(st.value?.variant_unit_name??"").trim(),x=s==="Mặc Äá»nh"?"1 gói":s;return x?[x]:[]}),T=r(()=>ht.value?C.value.length?`${ht.value} - ${C.value.join(" | ")}`:ht.value:"");function U(I){const g=I?.online_stock??I?.stock??I?.quantity,$=Number(g);return Number.isFinite($)?$:0}function H(I){return U(I)>0}function tt(I){const $=String(I||"").toLowerCase().replace(",",".").trim().match(/([\d.]+)\s*(kg|g|gram|gr|l|ml)?/);if(!$)return Number.POSITIVE_INFINITY;const d=Number($[1]);if(!Number.isFinite(d))return Number.POSITIVE_INFINITY;const s=$[2]||"";return s==="kg"?d*1e3:s==="g"||s==="gram"||s==="gr"?d:s==="l"?d*1e3:d}function q(I){const g=new Map;for(const x of V.value){const f=x?.sku_attributes?.[I];typeof f=="string"&&f.trim()&&g.set(f,f)}const $=Array.from(g.values()),d=m.value.find(x=>x?.key_code===I),s=`${d?.key_code||""} ${d?.key_label||""}`;return/(khoi.?luong|trong.?luong|weight|size|dung.?tich)/.test(yt(s))?$.slice().sort((x,f)=>tt(x)-tt(f)):$}function pt(I,g){return V.value.some($=>{const d=$?.sku_attributes||{};if(d[I]!==g)return!1;for(const[s,x]of Object.entries(z.value))if(s!==I&&x&&d[s]!==x)return!1;return H($)})}function ot(I,g){const $={...z.value,[I]:g},d=V.value.findIndex(s=>{const x=s?.sku_attributes||{};for(const[f,nt]of Object.entries($))if(nt&&x[f]!==nt)return!1;return H(s)});d>=0&&(z.value=$,F("select-unit",d))}const mt=R(1),_t=r(()=>it.value||mt.value<=1),wt=r(()=>it.value?!0:W.value===null?!1:mt.value>=W.value),Ct=R(!1);bt(()=>a.product?._id||a.product?.id||a.product?.slug||a.product?.name,()=>{mt.value=1},{immediate:!0});function It(){const I=encodeURI(window.location.href);navigator.clipboard.writeText(I),Ct.value=!0,setTimeout(()=>Ct.value=!1,2500)}return(I,g)=>{const $=Fe,d=rr;
1return n(y)?(o(),c("div",or,[P.loading?(o(),c("div",ar,[E($,{height:"40px",width:"78%",variant:"gold"}),e("div",sr,[E($,{height:"16px",width:"88px",variant:"gold"}),E($,{height:"16px",width:"120px",variant:"gold"}),E($,{type:"circle",height:"30px",width:"30px",variant:"gold"}),E($,{type:"circle",height:"30px",width:"30px",variant:"gold"})]),E($,{height:"56px",width:"260px",variant:"gold"}),e("div",ir,[E($,{height:"24px",width:"86px",variant:"gold"}),E($,{height:"24px",width:"90px",variant:"gold"})]),e("div",lr,[E($,{height:"24px",width:"110px",variant:"gold"}),E($,{height:"24px",width:"190px",variant:"gold"})]),e("div",cr,[E($,{height:"24px",width:"110px",variant:"gold"}),E($,{height:"76px",width:"96px","custom-class":"rounded-full",variant:"gold"}),E($,{height:"76px",width:"96px","custom-class":"rounded-full",variant:"gold"})]),e("div",ur,[E($,{height:"24px",width:"90px",variant:"gold"}),E($,{height:"46px",width:"150px","custom-class":"rounded-[14px]",variant:"gold"})]),E($,{height:"46px",width:"210px","custom-class":"rounded-[12px]",variant:"gold"})])):(o(),c(rt,{key:1},[e("div",null,[e("h1",dr,b(n(T)),1)]),e("div",pr,[e("div",mr,[g[4]||(g[4]=je('<svg width="88" height="16" viewBox="0 0 88 16" fill="none" xmlns="http://www.w3.org/2000/svg" class="-translate-y-[1px]" data-v-47358fb6><g clip-path="url(#clip0_33688_50942)" data-v-47358fb6><path d="M8.00491 12.6081L3.67845 15L4.50491 9.93382L1 6.34629L5.83677 5.60917L8 1L10.1632 5.60917L15 6.34629L11.4951 9.93382L12.3216 15L8.00491 12.6081Z" fill="#FED519" stroke="#FED519" stroke-linecap="round" stroke-linejoin="round" data-v-47358fb6></path></g><g clip-path="url(#clip1_33688_50942)" data-v-47358fb6><path d="M26.0049 12.6081L21.6784 15L22.5049 9.93382L19 6.34629L23.8368 5.60917L26 1L28.1632 5.60917L33 6.34629L29.4951 9.93382L30.3216 15L26.0049 12.6081Z" fill="#FED519" stroke="#FED519" stroke-linecap="round" stroke-linejoin="round" data-v-47358fb6></path></g><g clip-path="url(#clip2_33688_50942)" data-v-47358fb6><path d="M44.0049 12.6081L39.6784 15L40.5049 9.93382L37 6.34629L41.8368 5.60917L44 1L46.1632 5.60917L51 6.34629L47.4951 9.93382L48.3216 15L44.0049 12.6081Z" fill="#FED519" stroke="#FED519" stroke-linecap="round" stroke-linejoin="round" data-v-47358fb6></path></g><g clip-path="url(#clip3_33688_50942)" data-v-47358fb6><path d="M62.0049 12.6081L57.6784 15L58.5049 9.93382L55 6.34629L59.8368 5.60917L62 1L64.1632 5.60917L69 6.34629L65.4951 9.93382L66.3216 15L62.0049 12.6081Z" fill="#FED519" stroke="#FED519" stroke-linecap="round" stroke-linejoin="round" data-v-47358fb6></path></g><g clip-path="url(#clip4_33688_50942)" data-v-47358fb6><path d="M80.0049 12.6081L75.6784 15L76.5049 9.93382L73 6.34629L77.8368 5.60917L80 1L82.1632 5.60917L87 6.34629L83.4951 9.93382L84.3216 15L80.0049 12.6081Z" fill="#FED519" stroke="#FED519" stroke-linecap="round" stroke-linejoin="round" data-v-47358fb6></path></g><defs data-v-47358fb6><clipPath id="clip0_33688_50942" data-v-47358fb6><rect width="16" height="16" fill="white" data-v-47358fb6></rect></clipPath><clipPath id="clip1_33688_50942" data-v-47358fb6><rect width="16" height="16" fill="white" transform="translate(18)" data-v-47358fb6></rect></clipPath><clipPath id="clip2_33688_50942" data-v-47358fb6><rect width="16" height="16" fill="white" transform="translate(36)" data-v-47358fb6></rect></clipPath><clipPath id="clip3_33688_50942" data-v-47358fb6><rect width="16" height="16" fill="white" transform="translate(54)" data-v-47358fb6></rect></clipPath><clipPath id="clip4_33688_50942" data-v-47358fb6><rect width="16" height="16" fill="white" transform="translate(72)" data-v-47358fb6></rect></clipPath></defs></svg>',1)),e("span",gr,b(P.product?.rating),1)]),e("span",fr," | Äã bán Online: "+b(P.product?.total_sell??0),1),e("div",xr,[g[7]||(g[7]=e("div",null,[e("svg",{width:"30",height:"30",viewBox:"0 0 30 30",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[e("path",{d:"M19.1111 6C22.6333 6 25 9.3525 25 12.48C25 18.8138 15.1778 24 15 24C14.8222 24 5 18.8138 5 12.48C5 9.3525 7.36667 6 10.8889 6C12.9111 6 14.2333 7.02375 15 7.92375C15.7667 7.02375 17.0889 6 19.1111 6Z",stroke:"#707070","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})])],-1)),e("div",null,[e("div",{class:"cursor-pointer transition-transform active:scale-95",onClick:It},[...g[5]||(g[5]=[e("svg",{width:"30",height:"30",viewBox:"0 0 30 30",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[e("path",{d:"M24 16.7982C23.9739 19.8708 23.8038 21.5646 22.686 22.6815C21.3684 24 19.2462 24 15.0027 24C10.7592 24 8.637 24 7.3185 22.6815C6 21.363 6 19.2417 6 14.9973C6 10.7538 6 8.6316 7.3185 7.314C8.4354 6.1962 10.1292 6.0261 13.2018 6",stroke:"#414545","stroke-width":"1.5","stroke-linecap":"round"}),e("path",{d:"M24.0008 10.5H16.8008C15.1646 10.5 14.1791 11.3028 13.8128 11.67C13.7006 11.784 13.6436 11.841 13.6418 11.841C13.6418 11.8428 13.5848 11.8998 13.4708 12.012C13.1036 12.3783 12.3008 13.3638 12.3008 15V17.7M24.0008 10.5L19.5008 6M24.0008 10.5L19.5008 15",stroke:"#ED4959","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),E(Xe,{name:"fade-slide"},{default:St(()=>[n(Ct)?(o(),c("div",hr,[...g[6]||(g[6]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"white",class:"h-5 w-5"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M5 13l4 4L19 7"})],-1),e("span",null,"Äã copy link sản phẩm và o clipboard",-1)])])):A("",!0)]),_:1})])])]),e("div",vr,[n(k).isActiveUnitDiscounted?(o(),c("div",br,[e("div",yr,[e("span",_r," -"+b(n(k).discountPercent)+"% ",1)]),e("div",wr,[e("span",kr,b(("formatVNDWithComma"in I?I.formatVNDWithComma:n(de))(n(Z))),1),g[8]||(g[8]=e("span",{class:"ml-1 font-monasans text-[14px] font-medium text-[#414545] underline decoration-1 underline-offset-0"}," Ä ",-1))])])):n(k).showOtherUnitDiscountLabel?(o(),c("div",$r," Có lá»±a chá»n Äang giảm ")):A("",!0),e("div",Pr,[e("span",Sr,b(("formatVNDWithComma"in I?I.formatVNDWithComma:n(de))(n(D))),1),g[9]||(g[9]=e("span",{class:"ml-1 font-monasans text-[24px] font-bold leading-[100%] text-[#414545] underline decoration-1 underline-offset-0"}," Ä ",-1))])]),n(j)?(o(),c("div",Cr,[g[10]||(g[10]=e("p",{class:"font-monasans text-[16px] font-normal leading-[100%] text-grayPetpet"}," Tá»n kho Online: ",-1)),e("span",{class:ft(["font-monasans text-[16px] font-semibold leading-[100%]",n(W)&&n(W)>0?"text-[#0F9D58]":"text-[#E95160]"])}
1,b(n(M)),3)])):A("",!0),e("div",Ir,[g[11]||(g[11]=e("p",{class:"font-monasans text-[16px] font-normal leading-[100%] text-grayPetpet"}," Váºn chuyá»n: ",-1)),e("h3",Lr,b(n(et)),1)]),(o(!0),c(rt,null,xt(n(m),s=>(o(),c("div",{key:s.key_code,class:"flex items-start gap-[30px]"},[e("p",Tr,b(s.key_label)+": ",1),e("div",Ar,[(o(!0),c(rt,null,xt(q(s.key_code),x=>(o(),c("button",{key:`${s.key_code}-${x}`,type:"button",class:ft(["rounded-full border px-[16px] py-[10px] font-monasans text-[16px] font-medium transition",[n(z)[s.key_code]===x?"border-primary bg-[#FFFBEA] text-grayPetpet":"border-[#A8A8A8] bg-white text-grayPetpet",pt(s.key_code,x)?"":"cursor-not-allowed opacity-40"]]),disabled:!pt(s.key_code,x),onClick:f=>ot(s.key_code,x)},b(x),11,Fr))),128))])]))),128)),e("div",Er,[g[14]||(g[14]=e("p",{class:"font-monasans text-[16px] font-normal leading-[100%] text-grayPetpet"}," Sá» lượng: ",-1)),e("div",Nr,[e("button",{type:"button",translate:"no",disabled:n(_t),class:ft(["h-[34px] w-[34px] rounded-bl-[14px] rounded-tl-[14px] border-y border-l border-[#A8A8A8] transition-colors",n(_t)?"cursor-not-allowed border-[#D1D5DB] bg-[#F3F4F6] text-[#9CA3AF]":"bg-white text-grayPetpet"]),onClick:g[0]||(g[0]=s=>!n(_t)&&n(mt)>1&&mt.value--)},[...g[12]||(g[12]=[e("span",{class:"notranslate",translate:"no"},"-",-1)])],10,Dr),e("p",{class:ft(["notranslate flexRow-center h-[34px] w-[41px] border",n(it)?"border-[#D1D5DB] bg-[#F3F4F6] text-[#9CA3AF]":"border-[#A8A8A8] bg-white text-grayPetpet"]),translate:"no"},b(n(mt)),3),e("button",{type:"button",translate:"no",disabled:n(wt),class:ft(["h-[34px] w-[34px] rounded-br-[14px] rounded-tr-[14px] border-y border-r border-[#A8A8A8] transition-colors",n(wt)?"cursor-not-allowed border-[#D1D5DB] bg-[#F3F4F6] text-[#9CA3AF]":"bg-white text-grayPetpet"]),onClick:g[1]||(g[1]=s=>!n(wt)&&mt.value++)},[...g[13]||(g[13]=[e("span",{class:"notranslate",translate:"no"},"+",-1)])],10,Mr)])]),e("button",{class:"mb-[30px] h-[46px] w-[210px] rounded-[12px] bg-primary",onClick:g[2]||(g[2]=s=>v.value=!0)},[...g[15]||(g[15]=[e("span",{class:"font-monasans text-[14px] font-semibold leading-[100%] text-grayPetpet"}," Mua ngay trên app PETPET ",-1)])]),n(v)?(o(),Tt(d,{key:1,show:n(v),onClose:g[3]||(g[3]=s=>v.value=!1)},null,8,["show"])):A("",!0)],64))])):(o(),c("div",jr,[P.loading?(o(),c("div",Ur,[E($,{height:"100px",width:"100%",class:"rounded-[12px]"}),E($,{height:"30px",width:"80%"}),e("div",Br,[E($,{height:"20px",width:"100px"}),E($,{height:"20px",width:"60px"})])])):(o(),c(rt,{key:1},[e("div",Or,[e("div",null,[n(k).isActiveUnitDiscounted?(o(),c("div",Rr,[kt(b(("formatVNDWithComma"in I?I.formatVNDWithComma:n(de))(n(Z)))+" ",1),g[16]||(g[16]=e("span",{class:"text-[11px] md:text-[16px]"},"Ä",-1))])):n(k).showOtherUnitDiscountLabel?(o(),c("div",Vr," Có lá»±a chá»n Äang giảm ")):A("",!0),e("div",zr,[e("div",qr,b(("formatVNDWithComma"in I?I.formatVNDWithComma:n(de))(n(D))),1),g[17]||(g[17]=e("span",{class:"text-[16px] font-bold text-[#E95160] md:text-[24px]"}," Ä ",-1)),n(k).isActiveUnitDiscounted?(o(),c("div",Wr,b(n(k).discountPercent)+"% ",1)):A("",!0)])]),e("div",{class:"ml-2 flex items-center gap-2 md:ml-4 md:gap-4"},[g[19]||(g[19]=e("button",{type:"button",class:"ml-2 p-1 md:ml-4 md:p-2"},[e("svg",{class:"h-[20px] w-[20px] md:h-[32px] md:w-[32px]",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[e("path",{d:"M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 1 0-7.78 7.78L12 21.23l8.84-8.84a5.5 5.5 0 0 0 0-7.78z",stroke:"#ED4959","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})])],-1)),e("button",{type:"button",class:"ml-1 p-1 md:ml-2 md:p-2",onClick:It},[...g[18]||(g[18]=[e("svg",{class:"h-[20px] w-[20px] md:h-[32px] md:w-[32px]",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[e("path",{d:"M8 7V3h8v4",stroke:"#ED4959","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"}),e("path",{d:"M16 3l4 4",stroke:"#ED4959","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"}),e("rect",{x:"3",y:"11",width:"14",height:"10",rx:"2",stroke:"#414545","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])])])]),e("div",Hr,[e("h1",Xr,b(n(T)),1),e("div",Gr,[e("div",Yr,[(o(),c(rt,null,xt(5,s=>e("svg",{key:`mobile-${s}`,width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",class:"h-[20px] w-[20px] md:h-[32px] md:w-[32px]"},[...g[20]||(g[20]=[e("path",{d:"M8.00491 12.6081L3.67845 15L4.50491 9.93382L1 6.34629L5.83677 5.60917L8 1L10.1632 5.60917L15 6.34629L11.4951 9.93382L12.3216 15L8.00491 12.6081Z",fill:"#FED519",stroke:"#FED519","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])),64))]),g[21]||(g[21]=e("span",{class:"font-monasans text-[24px] font-bold text-[#414545] md:text-[36px]"},"5",-1)),g[22]||(g[22]=e("span",{class:"text-sm text-gray-400 md:text-xl"},"| Sản phẩm chÃnh hãng",-1))])]),n(j)?(o(),c("div",Kr,[g[23]||(g[23]=e("span",{class:"text-[14px] font-medium text-grayPetpet md:text-[24px]"}," Tá»n kho Online: ",-1)),e("span",{class:ft(["text-[14px] font-semibold md:text-[24px]",n(W)&&n(W)>0?"text-[#0F9D58]":"text-[#E95160]"])},b(n(M)),3)])):A("",!0),e("div",Zr,[g[24]||(g[24]=e("span",{class:"shrink-0 whitespace-nowrap text-[14px] font-medium text-grayPetpet md:text-[24px]"}," Váºn chuyá»n: ",-1)),e("span",Qr,b(n(et)),1)]),n(m).length?(o(),c("div",Jr,[(o(!0),c(rt,null,xt(n(m),s=>(o(),c("div",{key:s.key_code,class:"mb-5"},[e("p",to,b(s.key_label),1),e("div",eo,[(o(!0),c(rt,null,xt(q(s.key_code),x=>(o(),c("button",{key:`mobile-${s.key_code}-${x}`,type:"button",class:ft(["shrink-0 rounded-full border px-[18px] py-[12px] text-[14px] font-medium transition md:text-[22px]",[n(z)[s.key_code]===x?"border-primary bg-[#FFFBEA] text-grayPetpet":"border-[#A8A8A8] bg-white text-grayPetpet",pt(s.key_code,x)?"":"cursor-not-allowed opacity-40"]]),disabled:!pt(s.key_code,x),onClick:f=>ot(s.key_code,x)},b(x),11,no))),128))])]))),128))])):A("",!0)],64))]))}}}),oo=Dt(ro,[["__scopeId","data-v-47358fb6"]]),ao=Ge("/banner/DowloadApp.png"),so=At({__name:"mobile",setup(P){const _=Gt(),{mode:a}=ge(),F=r(()=>_(`/blog/${a.value==="both"||!a.value?"dog":a.value}/tai-ung-dung-petpet-mua-sam-cho-thu-cung-giam-50k-don-dau-tien`));return(v,y)=>{const N=Vt;return o(),Tt(N,{to:n(F),class:"mobile-banner relative block h-full overflow-hidden rounded-lg","aria-label":"Tải app PETPET"},{default:St(()=>[...y[0]||(y[0]=[e("img",{src:ao,alt:"PETPET Download",class:"h-full w-full object-contain"},null,-1)])]),_:1},8,["to"])}}}),io=Dt(so,[["__scopeId","data-v-197da3a4"]]),lo={key:0,class:"bg-white px-[10px] py-[16px] md:px-8"},co={class:"mb-4 flex items-center justify-between bg-[#FFF8E1] rounded-[12px] px-4 py-3"},uo={class:"flex h-[60px] w-[60px] items-center justify-center rounded-full bg-[#FFF9E5] text-[24px] font-bold text-[#FED519]"},po=["src"],mo={key:1},go={class:"font-monasans text-[20px] font-bold text-[#414545] md:text-[32px]"},fo={class:"notranslate",translate:"no"},xo={class:"flex max-h-full w-full max-w-sm flex-col md:max-w-2xl"},ho={class:"flex justify-end"},vo={class:"min-h-0 flex-1 overflow-hidden rounded-lg md:rounded-3xl"},bo={class:"grid grid-cols-3 gap-3 rounded-[12px] bg-[#FFF8E1] p-3"},yo={class:"rounded-[12px] bg-[#F8F8F8] p-3 text-center md:p-6"},_o={class:"font-monasans text-[18px] font-bold text-[#ED4959] md:text-[32px]"},wo={class:"rounded-[12px] bg-[#F8F8F8] p-3 text-center md:p-6"},ko={class:"font-monasans text-[18px] font-bold text-[#ED4959] md:text-[32px]"},$o={class:"rounded-[12px] bg-[#F8F8F8] p-3 text-center md:p-6"},Po={class:"font-monasans text-[18px] font-bold text-[#ED4959] md:text-[32px]"},So={key:1,class:"mt-6 h-fit w-full"},Co={class:"flex w-full gap-[12px] overflow-x-auto overflow-y-hidden pb-2 [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden"},Io=At({__name:"BrandCard",props:{product:{type:Object,required:!0}},setup(P){const _=P,a=Gt(),F=Xt(),v=R(null),y=R([]),N=R(!1),V=R("/download");function O(k){return[k?.canonical_alias,k?.alias,k?.product_id,k?.id,k?._id,k?.spu?.alias,k?.spu?.id,k?.spu?._id].map(D=>
1String(D??"").trim()).filter(Boolean)}const B=r(()=>new Set(O(_.product)));function st(k){return O(k).some(D=>B.value.has(D))}return bt(()=>_.product?.brand,async k=>{if(!k){v.value=null,y.value=[];return}const D=typeof k=="string"?k:k.id||k._id||k.value;if(D)try{const{data:Z}=await F.get(`brands/${D}`);v.value=Z.data||Z;const{data:et}=await F.get(`products?limit=4&brand_id=${D}`);y.value=et.data||et}catch(Z){console.error("Error fetching brand details and products:",Z),v.value=null,y.value=[]}},{immediate:!0}),(k,D)=>{const Z=Vt,et=io,W=Re;return v.value?(o(),c("div",lo,[e("div",co,[E(Z,{to:n(a)(n(nn)(v.value)),class:"flex items-center gap-3"},{default:St(()=>[e("div",uo,[v.value.logo||v.value.image?(o(),c("img",{key:0,src:v.value.logo||v.value.image,class:"h-full w-full rounded-full object-cover"},null,8,po)):(o(),c("span",mo,b(v.value.name?.charAt(0)||"B"),1))]),e("div",null,[e("h3",go,[e("span",fo,b(v.value.name),1)]),D[3]||(D[3]=e("p",{class:"font-monasans text-[14px] text-gray-400 md:text-[24px]"}," Thương hiá»u chÃnh hãng ",-1))])]),_:1},8,["to"]),e("button",{class:"rounded-full border border-[#FED519] px-6 py-2 font-monasans text-[16px] font-semibold text-[#FED519] md:px-10 md:py-4 md:text-2xl",onClick:D[0]||(D[0]=j=>N.value=!0)}," Theo dõi ")]),N.value?(o(),c("div",{key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/50 p-4 md:p-10",onClick:D[2]||(D[2]=dt(j=>N.value=!1,["self"]))},[e("div",xo,[e("div",ho,[e("button",{class:"mb-2 text-sm text-gray-200 md:mb-4 md:text-4xl",onClick:D[1]||(D[1]=j=>N.value=!1)}," Äóng â ")]),e("div",vo,[E(et,{link:V.value},null,8,["link"])])])])):A("",!0),e("div",bo,[e("div",yo,[D[4]||(D[4]=e("p",{class:"mb-1 font-monasans text-[14px] text-gray-500 md:text-[24px]"}," Hà i lòng ",-1)),e("p",_o,b(v.value.rating_percent||100)+"% ",1)]),e("div",wo,[D[5]||(D[5]=e("p",{class:"mb-1 font-monasans text-[14px] text-gray-500 md:text-[24px]"}," Theo dõi ",-1)),e("p",ko,b(v.value.follower_count||0),1)]),e("div",$o,[D[6]||(D[6]=e("p",{class:"mb-1 font-monasans text-[14px] text-gray-500 md:text-[24px]"}," Äánh giá ",-1)),e("p",Po,b(v.value.rating||"5/5"),1)])]),y.value.length>0?(o(),c("div",So,[e("div",Co,[(o(!0),c(rt,null,xt(y.value,(j,M)=>(o(),c("div",{key:M,class:"w-[160px] shrink-0 md:w-[240px]"},[E(W,{product:j,"is-current-product":st(j),class:"h-full"},null,8,["product","is-current-product"])]))),128))])])):A("",!0)])):A("",!0)}}}),Lo={class:"product-detail-info","aria-labelledby":"product-detail-info-title"},To={class:"product-detail-header"},Ao={key:0,class:"product-detail-name"},Fo={class:"product-specs"},Eo={key:0,class:"product-spec-row"},No={key:1,class:"notranslate",translate:"no"},Do={key:1,class:"product-spec-row"},Mo={key:1},jo={key:2,class:"product-spec-row"},Uo={key:0},Bo={key:0,class:"product-description-section","aria-labelledby":"product-description-title"},Oo=["innerHTML"],Ro=At({__name:"ProductDescription",props:{product:{type:Object,required:!0}},setup(P){const _=P;Ue(),Yt("ssrIsDesktop");const a=Xt(),F=R(""),v=Gt(),{mode:y}=ge(),N=r(()=>y.value==="dog"||y.value==="cat"?{c:y.value}:{});function V(j){return String(j||"").normalize("NFD").replace(/[\u0300-\u036F]/g,"").replace(/Ä/g,"d").replace(/Ä/g,"D").toLowerCase().replace(/[^a-z0-9\s-]/g," ").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}const O=r(()=>{const j=_.product?.category;return(typeof j=="object"?String(j?.display?.common||j?.display?.text||"").trim():String(j||"").trim()).split(">").map(it=>it.trim()).filter(Boolean)}),B=r(()=>O.value[1]||O.value[0]||""),st=r(()=>{if(!B.value)return"";const j=O.value[0],M=O.value[1];return j&&M?v({path:`/product/${V(j)}/${V(M)}`,query:N.value}):j?v({path:`/product/${V(j)}`,query:N.value}):""}),k=R(""),D=r(()=>rn({slug:k.value,name:F.value})),Z=r(()=>D.value?v(`/brand/${D.value}`):""),et=r(()=>{const j=_.product?.content||_.product?.description||_.product?.short_description||"";return typeof j=="string"?j:""}),W=r(()=>et.value.replace(/<!--[\s\S]*?-->/g,"").replace(/ | | /gi," ").replace(/<br\s*\/?>/gi," ").replace(/<[^>]*>/g," ").replace(/\u00A0/g," ").trim().length>0);return bt(()=>[_.product?.brand,_.product?.brand_name,_.product?.vendor],async([j,M,it])=>{if(F.value="",k.value="",!j){F.value=String(M||it||"").trim();return}if(typeof j=="string")try{const{data:m}=await a.get(`brands/${j}`),z=m.data||m;F.value=String(z?.name||z?.text||"").trim(),k.value=String(z?.slug||z?.alias||"").trim()}catch(m){console.error("Error fetching brand name:",m),F.value=String(M||it||"").trim()}else F.value=String(j.name||j.text||j.value||"").trim(),k.value=String(j.slug||j.alias||"").trim()},{immediate:!0}),(j,M)=>{const it=Vt;return o(),c("section",Lo,[e("header",To,[M[0]||(M[0]=e("h2",{id:"product-detail-info-title",class:"product-detail-title"}," THÃNG TIN SẢN PHẨM ",-1)),P.product.title||P.product.name?(o(),c("h3",Ao,b(P.product.title||P.product.name),1)):A("",!0)]),e("dl",Fo,[F.value?(o(),c("div",Eo,[M[1]||(M[1]=e("dt",null,"Thương hiá»u",-1)),e("dd",null,[n(Z)?(o(),Tt(it,{key:0,to:n(Z),class:"product-spec-link notranslate",translate:"no"},{default:St(()=>[kt(b(F.value),1)]),_:1},8,["to"])):(o(),c("span",No,b(F.value),1))])])):A("",!0),n(B)?(o(),c("div",Do,[M[2]||(M[2]=e("dt",null,"Danh mục",-1)),e("dd",null,[n(st)?(o(),Tt(it,{key:0,to:n(st),class:"product-spec-link"},{default:St(()=>[kt(b(n(B)),1)]),_:1},8,["to"])):(o(),c("span",Mo,b(n(B)),1))])])):A("",!0),Number(P.product.weight)>0?(o(),c("div",jo,[M[3]||(M[3]=e("dt",null,"Khá»i lượng",-1)),e("dd",null,[kt(b(P.product.weight),1),P.product.weight_unit?(o(),c("span",Uo,b(P.product.weight_unit),1)):A("",!0)])])):A("",!0),M[4]||(M[4]=e("div",{class:"product-spec-row"},[e("dt",null,"Hạn sá» dụng"),e("dd",null,">
11 nÄm")],-1))]),n(W)?(o(),c("section",Bo,[M[5]||(M[5]=e("h2",{id:"product-description-title",class:"product-description-title"}," Mô tả sản phẩm ",-1)),e("div",{class:"product-description-content",innerHTML:n(et)},null,8,Oo)])):A("",!0)])}}}),Vo=Dt(Ro,[["__scopeId","data-v-b2373e21"]]),zo={class:"flexCol-center h-fit w-full gap-[16px] rounded-[24px] bg-white px-[10px] py-[16px] lg:p-[20px]"},qo={class:"flex w-full items-center gap-[16px]"},Wo={class:"flexRow-center h-fit w-fit gap-[4px] rounded-[50px] bg-[#FFF693] px-[7px] py-[4px] md:px-[12px] md:py-[8px] lg:px-[10px] lg:py-[6px]"},Ho={class:"font-monasans text-[16px] font-semibold leading-[100%] text-grayPetpet md:text-[24px] lg:text-[18px]"},Xo={key:0,class:"flex min-h-[120px] items-center justify-center rounded-[16px] border border-dashed border-[#D8D8D8] px-4 py-6 text-center text-[14px] text-[#6B7280] md:text-[20px] lg:text-[16px]"},Go={class:"flex items-start gap-3"},Yo=["src"],Ko={class:"flex-1"},Zo={class:"flex flex-wrap items-center gap-x-3"},Qo={class:"notranslate font-semibold text-gray-900 lg:text-base",translate:"no"},Jo={class:"text-sm leading-none text-amber-400 lg:text-xs"},ta={class:"mt-1 text-[13px] font-semibold text-gray-700 md:mt-2 md:text-xl lg:text-sm"},ea={class:"mt-3 text-sm leading-relaxed text-gray-700 md:mt-4 md:text-2xl lg:text-base"},na={class:"flex items-start gap-3"},ra=["src"],oa={class:"flex-1 md:ml-1"},aa={class:"flex flex-wrap items-center gap-x-2"},sa={class:"notranslate text-base font-semibold text-gray-900 md:text-lg",translate:"no"},ia={class:"text-xs leading-none text-amber-400 md:text-sm"},la={class:"mt-1 text-[13px] font-semibold text-gray-700 md:mt-2 md:text-xl lg:text-sm"},ca={class:"mt-2 text-[13px] leading-relaxed text-gray-700 md:mt-3 md:text-[15px]"},ua={key:2,class:"mt-3 flex items-center justify-center gap-1.5 md:mt-5 md:gap-2"},da=["disabled"],pa=["disabled","onClick"],ma=["disabled"],Ce="/DogIcon.svg",Ie="/CatIcon.svg",Le=5,ga=At({__name:"ProductEvaluate",props:{product:{type:Object,required:!0}},setup(P){const _=P,a=r(()=>{const d=String(_.product?._id||"").trim();return/^[a-f0-9]{24}$/i.test(d)?d:""}),F=r(()=>{const d=_.product?.product_id??_.product?.id,s=Number(d);return Number.isFinite(s)&&s>0?s:null}),v=Xt(),y=R("");bt(()=>_.product?.brand,async d=>{if(!d){y.value="";return}if(typeof d=="string")try{const{data:s}=await v.get(`brands/${d}`),x=s?.data||s;y.value=String(x?.name||x?.text||"").trim()}catch{y.value=""}else y.value=String(d?.name||d?.text||d?.value||"").trim()},{immediate:!0});function N(d){const s=String(d||"").trim();if(!s)return"";const x=s.toLowerCase();return["dog","cat","both","cho","mèo","meo"].includes(x)?"":s.includes(">")?s.split(">").pop().trim():s}function V(d){return d?typeof d=="string"?N(d):typeof d=="object"&&(N(d?.display?.text)||N(d?.display?.common)||N(d?.category_name)||N(d?.name?.text)||N(d?.name?.common)||N(d?.text)||N(d?.name))||"":""}const O=r(()=>V(_.product?.category)||V(_.product?.categories)||"sản phẩm"),B=r(()=>{const d=String(_.product?.brand_name||"").trim();if(d)return d;const s=_.product?.brand&&typeof _.product.brand=="object"?String(_.product.brand?.name||_.product.brand?.text||"").trim():"";if(s)return s;if(y.value)return y.value;const x=String(_.product?.vendor||"").trim();return x&&!/^petpet$/i.test(x)?x:"PETPET"}),st=Gt(),{mode:k}=ge();function D(d){const s=String(d||"").toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"");return s?s.includes("cat")||s.includes("meo")?"cat":s.includes("dog")||s.includes("cho")?"dog":"":""}const Z=r(()=>{const d=String(_.product?.product_type||_.product?.pet_type||_.product?.type||"").trim().toLowerCase();if(d==="cat")return Ie;if(d==="dog")return Ce;const s=[V(_.product?.category),V(_.product?.categories),_.product?.name,_.product?.title].filter(Boolean).join(" "),x=D(s);return x==="cat"?Ie:x==="dog"?Ce:k.value==="cat"?Ie:Ce});function et(d){return String(d||"").trim()||Z.value}function W(d){const s=d.target;s&&s.dataset.fallbackApplied!=="1"&&(s.dataset.fallbackApplied="1",s.src=Z.value)}const j=r(()=>k.value==="both"?"dog-cat":k.value||"dog");r(()=>st(`/product/${j.value}/thuc-an/thuc-an-uot`));const M=d=>String(d??"").replace(/\s+/g,"");function it(d){return st(`/brand/${M(d)}`)}function m(d){const s=String(d??"").trim();return s?s.toLocaleLowerCase("vi-VN"):"sản phẩm"}const z=R(1),yt=r(()=>a.value?`reviews/product-object/${encodeURIComponent(a.value)}?page=${z.value}&limit=${Le}`:F.value?`reviews/product/${F.value}?page=${z.value}&limit=${Le}`:""),{data:Y}=me(()=>yt.value,{server:!1,default:()=>({data:[],total:0,average_rating:null,total_reviews:0})}),ht=r(()=>Array.isArray(Y.value?.data)?Y.value.data:[]);function C(d){const s=new Date(d);return Number.isNaN(s.getTime())?"--/--/----":s.toLocaleDateString("vi-VN")}const T=r(()=>ht.value.reduce((s,x,f)=>{const nt=Number(x.rating);if(!Number.isFinite(nt)||nt<4||nt>5)return s;const $t=V(x.category_name||x.product_category||x.category),Mt=String(x.brand_name||x.product_brand||"").trim();return s.push({id:`db-${x._id||f}`,name:x.user_name||"Ngưá»i dùng",avatar:et(x.user_avatar),rating:nt,date:C(x.created_at),variant:"Äã mua hà ng",content:String(x.comment||"").trim()||"Khách hà ng Äã Äánh giá sản phẩm.",categoryName:$t||O.value,brandName:Mt||B.value}),s},[])),U=r(()=>T.value),H=r(()=>U.value.length>0),tt=r(()=>{const d=Number(Y.value?.total);return Number.isFinite(d)&&d>0?d:0}),q=r(()=>Math.max(1,Math.ceil(tt.value/Le))),pt=r(()=>H.value&&q.value>1),ot=R(null);function mt(){Rt(()=>{const d=ot.value;if(!d)return;const s=d.getBoundingClientRect().top+window.scrollY-80;window.scrollTo({top:Math.max(0,s),behavior:"auto"})})}const _t=r(()=>{const d=q.value,s=z.value;return d<=5?Array.from({length:d},(x,f)=>f+1):s<=4?[1,2,3,4,5,"dots-right"]:s>=d-2?[1,2,"dots-left",d-2,d-1,d]:[1,2,"dots-left",s,s+1,s+2,"dots-right"]});function wt(d){const s=Math.max(1,Math.min(d,q.value));s!==z.value&&(z.value=s,mt())}function Ct(){z.value<=1||(z.value-=1,mt())}function It(){z.value>=q.value||(z.value+=1,mt())}bt([a,F],()=>{z.value=1}),bt(q,d=>{z.value>d&&(z.value=d)});const I=r(()=>{const d=Number(Y.value?.average_rating);return Number.isFinite(d)&&d>0?d.toFixed(1):U.value.length?(U.value.reduce((x,f)=>x+(Number(f.rating)||0),0)/U.value.length).toFixed(1):"0.0"});function g(d){const s=Math.max(0,Math.min(5,Math.round(Number(d)||0)));return`${"â
".repeat(s)}${"â".repeat(5-s)}`}const $=Yt("ssrIsDesktop");return(d,s)=>{const x=Vt;return o(),c("div",zo,[e("div",qo,[s[1]||(s[1]=e("span",{class:"font-monasans text-[24px] font-semibold leading-[160%] text-[#000000] md:text-[32px] lg:text-[24px]"}," ÄÃNH GIà ",-1)),e("div",Wo,[e("span",Ho,b(n(I)),1),s[0]||(s[0]=e("div",null,[e("svg",{class:"h-[16px] w-[16px] md:h-[24px] md:w-[24px] lg:h-[18px] lg:w-[18px]",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[e("path",{d:"M8.37831 2.07556L10.4135 6.70584L15.6238 7.1361C15.9852 7.1661 16.1322 7.59952 15.8579 7.82768L11.9058 11.119L13.0901 16.0153C13.1722 16.3556 12.7887 16.6232 12.4782 16.4424L8.00051 13.8466L3.52279 16.4424C3.21151 16.6224 2.82879 16.3548 2.91092 16.0153L4.09523 11.119L0.142316 7.82689C-0.131998 7.59873 0.0141935 7.16531 0.376387 7.13531L5.58671 6.70505L7.62189 2.07556C7.76316 1.75346 8.23705 1.75346 8.37831 2.07556L8.37831 2.07556Z",fill:"#FED519"})])],-1))])]),e("div",{ref_key:"reviewListTopRef",ref:ot,class:"h-fit w-full"},[n(H)?(o(),c(rt,{key:1},[n($)?(o(!0),c(rt,{key:0},xt(n(U),(f,nt)=>(o(),c("div",{key:f.id,class:ft(["bg-white p-5",nt===n(U).length-1?"":"border-b-[0.5px] border-[#D8D8D8]"])},[e("div",Go,[e("img",{src:f.avatar,alt:"avatar",class:"h-10 w-10 rounded-full object-cover shadow ring-2 ring-white",onError:W},null,40,Yo),e("div",Ko,[e("div",Zo,[e("h3",Qo,b(f.name),1),e("div",Jo,b(g(f.rating)),1)]),e("p",ta,[s[2]||(s[2]=kt(" Äã mua ",-1)),E(x,{to:it(f.brandName),class:"text-inherit underline hover:no-underline"},{default:St(()=>[kt(b(m(f.categoryName))+" cá»§a "+b(f.brandName),1)]),_:2},1032,["to"]),kt(" và o ngà y "+b(f.date),1)]),e("p",ea,b(f.content),1)])])],2))),128)):(o(!0),c(rt,{key:1},xt(n(U),(f,nt)=>(o(),c("div",{key:f.id,class:ft(["py-4 md:py-8",nt===n(U).length-1?"":"border-b-[0.5px] border-[#D8D8D8]"])},[e("div",na,[e("img",{src:f.avatar,alt:"avatar",class:"h-10 w-10 rounded-full object-cover md:h-14 md:w-14",onError:W},null,40,ra),e("div",oa,[e("div",aa,[e("h3",sa,b(f.name),1),e("div",ia,b(g(f.rating)),1)]),e("p",la,[s[3]||(s[3]=kt(" Äã mua ",-1)),E(x,{to:it(f.brandName),class:"text-inherit underline hover:no-underline"},{default:St(()=>[kt(b(m(f.categoryName))+" cá»§a "+b(f.brandName),1)]),_:2},1032,["to"]),kt(" và o ngà y "+b(f.date),1)]),e("p",ca,b(f.content),1)])])],2))),128)),n(pt)?(o(),c("div",ua,[e("button",{type:"button",class:"h-8 min-w-[32px] rounded-[6px] px-2 text-[18px] leading-none text-[#9CA3AF] disabled:cursor-not-allowed disabled:opacity-40 md:h-10 md:min-w-[40px] md:text-[22px]",disabled:n(z)===1,onClick:Ct}," < ",8,da),(o(!0),c(rt,null,xt(n(_t),f=>(o(),c("button",{key:typeof f=="number"?`page-${f}`:f,type:"button",class:ft(["h-8 min-w-[32px] rounded-[6px] px-2 text-[15px] font-medium md:h-10 md:min-w-[40px] md:text-[18px]",[f==="dots-left"||f==="dots-right"?"cursor-default text-[#9CA3AF]":"",typeof f=="number"&&f===n(z)?"bg-[#F3522A] text-white":typeof f=="number"?"text-[#9CA3AF] hover:bg-[#F3F4F6]":""]]),disabled:f==="dots-left"||f==="dots-right",onClick:nt=>typeof f=="number"&&wt(f)},b(f==="dots-left"||f==="dots-right"?"...":f),11,pa))),128)),e("button",{type:"button",class:"h-8 min-w-[32px] rounded-[6px] px-2 text-[18px] leading-none text-[#9CA3AF] disabled:cursor-not-allowed disabled:opacity-40 md:h-10 md:min-w-[40px] md:text-[22px]",disabled:n(z)===n(q),onClick:It}," > ",8,ma)])):A("",!0)],64)):(o(),c("div",Xo," Hãy mua hà ng Äá» bạn là ngưá»i Äánh giá Äầu tiên "))],512)])}}}),fa={key:0,class:"product-side-list"},xa=At({__name:"ProductOneCollum",props:{products:{},loading:{type:Boolean}},setup(P){return(_,a)=>{const F=Re;return P.loading||P.products.length>
10?(o(),c("div",fa,[P.loading?(o(),c(rt,{key:0},xt(4,v=>E(F,{key:"skeleton-"+v,product:{},loading:""})),64)):(o(!0),c(rt,{key:1},xt(P.products,(v,y)=>(o(),Tt(F,{key:y,product:v},null,8,["product"]))),128))])):A("",!0)}}}),ha=Dt(xa,[["__scopeId","data-v-4f618109"]]),va={class:"fixed left-0 right-0 z-50 lg:hidden",style:{bottom:"-1px"}},ba={class:"md:px-10 md:py-10",style:{width:"100%",background:"#fff",padding:"8px 16px","padding-bottom":"calc(13px + env(safe-area-inset-bottom, 0px))","box-shadow":"0 -1px 6px rgba(0,0,0,0.06), 0 50px 0 #fff"}},ya={style:{"max-width":"1200px",margin:"0 auto",display:"flex","justify-content":"center","align-items":"center",width:"100%"}},_a=["href"],wa=At({__name:"BuyNow",setup(P){const _=R("");Me(()=>{_.value=navigator.userAgent||""});const a=r(()=>/iPad|iPhone|iPod/.test(_.value)?"https://apps.apple.com/vn/app/petpet/id6746782670?l=vi":"https://play.google.com/store/apps/details?id=com.petpet");return(F,v)=>(o(),c("div",va,[e("div",ba,[e("div",ya,[e("a",{href:a.value,target:"_blank",class:"flexRow-center w-full",style:{padding:"14px 0","border-radius":"12px",background:"#FED519",color:"#414545","font-weight":"700","text-decoration":"none","font-size":"16px",border:"none","text-align":"center","box-shadow":"0 4px 6px -1px rgba(0, 0, 0, 0.1)"}}," MUA NGAY TRÃN APP PETPET ",8,_a)])])]))}}),ka={class:"product-detail-page"},$a={class:"product-detail-breadcrumb"},Pa={key:0,class:"product-detail-container"},Sa={key:0,class:"product-breadcrumb-skeleton"},Ca={class:"flex items-center gap-2"},Ia={class:"product-detail-main","aria-label":"Thông tin mua sản phẩm"},La={class:"product-detail-container product-detail-main-grid"},Ta={class:"product-detail-content","aria-label":"Ná»i dung chi tiết sản phẩm"},Aa={class:"product-detail-container product-detail-content-grid"},Fa={class:"product-detail-body"},Ea={class:"product-detail-related","aria-label":"Sản phẩm liên quan"},Na={class:"product-detail-container product-detail-related-stack"},Da={key:0,class:"w-full"},Ma={class:"combo-product-grid"},ja={class:"product-image combo-product-image"},Ua=["src","alt"],Ba={class:"product-info combo-product-info"},Oa={class:"product-name combo-product-name"},Ra={class:"combo-product-unit"},Va={class:"product-price combo-product-price"},za={key:1,class:"sr-only"},qa={key:0},Wa={key:1},Ha={key:2},pe="https://petpet.vn",Xa="preferred-unit-key",Ga="preferred-unit-image",Ya=At({__name:"[id]",async setup(P){let _,a;const F=Yt("ssrIsDesktop"),v=Gt(),{locale:y}=Ye(),N=Ue(),V=N.params.id,O=t=>/^\d+$/.test(String(t||"").trim())||/^[a-f0-9]{24}$/i.test(String(t||"").trim()),B=Ke(),st=r(()=>encodeURIComponent(String(V||"").trim())),k=t=>Array.isArray(t)?t[0]:t,D=r(()=>String(k(N.query.deal_group_id)??"").trim()),Z=r(()=>String(k(N.query.program_surface)??"").trim()),et=r(()=>String(k(N.query.program_entry_type)??"").trim()),W=r(()=>{const t=String(N.params.id??"").trim();return t?String(sessionStorage.getItem(`${Xa}:${t}`)??"").trim():""}),j=r(()=>{const t=String(N.params.id??"").trim();return t?jt(sessionStorage.getItem(`${Ga}:${t}`)):""}),M=r(()=>et.value==="combo"&&!!D.value),it=r(()=>{if(M.value)return`products/deal-groups/${encodeURIComponent(D.value)}`;const t=new URLSearchParams;D.value&&t.set("deal_group_id",D.value),Z.value&&t.set("program_surface",Z.value),et.value&&t.set("program_entry_type",et.value);const l=t.toString();return`products/${st.value}${l?`?${l}`:""}`}),{data:m,status:z,error:yt,refresh:Y}=([_,a]=Se(()=>me(()=>it.value,{key:`product-detail-${V}-${D.value}-${Z.value}-${et.value}`,lazy:!1,transform:t=>{const l=w=>!w||typeof w!="object"?{}:{...w,name:w.name??w.title??"",title:w.title??w.name??""};let p=t;for(let w=0;w<3;
1w++){if(Array.isArray(p)){p=p[0]||{};break}if(!p||typeof p!="object"||p.name||p.title||p.items?.length||!("data"in p))break;p=p.data}return l(p)}})),_=await _,a(),_),ht=t=>!!(t&&(t.name||t.title||t.items?.length));let C=m.value;if(!yt.value&&!ht(C)&&([_,a]=Se(()=>Y()),await _,a(),C=m.value),yt.value||!ht(C))throw Ze({statusCode:404,statusMessage:"Không tìm thấy sản phẩm"});const T=t=>String(t??"").trim(),U=t=>T(t?.canonical_alias||t?.spu?.alias||t?.alias),H=r(()=>!!(D.value||Z.value||et.value)),tt=T(V),q=U(C);!M.value&&!H.value&&O(tt)&&q&&q!==tt&&([_,a]=Se(()=>tn(v(`/p/${q}`),{replace:!0})),await _,a());const pt=r(()=>{const t=String(N.path.split("/")[1]||"vi");return["vi","en","ko"].includes(t)?`/${t}`:"/vi"}),ot=r(()=>{const t=U(m.value)||tt;return`${pe}${pt.value}/p/${encodeURIComponent(t)}`}),mt=r(()=>!!(m.value&&(m.value?.name||m.value?.title))),_t=t=>/^[a-f0-9]{24}$/i.test(String(t).trim()),wt=r(()=>z.value==="pending"||z.value==="idle"||!mt.value),Ct=r(()=>[m.value?._id,m.value?.id,m.value?.product_id,m.value?.spu?._id,m.value?.spu?.id].map(l=>String(l??"").trim()).find(l=>_t(l))||""),It=t=>{const l=t?.brand;return l?typeof l=="string"?l.trim():typeof l=="object"?String(l?._id||l?.id||l?.value||"").trim():"":""},I=r(()=>{const t=It(m.value);return _t(t)?t:""}),{data:g}=me(()=>I.value?`brands/${encodeURIComponent(I.value)}`:null,{key:`product-brand-${V}`,lazy:!0,default:()=>null,transform:t=>t?.data||t||null}),$=R({}),{data:d,status:s,error:x}=me(()=>Ct.value?`recommendation/related-to-item/${encodeURIComponent(Ct.value)}?limit=20&page=1`:null,{key:`related-products-${V}`,lazy:!0,server:!1,transform:t=>{$.value=t?.meta&&typeof t.meta=="object"?t.meta:{};const l=t?.data;return Array.isArray(l)?l:l&&Array.isArray(l.items)?l.items:Array.isArray(t?.items)?t.items:[]}}),f=R([]),nt=R(!1),$t=R(!1),Mt=r(()=>{const t=String(m.value?.product_type??m.value?.productType??"").trim();return t?`&product_type=${encodeURIComponent(t)}`:""}),fe=r(()=>{const t=m.value?.collections??m.value?.collection_ids??m.value?.collectionIds??m.value?.collection_id??m.value?.collectionId,l=Array.isArray(t)?t:[t];return[...new Set(l.map(p=>p&&typeof p=="object"?p.id??p.collection_id??p.collectionId??p._id??p.value:p).map(p=>String(p??"").trim()).filter(Boolean))]}),zt=t=>Array.isArray(t?.data)?t.data:t?.data&&Array.isArray(t.data.items)?t.data.items:Array.isArray(t?.items)?t.items:[];async function Kt(){if(!$t.value){$t.value=!0,nt.value=!0;try{const t=fe.value,l=t.length?t.map(Q=>Xt().get(`/products?collection_id=${encodeURIComponent(Q)}&limit=20&page=1&published=true&sort=published_on%20desc${Mt.value}`)):[Xt().get(`/products?limit=20&page=1&published=true&sort=published_on%20desc${Mt.value}`)],p=await Promise.allSettled(l),w=Q=>{const at=new Set;return Q.filter(Lt=>{const ct=String(Lt?._id??Lt?.product_id??Lt?.id??Lt?.alias??"").trim();return!ct||at.has(ct)?!1:(at.add(ct),!0)}).slice(0,20)};let K=w(p.filter(Q=>Q.status==="fulfilled").flatMap(Q=>zt(Q.value.data)));if(!K.length&&t.length){const Q=await Xt().get(`/products?limit=20&page=1&published=true&sort=published_on%20desc${Mt.value}`);K=w(zt(Q.data))}f.value=K}catch(t){console.error("[ProductDetail] related products fallback failed:",t),f.value=[]}finally{nt.value=!1}}}bt([d,s,x],([t,l,p])=>{const w=l==="success"&&(!Array.isArray(t)||t.length===0);(p||w)&&Kt()},{immediate:!0});const gt=r(()=>Array.isArray(d.value)&&d.value.length>0?d.value:f.value);let Zt="";bt(m,t=>{if(!t)return;const l=String(t.product_id??t.id??t._id??t.alias??"").trim();!l||Zt===l||(Zt=l,an({productId:l,productName:t.name||t.title,priceAtView:Number(t.price)||0,compareAtPrice:Number(t.compare_at_price)||void 0,from:"other"}))},{immediate:!0});const qt=r(()=>Array.isArray(m.value?.items)?m.value.items:[]),xe=t=>new Intl.NumberFormat("vi-VN").format(Number(t)||0),Qt=t=>{const l=String(t?.alias??t?.product_id??t?.variant_id??t?.id??"").trim();return l?v(`/p/${l}`):"#"},vt=r(()=>s.value==="pending"||s.value==="idle"||nt.value);let Ft=null;async function re(){if(y.value==="vi")return;await Rt();const t=document.querySelector(".goog-te-combo");t&&(t.value!==y.value&&(t.value=y.value),t.dispatchEvent(new Event("change",{bubbles:!0})),window.setTimeout(()=>{t.dispatchEvent(new Event("change",{bubbles:!0}))},120))}bt(()=>[vt.value,gt.value.length,y.value],([t,l,p])=>{Ft&&clearTimeout(Ft),!(t||l===0||p==="vi")&&(Ft=window.setTimeout(()=>{re()},150))},{flush:"post"});const Et=R(0),Nt=r(()=>(Array.isArray(m.value?.units)?m.value.units:[])[Et.value]??null);function oe(t){const l=t?.online_stock??t?.stock??t?.quantity;if(l==null||l==="")return!0;const p=Number(l);return Number.isFinite(p)?p>0:!0}function jt(t){return String(t??"").trim().replace(/^http:\/\//i,"https://").split("?")[0]}function ae(t){const l=Array.isArray(t?.images)?t.images:[t?.images];for(const p of l){const w=typeof p=="string"?p:p?.src||p?.url||p?.image;if(typeof w=="string"&&w.trim())return w}return typeof t?.main_image=="string"&&t.main_image.trim()?t.main_image:""}function he(t){return String(t?.sku??t?.variant_id??t?.product_id??t?.id??t?._id??"").trim()}function ve(t){const l=Oe(t),p=l.units;if(!p.length)return 0;const w=W.value;if(w){const ct=p.findIndex(Pt=>he(Pt)===w);if(ct>=0)return ct}const K=j.value;if(K){const ct=p.findIndex(Pt=>jt(Pt?.main_image)===K);if(ct>=0)return ct}const Q=jt(ae(t));if(Q){const ct=p.findIndex(Pt=>jt(Pt?.main_image)===Q);if(ct>=0)return ct}const at=l.defaultUnit?p.indexOf(l.defaultUnit):-1;if(at>=0)return at;const Lt=p.findIndex(ct=>oe(ct));return Lt>=0?Lt:0}bt(()=>[m.value,W.value,j.value],([t])=>{Et.value=ve(t)},{immediate:!0}),ln().getBrand("2");function be(){}const Jt=(t,l=!1)=>{const p=typeof t=="string"?t.trim():"";if(!p)return l?`${pe}/SEOImg.png`:"";if(p.startsWith("https://"))return p;if(p.startsWith("http://"))return p.replace("http://","https://");if(p.startsWith("//"))return`https:${p}`;if(p.startsWith("/"))return`${pe}${p}`;try{return new URL(p,`${B.protocol}//${B.host}`).toString()}catch{return l?`${pe}/SEOImg.png`:""}},Wt=t=>String(t||"").replace(/<[^>]*>/g," ").replace(/ /g," ").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/;/g,",").replace(/\s+/g," ").trim(),Ut=r(()=>{const t=m.value||{},l=Array.isArray(t.images)?t.images.find(w=>{const K=typeof w=="string"?w:w?.src||w?.url;return typeof K=="string"&&K.trim().length>0}):null,p=t.main_image||(typeof l=="string"?l:l?.src||l?.url);return Jt(p,!0)}),Bt=r(()=>{const t=m.value||{},l=t.description||t.short_description||t.content||"";return Wt(l)}),ie=r(()=>{const t=String(Bt.value||"").trim();return!t||/^\d+$/.test(t)?"":t.length>110?`${t.substring(0,107).trim()}...`:t}),ye=t=>/^\d+(?:[.,]\d+)*$/.test(String(t||"").trim()),u=t=>{const l=String(g.value?.name||"PETPET").trim()||"PETPET",p=Q=>{const at=String(Q??"").trim();return!at||/^(null|undefined|n\/a)$/i.test(at)?"":at},w=t?.vendor??t?.brand_name??t?.brand??"";if(!w)return l;if(typeof w=="object"){const Q=p(w?.name||w?.text||w?.label);if(Q)return Q;const at=p(w?._id||w?.id||w?.value);return at&&_t(at)?l:at||l}const K=p(w);return!K||_t(K)?l:K},i=r(()=>u(m.value)),h=r(()=>Array.isArray(m.value?.units)?m.value.units:[]),S=r(()=>h.value.map(t=>{const l=Number(t?.price),p=Number(t?.compare_at_price),w=t?.stock>0||t?.quantity>0||!Object.prototype.hasOwnProperty.call(t||{},"stock");return{raw:t,price:l,compareAtPrice:p,inStock:w}}).filter(t=>Number.isFinite(t.price)&&t.price>0)),L=r(()=>{if(S.value.length>0)return S.value[0].price;const t=Number(m.value?.price);return Number.isFinite(t)&&t>0?t:0}),G=r(()=>{const t=S.value.map(K=>K.price);if(t.length===0)return"";const l=Math.min(...t),p=Math.max(...t),w=K=>`${new Intl.NumberFormat("vi-VN").format(K)} Ä`;return l===p?w(l):`${w(l)} - ${w(p)}`}),lt=r(()=>{const t=Number(Nt.value?.online_stock??Nt.value?.stock??Nt.value?.quantity),l=Number(m.value?.online_stock??m.value?.stock??m.value?.quantity),p=Number.isFinite(t)?t:Number.isFinite(l)?l:0;return(S.value.length>0?S.value.some(K=>K.inStock):p>0)?p>0?`Còn ${new Intl.NumberFormat("vi-VN").format(p)} sản phẩm`:"Còn hà ng":"Hết hà ng"}),ut=r(()=>{const t=Number(m.value?.rating);return Number.isFinite(t)&&t>0?t:0}),te=t=>{const l=String(t||"").replace(/\s+/g," ").trim();return l?(l.split(new RegExp("(?<=[.!?])\\s+"))[0]||l).trim():""},le=r(()=>{const t=m.value;if(!t||!t.title)return"Sản phẩm thú cưng chÃnh hãng tại PETPET. Giao nhanh và ưu Äãi má»i ngà y.";const l=Bt.value.replace(/\b\d{1,3}(?:[.,]\d{3})+(?:\s?(?:Ä|â«|vnd))?\b/gi,"").replace(/\bgiá\b\s*:?\s*/gi,"").replace(/\s+/g," ").trim(),w=te(l)||`${t.title}.`;return w.length>160?`${w.substring(0,157).trim()}...`:w}),ce=r(()=>{const t=m.value;if(!t||!t.title)return le.value;const p=[ie.value,i.value&&i.value!=="PETPET"?`Thương hiá»u: ${i.value}`:"",G.value?`Giá: ${G.value}
1`:"",lt.value?`Tình trạng: ${lt.value}`:""].filter(Boolean).join(" | ");return p.length>160?`${p.substring(0,157).trim()}...`:p});r(()=>{const t=String(ie.value||"").replace(/\s+/g," ").trim(),l=i.value||"PETPET",p=G.value||"Äang cáºp nháºt",w=lt.value||"Còn hà ng";return[t&&!ye(t)?t:"",`Thương hiá»u: ${l}`,`Giá: ${p}`,`Tình trạng: ${w}`].filter(Boolean).join(" | ").replace(/\s+/g," ").trim()}),r(()=>{const t=m.value?.summary||"";let l=String(t).replace(/<[^>]*>?/g,"");return l=l.replace(/ /g," ").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/\s+/g," ").trim(),l?l.length>160?`${l.substring(0,157).trim()}...`:l:m.value?.title||"Sản phẩm PETPET"});const _e=r(()=>{const t=Wt(m.value?.summary||Bt.value||ce.value||m.value?.title),l=Wt(m.value?.title)||"Sản phẩm PETPET",p=t||l;return p.length>160?`${p.substring(0,157).trim()}...`:p}),Ee=r(()=>{const t=m.value;if(!t||!t.title)return"Sản phẩm | PETPET";const l=t.title.trim(),p=" | PETPET",w=60;if((l+p).length<=w)return l+p;const K=w-p.length-3;let Q=l.substring(0,K).trim();const at=Q.lastIndexOf(" ");return at>K*.8&&(Q=Q.substring(0,at)),Q+"..."+p});return Qe({title:()=>Ee.value,description:()=>_e.value,ogTitle:()=>m.value?.title||Ee.value,ogDescription:()=>_e.value,ogImage:()=>Ut.value,ogImageAlt:()=>m.value?.title||"Sản phẩm PETPET",ogImageWidth:"1200",ogImageHeight:"630",ogImageSecureUrl:()=>Ut.value,ogUrl:()=>ot.value,ogType:"product",ogSiteName:"Petpet",ogLocale:"vi_VN"}),Je({htmlAttrs:{prefix:"og: http://ogp.me/ns#"},link:[{rel:"canonical",href:r(()=>ot.value)}],meta:[{property:"product:price:amount",content:r(()=>L.value?String(L.value):"")},{property:"product:price:currency",content:r(()=>L.value?"VND":"")},{property:"product:availability",content:r(()=>lt.value||"")},{property:"og:image",content:r(()=>Ut.value)},{property:"og:image:secure_url",content:r(()=>Ut.value)},{property:"og:url",content:r(()=>ot.value)},{property:"og:image:url",content:r(()=>Ut.value)},{property:"og:image:type",content:"image/jpeg"},{property:"og:image:width",content:"1200"},{property:"og:image:height",content:"630"}],script:[{key:"product-page-schema",type:"application/ld+json",children:r(()=>{const t=m.value;if(!t||!t.title)return"{}";const l=t.units||[],w=`${new Date().getFullYear()}-12-31`,K=X=>X?typeof X=="string"?X:typeof X=="object"?X?.name?.text||X?.name||X?.text||"":String(X):"",Q=u(t),at=K(t.category)||K(t.product_type)||"",Lt=t.description||t.short_description||t.content||"",ct=Wt(Lt),Pt=[Jt(t.main_image),...t.images?.map(X=>Jt(X.src||X.url||X))||[]].filter(Boolean),Ht=S.value.map(X=>X.price),we=S.value.some(X=>X.inStock),Ot=l.map(X=>{const ue=Number(X.price),$e=Number(X.compare_at_price),Ve=X.stock>0||X.quantity>0||!Object.prototype.hasOwnProperty.call(X,"stock");if(!Number.isFinite(ue)||ue<=0)return null;const Pe={"@type":"Offer",name:`${t.title}${X.variant_unit_name?" - "+X.variant_unit_name:""}`,price:String(ue),priceCurrency:"VND",priceValidUntil:w,availability:Ve?"https://schema.org/InStock":"https://schema.org/OutOfStock",url:ot.value,sku:X.sku||X._id||X.id||t._id,seller:{"@type":"Organization",name:"PETPET"}};return $e&&$e>ue&&(Pe.priceSpecification={"@type":"UnitPriceSpecification",price:String($e),priceCurrency:"VND",valueAddedTaxIncluded:!0}),(X.weight||t.weight)&&(Pe.weight={"@type":"QuantitativeValue",value:X.weight||t.weight,unitCode:X.weight_unit||t.weight_unit||"GRM"}),Pe}).filter(Boolean),ke=Ot.length>1?{"@type":"AggregateOffer",lowPrice:String(Ht.length?Math.min(...Ht):t.price||0),highPrice:String(Ht.length?Math.max(...Ht):t.price||0),priceCurrency:"VND",offerCount:Ot.length,availability:we?"https://schema.org/InStock":"https://schema.org/OutOfStock",offers:Ot}:Ot.length===1?Ot[0]:{"@type":"Offer",price:String(L.value||t.price||0),priceCurrency:"VND",availability:lt.value==="Hết hà ng"?"https://schema.org/OutOfStock":"https://schema.org/InStock",url:ot.value},J={"@context":"https://schema.org/","@type":"Product",name:t.title,image:Pt.length>1?Pt:Pt[0]||"",description:ct||ce.value,url:ot.value,productID:t.sku||t._id||V,category:at,brand:{"@type":"Brand",name:Q},sku:t._id||V,mainEntityOfPage:ot.value,offers:ke};return ut.value&&(J.aggregateRating={"@type":"AggregateRating",ratingValue:String(ut.value),bestRating:"5",worstRating:"1"}),JSON.stringify(J)})}]}),(t,l)=>{const p=Fe,w=hn,K=wn,Q=Qn,at=oo,Lt=Io,ct=Vo,Pt=ga,Ht=ha,we=Vt,Ot=sn,ke=wa;return o(),c("main",ka,[e("section",$a,[n(F)?(o(),c("div",Pa,[n(wt)?(o(),c("div",Sa,[e("div",Ca,[E(p,{height:"20px",width:"54px",variant:"gold"}),l[2]||(l[2]=e("span",null,"/",-1)),E(p,{height:"20px",width:"110px",variant:"gold"}),l[3]||(l[3]=e("span",null,"/",-1)),E(p,{height:"20px",width:"320px",variant:"gold"})])])):(o(),Tt(w,{key:1,"product-title":n(m)?.name||n(m)?.title||"",category:n(m)?.category},null,8,["product-title","category"]))])):(o(),Tt(K,{key:1,product:n(m)||{},loading:n(wt)},null,8,["product","loading"]))]),e("section",Ia,[e("div",La,[E(Q,{class:"product-detail-gallery",product:n(m)||{},"selected-unit":n(Nt),"selected-unit-index":n(Et),loading:n(wt),onSelectUnit:l[0]||(l[0]=J=>Et.value=J)},null,8,["product","selected-unit","selected-unit-index","loading"]),E(at,{class:"product-detail-purchase",product:n(m)||{},"selected-unit-index":n(Et),loading:n(wt),onSelectUnit:l[1]||(l[1]=J=>Et.value=J)}
1,null,8,["product","selected-unit-index","loading"])])]),n(F)?A("",!0):(o(),Tt(Lt,{key:0,product:n(m)||{}},null,8,["product"])),e("section",Ta,[e("div",Aa,[e("div",Fa,[n(F)?(o(),c(rt,{key:0},[E(ct,{product:n(m)||{},class:"product-detail-copy"},null,8,["product"]),E(Pt,{product:n(m)||{},class:"product-detail-copy"},null,8,["product"])],64)):(o(),c(rt,{key:1},[E(Pt,{product:n(m)||{}},null,8,["product"]),E(ct,{product:n(m)||{}},null,8,["product"])],64))]),n(F)?(o(),Tt(Ht,{key:0,products:n(gt),loading:n(vt)},null,8,["products","loading"])):A("",!0)])]),e("section",Ea,[e("div",Na,[n(qt).length?(o(),c("div",Da,[l[4]||(l[4]=e("h2",{class:"mb-4 px-[10px] font-monasans text-[20px] font-bold text-grayPetpet lg:px-0 lg:text-[24px]"}," Danh sách món trong combo ",-1)),e("div",Ma,[(o(!0),c(rt,null,xt(n(qt),J=>(o(),c("article",{key:J.group_item_id||J.variant_id||J.product_id,class:"product-card combo-product-card"},[E(we,{to:Qt(J),prefetch:!1,class:"product-link combo-product-link","aria-label":J.name||J.title},{default:St(()=>[e("div",ja,[e("img",{src:J.main_image||J.image,alt:J.name||J.title||"Sản phẩm PETPET",loading:"lazy",decoding:"async",width:"160",height:"160"},null,8,Ua)]),e("div",Ba,[e("h3",Oa,b(J.name||J.title),1),e("p",Ra,b(J.variant_unit_name),1),e("p",Va,b(xe(J.price))+"Ä ",1)])]),_:2},1032,["to","aria-label"])]))),128))])])):A("",!0),E(Ot,{class:"product-detail-boss-favorites",title:"Boss cÅ©ng yêu thÃch",subtitle:"SÄn deal há»i - ChÄm boss nhẹ tênh!",products:n(gt),loading:n(vt),slug:"none","mobile-infinite":!0,"insert-product-banners":!0},null,8,["products","loading"])])]),!n(wt)&&n(m)?.title?(o(),c("div",za,[e("p",null,b(n(m).title)+" - Thông tin chi tiết sản phẩm",1),n(m).vendor||n(m).brand_name?(o(),c("p",qa," Thương hiá»u: "+b(n(m).vendor||n(m).brand_name),1)):A("",!0),n(m).units?.length?(o(),c("ul",Wa,[(o(!0),c(rt,null,xt(n(m).units,J=>(o(),c("li",{key:J._id||J.id},b(J.variant_unit_name)+": "+b(new Intl.NumberFormat("vi-VN").format(J.price))+" Ä ",1))),128))])):A("",!0),n(m).category?(o(),c("p",Ha," Danh mục: "+b(typeof n(m).category=="string"?n(m).category:n(m).category?.name?.text||n(m).category?.name||""),1)):A("",!0),e("p",null,"Mua "+b(n(m).title)+" chÃnh hãng tại PETPET - giao nhanh 2h TP.HCM, Äá»i trả 7 ngà y.",1)])):A("",!0),n(F)?A("",!0):(o(),Tt(ke,{key:2,onBuy:be}))])}}}),ds=Dt(Ya,[["__scopeId","data-v-26a3b628"]]);export{ds 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.