1import{d as i,j as e}from"./index-DG18vOvd.js";import{M}from"./MainLayout-DYthnANx.js";import{I,P as W,M as z,B as _,c as P}from"./InputComponent-ChxBcwn4.js";import{B as A}from"./Button-B0W-Zvui.js";import{s as D,a as O}from"./shareFormBg2-BtF4Vxog.js";import"./main-BeyqQwT-.js";import"./SEO-Y814nAdi.js";function Y(t){var L,k,B,S,C;const[m,b]=i.useState({}),[c,d]=i.useState({type:"",message:""}),[F,g]=i.useState(D),u=i.useRef(),p=((L=t==null?void 0:t.locale)==null?void 0:L.current)||"ar",w=p=="ar";i.useEffect(()=>{const r=()=>{window.innerWidth>=768?g(O):g(D)};return r(),window.addEventListener("resize",r),()=>window.removeEventListener("resize",r)},[]);const l=(t==null?void 0:t.page.content).match(/\[form\s+id="(\d+)"(?:\s+start_date="([\d-:\s]+)")?(?:\s+end_date="([\d-:\s]+)")?\]/i);let j=3,x=null,h=null;l&&(j=l[1],x=l[2]?new Date(l[2].replace(" ","T")):null,h=l[3]?new Date(l[3].replace(" ","T")):null);const y=new Date;let f=!0;x&&y<x&&(f=!1),h&&y>h&&(f=!1);const q={"& .MuiBackdrop-root":{backgroundColor:"rgba(0, 0, 0, 0.7)"}},R={position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"90%",maxWidth:"500px",bgcolor:"white",borderRadius:"none",boxShadow:"0 25px 50px -12px rgba(0, 0, 0, 0.25)",outline:"none",p:{xs:3,sm:4},alignItems:"center",display:"flex",flexDirection:"column"},N={en:{pageTitle:"Cheer With Us",formDescription:"Please fill out the form, and we will be happy to get in touch with you",fullNameLabel:"Full Name",phoneNumberLabel:"Mobile Number",submitButton:"Submit",closeButton:"Close",success:"Your Request has successfully been submitted",error:"An error occured whe subitting the request",expiredForm:"Sorry the form is not available"},ar:{pageTitle:"شجع Ù
Ø¹ÙØ§",formDescription:"ÙØ±Ø¬Ù Ù
ÙØ¡ اÙÙÙ
ÙØ°Ø¬Ø ÙÙØ³Ø¹Ø¯Ùا Ø§ÙØªÙاص٠Ù
عÙÙ
",fullNameLabel:"Ø§ÙØ§Ø³Ù
اÙÙØ§Ù
Ù",phoneNumberLabel:"رÙÙ
Ø§ÙØ¬ÙاÙ",submitButton:"إرساÙ",closeButton:"Ø¥ØºÙØ§Ù",success:"تÙ
إرسا٠اÙÙÙ
ÙØ°Ø¬ Ø¨ÙØ¬Ø§Ø",error:"ØØ¯Ø« خطأ Ø£Ø«ÙØ§Ø¡ Ø¥Ø±Ø³Ø§Ù Ø§ÙØ·Ùب",expiredForm:"عذرا اÙÙÙ
ÙØ°Ø¬ ØºÙØ± Ù
تÙÙØ±"}},s=N[p]||N.ar,v=r=>{const{name:n,value:a,countryCode:o}=r.target;b(E=>({...E,[n]:a,...o&&{countryCode:o}}))},T=async r=>{if(r.preventDefault(),u.current&&!u.current.validate())return;const n=new FormData;n.append("form_id",j),Object.entries(m).forEach(([a,o])=>{o instanceof File?n.append(`submitted_fields[${a}]`,o):n.append(`submitted_fields[${a}]`,o)});try{const a=await P("POST","/form-submissions",n);d({type:"success",message:s.success}),b({})}catch(a){console.error("Error submitting form:",a),d({type:"error",message:s.error})}};return e.jsxs("div",{className:"flex-1 -my-6",children:[e.jsxs("div",{className:"relative z-10 flex items-center justify-center min-h-[calc(100vh-100px)] py-16 px-4 lg:px-8",style:{backgroundImage:`url(${F})`,backgroundSize:"cover",backgroundPosition:"top",backgroundRepeat:"no-repeat"},children:[e.jsx("div",{className:"absolute inset-0 bg-black/30 z-0"}),e.jsx("div",{className:"max-w-4xl mx-auto w-full relative z-10",children:e.jsx("div",{className:"p-6 sm:p-8 lg:p-12 shadow-2xl rounded-lg border-b-8",style:{backgroundColor:"rgba(255,255,255,0.75)",borderImage:"linear-gradient(to right, var(--color-qad-red) 50%, var(--color-qad-yellow) 50%) 1"},children:f?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("h1",{className:"text-3xl lg:text-4xl font-bold text-gray-800 mb-4",children:((k=t==null?void 0:t.page)==null?void 0:k.title)||s.pageTitle}),e.jsx("p",{className:"text-lg text-gray-600",children:((S=(B=t==null?void 0:t.fields)==null?void 0:B.form)==null?void 0:S.title)||s.formDescription})]}),e.jsxs("form",{onSubmit:T,className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsx(I,{label:s.fullNameLabel,name:"fullName",value:m.fullName,type:"text",required:!0,onChange:v,isRTL:w,className:"w-full"}),e.jsx(W,{ref:u,label:s.phoneNumberLabel,name:"phoneNumber",value:m.phoneNumber,onChange:v,required:!0,isRTL:w})]}),e.jsx("div",{className:"flex justify-center pt-6",children:e.jsx("button",{type:"submit",className:"sm:px-10 px-8 sm:py-4 py-2 rounded-[8px] sm:text-[22px] text-[24px] w-full md:w-fit shadow-xl transition-all duration-300 transform focus:outline-none focus:ring-4 focus:ring-qad-yellow/50 bg-gradient-to-b from-[#b00f0f] to-[#ff1e0e] text-qad-yellow hover:scale-105 hover:shadow-lg cursor-pointer",children:s.submitButton})})]})]}):e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("h1",{className:"text-3xl lg:text-4xl font-bold text-gray-800 mb
1-4",children:((C=t==null?void 0:t.page)==null?void 0:C.title)||s.pageTitle}),e.jsx("p",{className:"text-lg text-gray-600",children:s.expiredForm})]})})})]}),c.message&&e.jsx(z,{open:!!c.message,onClose:()=>d({type:"",message:""}),"aria-labelledby":"form-response-modal-title","aria-describedby":"form-response-modal-description",sx:q,children:e.jsxs(_,{sx:R,children:[c.type==="success"?e.jsx("div",{className:"w-20 h-20 bg-qad-yellow rounded-full flex items-center justify-center mb-[25px]",children:e.jsx("svg",{className:"w-17 h-17 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:3,d:"M5 13l4 4L19 7"})})}):e.jsx("div",{className:"w-20 h-20 bg-qad-red rounded-full flex items-center justify-center mb-[25px]",children:e.jsxs("svg",{className:"w-17 h-17 text-white ",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[e.jsx("path",{d:"M18 6 6 18",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:3}),e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:3,d:"m6 6 12 12"})]})}),e.jsx("p",{className:"text-lg md:text-xl text-black mb-4",children:c.message}),e.jsx(A,{variant:"contained",onClick:()=>d({type:"",message:""}),className:"bg-qad-yellow hover:bg-qad-red text-black hover:text-white",children:s.closeButton})]})})]})}Y.layout=t=>e.jsx(M,{children:t});export{Y as default};
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.