1import{r as w,f as D,b as l,j as e,F as j,L as B,B as n,X as H,al as L,V as R,Y as T,C as $,a as I,c as U,d as V,e as W,aA as Y,s as c}from"./index-RxDZGo8S.js";import{B as b}from"./badge-Kwp9j7fd.js";import{H as Q}from"./Helmet-CNRh3xEi.js";import{M as P}from"./message-circle-BHbxpExN.js";import{S as X}from"./shopping-cart-CV1unszX.js";import{E as G}from"./eye-CB4j9jLn.js";import"./index-Cj1iWM2O.js";function oe(){const[N,C]=w.useState("available"),[o,y]=w.useState(0),[v,k]=w.useState(!1),_=D(),{data:r}=l({queryKey:["store-settings"],queryFn:async()=>{const{data:s,error:a}=await c.from("store_settings").select("*").single();if(a)throw a;return s}}),{data:i}=l({queryKey:["store-orchids"],queryFn:async()=>{const{data:s,error:a}=await c.from("orchid_gallery").select("*, orchid_colors (name, hex_color)").eq("available",!0).order("created_at",{ascending:!1});if(a)throw a;return s}}),{data:d}=l({queryKey:["store-orchids-past"],queryFn:async()=>{const{data:s,error:a}=await c.from("orchid_gallery").select("*, orchid_colors (name, hex_color)").eq("available",!1).not("photo_urls","is",null).order("updated_at",{ascending:!1}).limit(24);if(a)throw a;return s}}),{data:t}=l({queryKey:["store-banners"],queryFn:async()=>{const{data:s,error:a}=await c.from("store_banners").select("*").eq("is_active",!0).order("sort_order",{ascending:!0});if(a)throw a;return s}}),{data:S}=l({queryKey:["store-menu-items"],queryFn:async()=>{const{data:s,error:a}=await c.from("store_menu_items").select("*").eq("is_visible",!0).order("sort_order",{ascending:!0});if(a)throw a;return s}});l({queryKey:["store-pages"],queryFn:async()=>{const{data:s,error:a}=await c.from("store_pages").select("*").eq("is_published",!0).order("created_at",{ascending:!1});if(a)throw a;return s}});const{data:x}=l({queryKey:["store-shopify-content"],queryFn:async()=>{const{data:s,error:a}=await c.from("store_shopify_content").select("*").eq("is_published",!0).order("published_at",{ascending:!1}).limit(6);if(a)throw a;return s}}),m=(r==null?void 0:r.store_name)||"FloraFlor",f=r==null?void 0:r.whatsapp_number,u=(r==null?void 0:r.theme_color)||"#047373",h=r==null?void 0:r.payment_url,z=(r==null?void 0:r.payment_button_text)||"Comprar";r!=null&&r.show_prices;const q=s=>{if(!f)return;const a=encodeURIComponent(`Hola! Me interesa la orquÃdea: ${s}`);window.open(`https://wa.me/${f}?text=${a}`,"_blank")},K=()=>t&&y(s=>(s+1)%t.length),O=()=>t&&y(s=>(s-1+t.length)%t.length),A=[{id:"home",label:"Inicio",url:"/tienda"},{id:"products",label:"Productos",url:"/tienda#productos"}],E=S||[],M=x&&x.length>0?[{id:"blog",label:"Blog",url:"/tienda#blog"}]:[],p=[...A,...E,...M],F=({orchid:s,available:a=!0})=>e.jsxs($,{className:"overflow-hidden hover:shadow-lg transition-all duration-300 group cursor-pointer",onClick:()=>a&&_(`/tienda/producto/${s.id}`),children:[e.jsx(U,{className:"p-0",children:s.photo_urls&&s.photo_urls.length>0?e.jsxs("div",{className:"aspect-square overflow-hidden bg-muted relative",children:[e.jsx("img",{src:`https://wsrv.nl/?url=${encodeURIComponent(s.photo_urls[0])}&w=400&h=400&fit=cover&q=80`,alt:s.name,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-500",loading:"lazy"}),s.photo_urls.length>1&&e.jsxs("span",{className:"absolute top-2 right-2 bg-background/80 text-foreground text-xs px-1.5 py-0.5 rounded",children:[s.photo_urls.length," fotos"]}),!a&&e.jsx("div",{className:"absolute inset-0 bg-background/60 flex items-center justify-center",children:e.jsx(b,{variant:"secondary",className:"text-sm",children:"Fuera de stock"})}),s.is_new&&a&&e.jsx(b,{className:"absolute top-2 left-2 text-xs",style:{backgroundColor:u},children:"Nuevo"})]}):e.jsx("div",{className:"aspect-square bg-gradient-to-br from-primary/10 to-primary/5 flex items-center justify-center",children:e.jsx(j,{className:"w-16 h-16 text-primary/40"})})}),e.jsxs(I,{className:"pt-3",children:[e.jsx(V,{className:"text-base mb-2",children:s.name}),e.jsxs("div",{className:"flex gap-1.5 flex-wrap mb-2",children:[s.height_cm&&e.jsxs(b,{variant:"secondary",className:"text-xs",children:[s.height_cm,"cm"]}),s.orchid_colors&&e.jsx(b,{variant:"outline",className:"text-xs",style:{borderColor:s.orchid_colors.hex_color,color:s.orchid_colors.hex_color},children:s.orchid_colors.name})]}),s.description&&e.jsx(W,{className:"line-clamp-2 text-xs",children:s.description})]}),a&&e.jsxs(Y,{className:"gap-2 pt-0 flex-wrap",children:[h&&e.jsxs(n,{className:"flex-1 gap-1.5 text-sm",onClick:g=>{g.stopPropagation(),window.open(h,"_blank")},style:{backgroundColor:u},children:[e.jsx(X,{className:"w-3.5 h-3.5"}),z]}),f&&e.jsxs(n,{variant:h?"outline":"default",className:"flex-1 gap-1.5 text-sm ",onClick:g=>{g.stopPropagation(),q(s.name)},style:h?{}:{backgroundColor:u},children:[e.jsx(P,{className:"w-3.5 h-3.5"}),"Consultar"]}),e.jsxs(n,{variant:"outline",size:"sm",onClick:g=>{g.stopPropagation(),_(`/tienda/producto/${s.id}`)},className:"gap-1.5",children:[e.jsx(G,{className:"w-3.5 h-3.5"}),"Ver"]})]})]});return e.jsxs(e.Fragment,{children:[e.jsxs(Q,{children:[e.jsxs("title",{children:[m," - OrquÃdeas Premium"]}),e.jsx("meta",{name:"description",content:`Descubre nuestra colección exclusiva de orquÃdeas. ${m} ofrece las mejores orquÃdeas con envÃo a todo Chile.`}),e.jsx("meta",{property:"og:title",content:`${m} - OrquÃdeas Premium`}),e.jsx("meta",{property:"og:description",content:"Colección exclusiva de orquÃdeas premium"}),e.jsx("meta",{property:"og:type",content:"website"}),e.jsx("link",{rel:"canonical",href:window.location.href}),(r==null?void 0:r.analytics_code)&&e.jsx("script",{dangerouslySetInnerHTML:{__html:r.analytics_code}})]}),e.jsxs("div",{className:"min-h-screen bg-gradient-to-b from-background to-secondary/20",children:[e.jsx("header",{className:"border-b bg-background/80 backdrop-blur-sm sticky top-0 z-50",children:e.jsxs("div",{className:"container mx-auto px-4 py-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[r!=null&&r.logo_url?e.jsx("img",{src:r.logo_url,alt:m,className:"h-10 w-10 object-contain rounded"}):e.jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center",style:{backgroundColor:u},children:e.jsx(j,{className:"w-6 h-6 text-white"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:m}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"OrquÃdeas Premium"})]})]}),p.length>0&&e.jsx("nav",{className:"hidden md:flex gap-4 items-center",children:p.map(s=>e.jsx(B,{to:s.url,className:"text-sm font-medium hover:text-primary transition-colors",children:s.label},s.id))}),p.length>0&&e.jsx(n,{variant:"ghost",size:"icon",className:"md:hidden",onClick:()=>k(!v),children:v?e.jsx(H,{className:"w-5 h-5"}):e.jsx(L,{className:"w-5 h-5"})})]}),v&&p.length>0&&e.jsx("nav",{className:"md:hidden flex flex-col gap-2 pt-4 pb-2 border-t mt
1-4",children:p.map(s=>e.jsx(B,{to:s.url,className:"text-sm font-medium hover:text-primary transition-colors py-1",onClick:()=>k(!1),children:s.label},s.id))})]})}),t&&t.length>0&&e.jsxs("section",{className:"relative",children:[e.jsxs("div",{className:"relative h-48 sm:h-64 md:h-80 overflow-hidden",children:[e.jsx("img",{src:t[o].photo_url,alt:t[o].title||"Banner",className:"w-full h-full object-cover transition-all duration-500"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-background/80 to-transparent flex items-end",children:e.jsxs("div",{className:"container mx-auto px-4 pb-6",children:[t[o].title&&e.jsx("h2",{className:"text-2xl md:text-3xl font-bold text-foreground",children:t[o].title}),t[o].subtitle&&e.jsx("p",{className:"text-sm md:text-base text-muted-foreground mt-1",children:t[o].subtitle})]})}),t.length>1&&e.jsxs(e.Fragment,{children:[e.jsx(n,{variant:"ghost",size:"icon",className:"absolute left-2 top-1/2 -translate-y-1/2 bg-background/50",onClick:O,children:e.jsx(R,{className:"w-5 h-5"})}),e.jsx(n,{variant:"ghost",size:"icon",className:"absolute right-2 top-1/2 -translate-y-1/2 bg-background/50",onClick:K,children:e.jsx(T,{className:"w-5 h-5"})})]})]}),t.length>1&&e.jsx("div",{className:"flex justify-center gap-1.5 py-2",children:t.map((s,a)=>e.jsx("button",{onClick:()=>y(a),className:`w-2 h-2 rounded-full transition-colors ${a===o?"bg-primary":"bg-muted-foreground/30"}`},a))})]}),(!t||t.length===0)&&e.jsx("section",{className:"py-14 px-4",children:e.jsxs("div",{className:"container mx-auto text-center max-w-3xl",children:[e.jsx("h2",{className:"text-4xl md:text-5xl font-bold mb-4 bg-gradient-to-r from-primary to-primary/60 bg-clip-text text-transparent",children:"OrquÃdeas Exclusivas"}),e.jsx("p",{className:"text-lg text-muted-foreground mb-8",children:(r==null?void 0:r.store_description)||"Descubre nuestra colección cuidadosamente seleccionada de orquÃdeas premium."}),f&&e.jsxs(n,{size:"lg",className:"gap-2",style:{backgroundColor:u},onClick:()=>q("información general"),children:[e.jsx(P,{className:"w-5 h-5"}),"Consultar por WhatsApp"]})]})}),e.jsx("div",{className:"container mx-auto px-4 mt-6",children:e.jsxs("div",{className:"flex gap-2 border-b mb-8",children:[e.jsxs("button",{onClick:()=>C("available"),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px ${N==="available"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"}`,children:["Disponibles (",(i==null?void 0:i.length)||0,")"]}),e.jsxs("button",{onClick:()=>C("past"),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px ${N==="past"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"}`,children:["Anteriores (",(d==null?void 0:d.filter(s=>{var a;return(a=s.photo_urls)==null?void 0:a.length}).length)||0,")"]})]})}),e.jsx("section",{id:"productos",className:"pb-12 px-4",children:e.jsx("div",{className:"container mx-auto",children:N==="available"?!i||i.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx(j,{className:"w-16 h-16 mx-auto mb-4 text-muted-foreground"}),e.jsx("p",{className:"text-muted-foreground",children:"Próximamente nueva colección"})]}):e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:i.map(s=>e.jsx(F,{orchid:s,available:!0},s.id))}):!d||d.filter(s=>{var a;return(a=s.photo_urls)==null?void 0:a.length}).length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx(j,{className:"w-16 h-16 mx-auto mb-4 text-muted-foreground"}),e.jsx("p",{className:"text-muted-foreground",children:"Sin historial"})]}):e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:d.filter(s=>{var a;return(a=s.photo_urls)==null?void 0:a.length}).map(s=>e.jsx(F,{orchid:s,available:!1},s.id))})})}),x&&x.length>0&&e.jsx("section",{id:"blog",className:"py-12 px-4 bg-secondary/20",children:e.jsxs("div",{className:"container mx-auto",children:[e.jsx("h2",{className:"text-2xl font-bold mb-6",children:"Blog"}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:x.map(s=>e.jsxs($,{className:"overflow-hidden hover:shadow-md transition-shadow cursor-pointer",onClick:()=>_(`/tienda/articulo/${s.slug}`),children:[s.image_url&&e.jsx("div",{className:"aspect-video overflow-hidden",children:e.jsx("img",{src:s.image_url,alt:s.title,className:"w-full h-full object-cover",loading:"lazy"})}),e.jsxs(I,{className:"pt-4",children:[e.jsx(b,{variant:"secondary",className:"mb-2 text-xs",children:s.content_type==="blog"?"ArtÃculo":"Página"}),e.jsx("h3",{className:"font-semibold mb-1 line-clamp-2",children:s.title}),s.meta_description&&e.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:s.meta_description}),s.author&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:["Por ",s.author]})]})]},s.id))})]})}),e.jsx("footer",{className:"border-t py-8 px-4",children:e.jsxs("div",{className:"container mx-auto text-center text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex justify-center gap-4 mb-4",children:[(r==null?void 0:r.social_facebook)&&e.jsx("a",{href:r.social_facebook,target:"_blank",rel:"noopener noreferrer",className:"hover:text-primary transition-colors",children:"Facebook"}),(r==null?void 0:r.social_instagram)&&e.jsx("a",{href:r.social_instagram,target:"_blank",rel:"noopener noreferrer",className:"hover:text-primary transition-colors",children:"Instagram"})]}),e.jsxs("p",{children:["© ",new Date().getFullYear()," ",m,". Todos los derechos reservados."]}),e.jsx("p",{className:"mt-1",children:"ð¸ Cultivamos pasión, entregamos belleza"})]})})]})]})}export{oe 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.