PageSourceSearch

https://crypto-vault-insight.lovable.app/assets/Auth-BIPC9erQ.js

js crypto-vault-insight.lovable.app collected 2026-10-03 05:33:18 UTC 16,031 bytes, 1 lines download raw bytes

1import{u as se,v as ae,a as te,b as ie,r as t,j as e,H as le,bo as ne,B as n,I as o,s as v}from"./index-D4T1ghJH.js";import{L as r}from"./label-BeVhvnkf.js";import{C as w}from"./checkbox-BHdCC3Am.js";import{T as re}from"./textarea-pDjx8h1t.js";import"./index-Dg9XYgQE.js";const ce=["سفير","ربح العملات","الاستثمار","التطوير","التسويق","التعليم","المحتوى","الترجمة","الدعم المجتمعي","تشغيل نود","مساهمة في الشبكة","حرفة أو موهبة"],me=()=>{const O=typeof window<"u"?window.location.href:"/auth",{toast:i}=se(),m=ae(),{user:C}=te(),{t:s,dir:V}=ie(),[u,S]=t.useState("signin"),[x,k]=t.useState(""),[p,z]=t.useState(""),[N,P]=t.useState(""),[g,G]=t.useState(""),[E,L]=t.useState(""),[M,R]=t.useState(""),[A,q]=t.useState(""),[T,W]=t.useState(""),[_,K]=t.useState("beginner"),[b,U]=t.useState([]),[B,$]=t.useState(""),[F,Y]=t.useState(""),[y,J]=t.useState(!1),[H,Q]=t.useState(!0),[l,d]=t.useState(!1);t.useEffect(()=>{C&&m("/",{replace:!0})},[C,m]);const Z=async a=>{a.preventDefault(),d(!0);try{const{error:c}=await v.auth.signInWithPassword({email:x,password:p});if(c)throw c;i({title:s("تم تسجيل الدخول بنجاح"),description:s("مرحباً بك في منصة مصر")})}catch(c){i({title:s("فشل تسجيل الدخول"),description:c?.message||s("تحقق من البيانات"),variant:"destructive"}),d(!1)}},ee=async a=>{if(a.preventDefault(),!y){i({title:s("الشروط مطلوبة"),description:s("يرجى الموافقة على الشروط للمتابعة"),variant:"destructive"});return}d(!0);try{const c=g?(g.trim().startsWith("+")?"+":"")+g.replace(/\D/g,""):"";if(c&&!/^\+?[0-9]{10,15}$/.test(c))throw new Error(s("رقم الهاتف غير صالح — يجب أن يحتوي على 10-15 رقماً"));const f=`${window.location.origin}/`,{data:h,error:X}=await v.auth.signUp({email:x,password:p,options:{emailRedirectTo:f,data:{full_name:N,phone:c}}});if(X)throw X;i({title:s("تم إنشاء الحساب"),description:s("أكمل توثيق الهوية (KYC) للاستفادة من كل الخدمات")});const D=h.session?.user?.id||h.user?.id;if(D){const{error:j}=await v.from("profiles").upsert({user_id:D,full_name:N||null,phone:c||null,email:x,country:E||null,city:M||null,gender:A||null,date_of_birth:T||null,blockchain_experience:_||null,participation_interests:b.length?b:null,wallet_address:B||null,how_heard:F||null,agree_terms:!0,signup_completed_at:new Date().toISOString()},{onConflict:"user_id"});if(j)throw j.code==="23505"||/duplicate/i.test(j.message||"")?new Error(s("رقم الهاتف مسجل بحساب آخر")):new Error(j.message||s("فشل حفظ البيانات"))}h.session?.user&&(H&&typeof window<"u"&&window.PublicKeyCredential?m("/anubis/auth"):m("/identity"))}catch(c){i({title:s("تعذر إنشاء الحساب"),description:c?.message||s("تحقق من البيانات"),variant:"destructive"})}finally{d(!1)}},I=async()=>{d(!0);try{const{error:a}=await v.auth.signInWithOAuth({provider:"google",options:{redirectTo:`${window.location.origin}/`}});if(a)throw a}catch(a){i({title:s("فشل تسجيل الدخول بـ Google"),description:a?.message||s("حدث خطأ، حاول مرة أخرى"),variant:"destructive"}),d(!1)}};return e.jsxs(e.Fragment,{children:[e.jsxs(le,{children:[e.jsxs("title",{children:[s(u==="signin"?"تسجيل الدخول":"إنشاء حساب")," — Crypto-MSR"]}),e.jsx("meta",{name:"description",content:s("تسجيل الدخول")+" - Crypto-MSR"}),e.jsx("link",{rel:"canonical",href:O})]}),e.jsx("div",{className:"min-h-screen",style:{backgroundImage:"url('/lovable-uploads/5f71efaf-8d4b-42c4-993b-f0d50e00f50e.png')",backgroundSize:"cover",backgroundPosition:"center",backgroundAttachment:"fixed"},children:e.jsx("div",{className:"min-h-screen bg-background/90",children:e.jsxs("section",{className:"container mx-auto px-4 py-16 max-w-xl",dir:V,children:[e.jsx("div",{className:"flex justify-end mb-4",children:e.jsx(ne,{})}),e.jsx("h1",{className:"font-cairo text-3xl md:text-5xl font-bold mb-6 text-start",children:s(u==="signin"?"تسجيل الدخول":"إنشاء حساب")}),e.jsxs("div",{className:"mb-6 flex gap-3 bg-muted/50 p-1 rounded-lg font-cairo",children:[e.jsx(n,{variant:u==="signin"?"default":"ghost",onClick:()=>S("signin"),className:"flex-1",children:s("تسجيل الدخول")}),e.jsx(n,{variant:u==="signup"?"default":"ghost",onClick:()=>S("signup"),className:"flex-1",children:s("حساب جديد")})]}),u==="signin"?e.jsxs("form",{onSubmit:Z,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{htmlFor:"email",className:"font-cairo",children:s("البريد الإلكتروني")}),e.jsx(o,{id:"email",type:"email",value:x,onChange:a=>k(a.target.value),required:!0,dir:"ltr"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{htmlFor:"password",className:"font-cairo",children:s("كلمة المرور")}),e.jsx(o,{id:"password",type:"password",value:p,onChange:a=>z(a.target.value),required:!0,dir:"ltr"})]}),e.jsx(n,{size:"lg",type:"submit",disabled:l,className:"w-full font-cairo",children:s(l?"جاري الدخول...":"دخول")}),e.jsxs("div",{className:"relative my-6",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("span",{className:"w-full border-t"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:e.jsx("span",{className:"bg-background px-2 text-muted-foreground",children:s("أو")})})]}),e.jsxs(n,{type:"button",variant:"outline",size:"lg",onClick:I,disabled:l,className:"w-full font-cairo",children:[e.jsxs("svg",{className:"ml-2 h-5 w-5",viewBox:"0 0 24 24",children:[e.jsx("path",{fill:"#4285F4",d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"}),e.jsx("path",{fill:"#34A853",d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),e.jsx("path",{fill:"#FBBC05",d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"}),e.jsx("path",{fill:"#EA4335",d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"})]}),s("تسجيل الدخول بـ Google")]}),e.jsxs(n,{type:"button",variant:"outline",size:"lg",disabled:l,className:"w-full font-cairo",onClick:()=>i({title:s("قريباً"),description:s("تسجيل الدخول عبر تيليجرام سيكون متاحاً قريباً")}),children:[e.jsx("svg",{className:"ml-2 h-5 w-5",viewBox:"0 0 24 24",fill:"#229ED9",children:e.jsx("path",{d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.9
162 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})}),s("تسجيل الدخول عبر Telegram")]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs text-center text-muted-foreground font-cairo",children:s("أو الدخول بالمحفظة")}),e.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[e.jsx(n,{type:"button",variant:"outline",size:"sm",disabled:l,className:"font-cairo text-xs",onClick:()=>i({title:s("قريباً"),description:s("ربط محفظة Solana سيكون متاحاً قريباً")}),children:"Solana"}),e.jsx(n,{type:"button",variant:"outline",size:"sm",disabled:l,className:"font-cairo text-xs",onClick:()=>i({title:s("قريباً"),description:s("ربط محفظة EVM سيكون متاحاً قريباً")}),children:"EVM"}),e.jsx(n,{type:"button",variant:"outline",size:"sm",disabled:l,className:"font-cairo text-xs",onClick:()=>i({title:s("قريباً"),description:s("ربط محفظة TON سيكون متاحاً قريباً")}),children:"TON"})]})]})]}):e.jsxs("form",{onSubmit:ee,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{htmlFor:"fullName",className:"font-cairo",children:s("الاسم الكامل")}),e.jsx(o,{id:"fullName",value:N,onChange:a=>P(a.target.value),className:"font-cairo"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{htmlFor:"phone",className:"font-cairo",children:s("رقم الهاتف")}),e.jsx(o,{id:"phone",type:"tel",value:g,onChange:a=>G(a.target.value),placeholder:"+20 XXX XXX XXXX",dir:"ltr"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{htmlFor:"email",className:"font-cairo",children:s("البريد الإلكتروني")}),e.jsx(o,{id:"email",type:"email",value:x,onChange:a=>k(a.target.value),required:!0,dir:"ltr"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{htmlFor:"password",className:"font-cairo",children:s("كلمة المرور")}),e.jsx(o,{id:"password",type:"password",value:p,onChange:a=>z(a.target.value),required:!0,dir:"ltr",minLength:8})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{className:"font-cairo",children:s("الدولة")}),e.jsx(o,{value:E,onChange:a=>L(a.target.value),placeholder:"Egypt"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{className:"font-cairo",children:s("المدينة")}),e.jsx(o,{value:M,onChange:a=>R(a.target.value)})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{className:"font-cairo",children:s("الجنس")}),e.jsxs("select",{value:A,onChange:a=>q(a.target.value),className:"w-full h-10 px-3 rounded-md border bg-background font-cairo",children:[e.jsx("option",{value:"",children:s("اختر")}),e.jsx("option",{value:"male",children:s("ذكر")}),e.jsx("option",{value:"female",children:s("أنثى")})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{className:"font-cairo",children:s("تاريخ الميلاد")}),e.jsx(o,{type:"date",value:T,onChange:a=>W(a.target.value),dir:"ltr"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{className:"font-cairo",children:s("خبرتك في البلوكتشين والعملات الرقمية")}),e.jsxs("select",{value:_,onChange:a=>K(a.target.value),className:"w-full h-10 px-3 rounded-md border bg-background font-cairo",children:[e.jsx("option",{value:"beginner",children:s("مبتدئ")}),e.jsx("option",{value:"intermediate",children:s("متوسط")}),e.jsx("option",{value:"advanced",children:s("متقدم")}),e.jsx("option",{value:"developer",children:s("مطور بلوكتشين")})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{className:"font-cairo",children:s("اهتماماتك في المشاركة")}),e.jsx("div",{className:"grid grid-cols-2 gap-2 text-sm",children:ce.map(a=>e.jsxs("label",{className:"flex items-center gap-2 font-cairo cursor-pointer",children:[e.jsx(w,{checked:b.includes(a),onCheckedChange:c=>U(f=>c?[...f,a]:f.filter(h=>h!==a))}),e.jsx("span",{children:s(a)})]},a))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{className:"font-cairo",children:s("عنوان محفظتك (اختياري)")}),e.jsx(o,{value:B,onChange:a=>$(a.target.value),placeholder:"Solana / EVM / TON",dir:"ltr"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{className:"font-cairo",children:s("كيف عرفت عن المنصة؟")}),e.jsx(re,{value:F,onChange:a=>Y(a.target.value),rows:2,className:"font-cairo"})]}),e.jsxs("label",{className:"flex items-start gap-2 font-cairo text-sm cursor-pointer",children:[e.jsx(w,{checked:y,onCheckedChange:a=>J(!!a)}),e.jsx("span",{children:s("أوافق على الشروط والأحكام، وأتعهد بصحة البيانات، وأفهم أن الوصول الكامل للخدمات يتطلب اØ
1³ØªÙƒÙ…ال توثيق الهوية (KYC)")})]}),e.jsxs("label",{className:"flex items-start gap-2 font-cairo text-sm cursor-pointer",children:[e.jsx(w,{checked:H,onCheckedChange:a=>Q(!!a)}),e.jsxs("span",{children:[s("تفعيل الدخول للخزانة الرقمية بالبصمة أو الوجه (يُوصى به)"),e.jsx("span",{className:"block text-xs text-muted-foreground",children:s("سيتم تحويلك لتسجيل البصمة بعد إنشاء الحساب")})]})]}),e.jsx(n,{size:"lg",type:"submit",disabled:l||!y,className:"w-full font-cairo",children:s(l?"جاري إنشاء الحساب...":"إنشاء حساب والانتقال للتوثيق")}),e.jsxs("div",{className:"relative my-6",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("span",{className:"w-full border-t"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:e.jsx("span",{className:"bg-background px-2 text-muted-foreground font-cairo",children:s("أو")})})]}),e.jsxs(n,{type:"button",variant:"outline",size:"lg",onClick:I,disabled:l,className:"w-full font-cairo",children:[e.jsxs("svg",{className:"ml-2 h-5 w-5",viewBox:"0 0 24 24",children:[e.jsx("path",{fill:"#4285F4",d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"}),e.jsx("path",{fill:"#34A853",d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),e.jsx("path",{fill:"#FBBC05",d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"}),e.jsx("path",{fill:"#EA4335",d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"})]}),s("التسجيل بـ Google")]}),e.jsxs(n,{type:"button",variant:"outline",size:"lg",disabled:l,className:"w-full font-cairo",onClick:()=>i({title:s("قريباً"),description:s("التسجيل عبر تيليجرام سيكون متاحاً قريباً")}),children:[e.jsx("svg",{className:"ml-2 h-5 w-5",viewBox:"0 0 24 24",fill:"#229ED9",children:e.jsx("path",{d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"})}),s("التسجيل عبر Telegram")]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs text-center text-muted-foreground font-cairo",children:s("أو التسجيل بالمحفظة")}),e.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[e.jsx(n,{type:"button",variant:"outline",size:"sm",disabled:l,className:"font-cairo text-xs",onClick:()=>i({title:s("قريباً"),description:s("ربط محفظة Solana")}),children:"Solana"}),e.jsx(n,{type:"button",variant:"outline",size:"sm",disabled:l,className:"font-cairo text-xs",onClick:()=>i({title:s("قريباً"),description:s("ربط محفظة EVM")}),children:"EVM"}),e.jsx(n,{type:"button",variant:"outline",size:"sm",disabled:l,className:"font-cairo text-xs",onClick:()=>i({title:s("قريباً"),description:s("ربط محفظة TON")}),children:"TON"})]})]})]})]})})})]})};export{me 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.