import{a as ne,b as de,c as ue}from"/build/_shared/chunk-MCFZKHEV.js";import{c as h,d as F,e as w,g as se}from"/build/_shared/chunk-5N2KI6RR.js";import{a as le}from"/build/_shared/chunk-ZWPGJA2Y.js";import{a as M}from"/build/_shared/chunk-O4PRSVXB.js";import{a as pe}from"/build/_shared/chunk-7YGP3XXU.js";import{a as ae}from"/build/_shared/chunk-QRHVXRM6.js";import{a as ie}from"/build/_shared/chunk-PLLKVKTC.js";import{a as me}from"/build/_shared/chunk-EQXFMZRB.js";import{c as H,e as $,h as U,k as d,l as D}from"/build/_shared/chunk-RZVE2WC3.js";import{a as re}from"/build/_shared/chunk-KHQROCZC.js";import{f as b}from"/build/_shared/chunk-RIL7IWGV.js";import{e as te}from"/build/_shared/chunk-U4XGW2SA.js";import{a as u}from"/build/_shared/chunk-FCPYQDCY.js";import{i as oe}from"/build/_shared/chunk-FATBC4LL.js";import{b as j}from"/build/_shared/chunk-YF5WQOEQ.js";import{w as ee}from"/build/_shared/chunk-UCFRLLAO.js";import{b as Z,c as X}from"/build/_shared/chunk-RYMETT3Z.js";import{d as J,f as K}from"/build/_shared/chunk-4AM2M5FO.js";import{b as v}from"/build/_shared/chunk-AYFW4EXI.js";import{b as V}from"/build/_shared/chunk-DA2WVNPY.js";import{d as S,h as c}from"/build/_shared/chunk-B2D7FR2X.js";import{r as Y}from"/build/_shared/chunk-RNEZQOJU.js";import{a as R,b as m}from"/build/_shared/chunk-FQ74Y7PU.js";import{b as Se,d as o}from"/build/_shared/chunk-G5WX4PPA.js";var fe=Se((He,ce)=>{ce.exports={}});var qe=o(fe(),1);var Ge=o(R(),1);var L=o(R(),1),T=(0,L.createContext)({product:null,categories:[],productCategory:null}),I=()=>(0,L.useContext)(T);var A=o(R(),1);var _=o(m(),1),be=()=>{let e=K("home"),{$t:r}=c();return(0,_.jsx)(F.Confirm,{children:(0,_.jsx)(w,{size:"large",link:{to:e},children:r("Continue shopping")})})},ge=be;var he=o(R(),1);var G=o(m(),1),we=({product:e})=>{if(!e)return null;let{name:r,defaultImage:t,path:n}=e,y=J(n);return(0,G.jsxs)(Z,{className:"flex space-x-2 md:space-x-4",to:y,children:[(0,G.jsx)("div",{className:"shrink-0 w-15 md:w-48",children:(0,G.jsx)(j,{image:t,responsive:[{size:{width:96},maxWidth:768},{size:{width:192}}],className:"w-full aspect-[3/2] rounded"})}),(0,G.jsx)("span",{title:r,className:"block text-sm md:text-base line-clamp-3",children:r})]})},O=we;var i=o(m(),1),Le=({selectedCategories:e,onCategoriesChange:r,includeOtherProducts:t,onIOProductsChange:n,canSubmitDirectly:y})=>{let{$t:l}=c(),{product:p,categories:k}=I(),{setStep:P,submitting:B}=h(),{validateFields:C}=ne(),q=(0,he.useCallback)(()=>{C(["categories"],()=>{P("Request")})},[P,C]);return(0,i.jsxs)(F.Overview,{children:[p?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{children:[(0,i.jsx)(v,{lv:6,className:"!text-sm mb-2",children:l("Quotation for")}),(0,i.jsx)(O,{product:p}),(0,i.jsx)(re,{data:{"product.image":p.defaultImage?.urlOriginal||"","product.sku":p.sku||"","product.path":p.path||"","product.name":p.name||""}})]}),(0,i.jsx)(d,{name:"includeOtherProducts",label:l("Would you like to include other products in the quotation?"),children:(0,i.jsx)(le,{theme:"primary",name:"includeOtherProducts",value:t,onChange:n,children:(0,i.jsxs)("div",{className:"flex space-x-3",children:[(0,i.jsx)(M,{skipSpacing:!0,value:"No",label:l("No")}),(0,i.jsx)(M,{skipSpacing:!0,value:"Yes",label:l("Yes")})]})})})]}):null,t==="Yes"?(0,i.jsx)(d,{name:"categories",label:l(p?"Which products would you like to add to your quotation?":"For which products would you like a quote?"),required:!0,children:(0,i.jsx)(se,{name:"categories",options:k,value:e,onChange:r})}):null,(0,i.jsx)(w,{loading:B,type:y?"submit":"button",onClick:y?void 0:q,children:l("Go to the next step")})]})},Fe=Le;var Q=o(m(),1),Ie=()=>{let[e,r]=ee(!0),{$t:t}=c();return e?(0,Q.jsx)(d,{name:"comment",label:t("Comment"),children:(0,Q.jsx)(ie,{rows:4,maxLength:500,name:"comment",placeholder:t("Add further comment, question or wish")})}):(0,Q.jsx)(X,{theme:"embededAlt",className:"text-left",onClick:()=>r(!0),children:t("Add further comment, question or wish")})},ye=Ie;var a=o(m(),1),Oe=()=>{let{$t:e}=c();return(0,a.jsxs)("div",{children:[(0,a.jsx)(v,{lv:2,children:e("Your data")}),(0,a.jsxs)("div",{className:"mt-4 space-y-8",children:[(0,a.jsxs)(me.Row,{className:"w-full",colOnMobile:!0,gap:"lg",children:[(0,a.jsx)(d,{name:"firstName",label:e("First name"),required:!0,className:"flex-1",children:(0,a.jsx)(D,{className:"flex-1",name:"firstName",type:"text",placeholder:e("Fill in {fieldName}",{fieldName:e("First name").toLocaleLowerCase()})})}),(0,a.jsx)(d,{name:"lastName",label:e("Last name"),required:!0,className:"flex-1",children:(0,a.jsx)(D,{name:"lastName",type:"text",placeholder:e("Fill in {fieldName}",{fieldName:e("Last name").toLocaleLowerCase()})})})]}),(0,a.jsx)(d,{name:"phoneNumber",label:e("Phone number"),hint:e("Only used to ask you questions about the quote request"),children:(0,a.jsx)(D,{name:"phoneNumber",placeholder:e("Fill in {fieldName}",{fieldName:e("Phone number").toLocaleLowerCase()})})}),(0,a.jsx)(d,{name:"email",label:e("Email address"),required:!0,hint:e("Only used to contact you if we cannot reach you by telephone for your request."),children:(0,a.jsx)(D,{name:"email",type:"email",placeholder:e("Fill in {fieldName}",{fieldName:e("Email address").toLocaleLowerCase()})})}),(0,a.jsx)(d,{name:"city",label:e("City"),required:!0,children:(0,a.jsx)(D,{name:"city",placeholder:e("Fill in {fieldName}",{fieldName:e("City").toLocaleLowerCase()})})})]})]})},xe=Oe;var f=o(m(),1),ve=({categories:e,productEl:r})=>{let{submitting:t}=h();return(0,f.jsx)(F.Request,{children:(0,f.jsx)(ue,{categories:e,header:n=>n===0?r:null,beforeSubmitButtonEl:(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(ye,{}),(0,f.jsx)(xe,{})]}),submitting:t})})};var g=o(m(),1),Qe=()=>{let{categories:e,product:r,productCategory:t}=I(),{step:n,fetcher:y}=h(),{$t:l}=c(),[p=[],k]=H("categories",b),[P="Yes",B]=H("includeOtherProducts",b),C=P==="Yes",{validatorMsg:q,zRequiredStr:N}=pe(),E=(0,A.useMemo)(()=>{let x=[];return C?x=t?[t,...p.filter(z=>z!==t)]:p:x=t?[t]:[],x.map(z=>e.find(Re=>Re.value===z)).filter(S)},[p,C,t,e]),{categoryQuesValidator:W}=de(E),Ne=(0,A.useMemo)(()=>{let x=q.emailInvalid();return U(u.object({["categories"]:C?u.array(u.string(),{required_error:q.required(l("Categories"))}).or(u.string()):u.array(u.string()).or(u.string()).optional(),["firstName"]:N(l("First name")),["lastName"]:N(l("Last name")),["phoneNumber"]:u.ostring(),["email"]:u.string().email(x).min(3,x),["city"]:N(l("City")),["categoryAndQuestions"]:W}))},[l,W,C,q,N]);return(0,g.jsxs)("div",{children:[(0,g.jsxs)($,{id:b,hidden:n==="Confirm",encType:"multipart/form-data",method:"post",fetcher:y,action:"/quote-request",validator:Ne,children:[(0,g.jsx)(Fe,{selectedCategories:C?p:[],onCategoriesChange:k,includeOtherProducts:P,onIOProductsChange:B,canSubmitDirectly:!E.length}),(0,g.jsx)(ae,{}),(0,g.jsx)(ve,{categories:E,productEl:t?(0,g.jsx)(O,{product:r}):null})]}),(0,g.jsx)(ge,{})]})},De=Qe;var s=o(m(),1),ke=({page:e})=>{let{step:r}=h(),{title:t,description:n}=(0,Ge.useMemo)(()=>{switch(r){case"Confirm":return{title:e.confirmTitle,description:e.confirmDescription};default:return{title:e.title,description:e.description}}},[e.confirmDescription,e.confirmTitle,e.description,e.title,r]);return(0,s.jsxs)("div",{children:[(0,s.jsx)(v,{lv:1,children:t}),n&&(0,s.jsx)(oe,{noneParagraphGap:!0,content:n,className:"mt-2 sm:mt-6"})]})},Pe=()=>{let{page:e,product:r,categories:t,productCategory:n}=Y();return(0,s.jsx)(F,{children:(0,s.jsx)("div",{className:"pb-20",children:(0,s.jsxs)("div",{className:"container flex flex-col sm:flex-row sm:justify-between sm:gap-x-4 pb-10",children:[(0,s.jsx)("div",{className:"flex-1 sm:max-w-[608px]",children:(0,s.jsx)("div",{className:"flex flex-col space-y-6 md:space-y-11",children:(0,s.jsxs)(T.Provider,{value:{product:r,categories:t,productCategory:n},children:[(0,s.jsx)(ke,{page:e}),(0,s.jsx)(De,{})]})})}),(0,s.jsx)("aside",{className:"lg:w-[480px] mt-10 sm:mt-0",children:(0,s.jsx)("div",{className:"sm:sticky sm:top-20",children:(0,s.jsx)(te,{contentBlocks:e.sidebarBlocksCollection?.items||[],renderMode:"sidebar",payloads:{usps:{className:"!mt-6 md:!mt-12"}}})})})]})})})};var ze={breadcrumbs:(e,{locale:r})=>[e.product?{name:e.product.name,path:e.product.path}:null,{name:e.seo.title,path:V("quoteRequest",r)}].filter(S)};export{Pe as a,ze as b};
