1"use strict";(globalThis.__LOADABLE_LOADED_CHUNKS__||=[]).push([[8991],{8519(e,t,r){r.r(t),r.d(t,{default:()=>v});const n="heading_rFlQ9Z";var s=r(4018),a=r(8957),i=r(8952),o=r(5174),c=r(6057),l=r(6568),u=r(6540),d=r(361);class m{constructor(e,t){this.locale=e,this.currency=t}price(e){return null==e?"":((0,d.Kg)(e)&&(e=Number.parseFloat(e)),Number.isNaN(e)?"":e.toLocaleString(this.locale,{style:"currency",currency:this.currency,minimumFractionDigits:0}))}}var f=r(1224),g=r(9785),h=r(2095),p=r(911),x=r(4848);function v(){const e=(0,s.P)(),{backgroundImages:t,magazineOptions:r,topMagazines:d,translations:v,disableMagazineSelection:j,disableTopMagazines:N}=e,b=function(){const{currency:e}=(0,c.IQ)(),t=(0,l.Y)();return(0,u.useMemo)(()=>new m(t,e),[t,e])}(),I=(0,o.rd)(),V=(0,a.L)(i.Ik({text1:i.Yj().optional(),text2:i.Yj().optional(),text3:i.Yj().optional(),text4:i.Yj().optional(),text5:i.Yj().optional(),backgroundImageId:i.Yj(),magazineId:i.Yj().optional()}),{initialValues:()=>function(e,t,r){const n=r.translations,s=e.query.get("code"),a=e.query.get("amount"),i=e.query.get("expiry"),o=[];return a&&o.push(`${n.amountText}: ${t.price(a)}`),i&&o.push(`${n.expiryText}: ${i}`),{text1:n.text1,text2:n.text2,text3:n.text3,text4:s?`${n.codeText}: ${s}`:n.text4,text5:o.length?o.join(" - "):n.text5,backgroundImageId:r.backgroundImages.at(0)?.id}}(I,b,e)}),_=(0,g.FH)({name:"backgroundImageId",control:V.control}),k=(0,u.useMemo)(()=>_?t.find(e=>e.id===_):void 0,[t,_]),E=(0,g.FH)({name:"magazineId",control:V.control}),w=(0,u.useMemo)(()=>E?r.find(e=>e.id===E):void 0,[r,E]);return(0,x.jsxs)("form",{className:"form_cFlSoE",target:"_blank",action:"/api/voucher/create",method:"POST",children:[(0,x.jsx)("h3",{className:n,children:v.chooseBackgroundImage}),(0,x.jsxs)("fieldset",{className:"images_reSdY1",children:[(0,x.jsx)("legend",{className:"sr-only",children:v.chooseBackgroundImage}),(0,x.jsx)("div",{className:"list_Gw_tg0",children:t.map((e,t)=>(0,x.jsx)(y,{value:e,form:V},t))})]}),!j&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)("h3",{className:n,children:v.chooseMagazine}),(0,x.jsx)(p.d,{form:V,name:"magazineId",options:r,getKey:e=>e.id,getOption:e=>e.name,label:v.chooseMagazine,placeholder:v.chooseMagazine,className:"magazine-select_JVK191"})]}),(0,x.jsx)("h3",{className:n,children:v.fillInVoucher}),(0,x.jsxs)("div",{className:"preview_UVwSCL",children:[(0,x.jsx)(h.A,{image:k?.image,className:"background_kEBT2Y"}),(0,x.jsxs)("div",{className:"content_zmFdtZ",children:[(0,x.jsxs)("div",{className:"inputs_pvm387",children:[(0,x.jsx)("input",{type:"text",...V.register("text1")}),(0,x.jsx)("input",{type:"text",...V.register("text2")}),(0,x.jsx)("input",{type:"text",...V.register("text3")}),(0,x.jsx)("input",{type:"text",...V.register("text4")}),(0,x.jsx)("input",{type:"text",...V.register("text5")})]}),w&&(0,x.jsx)(h.A,{image:w.logo,className:"logo_JmeEZE"}),(0,x.jsx)("div",{className:"footer_uueZm3",children:!N&&d.map((e,t)=>(0,x.jsx)(h.A,{image:e,width:200},t))})]})]}),(0,x.jsx)(f.A,{className:"submit_S7iv9U",type:"submit",variant:"contained",size:"large",children:v.createVoucher})]})}function y(e){let{value:t,form:r}=e;const n=(0,u.useId)();return(0,x.jsxs)("div",{className:"image-tile_GyuMCp",children:[(0,x.jsx)("input",{id:n,className:"sr-only",type:"radio",value:t.id,...r.register("backgroundImageId")}),(0,x.jsx)("label",{htmlFor:n,children:(0,x.jsx)(h.A,{image:t.image,width:200})})]})}},8957(e,t,r){r.d(t,{L:()=>u});var n=r(9785),s=r(8952),a=r(6540),i=r(893),o=r(8797);function c(e){if(e instanceof s.l1)return null;if(e instanceof s.Ii&&(e=e.unwrap()),e instanceof s.ND)return"";if(e instanceof s.rS)return 0;if(e instanceof s.WF)return!1;if(e instanceof s.bv){const t={};for(const r in e.shape)t[r]=c(e.shape[r]);return t}if(e instanceof s.k1)return c(e.innerType());throw new Error("Unsupported ZodType: "+typeof e)}function l(e){if(e instanceof s.bv)return e.shape;if(e instanceof s.k1)return l(e.innerType());throw new Error("Invalid zod template type")}function u(e,t){const r=(0,a.useRef)(e),[u]=(0,a.useState)(()=>l(e)),d=(0,a.useMemo)(()=>{const e=(0,o.v)(t?.defaultValues)??{},r={};for(const t in u)r[t]=e[t]||c(u[t]);return r},[]),m=(0,a.useMemo)(()=>({...d,...(0,o.v)(t?.initialValues)??{}}),[d]),f=(0,n.mN)({resolver:(0,i.u)(r.current),defaultValues:m,mode:"all"}),g=(0,a.useCallback)(e=>{const t={required:!0,type:void 0};let r=u[e];return r?(r instanceof s.Ii&&(r=r.unwrap(),t.required=!1),r instanceof s.ND&&!0===r.isEmail&&(t.type="email"),t):t},[]),h=(0,a.useCallback)(()=>
1{if(!t?.resetValues)return void f.reset();const e=f.getValues(),r=(0,o.v)(t.resetValues),n={};for(const t in r)null==r[t]?n[t]=e[t]:n[t]=r[t];f.reset({...d,...n})},[f,t?.resetValues]),p=(0,a.useCallback)(()=>{const e=f.getValues();for(const t in e)u[t]instanceof s.Ii&&(e[t]||(e[t]=void 0));return e},[f]);return{...f,getFieldInfo:g,customReset:h,getFormValue:p}}},893(e,t,r){r.d(t,{u:()=>u});var n=r(9785);const s=(e,t,r)=>{if(e&&"reportValidity"in e){const s=(0,n.Jt)(r,t);e.setCustomValidity(s&&s.message||""),e.reportValidity()}},a=(e,t)=>{for(const r in t.fields){const n=t.fields[r];n&&n.ref&&"reportValidity"in n.ref?s(n.ref,r,e):n&&n.refs&&n.refs.forEach(t=>s(t,r,e))}},i=(e,t)=>{t.shouldUseNativeValidation&&a(e,t);const r={};for(const s in e){const a=(0,n.Jt)(t.fields,s),i=Object.assign(e[s]||{},{ref:a&&a.ref});if(o(t.names||Object.keys(e),s)){const e=Object.assign({},(0,n.Jt)(r,s));(0,n.hZ)(e,"root",i),(0,n.hZ)(r,s,e)}else(0,n.hZ)(r,s,i)}return r},o=(e,t)=>{const r=c(t);return e.some(e=>c(e).match(`^${r}\\.\\d+`))};function c(e){return e.replace(/\]|\[/g,"")}function l(e,t){for(var r={};e.length;){var s=e[0],a=s.code,i=s.message,o=s.path.join(".");if(!r[o])if("unionErrors"in s){var c=s.unionErrors[0].errors[0];r[o]={message:c.message,type:c.code}}else r[o]={message:i,type:a};if("unionErrors"in s&&s.unionErrors.forEach(function(t){return t.errors.forEach(function(t){return e.push(t)})}),t){var l=r[o].types,u=l&&l[s.code];r[o]=(0,n.Gb)(o,t,r,a,u?[].concat(u,s.message):s.message)}e.shift()}return r}function u(e,t,r){return void 0===r&&(r={}),function(n,s,o){try{return Promise.resolve(function(s,i){try{var c=Promise.resolve(e["sync"===r.mode?"parse":"parseAsync"](n,t)).then(function(e){return o.shouldUseNativeValidation&&a({},o),{errors:{},values:r.raw?Object.assign({},n):e}})}catch(e){return i(e)}return c&&c.then?c.then(void 0,i):c}(0,function(e){if(function(e){return Array.isArray(null==e?void 0:e.errors)}(e))return{values:{},errors:i(l(e.errors,!o.shouldUseNativeValidation&&"all"===o.criteriaMode),o)};throw e}))}catch(e){return Promise.reject(e)}}}}}]);
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.