import{aw as p,j as e,ax as n,dh as y,h as x,i as f,am as g,h2 as j,aA as t,h3 as l,dg as r,G as b,az as F,aS as E,a3 as v}from"./app-BgLa5dit.js";import{F as T}from"./w68yffRy.chunk.js";const k=[{key:"topLeft",label:"Top Left"},{key:"topRight",label:"Top Right"},{key:"bottomLeft",label:"Bottom Left"},{key:"bottomRight",label:"Bottom Right"}];function w(){var o,i,s,c;const a=p();return e.jsxs(e.Fragment,{children:[e.jsx(n,{label:"Primary colour",name:"data.colours.primary",id:"data.colours.primary",value:(i=(o=a.values.data)==null?void 0:o.colours)==null?void 0:i.primary,placeholder:"Enter the primary colour for this theme"}),e.jsx(n,{label:"Secondary colour",name:"data.colours.secondary",id:"data.colours.secondary",value:(c=(s=a.values.data)==null?void 0:s.colours)==null?void 0:c.secondary,placeholder:"Enter the secondary colour for this theme"}),e.jsx("div",{className:"form-group",children:k.map(m=>{const d=`data.images.${m.key}`;return e.jsx(y,{label:m.label,imageType:g.HeroBanners,fieldName:d,uploadAppLink:{application:f.THEMES,action:x.Videos.UPLOAD_IMAGE},setSelectedImage:u=>{a.setFieldValue(d,{fileId:u.id,url:u.url,fileIdType:j.ImageAPIv2})}},m.key)})})]})}const h=/^#(?:[0-9a-fA-F]{3}){1,2}$/,I=t.object().shape({topLeft:r,topRight:r,bottomLeft:r,bottomRight:r}).default({}).noUnknown(),S=t.object().shape({primary:t.string().required("Primary colour is required").matches(h,"Colour must be a valid hex code. Example: #F5F4FF").trim().default(""),secondary:t.string().required("Secondary colour is required").matches(h,"Colour must be a valid hex code. Example: #F5F4FF").trim().default("")}),A=t.object().shape({name:t.string().trim().max(255,"Name is too long").required("Name is required").default(""),type:t.mixed().required("Type is required"),data:t.mixed().when("type",{is:l.Glance,then:t.object().shape({images:I,colours:S}).noUnknown(),otherwise:t.mixed().strip(!0)}).default({})}).noUnknown();function N(a){switch(a){case l.Glance:return w;default:return}}function q(a){const o=p(),i=N(o.values.type);return e.jsxs(F,{children:[e.jsx(n,{label:"Name",name:"name",id:"name",value:o.values.name,placeholder:"Enter a name for this theme",autoFocus:!0}),e.jsxs(n,{as:"select",label:"Type",name:"type",id:"type",value:o.values.type,children:[e.jsx("option",{value:null,children:"Select a type..."}),E.getEnumKeys(l).map(s=>e.jsx("option",{value:l[s],children:s},s))]}),!!i&&e.jsx(i,{}),e.jsxs("div",{className:"d-flex justify-content-between align-items-center",children:[e.jsx(T,{isNew:a.isNew}),!!a.actions&&e.jsx(v,{actions:a.actions})]})]})}function C(a){var o;return e.jsx(b,{initialValues:a.theme,validationSchema:A,onSubmit:a.saveTheme,children:e.jsx(q,{isNew:!((o=a.theme)!=null&&o.id),actions:a.actions})})}export{C as E};
//# sourceMappingURL=BNklC_3n.chunk.js.map
