1import{k as L,l as i,r as b,O,u as R,c as l,m as o,t as r,b as s,a as d,h as p,e as y,F as V,i as c,p as U,_ as I,U as B,o as n}from"#entry";import{g as M,e as z,a as D,d as A}from"./CaVVEZRR.js";import{A as H,M as $,a as j}from"./DRq45blS.js";import{w as q}from"./pAYh3yWb.js";import{u as F}from"./ufxNFHnW.js";import{u as T}from"./D-GNixRz.js";import{u as W}from"./Dfz_eyMs.js";import"./BsqTxom4.js";import"./B-jTRGN7.js";const G={class:"min-h-screen bg-[#f6f6f7] pt-28 pb-16"},J={key:0,class:"max-w-6xl mx-auto px-4 py-20 text-center text-slate-500"},K={key:1,class:"max-w-6xl mx-auto px-4 py-12 text-center text-red-600"},Q={key:2,class:"max-w-2xl mx-auto px-4 py-16 text-center"},X={key:3,class:"max-w-[1200px] mx-auto px-4 sm:px-6"},Y={class:"text-sm text-slate-500 mb-8 flex flex-wrap gap-1"},Z={class:"text-slate-800"},tt={class:"grid grid-cols-1 lg:grid-cols-2 gap-10 lg:gap-14"},et={class:"bg-white border border-slate-200/80 rounded-lg overflow-hidden"},st={class:"aspect-square bg-slate-50 flex items-center justify-center p-8"},ot=["src","alt"],at={key:1,class:"text-slate-300 text-sm"},lt={class:"flex flex-col"},rt={class:"text-xs font-semibold uppercase tracking-widest text-blue-700 mb-2"},nt={class:"text-2xl sm:text-3xl font-semibold text-slate-900 tracking-tight leading-tight"},it={key:0,class:"mt-2 text-sm text-slate-500"},ct={class:"font-medium text-slate-800"},mt={class:"mt-6 flex items-baseline gap-3"},ut={class:"text-3xl font-semibold text-slate-900"},dt={class:"mt-6 text-slate-600 leading-relaxed whitespace-pre-line"},kt={__name:"[slug]",async setup(pt){let m,f;const k=L(),_=i(()=>String(k.params.slug||"")),{getAccesorioBySlug:C}=F(),{agregarAlCarrito:w}=T(),{setPageSEO:S}=W(),x=b(!0),g=b(""),t=b(null),v=i(()=>M(t.value?.categoria||"")?.nombre||""),h=i(()=>t.value?.categoria?z(t.value.categoria):null),P=i(()=>D(_.value));x.value=!0;try{t.value=([m,f]=O(()=>C(_.value)),m=await m,f(),m),t.value&&S("producto",{nombre:t.value.nombre},`${t.value.nombre} | AutoPiezas360`,(t.value.descripcion||"").slice(0,160))}catch(a){g.value=a?.message||"Error al cargar el producto"}finally{x.value=!1}R({link:[{rel:"canonical",href:i(()=>B(P.value))}]});function E(){if(!t.value)return;const a=t.value;w({id:a.id||"",nombre:a.nombre,precio:a.precio,cantidad:1,imagen:a.imagen,marca:a.marca||j,modelo:a.modelo||$,anio:a.anio||H,categoria:a.categoria,slug:a.slug||"",stock:a.stock})}function N(){const a=t.value,e=a?`Hola, me interesa el accesorio: ${a.nombre}`:"Hola, consulto por un accesorio en AutoPiezas360";window.open(q(e),"_blank")}return(a,e)=>{const u=I;return n(),l("div",G,[o(x)?(n(),l("div",J," Cargando producto⦠")):o(g)?(n(),l("div",K,r(o(g)),1)):o(t)?(n(),l("div",X,[s("nav",Y,[d(u,{to:"/",class:"hover:text-blue-700"},{default:p(()=>[...e[3]||(e[3]=[c("Inicio",-1)])]),_:1}),e[6]||(e[6]=s("span",null,"/",-1)),d(u,{to:o(A),class:"hover:text-blue-700"},{default:p(()=>[...e[4]||(e[4]=[c("Accesorios",-1)])]),_:1},8,["to"]),o(h)?(n(),l(V,{key:0},[e[5]||(e[5]=s("span",null,"/",-1)),d(u,{to:o(h),class:"hover:text-blue-700"},{default:p(()=>[c(r(o(v)),1)]),_:1},8,["to"])],64)):y("",!0),e[7]||(e[7]=s("span",null,"/",-1)),s("span",Z,r(o(t).nombre),1)]),s("div",tt,[s("div",et,[s("div",st,[o(t).imagen?(n(),l("img",{key:0,src:o(t).imagen,alt:o(t).nombre,class:"max-w-full max-h-full object-contain"},null,8,ot)):(n(),l("div",at,"Sin imagen"))])]),s("div",lt,[s("p",rt,r(o(v)||"Accesorio"),1),s("h1",nt,r(o(t).nombre),1),o(t).marcaRepuesto?(n(),l("p",it,[e[8]||(e[8]=c(" Marca: ",-1)),s("span",ct,r(o(t).marcaRepuesto),1)])):y("",!0),s("div",mt,[s("span",ut," $"+r(Number(o(t).precio).toLocaleString("es-CL")),1),e[9]||(e[9]=s("span",{class:"text-sm text-slate-500"},"CLP",-1))]),s("p",{class:U(o(t).stock?"mt-2 text-sm font-medium text-emerald-700":"mt-2 text-sm font-medium text-amber-700")},r(o(t).stock?"â Disponible":"â Consultar disponibilidad"),3),s("p",dt,r(o(t).descripcion),1),s("div",{class:"mt-8 flex flex-col sm:flex-row gap-3"},[s("button",{type:"button",class:"flex-1 bg-slate-900 text-white py-3.5 rounded-md font-medium hover:bg-blue-700 transition-colors",onClick:E}," Agregar al carrito "),s("button",{type:"button",class:"flex-1 border border-slate-300 text-slate-800 py-3.5 rounded-md font-medium hover:bg-slate-50",onClick:N}," Consultar por WhatsApp ")])])])])):(n(),l("div",Q,[e[1]||(e[1]=s("h1",{class:"text-2xl font-semibold text-slate-900 mb-4"},"Producto no encontrado",-1)),e[2]||(e[2]=s("p",{class:"text-slate-600 mb-6"},"Puede que ya no esté disponible. Contáctanos y te ayudamos.",-1)),d(u,{to:o(A),class:"inline-block bg-slate-900 text-white px-6 py-3 rounded-md font-medium"},{default:p(()=>[...e[0]||(e[0]=[c(" Ver accesorios ",-1)])]),_:1},8,["to"])]))])}}};export{kt 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.