const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/StructureModelPDFGenerator-BzCndBoj.js","assets/jspdf.es.min-CnLoolOT.js","assets/supabase-zQsF3e6k.js","assets/react-vendor-f6QdChhz.js","assets/jspdf.plugin.autotable-Dge4SOWT.js","assets/index-BzXujQ-F.js","assets/ui-vendor-CJlQk0Tq.js","assets/charts-BzMgu6zK.js","assets/index-CTE_Qb0i.css"])))=>i.map(i=>d[i]);
import{j as e,V as s}from"./ui-vendor-CJlQk0Tq.js";import{r as t,u as r,e as a,j as i,L as l,R as n}from"./react-vendor-f6QdChhz.js";import{C as o}from"./CTAButton-CfAJjgj1.js";import{g as c,h as d,i as m,j as u,F as x,B as h,H as p,am as g,C as j,b as f,c as N,bw as b,d as v,e as y,L as w,I as C,u as S,eR as P,eS as O,bb as k,P as D,aF as F,M as $,a$ as T,ci as A,cW as q,a5 as L,k as M,fQ as _,s as R,ag as E,A as U,ar as W,E as z,b3 as B,aZ as G,R as I,d2 as Q,N as V,$ as Y,a1 as H,ac as Z,a8 as J,aU as X,bP as K,eE as ee,cl as se,fR as te,bF as re,em as ae,fx as ie,Q as le,T as ne,aN as oe,a9 as ce,co as de}from"./index-BzXujQ-F.js";import{a as me}from"./slug-parser-8h41spFl.js";import{T as ue}from"./textarea-EMfUVvyA.js";import{R as xe,a as he}from"./radio-group-B7c_jw0C.js";import{S as pe,a as ge,b as je,c as fe,d as Ne}from"./select-DamQt7wx.js";import{f as be}from"./similarStructures-DwR6fShB.js";import{g as ve}from"./bunny-image-VphMgYzL.js";import{_ as ye}from"./supabase-zQsF3e6k.js";import{u as we,P as Ce}from"./PDFPreviewDialog-BkLcrMgQ.js";import{D as Se,a as Pe,b as Oe,c as ke}from"./dropdown-menu-sYWqzZq1.js";import{i as De,g as Fe,C as $e}from"./ColorSection-CG--mthy.js";import{S as Te}from"./SocialShareButton-mvbNhE3x.js";const Ae=({open:s,onOpenChange:t,pdfUrl:r,structureTitle:a,itemNumber:i})=>{const l=()=>{const e=document.createElement("a");e.href=r,e.download=`${a}-${i}-Specifications.pdf`,e.target="_blank",document.body.appendChild(e),e.click(),document.body.removeChild(e)};return e.jsx(c,{open:s,onOpenChange:t,children:e.jsxs(d,{className:"max-w-5xl h-[90vh] flex flex-col p-0",children:[e.jsxs(m,{className:"p-6 pb-4 border-b",children:[e.jsxs(u,{className:"flex items-center gap-2 text-xl",children:[e.jsx(x,{className:"h-5 w-5"}),a," Specifications"]}),e.jsxs("div",{className:"flex gap-2 mt-4",children:[e.jsxs(h,{onClick:l,variant:"outline",size:"sm",children:[e.jsx(p,{className:"h-4 w-4 mr-2"}),"Download PDF"]}),e.jsxs(h,{onClick:()=>{const e=window.open(r,"_blank");e&&(e.onload=()=>{e.print()})},variant:"outline",size:"sm",children:[e.jsx(g,{className:"h-4 w-4 mr-2"}),"Print"]})]})]}),e.jsx("div",{className:"flex-1 p-6 pt-0",children:e.jsx("iframe",{src:r,className:"w-full h-full border rounded-lg",title:`${a} Specifications PDF`,children:e.jsxs("p",{className:"text-center py-8",children:["Your browser doesn't support PDF viewing.",e.jsx(h,{onClick:l,variant:"link",className:"ml-2",children:"Download the PDF instead"})]})})})]})})},qe=({structure:s})=>e.jsxs(j,{children:[e.jsx(f,{children:e.jsxs(N,{className:"text-lg flex items-center gap-2",children:[e.jsx(b,{className:"w-5 h-5"}),"Structure Details"]})}),e.jsx(v,{children:e.jsxs("div",{className:"flex gap-4",children:[s.imageSrc&&e.jsx("div",{className:"flex-shrink-0",children:e.jsx("img",{src:s.imageSrc,alt:s.altText||s.title,className:"w-20 h-20 object-cover rounded-lg border"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"font-semibold text-lg",children:s.title}),s.dimensions&&e.jsx("p",{className:"text-gray-600",children:s.dimensions}),s.itemNumber&&e.jsxs("p",{className:"text-sm text-gray-500",children:["Item #",s.itemNumber]}),s.price&&e.jsxs("p",{className:"text-lg font-semibold text-green-600 mt-1",children:["$",s.price.toLocaleString()]})]})]})})]}),Le=({formData:s,onChange:t,onSelectChange:r})=>e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(y,{className:"h-4 w-4 text-gray-500"}),e.jsx(w,{className:"text-sm font-medium",children:"Delivery Address"})]}),e.jsx("div",{children:e.jsx(C,{name:"street",value:s.street,onChange:t,required:!0,placeholder:"Street Address *"})}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[e.jsx("div",{children:e.jsx(C,{name:"city",value:s.city,onChange:t,required:!0,placeholder:"City *"})}),e.jsx("div",{children:e.jsxs(pe,{onValueChange:e=>r("state",e),required:!0,children:[e.jsx(ge,{children:e.jsx(je,{placeholder:"State *"})}),e.jsxs(fe,{children:[e.jsx(Ne,{value:"PA",children:"Pennsylvania"}),e.jsx(Ne,{value:"NJ",children:"New Jersey"}),e.jsx(Ne,{value:"DE",children:"Delaware"}),e.jsx(Ne,{value:"MD",children:"Maryland"}),e.jsx(Ne,{value:"NY",children:"New York"}),e.jsx(Ne,{value:"other",children:"Other"})]})]})}),e.jsx("div",{children:e.jsx(C,{name:"zipCode",value:s.zipCode,onChange:t,required:!0,placeholder:"ZIP Code *"})})]})]}),Me=({open:r,onOpenChange:a,structure:i,mode:l="quote",sourceButton:n})=>{const[o,m]=t.useState("exact"),[x,p]=t.useState({siding:!1,color:!1,trim:!1,roofing:!1,windows:!1,electrical:!1,flooring:!1,other:!1}),[g,b]=t.useState(""),[y,E]=t.useState("call"),[U,W]=t.useState({name:"",phone:"",email:"",street:"",city:"",state:"",zipCode:"",notes:""}),[z,B]=t.useState(!1),[G,I]=t.useState(!1),{toast:Q}=S(),{trackQuickQuote:V}=P(),{trackLead:Y}=O(),H=e=>{const{name:s,value:t}=e.target;W(e=>({...e,[s]:t}))},Z=(e,s)=>{p(t=>({...t,[e]:s}))},J=()=>{let e=`Quote request for: ${i.title}\n`;return e+=`Item Number: ${i.itemNumber}\n`,e+=`Dimensions: ${i.dimensions}\n\n`,"quote"===l?"exact"===o?e+="Quote Type: Exact as shown\n":"delivery"===o?e+="Quote Type: Exact as shown + Delivery\n":"custom"===o&&(e+="Quote Type: Custom modifications requested\n",e+="Customization requests:\n",Object.entries(x).forEach(([s,t])=>{t&&"other"!==s&&(e+=`- ${s.charAt(0).toUpperCase()+s.slice(1)}\n`)}),x.other&&g&&(e+=`- Other: ${g}\n`),e+="\n"):e+="Contact request for general information\n\n",e+=`Preferred contact method: ${"call"===y?"Phone Call":"text"===y?"Text Message":"Email"}\n`,U.notes&&(e+=`\nAdditional notes:\n${U.notes}`),e};return G?e.jsx(c,{open:r,onOpenChange:a,children:e.jsxs(d,{className:"sm:max-w-md",children:[e.jsxs(s,{children:[e.jsx(u,{children:"Request Submitted"}),e.jsx(k,{children:"Your request has been successfully submitted"})]}),e.jsxs("div",{className:"text-center py-6",children:[e.jsx("div",{className:"w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mx-auto mb-4",children:e.jsx("svg",{className:"w-8 h-8 text-green-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"quote"===l?"Quote Request Sent!":"Message Sent!"}),e.jsx("p",{className:"text-gray-600",children:"quote"===l?"We'll prepare your quote and contact you shortly.":"Thank you for reaching out. We'll get back to you soon!"})]})]})}):e.jsx(c,{open:r,onOpenChange:a,children:e.jsxs(d,{className:"sm:max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsxs(s,{children:[e.jsx(u,{children:"quote"===l?"Request a Quote":"Contact Us"}),e.jsx(k,{children:"quote"===l?"Get a personalized quote for this structure":"Get in touch with our team for assistance"})]}),e.jsxs("form",{onSubmit:async e=>{var s;e.preventDefault(),B(!0);try{const e=_({name:U.name,message:U.notes||J(),email:U.email});if(e.isSpam)return Q({title:"Submission Error",description:e.reason,variant:"destructive"}),void B(!1);const t={name:U.name,email:U.email,phone:U.phone,message:J(),source_page:window.location.pathname,structure_id:i.id,structure_item_number:i.itemNumber,quote_type:"quote"===l?o:"contact",contact_method:y,address:U.street,city:U.city,state:U.state,zip:U.zipCode,source_button:n},{error:r}=await R.from("contact_submissions").insert([t]);if(r)throw r;if("quote"===l){V();const e=(null==(s=i.sale)?void 0:s.price)||i.price||0;Y({email:U.email,phone:U.phone},{value:e,content_name:i.title,content_category:i.type,content_ids:[i.itemNumber||i.id]})}await R.functions.invoke("send-notification-email",{body:{type:"quote"===l?"quote_request":"contact_request",data:t}}),I(!0),Q({title:"Success!",description:"quote"===l?"Your quote request has been submitted. We'll contact you shortly!":"Your message has been sent. We'll get back to you soon!"}),setTimeout(()=>{a(!1),I(!1),W({name:"",phone:"",email:"",street:"",city:"",state:"",zipCode:"",notes:""}),m("exact"),p({siding:!1,color:!1,trim:!1,roofing:!1,windows:!1,electrical:!1,flooring:!1,other:!1}),b("")},2e3)}catch(t){Q({title:"Error",description:"Failed to submit request. Please try again.",variant:"destructive"})}finally{B(!1)}},className:"space-y-6",children:[e.jsx(qe,{structure:i}),e.jsxs(j,{children:[e.jsx(f,{children:e.jsxs(N,{className:"text-lg flex items-center gap-2",children:[e.jsx(D,{className:"w-5 h-5"}),"How would you like us to contact you?"]})}),e.jsx(v,{children:e.jsxs(xe,{value:y,onValueChange:E,className:"grid grid-cols-3 gap-4",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(he,{value:"call",id:"call"}),e.jsxs(w,{htmlFor:"call",className:"flex items-center gap-2 cursor-pointer",children:[e.jsx(D,{className:"w-4 h-4"}),"Call"]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(he,{value:"text",id:"text"}),e.jsxs(w,{htmlFor:"text",className:"flex items-center gap-2 cursor-pointer",children:[e.jsx(F,{className:"w-4 h-4"}),"Text"]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(he,{value:"email",id:"email"}),e.jsxs(w,{htmlFor:"email",className:"flex items-center gap-2 cursor-pointer",children:[e.jsx($,{className:"w-4 h-4"}),"Email"]})]})]})})]}),"quote"===l&&e.jsxs(j,{children:[e.jsx(f,{children:e.jsx(N,{className:"text-lg",children:"What type of quote do you need?"})}),e.jsx(v,{children:e.jsx(xe,{value:o,onValueChange:e=>m(e),children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center space-x-3 p-3 rounded-lg border",children:[e.jsx(he,{value:"exact",id:"exact"}),e.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[e.jsx(T,{className:"w-5 h-5 text-blue-600"}),e.jsxs("div",{children:[e.jsx(w,{htmlFor:"exact",className:"font-medium cursor-pointer",children:"Exact as shown"}),e.jsx("p",{className:"text-sm text-gray-600",children:"Quote for the structure exactly as displayed"})]})]})]}),e.jsxs("div",{className:"flex items-center space-x-3 p-3 rounded-lg border",children:[e.jsx(he,{value:"delivery",id:"delivery"}),e.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[e.jsx(A,{className:"w-5 h-5 text-green-600"}),e.jsxs("div",{children:[e.jsx(w,{htmlFor:"delivery",className:"font-medium cursor-pointer",children:"With delivery"}),e.jsx("p",{className:"text-sm text-gray-600",children:"Quote including delivery to your location"})]})]})]}),e.jsxs("div",{className:"flex items-center space-x-3 p-3 rounded-lg border",children:[e.jsx(he,{value:"custom",id:"custom"}),e.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[e.jsx(q,{className:"w-5 h-5 text-purple-600"}),e.jsxs("div",{children:[e.jsx(w,{htmlFor:"custom",className:"font-medium cursor-pointer",children:"Custom modifications"}),e.jsx("p",{className:"text-sm text-gray-600",children:"Request modifications to the design"})]})]})]})]})})})]}),"quote"===l&&"custom"===o&&e.jsxs(j,{children:[e.jsx(f,{children:e.jsx(N,{className:"text-lg",children:"What would you like to customize?"})}),e.jsxs(v,{children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[Object.entries(x).map(([s,t])=>"other"===s?null:e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(L,{id:s,checked:t,onCheckedChange:e=>Z(s,e)}),e.jsx(w,{htmlFor:s,className:"capitalize cursor-pointer",children:"roofing"===s?"Roof":s})]},s)),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(L,{id:"other",checked:x.other,onCheckedChange:e=>Z("other",e)}),e.jsx(w,{htmlFor:"other",className:"cursor-pointer",children:"Other"})]})]}),x.other&&e.jsxs("div",{className:"mt-4",children:[e.jsx(w,{htmlFor:"otherCustomization",children:"Please specify:"}),e.jsx(C,{id:"otherCustomization",value:g,onChange:e=>b(e.target.value),placeholder:"Describe your custom requirements"})]})]})]}),e.jsxs(j,{children:[e.jsx(f,{children:e.jsx(N,{className:"text-lg",children:"Contact Information"})}),e.jsxs(v,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(w,{htmlFor:"name",children:"Full Name *"}),e.jsx(C,{id:"name",name:"name",value:U.name,onChange:H,required:!0,placeholder:"John Smith"})]}),e.jsxs("div",{children:[e.jsx(w,{htmlFor:"phone",children:"Phone Number *"}),e.jsx(C,{id:"phone",name:"phone",type:"tel",value:U.phone,onChange:e=>{M(e,H)},required:!0,placeholder:"(555) 123-4567"})]})]}),e.jsxs("div",{children:[e.jsx(w,{htmlFor:"email",children:"Email Address *"}),e.jsx(C,{id:"email",name:"email",type:"email",value:U.email,onChange:H,required:!0,placeholder:"john@example.com"})]})]})]}),e.jsxs(j,{children:[e.jsx(f,{children:e.jsx(N,{className:"text-lg",children:"Address Information"})}),e.jsx(v,{children:e.jsx(Le,{formData:U,onChange:H,onSelectChange:(e,s)=>{W(t=>({...t,[e]:s}))}})})]}),e.jsxs(j,{children:[e.jsx(f,{children:e.jsx(N,{className:"text-lg",children:"Additional Notes"})}),e.jsx(v,{children:e.jsx(ue,{id:"notes",name:"notes",value:U.notes,onChange:H,placeholder:"Any additional questions or special requirements...",rows:4})})]}),e.jsx(h,{type:"submit",className:"w-full",disabled:z,children:z?"quote"===l?"Sending Quote Request...":"Sending Message...":"quote"===l?"Request Quote":"Send Message"})]})]})})},_e=({open:s,onOpenChange:t,referenceStructure:a})=>{const i=r(),l=be(a,6);return e.jsx(c,{open:s,onOpenChange:t,children:e.jsxs(d,{className:"max-w-4xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(m,{children:[e.jsx(u,{className:"text-xl font-semibold",children:"Similar Available Structures"}),e.jsxs("p",{className:"text-muted-foreground",children:["Since the ",a.title," is no longer available, here are similar structures you can order today:"]})]}),l.length>0?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 mt-6",children:l.map(s=>{var r;return e.jsxs("div",{onClick:()=>(e=>{const s=e.link||`/structure/${encodeURIComponent(e.id)}`;t(!1),i(s)})(s),className:"border rounded-lg p-4 hover:shadow-md transition-shadow cursor-pointer group",children:[e.jsx("div",{className:"aspect-[4/3] mb-3 overflow-hidden rounded-md",children:e.jsx("img",{src:ve((null==(r=s.images)?void 0:r[0])||"/placeholder.svg",{width:300,height:225,format:"webp"}),alt:s.title,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"font-semibold text-base line-clamp-1",children:s.title}),s.dimensions&&e.jsx("p",{className:"text-sm text-muted-foreground",children:s.dimensions}),s.price&&e.jsxs("p",{className:"text-lg font-bold text-primary",children:["$",s.price.toLocaleString()]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-green-100 text-green-800",children:"Available Now"}),e.jsx(E,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary transition-colors"})]})]})]},s.id)})}):e.jsx("div",{className:"text-center py-8",children:e.jsx("p",{className:"text-muted-foreground mb-4",children:"No similar structures are currently available in our stock inventory."})}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mt-6 pt-6 border-t",children:[e.jsxs(h,{onClick:()=>{window.open("/stock-structures","_blank","noopener,noreferrer")},variant:"outline",className:"flex items-center justify-center flex-1",children:[e.jsx(U,{className:"mr-2 h-4 w-4"}),"Browse All Stock Structures"]}),e.jsx(h,{onClick:()=>{t(!1),setTimeout(()=>{const e=new CustomEvent("openContactModal");window.dispatchEvent(e)},100)},variant:"default",className:"flex items-center justify-center flex-1",children:"Contact Us for Custom Options"})]})]})})},Re=({structure:s,variant:t="outline",size:r="default",className:a})=>{const i=we();return e.jsxs(e.Fragment,{children:[e.jsxs(Se,{children:[e.jsx(Pe,{asChild:!0,children:e.jsxs(h,{variant:t,size:r,disabled:i.isGenerating,className:a,children:[e.jsx(x,{className:"mr-2 h-4 w-4"}),"Structure Details",e.jsx(W,{className:"ml-2 h-4 w-4"})]})}),e.jsxs(Oe,{align:"end",className:"w-48",children:[e.jsxs(ke,{onClick:async()=>{try{const{StructureModelPDFGenerator:e}=await ye(async()=>{const{StructureModelPDFGenerator:e}=await import("./StructureModelPDFGenerator-BzCndBoj.js");return{StructureModelPDFGenerator:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8])),t=new e({structure:s}),r=`${s.title.replace(/[^a-zA-Z0-9]/g,"_")}-${s.itemNumber}-Details.pdf`;await i.openPreview(t,r)}catch(e){B({title:"Preview Failed",description:"There was an error generating the PDF preview. Please try again.",variant:"destructive"})}},children:[e.jsx(z,{className:"mr-2 h-4 w-4"}),"Preview PDF"]}),e.jsxs(ke,{onClick:async()=>{try{const{StructureModelPDFGenerator:e}=await ye(async()=>{const{StructureModelPDFGenerator:e}=await import("./StructureModelPDFGenerator-BzCndBoj.js");return{StructureModelPDFGenerator:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8]));new e({structure:s}).download(),B({title:"PDF Downloaded",description:`${s.title} details downloaded successfully.`})}catch(e){B({title:"Download Failed",description:"There was an error downloading the PDF. Please try again.",variant:"destructive"})}},children:[e.jsx(p,{className:"mr-2 h-4 w-4"}),"Download PDF"]}),e.jsxs(ke,{onClick:async()=>{try{const{StructureModelPDFGenerator:e}=await ye(async()=>{const{StructureModelPDFGenerator:e}=await import("./StructureModelPDFGenerator-BzCndBoj.js");return{StructureModelPDFGenerator:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8])),t=new e({structure:s}).getBlob(),r=URL.createObjectURL(t),a=window.open(r,"_blank");a&&(a.onload=()=>{a.print()})}catch(e){B({title:"Print Failed",description:"There was an error preparing the PDF for printing. Please try again.",variant:"destructive"})}},children:[e.jsx(g,{className:"mr-2 h-4 w-4"}),"Print Details"]})]})]}),e.jsx(Ce,{open:i.isOpen,onOpenChange:i.closePreview,pdfBlob:i.pdfBlob,isGenerating:i.isGenerating,filename:i.filename,onDownload:()=>{i.handleDownload(),B({title:"PDF Downloaded",description:`${s.title} specifications downloaded.`})},onPrint:i.handlePrint})]})},Ee=()=>{var s,l;const n=r(),c=a(),[d,m]=t.useState(!1),[u,h]=t.useState(!1),[p,g]=t.useState(!1),j=i(),f=j["*"],{itemNumber:N}=j,b=(()=>{if(f){const{baseId:e,itemNumber:s,cleanId:t}=me(f);if(t!==f){const e=Q.find(e=>{var s;return(null==(s=e.id)?void 0:s.toLowerCase())===t.toLowerCase()});if(e)return e}if(s){const t=Q.find(t=>{var r,a;return((null==(r=t.id)?void 0:r.toLowerCase())===(null==e?void 0:e.toLowerCase())||(null==(a=t.link)?void 0:a.toLowerCase().includes(null==e?void 0:e.toLowerCase())))&&t.itemNumber===s});if(t)return t}const r=Q.find(e=>{var s;return(null==(s=e.id)?void 0:s.toLowerCase())===f.toLowerCase()});if(r)return r;const a=Q.find(e=>{var s;return null==(s=e.link)?void 0:s.toLowerCase().includes(f.toLowerCase())});if(a)return a;const i=Q.find(e=>e.itemNumber===f);if(i)return i}if(N){const e=Q.find(e=>e.itemNumber===N);if(e)return e}return null})(),v=(null==b?void 0:b.soldOut)||!1;c.pathname.includes("/inventory/"),c.pathname.includes("/past-inventory");const y=v,w=(null==(s=null==b?void 0:b.tags)?void 0:s.includes("refurbished"))||(null==(l=null==b?void 0:b.style)?void 0:l.includes("refurbished"));return e.jsxs("div",{className:"mt-8 flex flex-col gap-4",children:[v?e.jsxs(o,{onClick:w?()=>{g(!0)}:()=>{if(b){const e=`/custom-order?structure=${b.itemNumber||b.id}`;n(e)}},variant:"primary",className:"flex items-center justify-center font-medium text-base",children:[e.jsx(G,{className:"mr-2 h-5 w-5"}),w?"Browse Similar Structures":"Contact for Custom Order"]}):e.jsxs(e.Fragment,{children:[e.jsxs(o,{onClick:()=>{b&&m(!0)},variant:"primary",className:"flex items-center justify-center font-medium text-base",children:[e.jsx(G,{className:"mr-2 h-5 w-5"}),"Get Quote for This Structure"]}),e.jsxs(o,{onClick:()=>n("/contact"),variant:"outline",className:"flex items-center justify-center",children:[e.jsx(I,{className:"mr-2 h-5 w-5"}),"Contact Us"]})]}),(null==b?void 0:b.pdfUrl)&&e.jsxs(o,{onClick:()=>{h(!0)},variant:"outline",className:"flex items-center justify-center",children:[e.jsx(x,{className:"mr-2 h-5 w-5"}),"View Specifications"]}),b&&e.jsx(Re,{structure:b,variant:"outline",className:"flex items-center justify-center w-full"}),e.jsxs(o,{onClick:()=>n(y?"/past-inventory":"/stock-structures"),variant:"outline",className:"flex items-center justify-center",children:[e.jsx(U,{className:"mr-2 h-5 w-5"}),y?"Back to Customer Builds":"Back to Stock Structures"]}),b&&e.jsx(Me,{open:d,onOpenChange:m,structure:b,mode:"quote",sourceButton:"Structure Actions"}),(null==b?void 0:b.pdfUrl)&&e.jsx(Ae,{open:u,onOpenChange:h,pdfUrl:b.pdfUrl,structureTitle:b.title,itemNumber:b.itemNumber||""}),b&&e.jsx(_e,{open:p,onOpenChange:g,referenceStructure:b})]})},Ue=({images:s,altText:r,imageAlts:a,className:i})=>{const[l,n]=t.useState(0),[o,c]=t.useState(null),[d,m]=t.useState(null),u=e=>a&&a[e]?a[e]:`${r} - Image ${e+1} of ${s.length}`,x=(null==s?void 0:s.filter(e=>e&&""!==e.trim()))||[],p=x.length>0?x:["/placeholder.svg"],g=()=>{n(e=>0===e?p.length-1:e-1)},j=()=>{n(e=>e===p.length-1?0:e+1)},f=Math.min(l,p.length-1),N=p[f];let b;try{b=N.startsWith("/")||N.startsWith("http")?N:ve(N,{width:800,height:700})}catch(v){b=N}return e.jsxs("div",{className:V("relative",i),children:[e.jsxs("div",{className:"relative aspect-[4/3] overflow-hidden rounded-lg bg-gray-100 touch-pan-y",onTouchStart:e=>{m(null),c(e.targetTouches[0].clientX)},onTouchMove:e=>{m(e.targetTouches[0].clientX)},onTouchEnd:()=>{if(!o||!d)return;const e=o-d,s=e<-50;e>50&&j(),s&&g()},children:[e.jsx("img",{src:b,alt:u(f),width:800,height:600,className:"w-full h-full object-cover object-center",loading:"lazy",onError:e=>{e.currentTarget.src="/placeholder.svg"}}),p.length>1&&e.jsxs(e.Fragment,{children:[e.jsx(h,{variant:"outline",size:"icon",className:"absolute left-2 top-1/2 -translate-y-1/2 bg-white/80 hover:bg-white",onClick:g,"aria-label":"Previous image",children:e.jsx(Y,{className:"h-4 w-4"})}),e.jsx(h,{variant:"outline",size:"icon",className:"absolute right-2 top-1/2 -translate-y-1/2 bg-white/80 hover:bg-white",onClick:j,"aria-label":"Next image",children:e.jsx(H,{className:"h-4 w-4"})})]}),p.length>1&&e.jsxs("div",{className:"absolute bottom-2 right-2 bg-black/60 text-white px-2 py-1 rounded text-sm",children:[f+1," of ",p.length]})]}),p.length>1&&e.jsx("div",{className:"flex gap-2 mt-4 overflow-x-auto",children:p.map((s,t)=>{let r;try{r=s.startsWith("/")||s.startsWith("http")?s:ve(s,{width:120,height:90})}catch(v){r=s}return e.jsx("button",{onClick:()=>n(t),className:V("flex-shrink-0 relative aspect-[4/3] w-24 overflow-hidden rounded border-2 transition-colors",f===t?"border-primary":"border-gray-200 hover:border-gray-300"),"aria-label":`View image ${t+1}`,children:e.jsx("img",{src:r,alt:`${u(t)} thumbnail`,width:120,height:90,className:"w-full h-full object-cover object-center",loading:"lazy",onError:e=>{e.currentTarget.src="/placeholder.svg"}})},t)})})]})},We=({included:s,isPremiumFeaturesModel:t=!1,includedOptionsLabel:r,soldOut:a=!1})=>{if(!s)return null;const i=a?"How This Model Was Configured":r||"Included Options",l=!r;if(Array.isArray(s))return e.jsxs(j,{children:[e.jsxs(f,{className:"pb-2",children:[e.jsxs(N,{className:"flex items-center gap-2 text-lg font-semibold text-primary",children:[e.jsx(Z,{className:"h-5 w-5"}),i]}),l&&!a&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"These upgrades are included at no extra cost with this model"}),a&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"This is how this sold model was configured with upgrade values"})]}),e.jsx(v,{children:e.jsx("ul",{className:"space-y-1",children:s.map((s,t)=>e.jsxs("li",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(J,{className:"h-4 w-4 text-green-600 flex-shrink-0"}),e.jsx("span",{children:s})]},t))})})]});const{standardFeatures:n,includedOptions:o}=s;if(!(n&&0!==n.length||o&&0!==o.length))return null;return e.jsxs("div",{className:"space-y-4",children:[!t&&(()=>{if(!o||0===o.length)return null;const s="string"==typeof o[0];return e.jsxs(j,{children:[e.jsxs(f,{className:"pb-2",children:[e.jsxs(N,{className:"flex items-center gap-2 text-lg font-semibold text-primary",children:[e.jsx(Z,{className:"h-5 w-5"}),i]}),l&&!a&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"These upgrades are included at no extra cost with this model"}),a&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"This is how this sold model was configured with upgrade values"})]}),e.jsx(v,{children:e.jsx("ul",{className:"space-y-2",children:o.map((t,r)=>e.jsxs("li",{className:"flex items-center justify-between p-2 bg-muted/30 rounded",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Z,{className:"h-3 w-3 text-primary flex-shrink-0"}),e.jsx("span",{className:"font-medium text-foreground",children:s?t:t.name})]}),!s&&t.price&&e.jsx("span",{className:"text-sm text-green-600 font-medium",children:"number"==typeof t.price?a?`$${t.price.toFixed(2)}`:`(+$${t.price.toLocaleString()} value)`:`(${t.price})`})]},r))})})]})})(),n&&n.length>0&&e.jsxs(j,{children:[e.jsxs(f,{className:"pb-2",children:[e.jsxs(N,{className:"flex items-center gap-2 text-lg font-semibold text-primary",children:[e.jsx(J,{className:"h-5 w-5"}),"Standard Features"]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Base features included with this structure"})]}),e.jsx(v,{children:e.jsx("ul",{className:"space-y-1",children:n.map((s,t)=>e.jsxs("li",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(J,{className:"h-3 w-3 text-green-600 flex-shrink-0"}),e.jsx("span",{children:s})]},t))})})]})]})},ze=({structure:s,finalPrice:t,isDiscounted:r})=>{var a,i,l;const n=(null==(a=s.tags)?void 0:a.includes("refurbished"))||(null==(i=s.style)?void 0:i.includes("refurbished")),o=Fe(s),c=!!o,d=c?o.price:t||s.price,m=c?o.originalPrice:s.originalPrice;c&&o.label;const u=c||r,x=s.basePrice&&s.optionsAmount,h=(null==(l=s.included)?void 0:l.includedOptions)&&Array.isArray(s.included.includedOptions)&&s.included.includedOptions.length>0&&s.included.includedOptions.some(e=>"object"==typeof e&&null!==e&&"number"==typeof e.price);let p=s.basePrice,g=s.optionsAmount;if(h&&!x){const e=s.included.includedOptions.reduce((e,s)=>"object"==typeof s&&null!==s&&"number"==typeof s.price?e+s.price:e,0);p=d-e,g=e}const j=s.availableNow&&!s.soldOut,f=s.soldOut||!s.availableNow,N=u&&!f;return!d||d<=0?null:e.jsxs("div",{className:"space-y-2",children:[j&&!u&&!s.displayModel&&e.jsxs("div",{className:"bg-green-50 border border-green-200 rounded-lg p-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-base font-semibold text-green-800",children:"Complete Ready-to-Deliver Price:"}),e.jsxs("span",{className:"text-2xl font-bold text-green-700",children:["$",d.toLocaleString()]})]}),e.jsxs("p",{className:"text-sm text-green-700 mt-2 font-medium flex items-center gap-2",children:[e.jsx("span",{className:"w-2 h-2 bg-green-500 rounded-full"}),"Available Now - Ready to Ship!"]})]}),s.displayModel&&!u&&e.jsx("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-base font-semibold text-blue-800",children:"Display Model Price:"}),e.jsxs("span",{className:"text-2xl font-bold text-blue-700",children:["$",d.toLocaleString()]})]})}),f&&(x||h)&&!u&&e.jsxs("div",{className:"bg-orange-50 border border-orange-200 rounded-lg p-3 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between text-gray-700",children:[e.jsx("span",{className:"font-semibold",children:"Base Structure:"}),e.jsxs("span",{className:"font-bold",children:["$",p.toLocaleString()]})]}),e.jsxs("div",{className:"flex items-center justify-between text-orange-700",children:[e.jsx("span",{className:"font-semibold",children:"Optional Upgrades Added:"}),e.jsxs("span",{className:"font-bold",children:["+$",g.toLocaleString()]})]}),e.jsxs("div",{className:"border-t border-orange-300 pt-2 flex items-center justify-between",children:[e.jsx("span",{className:"text-lg font-bold text-orange-800",children:"This Build Total:"}),e.jsxs("span",{className:"text-2xl font-bold text-orange-700",children:["$",d.toLocaleString()]})]})]}),f&&!x&&!h&&!u&&e.jsx("div",{className:"bg-amber-50 border border-orange-200 rounded-lg p-3",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-base font-semibold text-orange-800",children:n?"Refurbished Price:":"Custom Order Price:"}),e.jsxs("span",{className:"text-2xl font-bold text-orange-700",children:["$",d.toLocaleString()]})]})}),N&&e.jsxs("div",{className:"bg-rose-50 border border-red-200 rounded-lg p-3 space-y-2",children:[e.jsx("div",{className:"flex items-baseline gap-3 flex-wrap justify-between",children:e.jsxs("div",{className:"flex items-baseline gap-3 flex-wrap",children:[e.jsxs("span",{className:"text-2xl font-bold text-red-600",children:["$",d.toLocaleString()]}),m&&m>d&&e.jsxs("span",{className:"text-lg text-gray-500 line-through",children:["$",m.toLocaleString()]})]})}),m&&m>d&&e.jsx("div",{className:"bg-red-100 border border-red-300 rounded-md p-2",children:e.jsxs("p",{className:"text-sm text-red-800 font-bold text-center",children:["SALE - Save $",(m-d).toLocaleString(),s.discountPercentage&&` (${s.discountPercentage}% Off)`]})}),!c&&s.discountAmount&&s.discountAmount>0&&e.jsx("div",{className:"bg-red-100 border border-red-300 rounded-md p-2",children:e.jsxs("p",{className:"text-sm text-red-800 font-bold text-center",children:["DISCOUNT - Save $",s.discountAmount.toLocaleString()]})})]}),s.rentToOwn&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-gray-600",children:s.rentToOwn}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("a",{href:"https://www.smartpayrentals.com/app/white_pine_structures",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-sm text-primary hover:text-primary/80 font-medium transition-colors",children:["Sign up for rent-to-own",e.jsx(E,{className:"h-3 w-3"})]})}),s.soldOut&&e.jsx("p",{className:"text-sm text-amber-600",children:"*Rent-to-own pricing available for similar structures or custom orders"})]})]})},Be=({structure:s,status:t,onCustomOrderClick:r,isGalleryContext:a=!1})=>{var i,l;const n=(null==(i=s.tags)?void 0:i.includes("refurbished"))||(null==(l=s.style)?void 0:l.includes("refurbished")),o=!0===s.customizable,c=n&&(!s.soldOut||!o);return e.jsx("div",{className:"space-y-3",children:e.jsx("div",{className:"flex items-center gap-3 flex-wrap",children:"sold-out"===t?a?e.jsx("span",{className:"bg-green-100 text-green-800 px-3 py-1 rounded-full text-sm font-medium",children:"✓ Completed Project"}):e.jsx("span",{className:"bg-red-100 text-red-800 px-3 py-1 rounded-full text-sm font-medium",children:c?"REFURBISHED - SOLD":"SOLD OUT"}):"discount"===t?e.jsx(e.Fragment,{children:s.sale?e.jsx("span",{className:"bg-red-100 text-red-800 px-3 py-1 rounded-full text-sm font-medium",children:s.sale.label}):e.jsx("span",{className:"bg-green-100 text-green-800 px-3 py-1 rounded-full text-sm font-medium",children:"ON SALE"})}):s.displayModel?e.jsx("span",{className:"bg-blue-100 text-blue-800 px-3 py-1 rounded-full text-sm font-medium",children:"Display Model - Order Similar Structure"}):s.availableNow?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"bg-green-100 text-green-800 px-3 py-1 rounded-full text-sm font-medium",children:"Available Now"}),e.jsx("div",{className:"bg-amber-100 border border-amber-300 text-amber-800 px-2 py-1 sm:px-3 rounded-full text-xs sm:text-sm font-medium shadow-lg animate-pulse",children:"🔥 High Demand"})]}):e.jsx("span",{className:"bg-yellow-100 text-yellow-800 px-3 py-1 rounded-full text-sm font-medium",children:"Contact for Availability"})})})},Ge=({upgrades:s,description:t,soldOut:r=!1})=>{if(!s||0===s.length)return null;let a,i,l;r?(a="How This Model Was Configured",i=X,l=t||"This model was built with the following optional upgrades. When you order this design, you can choose different options, fewer options, or none at all."):(a="Optional Upgrades Included",i=K,l=t||"This ready-to-deliver structure includes the following optional upgrades. These are already built in and included in the price.");const n=i;return e.jsxs(j,{children:[e.jsxs(f,{className:"pb-2",children:[e.jsxs(N,{className:"flex items-center gap-2 text-lg font-semibold "+(r?"text-muted-foreground":"text-green-600"),children:[e.jsx(n,{className:"h-5 w-5"}),a]}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:l})]}),e.jsx(v,{children:e.jsx("ul",{className:"space-y-3",children:s.map((s,t)=>e.jsxs("li",{className:"flex items-center justify-between p-3 rounded-lg border "+(r?"bg-gray-50 border-gray-200":"bg-green-50 border-green-200"),children:[e.jsx("span",{className:"font-medium text-gray-900",children:s.name}),e.jsx("span",{className:"font-bold "+(r?"text-muted-foreground":"text-green-600"),children:r?`$${s.price.toLocaleString()}`:0===s.price?"Included":`$${s.price.toLocaleString()} Value`})]},t))})})]})},Ie=[{id:"ramp",name:"Entry Ramp",description:"Easy access ramp",priceRange:"From $95",icon:ee},{id:"shelves",name:"Wall Shelves",description:"Built-in storage (2' wide sections)",priceRange:"From $4/sq ft",icon:T},{id:"extra-window",name:"Extra Window",description:"More natural light",priceRange:"From $50",icon:se},{id:"door-upgrade",name:"Door Upgrade",description:"Single door ($150) or double door ($200+)",priceRange:"From $150",icon:te},{id:"custom-colors",name:"Custom Colors",description:"Your color choice",priceRange:"From $75",icon:re},{id:"workbench",name:"Workbench",description:"Built-in work station (3' wide)",priceRange:"From $150",icon:q}],Qe=({soldOut:s,isRefurbished:t,onCustomOrderClick:r})=>{const{openQuickQuote:a}=ae();if(!s||t)return null;return e.jsxs(j,{className:"overflow-hidden border-2 border-primary/20 bg-gradient-to-br from-primary/5 via-primary/3 to-background",children:[e.jsx(f,{className:"pb-4",children:e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("div",{className:"p-2.5 bg-primary/15 rounded-lg",children:e.jsx(ie,{className:"w-6 h-6 text-primary"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"text-xl font-bold text-foreground",children:"Customize This Design"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Build it your way - choose your options"})]})]})}),e.jsxs(v,{className:"space-y-6",children:[e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-3",children:Ie.map(s=>{const t=s.icon;return e.jsx("div",{className:"p-3 bg-card border border-border rounded-lg hover:border-primary/40 hover:bg-primary/5 transition-all group",children:e.jsxs("div",{className:"flex flex-col items-center text-center space-y-2",children:[e.jsx("div",{className:"p-2 bg-primary/10 rounded-full group-hover:bg-primary/20 transition-colors",children:e.jsx(t,{className:"w-4 h-4 text-primary"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold text-foreground leading-tight",children:s.name}),e.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:s.description}),e.jsx("p",{className:"text-[11px] font-medium text-primary mt-1",children:s.priceRange})]})]})},s.id)})}),e.jsx("div",{className:"p-4 bg-gradient-to-r from-accent/20 to-accent/10 border border-accent/30 rounded-lg",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"p-2 bg-accent/20 rounded-lg shrink-0",children:e.jsx(ie,{className:"w-5 h-5 text-accent-foreground"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-foreground text-sm mb-1",children:"Size & Color Options Available"}),e.jsxs("p",{className:"text-xs text-muted-foreground leading-relaxed",children:["We can build this design in ",e.jsx("span",{className:"font-semibold text-foreground",children:"ANY SIZE"})," you need! Choose from hundreds of custom color combinations to match your style."]})]})]})}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs(h,{onClick:()=>{r?r():a()},size:"lg",className:"w-full text-base font-semibold",children:["Get Custom Quote",e.jsx(ie,{className:"ml-2 w-4 h-4"})]}),e.jsx(h,{variant:"outline",size:"lg",className:"w-full",asChild:!0,children:e.jsxs("a",{href:"tel:610-857-3420",children:[e.jsx(D,{className:"mr-2 w-4 h-4"}),"Call for Details: (610) 857-3420"]})})]}),e.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-x-4 gap-y-2 text-xs text-muted-foreground pt-2 border-t border-border/50",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(le,{className:"w-3.5 h-3.5 text-primary"}),e.jsx("span",{children:"Free quotes"})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(le,{className:"w-3.5 h-3.5 text-primary"}),e.jsx("span",{children:"No obligation"})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(le,{className:"w-3.5 h-3.5 text-primary"}),e.jsx("span",{children:"Quick response"})]})]})]})]})},Ve=()=>e.jsx(j,{className:"border-blue-200 bg-blue-50",children:e.jsx(v,{className:"pt-4",children:e.jsxs("div",{className:"text-center space-y-3",children:[e.jsx("h4",{className:"font-semibold text-blue-900",children:"Planning Your Purchase?"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 justify-center",children:[e.jsxs(l,{to:"/site-preparation",className:"inline-flex items-center gap-2 text-blue-700 hover:text-blue-900 font-medium transition-colors",children:[e.jsx(y,{className:"h-4 w-4"}),"Site Preparation Info"]}),e.jsxs(l,{to:"/delivery",className:"inline-flex items-center gap-2 text-blue-700 hover:text-blue-900 font-medium transition-colors",children:[e.jsx(ne,{className:"h-4 w-4"}),"Delivery Information"]})]})]})})}),Ye=()=>e.jsx(j,{className:"border-amber-200 bg-amber-50",children:e.jsx(v,{className:"pt-4",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(oe,{className:"h-5 w-5 text-amber-600 flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"text-sm text-amber-800",children:[e.jsx("p",{className:"font-medium mb-2",children:"Pricing Disclaimer"}),e.jsx("p",{children:"Prices are subject to change without notice due to material cost fluctuations, supplier adjustments, and market conditions. While we strive for accuracy, human errors may occur in pricing calculations. All prices will be confirmed at time of order. Contact us for current pricing and availability."})]})]})})});function He(e,s={}){const t=[];e.dimensions&&t.push(e.dimensions);const r=e.style||e.type;if(r){const s=function(e){if(e.toLowerCase().startsWith("a-frame")){const s=e.split("-");if(s.length>=2){const e="A-Frame",t=s.slice(2).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ");return t?`${e} ${t}`:e}}return e.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}(r);t.push(s);const a=Ze(e);a&&!s.toLowerCase().includes(a.toLowerCase())&&t.push(a)}else{const s=Ze(e);s&&t.push(s)}return t.join(" ")}function Ze(e){if(e.category)return e.category;if(e.title){const s=e.title.match(/\b(Shed|Garage|Workshop|Barn|Cabin|Greenhouse|Playhouse|Pavilion|Run-in|Chicken Coop)\b/i);if(s)return s[1]}return e.type||null}const Je=({structure:s})=>{const[t,r]=n.useState(!1),{status:i,finalPrice:l,isDiscounted:o}=(e=>{const s=e.soldOut?"sold-out":e.sale&&De(e.sale)||e.inDiscountSection||e.originalPrice&&e.originalPrice>0&&(e.discountAmount&&e.discountAmount>0||e.discountPercentage&&e.discountPercentage>0)?"discount":"regular",t=(()=>{if(e.sale&&De(e.sale)&&e.sale.price&&e.sale.price>0)return e.sale.price;if("discount"===s&&e.originalPrice&&e.originalPrice>0){if(e.discountAmount&&e.discountAmount>0)return e.originalPrice-e.discountAmount;if(e.discountPercentage&&e.discountPercentage>0)return e.originalPrice-e.originalPrice*e.discountPercentage/100}return e.price})(),r=e.sale&&De(e.sale)&&e.sale.price&&e.sale.originalPrice&&e.sale.originalPrice>e.sale.price||"discount"===s&&e.originalPrice&&e.originalPrice>0&&t&&t<e.originalPrice;return{status:s,finalPrice:t,isDiscounted:r}})(s),c=ce();a();const d=!0===s.soldOut,m=n.useMemo(()=>He(s),[s]),u=n.useMemo(()=>function(e){return e.itemNumber?`Item #${e.itemNumber}`:""}(s),[s,i]),x=n.useMemo(()=>s.images&&Array.isArray(s.images)&&s.images.length>0?s.images:s.imageSrc&&"string"==typeof s.imageSrc?[s.imageSrc]:["/placeholder.svg"],[s.images,s.imageSrc]),h=(p=s.description||"",d&&p?p.replace(/This sold-out/gi,"This beautifully crafted").replace(/sold-out/gi,"completed").replace(/Though currently unavailable,? ?/gi,"").replace(/this model represents our commitment/gi,"We can custom-build this design for you, demonstrating our commitment").replace(/currently sold out/gi,"available for custom order").replace(/is sold out/gi,"was completed"):p);var p;const g="3169"===s.itemNumber?"Shown with these options":void 0,j=()=>{r(!0)},f=n.useMemo(()=>{var e,t;return(null==(e=s.style)?void 0:e.toLowerCase().includes("refurbished"))||(null==(t=s.tags)?void 0:t.some(e=>e.toLowerCase().includes("refurbished")))},[s.style,s.tags]);return e.jsxs("div",{className:"px-4 pt-0 pb-8",children:[c?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold text-gray-900 mb-2",children:m}),e.jsx("p",{className:"text-base text-gray-600 font-medium",children:u})]}),e.jsx(Ue,{images:x,altText:s.altText||s.title,imageAlts:s.imageAlts,className:"w-full"}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Share This Structure"}),e.jsx(Te,{title:`${s.title} - White Pine Structures`,description:`Check out this ${s.dimensions} ${s.type.toLowerCase()} available at White Pine Structures. ${null==(N=s.description)?void 0:N.substring(0,100)}...`,url:`https://whitepinestructures.com/structure/${s.id}`,imageUrl:s.imageSrc,variant:"outline",showText:!0,itemNumber:s.itemNumber,pageType:"structure",structureType:s.type})]}),e.jsx(ze,{structure:s,finalPrice:l,isDiscounted:o}),e.jsx(Be,{structure:s,status:i,onCustomOrderClick:j,isGalleryContext:d}),e.jsx(Ee,{}),e.jsxs("a",{href:de.phone.href,className:"flex items-center justify-center gap-2 py-3 px-4 bg-green-50 border border-green-200 rounded-lg text-green-800 font-medium hover:bg-green-100 transition-colors",children:[e.jsx(D,{className:"h-5 w-5"}),"Call ",de.phone.display]}),s.colors&&e.jsx($e,{colors:s.colors,title:"Colors",className:"space-y-3"}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Description"}),e.jsx("div",{className:"prose prose-gray max-w-none",children:h.split("\n\n").map((s,t)=>e.jsx("p",{className:"text-gray-700 leading-relaxed mb-4",children:s},t))})]}),e.jsx(We,{included:{standardFeatures:s.standardFeatures||(null==(b=s.included)?void 0:b.standardFeatures),includedOptions:s.includedOptions||(Array.isArray(s.included)?s.included:null==(v=s.included)?void 0:v.includedOptions)},isPremiumFeaturesModel:null==(y=s.optionalUpgradesDescription)?void 0:y.includes("ready-to-deliver"),includedOptionsLabel:g,soldOut:s.soldOut}),e.jsx(Ge,{upgrades:s.optionalUpgrades||[],description:s.optionalUpgradesDescription,soldOut:s.soldOut}),e.jsx(Qe,{soldOut:s.soldOut,isRefurbished:f,onCustomOrderClick:j}),e.jsx(Ve,{}),e.jsx(Ye,{})]}):(()=>{var t,r,a,n;return e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsx(Ue,{images:x,altText:s.altText||s.title,imageAlts:s.imageAlts,className:"w-full"}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Share This Structure"}),e.jsx(Te,{title:`${s.title} - White Pine Structures`,description:`Check out this ${s.dimensions} ${s.type.toLowerCase()} available at White Pine Structures. ${null==(t=s.description)?void 0:t.substring(0,100)}...`,url:`https://whitepinestructures.com/structure/${s.id}`,imageUrl:s.imageSrc,variant:"outline",showText:!0,itemNumber:s.itemNumber,pageType:"structure",structureType:s.type})]}),e.jsx(Ge,{upgrades:s.optionalUpgrades||[],description:s.optionalUpgradesDescription,soldOut:s.soldOut}),e.jsx(Qe,{soldOut:s.soldOut,isRefurbished:f,onCustomOrderClick:j}),e.jsx(We,{included:{standardFeatures:s.standardFeatures||(null==(r=s.included)?void 0:r.standardFeatures),includedOptions:s.includedOptions||(Array.isArray(s.included)?s.included:null==(a=s.included)?void 0:a.includedOptions)},isPremiumFeaturesModel:null==(n=s.optionalUpgradesDescription)?void 0:n.includes("ready-to-deliver"),includedOptionsLabel:g,soldOut:s.soldOut}),e.jsx(Ve,{}),e.jsx(Ye,{})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold text-gray-900 mb-2",children:m}),e.jsx("p",{className:"text-lg text-gray-600 font-medium",children:u})]}),e.jsx(ze,{structure:s,finalPrice:l,isDiscounted:o}),e.jsx(Be,{structure:s,status:i,onCustomOrderClick:j,isGalleryContext:d}),s.colors&&e.jsx($e,{colors:s.colors,title:"Colors",className:"space-y-3"}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Description"}),e.jsx("div",{className:"prose prose-gray max-w-none",children:h.split("\n\n").map((s,t)=>e.jsx("p",{className:"text-gray-700 leading-relaxed mb-4",children:s},t))})]}),e.jsx(Ee,{})]})]})})(),s&&e.jsx(Me,{open:t,onOpenChange:r,structure:s,mode:"quote",sourceButton:"Structure Details"})]});var N,b,v,y};export{Re as P,Je as S,He as g};