const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/RunInShedPriceListPDF-B7kMjvsV.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","assets/SingleSlopeGreenhousePriceListPDF-By4Yob6W.js"])))=>i.map(i=>d[i]);
import{j as e}from"./ui-vendor-CJlQk0Tq.js";import{B as s,F as i,ar as a,E as r,H as t,am as n,b3 as l,g as c,h as d,i as o,j as m,ah as x,a9 as h,C as p,b as j,c as g,d as u,fa as P}from"./index-BzXujQ-F.js";import{T as y,a as b,b as N,c as f,d as w,e as v}from"./table-CY8755fw.js";import{M as S}from"./ModelPriceListButton-0Y-lLuDr.js";import"./jspdf.es.min-CnLoolOT.js";import"./jspdf.plugin.autotable-Dge4SOWT.js";import{_ as D}from"./supabase-zQsF3e6k.js";import{D as F,a as L,b as G,c as R}from"./dropdown-menu-sYWqzZq1.js";import{u as _,P as I}from"./PDFPreviewDialog-BkLcrMgQ.js";import{r as C}from"./react-vendor-f6QdChhz.js";import{i as z,V as $,c as E}from"./vinylPromoConfig-fv0OTRZ0.js";const T=({pricingData:c,variant:d="outline",size:o="default",className:m=""})=>{const x=_();return e.jsxs(e.Fragment,{children:[e.jsxs(F,{children:[e.jsx(L,{asChild:!0,children:e.jsx(s,{variant:d,size:o,className:m,disabled:x.isGenerating,children:x.isGenerating?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"animate-spin mr-2 h-4 w-4 border-2 border-current border-t-transparent rounded-full"}),"Generating..."]}):e.jsxs(e.Fragment,{children:[e.jsx(i,{className:"h-4 w-4 mr-2"}),"Price List",e.jsx(a,{className:"ml-2 h-4 w-4"})]})})}),e.jsxs(G,{align:"end",className:"w-48",children:[e.jsxs(R,{onClick:async()=>{try{const{RunInShedPriceListPDFGenerator:e}=await D(async()=>{const{RunInShedPriceListPDFGenerator:e}=await import("./RunInShedPriceListPDF-B7kMjvsV.js");return{RunInShedPriceListPDFGenerator:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8])),s=new e({pricingData:c});await x.openPreview(s,"run-in-shed-price-list.pdf"),l({title:"Success",description:"PDF preview generated successfully"})}catch(e){l({title:"Error",description:"Failed to generate PDF preview",variant:"destructive"})}},disabled:x.isGenerating,children:[e.jsx(r,{className:"h-4 w-4 mr-2"}),"Preview"]}),e.jsxs(R,{onClick:async()=>{try{const{RunInShedPriceListPDFGenerator:e}=await D(async()=>{const{RunInShedPriceListPDFGenerator:e}=await import("./RunInShedPriceListPDF-B7kMjvsV.js");return{RunInShedPriceListPDFGenerator:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8]));new e({pricingData:c}).download(),l({title:"Success",description:"Run-In Shed price list downloaded successfully"})}catch(e){l({title:"Error",description:"Failed to download price list",variant:"destructive"})}},disabled:x.isGenerating,children:[e.jsx(t,{className:"h-4 w-4 mr-2"}),"Download"]}),e.jsxs(R,{onClick:async()=>{try{const{RunInShedPriceListPDFGenerator:e}=await D(async()=>{const{RunInShedPriceListPDFGenerator:e}=await import("./RunInShedPriceListPDF-B7kMjvsV.js");return{RunInShedPriceListPDFGenerator:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8]));new e({pricingData:c}).print(),l({title:"Success",description:"Opening print dialog..."})}catch(e){l({title:"Error",description:"Failed to open print dialog",variant:"destructive"})}},disabled:x.isGenerating,children:[e.jsx(n,{className:"h-4 w-4 mr-2"}),"Print"]})]})]}),e.jsx(I,{open:x.isOpen,onOpenChange:x.closePreview,pdfBlob:x.pdfBlob,isGenerating:x.isGenerating,filename:x.filename,onDownload:x.handleDownload,onPrint:x.handlePrint})]})},B=({pricingData:a,porchPricingData:r,variant:l="outline",size:h="default",className:p=""})=>{const[j,g]=C.useState(!1),[u,P]=C.useState(null),y=async()=>{try{const{SingleSlopeGreenhousePriceListPDFGenerator:e}=await D(async()=>{const{SingleSlopeGreenhousePriceListPDFGenerator:e}=await import("./SingleSlopeGreenhousePriceListPDF-By4Yob6W.js");return{SingleSlopeGreenhousePriceListPDFGenerator:e}},__vite__mapDeps([9,1,2,3,4,5,6,7,8]));return new e({pricingData:a,porchPricingData:r})}catch(e){return x.error("Failed to generate price list PDF"),null}};return e.jsxs(e.Fragment,{children:[e.jsxs(F,{children:[e.jsx(L,{asChild:!0,children:e.jsxs(s,{variant:l,size:h,className:p,children:[e.jsx(i,{className:"mr-2 h-4 w-4"}),"Price List PDF"]})}),e.jsxs(G,{align:"end",children:[e.jsxs(R,{onClick:async()=>{const e=await y();if(e){const s=e.getBlob(),i=URL.createObjectURL(s);P(i),g(!0)}},children:[e.jsx(i,{className:"mr-2 h-4 w-4"}),"Preview PDF"]}),e.jsxs(R,{onClick:async()=>{const e=await y();e&&(e.download(),x.success("Price list downloaded successfully"))},children:[e.jsx(t,{className:"mr-2 h-4 w-4"}),"Download PDF"]}),e.jsxs(R,{onClick:async()=>{const e=await y();e&&(e.print(),x.success("Opening print dialog..."))},children:[e.jsx(n,{className:"mr-2 h-4 w-4"}),"Print PDF"]})]})]}),e.jsx(c,{open:j,onOpenChange:()=>{u&&(URL.revokeObjectURL(u),P(null)),g(!1)},children:e.jsxs(d,{className:"max-w-4xl h-[90vh]",children:[e.jsx(o,{children:e.jsx(m,{children:"Single Slope Greenhouse Price List Preview"})}),e.jsx("div",{className:"flex-1 w-full h-full",children:u&&e.jsx("iframe",{src:u,className:"w-full h-full border-0",title:"PDF Preview"})})]})})]})},O=({title:s,description:i,pricingData:a,standardFeatures:r=[],woodSidingText:t="½ Inch LP SmartSide Panel with Smartguard",vinylSidingText:n="Vinyl Siding over ½ Inch Sheathing",hideVinylSiding:l=!1,customWoodLabel:c,customVinylLabel:d,equalColumnWidths:o=!1,secondarySidingText:m,secondarySidingLabel:x="Cedar Board & Batten",useBothWoodTypes:D=!1,hideWoodSidingDescription:F=!1,hideVinylSidingDescription:L=!1,rowNotes:G,porchPricingData:R,customPriceListButton:_})=>{const I=h(),C=!l&&!D,O=D,V=o?"w-1/2":"",k=r&&r.length>0,W=z()&&C;return e.jsxs(p,{className:"border-primary/20 shadow-sm mb-6",children:[e.jsx(j,{className:"bg-primary/10 border-b border-primary/20",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(g,{className:"text-2xl font-bold text-primary-dark",children:[s," Pricing"]}),_||("Single Slope Greenhouse"===s?e.jsx(B,{pricingData:a,porchPricingData:R||[],variant:"outline",size:"sm"}):"Run-In Shed"===s?e.jsx(T,{pricingData:a,variant:"outline",size:"sm"}):e.jsx(S,{modelName:s,pricingData:{title:s,description:i,woodSidingText:t,vinylSidingText:n,pricingData:a},variant:"outline",size:"sm"}))]})}),e.jsxs(u,{className:"p-6",children:[e.jsxs("div",{className:"mb-4 text-center",children:[e.jsx("p",{className:"text-gray-700",children:i}),!F&&e.jsxs("p",{className:"text-gray-700 mt-2",children:[e.jsx("span",{className:"font-semibold",children:"Wood Siding:"})," ",t]}),C&&!L&&e.jsxs("p",{className:"text-gray-700 mt-1",children:[e.jsx("span",{className:"font-semibold",children:"Vinyl Siding:"})," ",n]}),O&&m&&e.jsxs("p",{className:"text-gray-700 mt-1",children:[e.jsxs("span",{className:"font-semibold",children:[x,":"]})," ",m]})]}),I?e.jsx("div",{className:"space-y-3",children:a.map((s,i)=>e.jsxs("div",{className:"bg-white border border-gray-200 rounded-lg p-4 shadow-sm",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("span",{className:"text-lg font-bold text-primary",children:s.size}),G&&G[s.size]&&e.jsx("span",{className:"text-xs text-blue-600 bg-blue-50 px-2 py-1 rounded",children:"※ Stalls available"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between items-center py-2 border-b border-gray-100",children:[e.jsx("span",{className:"text-sm text-gray-600",children:c||"Wood LP SmartSide"}),e.jsxs("span",{className:"text-base font-semibold text-gray-900",children:["$",P(s.woodPrice)]})]}),C&&s.vinylPrice&&e.jsxs("div",{className:"flex justify-between items-center py-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm text-gray-600",children:d||"Vinyl Siding"}),W&&e.jsx("span",{className:"text-xs bg-gradient-to-r from-blue-500 to-purple-600 text-white px-1.5 py-0.5 rounded font-medium",children:$.badgeText})]}),W?e.jsxs("div",{className:"text-right",children:[e.jsxs("span",{className:"text-sm text-gray-400 line-through",children:["$",P(s.vinylPrice)]}),e.jsxs("span",{className:"text-base font-semibold text-green-600 ml-2",children:["$",P(E(s.vinylPrice).salePrice)]})]}):e.jsxs("span",{className:"text-base font-semibold text-gray-900",children:["$",P(s.vinylPrice)]})]}),O&&s.vinylPrice&&e.jsxs("div",{className:"flex justify-between items-center py-2",children:[e.jsx("span",{className:"text-sm text-gray-600",children:x}),e.jsxs("span",{className:"text-base font-semibold text-gray-900",children:["$",P(s.vinylPrice)]})]})]})]},i))}):e.jsx("div",{className:"overflow-x-auto rounded-lg border border-gray-200",children:e.jsxs(y,{children:[e.jsx(b,{children:e.jsxs(N,{className:"bg-gray-100",children:[e.jsx(f,{className:`font-semibold text-center ${V}`,children:"Structure Size"}),e.jsx(f,{className:`font-semibold text-center ${V}`,children:c||"Wood LP SmartSide Price"}),C&&e.jsx(f,{className:"font-semibold text-center",children:e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[d||"Vinyl Siding Price",W&&e.jsx("span",{className:"bg-gradient-to-r from-blue-500 to-purple-600 text-white text-xs px-1.5 py-0.5 rounded font-medium",children:$.badgeText})]})}),O&&e.jsx(f,{className:"font-semibold text-center",children:x||"Cedar Board & Batten"})]})}),e.jsx(w,{children:a.map((s,i)=>e.jsxs(N,{className:i%2==0?"bg-white hover:bg-gray-50":"bg-gray-50 hover:bg-gray-100",children:[e.jsxs(v,{className:`font-medium text-center ${V}`,children:[s.size,G&&G[s.size]&&e.jsx("span",{className:"ml-1 text-blue-600",title:G[s.size],children:"※"})]}),e.jsxs(v,{className:`text-center ${V}`,children:["$",P(s.woodPrice)]}),C&&s.vinylPrice&&e.jsx(v,{className:"text-center",children:W?e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsxs("span",{className:"text-sm text-gray-400 line-through",children:["$",P(s.vinylPrice)]}),e.jsxs("span",{className:"text-green-600 font-semibold",children:["$",P(E(s.vinylPrice).salePrice)]})]}):e.jsxs(e.Fragment,{children:["$",P(s.vinylPrice)]})}),O&&s.vinylPrice&&e.jsxs(v,{className:"text-center",children:["$",P(s.vinylPrice)]})]},i))})]})}),G&&Object.keys(G).length>0&&e.jsxs("div",{className:"mt-4 text-sm text-gray-600 border-t pt-3",children:[e.jsx("p",{className:"font-medium text-gray-700 mb-1",children:"Sizing Notes:"}),e.jsx("p",{className:"text-gray-600",children:"※ Sizes 20' and longer can be divided into stalls (typically 10-12' per stall). See configuration options above for details."})]}),k&&e.jsxs("div",{className:"mt-6",children:[e.jsx("h4",{className:"text-lg font-semibold text-primary-dark mb-2 text-center",children:"Standard Features:"}),e.jsx("ul",{className:"list-disc pl-5 space-y-1",children:r.map((s,i)=>e.jsx("li",{className:"text-gray-700",children:s},i))})]})]})]})};export{O as S};