1import{_ as ae}from"./uNecWPRX.js";import{x as oe,e as re,y as ne,z as se,u as le,f as ie,c as s,a as t,t as f,l as p,n as O,A as N,B as de,p as b,q as w,C as P,d as M,k as ue,F as U,b as ce,w as me,D as pe,r as d,j as _,s as ve,i as fe,o as l,E as G}from"./CsyhkCrC.js";const be={class:"max-w-md mx-auto mt-12 bg-white p-8 rounded-lg shadow-sm border border-cardBorder"},ye={class:"text-2xl font-bold text-center text-textDark mb-6"},xe={key:0},ge={key:1},he={key:2},ke={key:3},we={key:0,class:"mb-4 p-3 bg-errorLight text-error rounded-md text-sm"},_e={key:1,class:"mb-4 p-3 bg-blue-50 text-blue-700 rounded-md text-sm border border-blue-200"},ze={key:2,class:"flex mb-6 bg-gray-100 rounded-lg p-1"},Se={class:"flex"},De={key:0},Te={key:1,class:"space-y-4 my-6 px-1"},Be={class:"text-center"},Ce={class:"flex items-start gap-3"},Me={for:"membership_consent_step1",class:"text-xs text-textLight leading-tight cursor-pointer select-none"},$e={class:"flex items-start gap-3"},Le={for:"commercial_consent_step1",class:"text-xs text-textLight leading-tight cursor-pointer select-none"},Ve={class:"flex justify-center my-4 scale-90 sm:scale-100 origin-center min-h-[78px]"},Xe=["data-sitekey"],Ae=["disabled"],Ke={key:0,class:"mb-4 p-3 bg-blue-50 text-blue-700 rounded-md text-sm border border-blue-200"},Re={class:"text-sm text-textLight text-center mb-4"},Ee=["disabled"],Oe={key:5,class:"mt-6 pt-5 border-t border-cardBorder text-right"},Ne={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center p-4 bg-black/60 backdrop-blur-sm"},Pe={class:"bg-white w-full max-w-2xl rounded-2xl shadow-2xl overflow-hidden flex flex-col max-h-[85vh] animate-in fade-in zoom-in duration-300"},Ue={class:"p-6 border-b border-cardBorder flex justify-between items-center bg-gray-50"},Ge={class:"text-lg font-bold text-textDark"},qe={class:"p-6 overflow-y-auto flex-1"},je={key:0,class:"flex flex-col items-center justify-center py-20 gap-4"},He={key:1,class:"prose prose-sm max-w-none text-gray-600 space-y-4"},Fe=["innerHTML"],Ie={class:"p-4 bg-gray-50 border-t border-cardBorder flex justify-end"},Ze={__name:"giris",setup(Ye){const y=d(""),x=d(""),z=d(""),$=d(null),h=d(""),S=d(""),g=d(""),u=d({combined:!1,membership:!1,open_consent:!1,commercial_communication:!1}),n=d(!1),m=d(!1),c=d(!1),i=d(""),v=d(""),D=d(!1),V=d(""),k=d(""),L=d(!1),q=fe(),T=oe(),j=re();ne();const X=pe().public.recaptchaSiteKey,H=ve(()=>m.value?!1:(Array.isArray(T.query.redirect)?T.query.redirect[0]:T.query.redirect)==="/odeme"),F=a=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(a),A=a=>a.replace(/\D/g,""),I=a=>{const e=a.replace(/\D/g,"");return e.length===0?"":e.length<=3?`(${e}`:e.length<=6?`(${e.slice(0,3)}) ${e.slice(3)}`:e.length<=8?`(${e.slice(0,3)}) ${e.slice(3,6)} ${e.slice(6)}`:`(${e.slice(0,3)}) ${e.slice(3,6)} ${e.slice(6,8)} ${e.slice(8,10)}`},Y=a=>{const e=I(a.target.value);y.value=e},W=a=>{const e=a.replace(/\D/g,"");return e.length===10&&e.startsWith("5")},K=a=>{n.value=a==="register",i.value="",z.value="",v.value="",h.value="",S.value="",g.value="",typeof window<"u"&&window.grecaptcha&&window.grecaptcha.reset(),u.value.combined=!1,u.value.membership=!1,u.value.open_consent=!1,u.value.commercial_communication=!1},R=()=>{if(typeof window<"u"&&window.grecaptcha&&window.grecaptcha.render){const a=document.getElementById("recaptcha-main");a&&a.innerHTML===""&&window.grecaptcha.render("recaptcha-main",{sitekey:X,callback:window.onRecaptchaSuccess,"expired-callback":window.onRecaptchaExpired})}};se(m,a=>{a?G(()=>{window.scrollTo({top:0,behavior:"smooth"}),setTimeout(()=>{$.value&&$.value.focus()},50)}):G(()=>{setTimeout(R,300)})}),le({script:[{src:"https://www.google.com/recaptcha/api.js?render=explicit",async:!0,defer:!0}]}),ie(()=>{window.onRecaptchaSuccess=a=>{g.value=a},window.onRecaptchaExpired=()=>{g.value=""},setTimeout(R,1e3)});const B=async a=>{D.value=!0,L.value=!0,k.value="";const e={kvkk:"KVKK Aydınlatma Metni",membership:"Ãyelik SözleÅmesi","open-consent":"Açık Rıza Metni","commercial-communication":"Ticari İletiÅim İzni Metni"};V.value=e[a]||"SözleÅme";try{const r=await _(`/contracts/template/${a}`);r&&r.success&&r.data?k.value=r.data.content:k.value="İçerik yüklenemedi."}catch(r){k.value="Hata oluÅtu: "+(r.message||"İçerik yüklenemedi.")}finally{L.value=!1}},J=async()=>{c.value=!0,i.value="";try{const a=A(y.value);if(!W(a)){i.value="Lütfen geçerli bir telefon numarası girin. (5XX) XXX XX XX",c.value=!1;return}if(n.value&&x.value&&!F(x.value)){i.value="Lütfen geçerli bir e-posta adresi girin.",c.value=!1;return}if(n.value){if(!u.value.combined){i.value="Lütfen sözleÅmeleri kabul edin.",c.value=!1;return}if(!g.value){i.value="Lütfen robot olmadıÄınızı doÄrulayın.",c.value=!1;return}const e=await _("/auth/sms/send-register-code",{method:"POST",body:{phone:a,captcha_token:g.value}});e&&e.success?m.value=!0:e?.message?.includes?.("zaten kayıtlı")?(i.value="Bu numara ile zaten kayıtlı bir hesap var. GiriÅ yapabilirsiniz.",n.value=!1):i.value=e?.message||"Kod gönderilemedi."}else{const e=await _("/auth/sms/send-code",{method:"POST",body:{phone:a}});if(e&&e.success)m.value=!0;else{const r=e?.message||"";e?.status===404||r.includes("bulunamadı")||r.includes("USER_NOT_FOUND")?(n.value=!0,i.value="",v.value="Bu numara ile kayıtlı hesap bulunamadı. Lütfen sözleÅmeleri onaylayarak kayıt olun."):i.value=r||"Kod gönderilemedi."}}}catch(a){const r=(a?.data||a?.response?._data||{})?.message||a?.message||"";
1!n.value&&(a?.statusCode===404||a?.status===404||r.includes("bulunamadı")||r.includes("USER_NOT_FOUND"))?(n.value=!0,i.value="",v.value="Bu numara ile kayıtlı hesap bulunamadı. Lütfen sözleÅmeleri onaylayarak kayıt olun."):i.value=r||"Bir hata oluÅtu."}finally{c.value=!1}},Q=async()=>{c.value=!0,i.value="";try{const a=A(y.value);let e="/auth/sms/verify-code",r={phone:a,verification_code:z.value};n.value&&(e="/auth/sms/verify-register-code",r={...r,name:h.value,surname:S.value,accepted_contracts:{membership:u.value.combined,open_consent:u.value.combined,commercial_communication:u.value.commercial_communication}});const o=await _(e,{method:"POST",body:r});if(o&&o.success){const{token:Z,user:E}=o.data;await j.setAuth(Z,E),n.value&&x.value&&_("/user/profile",{method:"PUT",body:{name:h.value||E.name,email:x.value}}).catch(te=>{console.error("Email update failed:",te)});let C=T.query.redirect;Array.isArray(C)&&(C=C[0]);const ee=C||"/";q.push(ee);return}else i.value=o?.message||"Geçersiz kod."}catch(a){i.value=a.data?.message||"Bir hata oluÅtu."}finally{c.value=!1}};return(a,e)=>{const r=ae;return l(),s(U,null,[t("div",be,[t("h1",ye,[m.value&&n.value?(l(),s("span",xe,"Kayıt Ol")):m.value?(l(),s("span",ge,"DoÄrulama Kodu")):n.value?(l(),s("span",he,"Kayıt Ol")):(l(),s("span",ke,"GiriÅ Yap"))]),i.value?(l(),s("div",we,f(i.value),1)):p("",!0),!m.value&&v.value?(l(),s("div",_e,f(v.value),1)):p("",!0),m.value?p("",!0):(l(),s("div",ze,[t("button",{onClick:e[0]||(e[0]=o=>K("login")),class:O(["flex-1 py-1.5 text-sm font-medium rounded-md transition-shadow",n.value?"text-gray-500 hover:text-textDark":"bg-white shadow text-primary"]),type:"button"}," GiriÅ ",2),t("button",{onClick:e[1]||(e[1]=o=>K("register")),class:O(["flex-1 py-1.5 text-sm font-medium rounded-md transition-shadow",n.value?"bg-white shadow text-primary":"text-gray-500 hover:text-textDark"]),type:"button"}," Kayıt Ol ",2)])),m.value?(l(),s("form",{key:4,onSubmit:N(Q,["prevent"]),class:"space-y-4"},[v.value?(l(),s("div",Ke,f(v.value),1)):p("",!0),t("p",Re," +90 "+f(y.value)+" numarasına gönderilen 4 haneli kodu girin. ",1),n.value?(l(),s(U,{key:1},[t("div",null,[e[22]||(e[22]=t("label",{class:"block text-sm font-medium text-textDark mb-1"},"Adınız",-1)),b(t("input",{"onUpdate:modelValue":e[10]||(e[10]=o=>h.value=o),type:"text",required:"",class:"w-full px-4 py-2 border border-cardBorder rounded-md focus:ring-primary focus:border-primary outline-none transition-colors",placeholder:"Adınız"},null,512),[[w,h.value]])]),t("div",null,[e[23]||(e[23]=t("label",{class:"block text-sm font-medium text-textDark mb-1"},"Soyadınız",-1)),b(t("input",{"onUpdate:modelValue":e[11]||(e[11]=o=>S.value=o),type:"text",required:"",class:"w-full px-4 py-2 border border-cardBorder rounded-md focus:ring-primary focus:border-primary outline-none transition-colors",placeholder:"Soyadınız"},null,512),[[w,S.value]])])],64)):p("",!0),t("div",null,[e[24]||(e[24]=t("label",{for:"otp_code_input",class:"block text-sm font-medium text-textDark mb-1"},"DoÄrulama Kodu",-1)),b(t("input",{id:"otp_code_input",name:"verification_code",ref_key:"codeInput",ref:$,"onUpdate:modelValue":e[12]||(e[12]=o=>z.value=o),type:"text",maxlength:"4",required:"",class:"w-full px-4 py-2 border border-cardBorder rounded-md focus:ring-primary focus:border-primary outline-none transition-colors text-center text-2xl tracking-widest",placeholder:"0000"},null,512),[[w,z.value]])]),t("button",{type:"submit",disabled:c.value,class:"w-full bg-primary text-white py-2 px-4 rounded-md hover:bg-accent transition-colors font-medium disabled:opacity-50 mt-4"},f(c.value?"DoÄrulanıyor...":n.value?"Kaydı Tamamla":"GiriÅ Yap"),9,Ee),t("button",{type:"button",onClick:e[13]||(e[13]=o=>m.value=!1),class:"w-full mt-2 text-sm text-primary hover:underline"}," Geri Dön ")],32)):(l(),s("form",{key:3,onSubmit:N(J,["prevent"]),class:"space-y-4"},[e[21]||(e[21]=de('<div class="bg-green-50 border border-green-100 rounded-lg p-3 flex items-start gap-3"><svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 text-green-600 shrink-0 mt-0.5" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"></path></svg><div class="text-xs text-slate-600 leading-relaxed"><p class="font-semibold text-slate-800 mb-0.5">Güvenli ve Kolay GiriÅ</p><p>Telefon numaranız, Åifre hatırlama derdini ortadan kaldırmak ve hesabınızı güvende tutmak
1için istenir. <strong>Telefonunuza asla reklam/promosyon SMS'i gönderilmeyecektir.</strong></p></div></div><label for="phone_input" class="block text-sm font-medium text-textDark mb-1">Telefon Numarası</label>',2)),t("div",Se,[e[16]||(e[16]=t("span",{class:"inline-flex items-center px-3 rounded-l-md border border-r-0 border-cardBorder bg-gray-50 text-textLight sm:text-sm"}," +90 ",-1)),b(t("input",{id:"phone_input",name:"phone","onUpdate:modelValue":e[2]||(e[2]=o=>y.value=o),type:"tel",onInput:Y,maxlength:"15",placeholder:"(5XX) XXX XX XX",pattern:"\\(\\d{3}\\) \\d{3} \\d{2} \\d{2}",required:"",class:"flex-1 w-full px-4 py-2 border border-cardBorder rounded-r-md focus:ring-primary focus:border-primary outline-none transition-colors"},null,544),[[w,y.value]])]),n.value?(l(),s("div",De,[e[17]||(e[17]=t("label",{for:"email_input",class:"block text-sm font-medium text-textDark mb-1"},"E-Posta",-1)),b(t("input",{id:"email_input",name:"email","onUpdate:modelValue":e[3]||(e[3]=o=>x.value=o),type:"email",placeholder:"[email protected]",class:"w-full px-4 py-2 border border-cardBorder rounded-md focus:ring-primary focus:border-primary outline-none transition-colors"},null,512),[[w,x.value]])])):p("",!0),n.value?(l(),s("div",Te,[t("div",Be,[t("button",{type:"button",onClick:e[4]||(e[4]=o=>B("kvkk")),class:"text-xs font-bold text-primary hover:underline"}," KiÅisel Verilerin Korunması Hakkında Aydınlatma Metni için tıklayın. ")]),t("div",Ce,[b(t("input",{type:"checkbox",id:"membership_consent_step1","onUpdate:modelValue":e[5]||(e[5]=o=>u.value.combined=o),class:"mt-1 w-6 h-6 rounded text-primary focus:ring-primary cursor-pointer border-cardBorder shrink-0",required:""},null,512),[[P,u.value.combined]]),t("label",Me,[t("button",{type:"button",onClick:e[6]||(e[6]=o=>B("membership")),class:"text-primary font-bold hover:underline"},"Ãyelik SözleÅmesi"),e[18]||(e[18]=M("'ni onaylıyorum ve ",-1)),t("button",{type:"button",onClick:e[7]||(e[7]=o=>B("open_consent")),class:"text-primary font-bold hover:underline"},"Açık Rıza Metni"),e[19]||(e[19]=M(" kapsamında kiÅisel verilerimin iÅlenmesine ve paylaÅılmasına onay veriyorum.* ",-1))])]),t("div",$e,[b(t("input",{type:"checkbox",id:"commercial_consent_step1","onUpdate:modelValue":e[8]||(e[8]=o=>u.value.commercial_communication=o),class:"mt-1 w-6 h-6 rounded text-primary focus:ring-primary cursor-pointer border-cardBorder shrink-0"},null,512),[[P,u.value.commercial_communication]]),t("label",Le,[t("button",{type:"button",onClick:e[9]||(e[9]=o=>B("commercial_communication")),class:"text-primary font-bold hover:underline"},"Ticari İletiÅim İzni Metni"),e[20]||(e[20]=M(" kapsamında tarafıma ticari elektronik ileti gönderilmesine onay veriyorum. ",-1))])])])):p("",!0),t("div",Ve,[t("div",{id:"recaptcha-main",class:"g-recaptcha","data-sitekey":ue(X),"data-callback":"onRecaptchaSuccess","data-expired-callback":"onRecaptchaExpired"},null,8,Xe)]),t("button",{type:"submit",disabled:c.value||!g.value||n.value&&(!u.value.combined||!u.value.commercial_communication),class:"w-full bg-primary text-white py-2 px-4 rounded-md hover:bg-accent transition-colors font-medium disabled:opacity-50 disabled:cursor-not-allowed"},f(c.value?"Gönderiliyor...":n.value?"Kod Gönder":"Devam Et"),9,Ae)],32)),H.value?(l(),s("div",Oe,[ce(r,{to:"/odeme?misafir=1",class:"text-sm text-textLight hover:text-primary transition-colors underline underline-offset-2"},{default:me(()=>[...e[25]||(e[25]=[M(" Ãye Olmadan Devam Et â ",-1)])]),_:1})])):p("",!0)]),D.value?(l(),s("div",Ne,[t("div",Pe,[t("div",Ue,[t("h3",Ge,f(V.value),1),t("button",{onClick:e[14]||(e[14]=o=>D.value=!1),class:"p-2 hover:bg-gray-200 rounded-full transition-colors text-gray-500"},[...e[26]||(e[26]=[t("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])])]),t("div",qe,[L.value?(l(),s("div",je,[...e[27]||(e[27]=[t("div",{class:"w-10 h-10 border-4 border-primary/20 border-t-primary rounded-full animate-spin"},null,-1),t("span",{class:"text-sm text-textLight font-medium"},"Yükleniyor...",-1)])])):(l(),s("div",He,[t("div",{innerHTML:k.value,class:"whitespace-pre-wrap leading-relaxed"},null,8,Fe)]))]),t("div",Ie,[t("button",{onClick:e[15]||(e[15]=o=>D.value=!1),class:"px-8 py-2.5 bg-primary text-white rounded-xl font-bold hover:bg-accent transition-all shadow-lg shadow-primary/20"}
1," Anladım ")])])])):p("",!0)],64)}}};export{Ze 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.