PageSourceSearch

https://www.shahiin.com/_next/static/chunks/pages/profile-ac8dcba1f9736f76.js

js shahiin.com collected 2026-10-02 00:57:19 UTC 58,674 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4063],{8172:(e,t,s)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/profile",function(){return s(37970)}])},37970:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>ev,dynamic:()=>ej});var a=s(37876),r=s(68229),l=s(86382),n=s(45770),i=s(35835),c=s(34121),d=s(18076),o=s(14232),x=s(89099),m=s(45682),h=s(68605),u=s(20727),p=s(65682),g=s(47333),j=s(65084),v=s(3909),f=s(77041),b=s(48971),y=s(40053),N=s(74725),w=s(72671),E=s(71416),F=s(10345),A=s(81193),S=s(53656),C=s(96575),B=s(89155),k=s(94108),_=s(48230),T=s.n(_);let q=()=>{var e,t,s;let r=(0,g.A)(),{toast:l}=(0,N.dj)();if(!r)return(0,a.jsxs)("div",{className:"text-center py-16",children:[(0,a.jsx)("div",{className:"animate-spin rounded-full h-12 w-12 border-2 border-[#FF9933] border-t-transparent mx-auto mb-4"}),(0,a.jsx)("p",{className:"text-gray-600",children:"جاري التحميل..."})]});let{user:n,refreshAuthState:i}=r,[c,d]=(0,o.useState)(!1),[x,m]=(0,o.useState)({name:"",phone:""}),[h,p]=(0,o.useState)(!1),[j,v]=(0,o.useState)(!1),[_,q]=(0,o.useState)(null),[U,J]=(0,o.useState)(!1),[O,W]=(0,o.useState)(!1),[P,R]=(0,o.useState)(!1),[M,Z]=(0,o.useState)(!1),$=async()=>{if(null==n?void 0:n.id)try{let e=await (0,A.f)(n.id);p(e.phoneVerified),v(e.emailVerified),q(e.pendingEmail)}catch(e){p(!1),v(!1),q(null)}};(0,o.useEffect)(()=>{(null==n?void 0:n.id)&&$()},[null==n?void 0:n.id]),(0,o.useEffect)(()=>{n&&m({name:n.name||"",phone:n.phone||""})},[n]);let z=async e=>{if(e.preventDefault(),n){d(!0);try{var t;let e=C.AuthService.getJwt();if(!e)throw Error("No authentication token");let s=null!=(t=n.preferences)?t:{},a=await fetch("".concat((0,k.getEdgeFunctionsUrl)(),"/clients"),{method:"PUT",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(e),apikey:(0,k.getSupabaseAnonKey)()},body:JSON.stringify({name:x.name,phone:x.phone,preferences:s})}),r=await a.json().catch(()=>({}));if(!a.ok||!0!==r.success)throw Error(r.error||"Failed to update profile");let c={id:n.id,email:n.email,name:x.name,phone:x.phone,role:n.role||"client",preferences:s,created_at:n.created_at,updated_at:new Date().toISOString()};localStorage.setItem("user_data",JSON.stringify(c)),await i(),l({title:"تم حفظ التغييرات",description:"تم تحديث معلومات ملفك الشخصي بنجاح"})}catch(e){console.error("Profile update error:",e),l({title:"خطأ",description:e instanceof Error?e.message:"حدث خطأ أثناء حفظ التغييرات",variant:"destructive"})}finally{d(!1)}}};return n?(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)(u.Zp,{className:"rounded-2xl shadow-lg border-[#
1E5E7EB] overflow-hidden",children:[(0,a.jsx)(u.aR,{className:"pb-2",children:(0,a.jsxs)(u.ZB,{className:"flex items-center gap-3 text-right",children:[(0,a.jsx)("div",{className:"w-12 h-12 rounded-xl bg-[#FFF4EA] flex items-center justify-center",children:(0,a.jsx)(w.A,{className:"h-6 w-6 text-[#FF9933]"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"block",children:"المعلومات الأساسية"}),(0,a.jsx)("p",{className:"text-sm font-normal text-gray-500 mt-0.5",children:"إدارة معلومات حسابك الشخصي"})]})]})}),(0,a.jsx)(u.Wu,{className:"pt-4",children:(0,a.jsxs)("form",{onSubmit:z,className:"space-y-5",children:[(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(y.J,{htmlFor:"name",className:"text-right block",children:"الاسم الكامل"}),(0,a.jsx)(b.p,{id:"name",value:x.name,onChange:e=>m({...x,name:e.target.value}),required:!0,className:"rounded-xl border-[#E5E7EB]"})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(y.J,{htmlFor:"phone",className:"text-right block",children:"رقم الهاتف"}),(0,a.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,a.jsx)(b.p,{id:"phone",type:"tel",value:x.phone,onChange:e=>m({...x,phone:e.target.value}),className:"rounded-xl border-[#E5E7EB] flex-1 min-w-0",placeholder:"أدخل رقم الهاتف"}),h&&(null!=(t=null==(e=x.phone)?void 0:e.trim())?t:"").length>0?(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-xl text-sm font-medium bg-green-100 text-green-800",children:[(0,a.jsx)(E.A,{className:"h-4 w-4"}),"موثّق"]}):(0,a.jsx)(f.$,{type:"button",variant:"outline",size:"sm",disabled:!x.phone||U,className:"rounded-xl border-[#E5E7EB]",onClick:async()=>{if(x.phone){J(!0);try{let e=C.AuthService.getJwt();await S.d.sendWhatsAppCode(x.phone,"verify_phone","client",e),R(!0)}catch(e){l({title:"خطأ",description:(null==e?void 0:e.message)||"فشل إرسال رمز التحقق",variant:"destructive"})}finally{J(!1)}}},children:U?"جاري الإرسال...":"توثيق الهاتف"})]}),!h&&(0,a.jsx)("p",{className:"text-sm text-gray-500 mt-1",children:"توثيق الهاتف يضمن أمان حسابك. سنرسل لك رمزاً عبر واتساب."})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(y.J,{htmlFor:"email",className:"text-right block",children:"البريد الإلكتروني"}),(0,a.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,a.jsx)(b.p,{id:"email",type:"email",value:(null==_?void 0:_.trim())?_:null!=(s=n.email)?s:"",disabled:!0,className:"bg-[#F9FAFB] rounded-xl border-[#E5E7EB] flex-1 min-w-0"}),(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-xl text-sm font-medium ".concat((null==_?void 0:_.trim())?"bg-amber-100 text-amber-800":j?"bg-green-100 text-green-800":"bg-gray-100 text-gray-600"),children:[(0,a.jsx)(E.A,{className:"h-4 w-4"}),(null==_?void 0:_.trim())?"بانتظار التحقق":j?"موثّق":"غير موثّق"]})]}),(0,a.jsx)("p",{className:"text-sm text-gray-500",children:"لا يمكن تغيير البريد الإلكتروني"}),!j&&(0,a.jsx)(f.$,{type:"button",variant:"outline",size:"sm",disabled:O||!n.email,className:"rounded-xl border-[#E5E7EB] mt-2",onClick:async()=>{var e;let t=null!=(e=(null==_?void 0:_.trim())||n.email)?e:"";if(t){W(!0);try{let e=C.AuthService.getJwt();await S.d.sendEmailCode(t,"verify_email","client",e),Z(!0)}catch(e){l({title:"خطأ",description:(null==e?void 0:e.message)||"فشل إرسال رمز التحقق",variant:"destructive"})}finally{W(!1)}}},children:O?"جاري الإرسال...":"توثيق البريد"})]}),(0,a.jsxs)("p",{className:"text-sm text-gray-600 text-right rounded-xl border border-gray-200 bg-[#F9FAFB] px-4 py-3",children:["عناوين التوصيل وخرائط الاستلام تُدار من تبويب"," ",(0,a.jsx)(T(),{href:"/profile?tab=addresses",className:"font-semibold text-[#FF8524] hover:underline",children:"العناوين"}),"— مثل التطبيق (جدول العناوين وليس صفحة العميل)."]}),(0,a.jsxs)(f.$,{type:"submit",className:"w-full bg-[#FF9933] hover:bg-[#
1E6801A] text-white rounded-xl font-semibold py-6 flex items-center justify-center gap-2",disabled:c,children:[(0,a.jsx)(F.A,{className:"h-4 w-4"}),(0,a.jsx)("span",{children:c?"جارِ الحفظ...":"حفظ التغييرات"})]})]})})]}),(0,a.jsx)(B.l,{open:P,onOpenChange:R,title:"أدخل رمز التحقق",description:"أدخل الرمز المرسل إليك عبر واتساب",onVerify:async e=>{let t=C.AuthService.getJwt();await S.d.verifyWhatsAppCode(x.phone,e,"verify_phone",void 0,"client",t),await $(),null==i||i(),l({title:"تم التوثيق",description:"تم توثيق رقم هاتفك بنجاح"})}}),(0,a.jsx)(B.l,{open:M,onOpenChange:Z,title:"أدخل رمز التحقق",description:"أدخل الرمز المرسل إلى بريدك الإلكتروني",onVerify:async e=>{var t;let s=null!=(t=(null==_?void 0:_.trim())||(null==n?void 0:n.email))?t:"";if(!s)return;let a=C.AuthService.getJwt();await S.d.verifyEmailCode(s,e,"verify_email",void 0,"client",a),await $(),null==i||i(),Z(!1),l({title:"تم التوثيق",description:"تم توثيق بريدك الإلكتروني بنجاح"})}})]}):(0,a.jsx)("div",{children:"غير مسموح"})};var U=s(10456),J=s(17739),O=s(92161),W=s(89774),P=s(87966),R=s(86739),M=s(95167),Z=s(6973),$=s(23834),z=s(91220),L=s(2466),D=s(46961),I=s(25666),X=s(43846);let K=(e,t)=>{if("SYP"===t){let t=Math.round(e);return"".concat(t.toLocaleString("en-US")," ل.س")}return"USD"===t?"$".concat(e.toFixed(2)):"".concat(e.toFixed(2)," ").concat(t)},V=e=>{switch(null==e?void 0:e.toLowerCase()){case"approved":case"completed":return"bg-green-100 text-green-800";
1case"pending":return"bg-amber-100 text-amber-800";case"rejected":case"cancelled":return"bg-red-100 text-red-800";default:return"bg-gray-100 text-gray-800"}},Y=()=>{var e,t,s,r;let[l,n]=(0,o.useState)(null),[i,c]=(0,o.useState)([]),[d,x]=(0,o.useState)([]),[m,p]=(0,o.useState)(null),[g,j]=(0,o.useState)(null),[v,N]=(0,o.useState)(!0),[w,F]=(0,o.useState)(!1),[A,S]=(0,o.useState)(!1),[C,B]=(0,o.useState)(!1),[k,_]=(0,o.useState)(!1),[T,q]=(0,o.useState)(null),[U,Y]=(0,o.useState)("manual"),[G,Q]=(0,o.useState)(null),[H,ee]=(0,o.useState)(null),[et,es]=(0,o.useState)({amount:"",currency:"SYP",paymentMethod:"shamcash",confirmationCode:"",receiptUrl:"",notes:""}),[ea,er]=(0,o.useState)({amount:"",currency:"SYP",paymentMethod:"shamcash",recipientAccount:"",notes:""}),el=async()=>{try{N(!0);let e=await W.F.getWalletBalance();n(e)}catch(e){q(e instanceof Error?e.message:"حدث خطأ أثناء تحميل المحفظة")}finally{N(!1)}},en=async()=>{try{F(!0);let[e,t]=await Promise.all([W.F.getChargeRequests(),W.F.getWithdrawRequests()]);c(e),x(t)}catch(e){q(e instanceof Error?e.message:"حدث خطأ أثناء تحميل الطلبات")}finally{F(!1)}},ei=async()=>{try{S(!0);let[e,t]=await Promise.all([P.J.generateReferralLink(),P.J.getReferralStats()]);p(e),j(t)}catch(e){q(e instanceof Error?e.message:"حدث خطأ أثناء تحميل بيانات الدعوات")}finally{S(!1)}};(0,o.useEffect)(()=>{el(),en(),ei()},[]);let ec=async()=>{let e=Number(et.amount);e&&!(e<=0)&&et.confirmationCode.trim()&&(await W.F.createChargeRequest({amount:e,currency:et.currency,paymentMethod:et.paymentMethod,confirmationCode:et.confirmationCode.trim(),receiptUrl:et.receiptUrl||void 0,notes:et.notes||void 0}),B(!1),es({amount:"",currency:et.currency,paymentMethod:et.paymentMethod,confirmationCode:"",receiptUrl:"",notes:""}),en(),el())},ed=async e=>{try{ee(null),Q(e);let t=await W.F.getStripeWalletPaymentUrl(e);window.location.href=t}catch(e){ee(e instanceof Error?e.message:"تعذّر بدء عملية الدفع بالبطاقة"),Q(null)}},eo=async()=>{let e=Number(ea.amount);e&&!(e<=0)&&ea.recipientAccount.trim()&&(await W.F.createWithdrawRequest({amount:e,currency:ea.currency,paymentMethod:ea.paymentMethod,recipientAccount:ea.recipientAccount.trim(),notes:ea.notes||void 0}),_(!1),er({amount:"",currency:ea.currency,paymentMethod:ea.paymentMethod,recipientAccount:"",notes:""}),en(),el())},ex=(0,o.useMemo)(()=>l?(l.wallet.syp_balance||0)+(l.wallet.usd_balance||0):0,[l]);if(v)return(0,a.jsxs)("div",{className:"text-center py-16",children:[(0,a.jsx)("div",{className:"animate-spin rounded-full h-12 w-12 border-2 border-[#FF9933] border-t-transparent mx-auto mb-4"}),(0,a.jsx)("p",{className:"text-gray-600",children:"جاري تحميل المحفظة..."})]});if(T)return(0,a.jsx)(u.Zp,{className:"rounded-2xl shadow-lg border-[#
1E5E7EB] overflow-hidden",children:(0,a.jsx)(u.Wu,{className:"p-6 text-center text-red-600",children:T})});if(!l)return(0,a.jsx)(u.Zp,{className:"rounded-2xl shadow-lg border-[#E5E7EB] overflow-hidden",children:(0,a.jsx)(u.Wu,{className:"p-6 text-center text-gray-600",children:"لا توجد بيانات للمحفظة"})});let em=0===(l.wallet.syp_balance||0)&&0===(l.wallet.usd_balance||0);return(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)(h.tU,{defaultValue:"balance",className:"w-full",children:[(0,a.jsxs)(h.j7,{className:"w-full justify-between flex-wrap h-auto p-1.5 rounded-xl bg-[#F3F4F6] gap-1",children:[(0,a.jsx)(h.Xi,{value:"balance",className:"rounded-lg px-4 py-2.5 data-[state=active]:bg-white data-[state=active]:text-[#FF9933] data-[state=active]:shadow-sm",children:"الرصيد"}),(0,a.jsx)(h.Xi,{value:"transactions",className:"rounded-lg px-4 py-2.5 data-[state=active]:bg-white data-[state=active]:text-[#FF9933] data-[state=active]:shadow-sm",children:"المعاملات"}),(0,a.jsx)(h.Xi,{value:"rewards",className:"rounded-lg px-4 py-2.5 data-[state=active]:bg-white data-[state=active]:text-[#FF9933] data-[state=active]:shadow-sm",children:"المكافآت"}),(0,a.jsx)(h.Xi,{value:"requests",className:"rounded-lg px-4 py-2.5 data-[state=active]:bg-white data-[state=active]:text-[#FF9933] data-[state=active]:shadow-sm",children:"الطلبات"})]}),(0,a.jsxs)(h.av,{value:"balance",className:"mt-6",children:[em&&(0,a.jsxs)("div",{className:"rounded-2xl border border-[#FF9933]/30 bg-[#FFF4EA] p-5 mb-6 flex items-start gap-4",children:[(0,a.jsx)("div",{className:"w-12 h-12 rounded-xl bg-[#FF9933]/20 flex items-center justify-center flex-shrink-0",children:(0,a.jsx)(R.A,{className:"h-6 w-6 text-[#FF9933]"})}),(0,a.jsxs)("div",{className:"flex-1 text-right",children:[(0,a.jsx)("p",{className:"font-semibold text-gray-900",children:"رصيدك فارغ"}),(0,a.jsx)("p",{className:"text-sm text-gray-600 mt-1",children:"شحن المحفظة للدفع من خلالها عند الطلب"}),(0,a.jsxs)("button",{type:"button",onClick:()=>B(!0),className:"inline-flex items-center gap-2 mt-3 text-sm font-semibold text-[#FF9933] hover:text-[#E6801A] transition-colors",children:[(0,a.jsx)(M.A,{className:"h-4 w-4"}),"شحن المحفظة الآن"]})]})]}
1),(0,a.jsxs)(u.Zp,{className:"rounded-2xl shadow-lg border-[#E5E7EB] overflow-hidden",children:[(0,a.jsx)(u.aR,{className:"pb-2",children:(0,a.jsxs)(u.ZB,{className:"flex items-center gap-2 text-right",children:[(0,a.jsx)("div",{className:"w-10 h-10 rounded-xl bg-[#FFF4EA] flex items-center justify-center",children:(0,a.jsx)(Z.A,{className:"h-5 w-5 text-[#FF9933]"})}),(0,a.jsx)("span",{children:"رصيد المحفظة"})]})}),(0,a.jsxs)(u.Wu,{className:"space-y-5",children:[(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{className:"bg-[#F9FAFB] rounded-2xl p-5 border border-[#E5E7EB] text-center",children:[(0,a.jsx)("div",{className:"text-sm text-gray-500 mb-1",children:"SYP"}),(0,a.jsx)("div",{className:"text-xl font-bold text-[#111827]",children:K(l.wallet.syp_balance||0,"SYP")})]}),(0,a.jsxs)("div",{className:"bg-[#F9FAFB] rounded-2xl p-5 border border-[#E5E7EB] text-center",children:[(0,a.jsx)("div",{className:"text-sm text-gray-500 mb-1",children:"USD"}),(0,a.jsx)("div",{className:"text-xl font-bold text-[#111827]",children:K(l.wallet.usd_balance||0,"USD")})]})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between text-sm py-3 px-4 bg-[#F9FAFB] rounded-xl",children:[(0,a.jsx)("span",{className:"text-gray-600",children:"العملة المفضلة"}),(0,a.jsx)("span",{className:"font-semibold text-gray-900 px-3 py-1 rounded-full bg-white border border-[#E5E7EB]",children:l.preferredCurrency})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between text-sm py-3 px-4 bg-[#FFF4EA] rounded-xl border border-[#FF9933]/20",children:[(0,a.jsx)("span",{className:"text-gray-600",children:"إجمالي الرصيد"}),(0,a.jsx)("span",{className:"font-bold text-lg text-[#FF9933]",children:K(ex,l.preferredCurrency)})]}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-3 pt-2",children:[(0,a.jsxs)(f.$,{className:"bg-[#FF9933] hover:bg-[#E6801A] text-white rounded-xl font-semibold px-6",onClick:()=>B(!0),children:[(0,a.jsx)(M.A,{className:"h-4 w-4 ml-2"}),"شحن المحفظة"]}),(0,a.jsxs)(f.$,{variant:"outline",className:"rounded-xl border-[#E5E7EB] hover:bg-gray-50 font-semibold px-6",onClick:()=>_(!0),children:[(0,a.jsx)($.A,{className:"h-4 w-4 ml-2"}),"سحب الرصيد"]})]})]})]})]}),(0,a.jsx)(h.av,{value:"transactions",className:"mt-6",children:(0,a.jsxs)(u.Zp,{className:"rounded-2xl shadow-lg border-[#
1E5E7EB] overflow-hidden",children:[(0,a.jsx)(u.aR,{className:"pb-2",children:(0,a.jsxs)(u.ZB,{className:"flex items-center gap-2 text-right",children:[(0,a.jsx)("div",{className:"w-10 h-10 rounded-xl bg-[#FFF4EA] flex items-center justify-center",children:(0,a.jsx)(z.A,{className:"h-5 w-5 text-[#FF9933]"})}),(0,a.jsx)("span",{children:"المعاملات الأخيرة"})]})}),(0,a.jsx)(u.Wu,{children:0===l.recentTransactions.length?(0,a.jsxs)("div",{className:"text-center py-12 text-gray-500",children:[(0,a.jsx)(z.A,{className:"h-12 w-12 mx-auto mb-3 opacity-40"}),(0,a.jsx)("p",{children:"لا توجد معاملات بعد"})]}):(0,a.jsx)("div",{className:"space-y-2",children:l.recentTransactions.map(e=>(0,a.jsxs)("div",{className:"flex items-center justify-between py-4 px-4 rounded-xl hover:bg-[#F9FAFB] transition-colors border-b border-gray-100 last:border-0",children:[(0,a.jsxs)("div",{className:"text-right",children:[(0,a.jsx)("div",{className:"text-sm font-medium text-gray-900",children:function(e){let t=String(e.type||"").toLowerCase().trim(),s=String(e.reason||"").toLowerCase(),a=function(e){if(e.order_id&&String(e.order_id).length>0)return String(e.order_id);let t=e.source_id?String(e.source_id):"";return t.toLowerCase().startsWith("order:")?t.slice(6).trim():null}(e),r=a?" \xb7 #".concat(function(e){let t=e.trim();return t.length<=8?t:t.slice(-8)}(a)):"",l=s.includes("order payment")||s.includes("order:")||!!a,n=s.includes("order cancelled")||s.includes("order canceled")||s.includes("wallet refund")||s.includes("refund:")||!!a;return"redeem"===t?l?"دفع طلب بالمحفظة".concat(r):"استخدام رصيد":"refund"===t?n||s.includes("cancel")?"استرداد مبلغ الطلب".concat(r):"استرداد إلى المحفظة":"reward"===t?"إضافة رصيد":"revoke"===t?"إلغاء رصيد":"withdraw"===t?"سحب رصيد":e.type||"معاملة"}(e)}),(0,a.jsx)("div",{className:"text-xs text-gray-500 mt-0.5",children:new Date(e.created_at).toLocaleString("ar-SA")})]}),(0,a.jsxs)("div",{className:"text-sm font-bold ".concat(e.amount>=0?"text-green-600":"text-red-600"),children:[e.amount>=0?"+":"-"," ",K(Math.abs(e.amount),e.currency)]})]},e.id))})})]})}),(0,a.jsx)(h.av,{value:"rewards",className:"mt-6",children:(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)(u.Zp,{className:"rounded-2xl shadow-lg border-[#
1E5E7EB] overflow-hidden",children:[(0,a.jsx)(u.aR,{className:"pb-2",children:(0,a.jsxs)(u.ZB,{className:"flex items-center gap-2 text-right",children:[(0,a.jsx)("div",{className:"w-10 h-10 rounded-xl bg-[#FFF4EA] flex items-center justify-center",children:(0,a.jsx)(L.A,{className:"h-5 w-5 text-[#FF9933]"})}),(0,a.jsx)("span",{children:"عجلة الحظ اليومية"})]})}),(0,a.jsx)(u.Wu,{className:"text-sm text-gray-600",children:"قريباً: ميزة عجلة الحظ اليومية لكسب رصيد مجاني."})]}),(0,a.jsxs)(u.Zp,{className:"rounded-2xl shadow-lg border-[#E5E7EB] overflow-hidden",children:[(0,a.jsx)(u.aR,{className:"pb-2",children:(0,a.jsxs)(u.ZB,{className:"flex items-center gap-2 text-right",children:[(0,a.jsx)("div",{className:"w-10 h-10 rounded-xl bg-[#FFF4EA] flex items-center justify-center",children:(0,a.jsx)(L.A,{className:"h-5 w-5 text-[#FF9933]"})}),(0,a.jsx)("span",{children:"دعوة الأصدقاء"})]})}),(0,a.jsxs)(u.Wu,{className:"space-y-4",children:[A?(0,a.jsxs)("div",{className:"text-center py-8",children:[(0,a.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-2 border-[#FF9933] border-t-transparent mx-auto"}),(0,a.jsx)("p",{className:"text-sm text-gray-500 mt-2",children:"جاري تحميل رابط الدعوة..."})]}):m?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"bg-[#F9FAFB] p-4 rounded-xl text-sm break-all border border-[#E5E7EB] font-mono",children:m}),(0,a.jsxs)("div",{className:"flex gap-3 flex-wrap",children:[(0,a.jsx)(f.$,{className:"bg-[#FF9933] hover:bg-[#E6801A] text-white rounded-xl",onClick:()=>P.J.shareReferralLink(m),children:"مشاركة الرابط"}),(0,a.jsxs)(f.$,{variant:"outline",className:"rounded-xl border-[#E5E7EB]",onClick:ei,children:[(0,a.jsx)(D.A,{className:"h-4 w-4 ml-2"}),"تحديث"]})]})]}):(0,a.jsx)(f.$,{className:"bg-[#FF9933] hover:bg-[#E6801A] text-white rounded-xl",onClick:ei,children:"تحميل رابط الدعوة"}),g&&(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4 pt-4 border-t border-[#E5E7EB]",children:[(0,a.jsxs)("div",{className:"bg-[#F9FAFB] p-4 rounded-xl border border-[#E5E7EB]",children:[(0,a.jsx)("p",{className:"text-xs text-gray-500 mb-1",children:"النقرات"}),(0,a.jsx)("p",{className:"text-lg font-bold text-[#111827]",children:null!=(e=g.totalClicks)?e:0})]}),(0,a.jsxs)("div",{className:"bg-[#F9FAFB] p-4 rounded-xl border border-[#E5E7EB]",children:[(0,a.jsx)("p",{className:"text-xs text-gray-500 mb-1",children:"التسجيلات"}),(0,a.jsx)("p",{className:"text-lg font-bold text-[#111827]",children:null!=(t=g.totalSignups)?t:0})]}),(0,a.jsxs)("div",{className:"bg-[#F9FAFB] p-4 rounded-xl border border-[#E5E7EB]",children:[(0,a.jsx)("p",{className:"text-xs text-gray-500 mb-1",children:"الرصيد المكتسب"}),(0,a.jsx)("p",{className:"text-lg font-bold text-[#FF9933]",children:null!=(s=g.totalEarned)?s:0})]}),(0,a.jsxs)("div",{className:"bg-[#F9FAFB] p-4 rounded-xl border border-[#E5E7EB]",children:[(0,a.jsx)("p",{className:"text-xs text-gray-500 mb-1",children:"معدل التحويل"}),(0,a.jsxs)("p",{className:"text-lg font-bold text-[#111827]",children:[null!=(r=g.conversionRate)?r:0,"%"]})]})]})]})]})]})}),(0,a.jsx)(h.av,{value:"requests",className:"mt-6",children:(0,a.jsxs)(u.Zp,{className:"rounded-2xl shadow-lg border-[#
1E5E7EB] overflow-hidden",children:[(0,a.jsx)(u.aR,{className:"pb-2",children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)(u.ZB,{className:"flex items-center gap-2 text-right",children:[(0,a.jsx)("div",{className:"w-10 h-10 rounded-xl bg-[#FFF4EA] flex items-center justify-center",children:(0,a.jsx)(I.A,{className:"h-5 w-5 text-[#FF9933]"})}),(0,a.jsx)("span",{children:"طلبات المحفظة"})]}),(0,a.jsxs)(f.$,{variant:"ghost",size:"sm",onClick:en,className:"rounded-xl text-gray-600 hover:bg-gray-100",children:[(0,a.jsx)(D.A,{className:"h-4 w-4 ml-2"}),"تحديث"]})]})}),(0,a.jsx)(u.Wu,{className:"space-y-6",children:w?(0,a.jsxs)("div",{className:"text-center py-12",children:[(0,a.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-2 border-[#FF9933] border-t-transparent mx-auto"}),(0,a.jsx)("p",{className:"text-sm text-gray-500 mt-2",children:"جاري تحميل الطلبات..."})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)("div",{className:"font-semibold text-sm text-gray-700",children:"طلبات الشحن"}),0===i.length?(0,a.jsx)("div",{className:"text-sm text-gray-500 py-4 px-4 bg-[#F9FAFB] rounded-xl",children:"لا توجد طلبات شحن"}):(0,a.jsx)("div",{className:"space-y-2",children:i.map(e=>(0,a.jsxs)("div",{className:"flex items-center justify-between p-4 rounded-xl border border-[#E5E7EB] bg-white hover:shadow-sm transition-shadow",children:[(0,a.jsxs)("div",{className:"text-right",children:[(0,a.jsx)("div",{className:"font-semibold text-[#111827]",children:K(e.amount,e.currency)}),(0,a.jsx)("div",{className:"text-xs text-gray-500 mt-0.5",children:new Date(e.created_at).toLocaleString("ar-SA")})]}),(0,a.jsx)("span",{className:"px-3 py-1 rounded-full text-xs font-medium ".concat(V(e.status)),children:e.status})]},e.id))})]}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)("div",{className:"font-semibold text-sm text-gray-700",children:"طلبات السحب"}),0===d.length?(0,a.jsx)("div",{className:"text-sm text-gray-500 py-4 px-4 bg-[#F9FAFB] rounded-xl",children:"لا توجد طلبات سحب"}):(0,a.jsx)("div",{className:"space-y-2",children:d.map(e=>(0,a.jsxs)("div",{className:"flex items-center justify-between p-4 rounded-xl border border-[#E5E7EB] bg-white hover:shadow-sm transition-shadow",children:[(0,a.jsxs)("div",{className:"text-right",children:[(0,a.jsx)("div",{className:"font-semibold text-[#111827]",children:K(e.amount,e.currency)}),(0,a.jsx)("div",{className:"text-xs text-gray-500 mt-0.5",children:new Date(e.created_at).toLocaleString("ar-SA")})]}),(0,a.jsx)("span",{className:"px-3 py-1 rounded-full text-xs font-medium ".concat(V(e.status)),children:e.status})]},e.id))})]})]})})]})})]}),(0,a.jsx)(O.lG,{open:C,onOpenChange:e=>{B(e),e||(Y("manual"),ee(null),Q(null))},children:(0,a.jsxs)(O.Cf,{className:"max-w-md rounded-2xl border-[#
1E5E7EB]",children:[(0,a.jsx)(O.c7,{className:"text-right",children:(0,a.jsx)(O.L3,{children:"شحن المحفظة"})}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-2 p-1 rounded-xl bg-[#F3F4F6]",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>Y("manual"),className:"flex items-center justify-center gap-2 rounded-lg py-2.5 text-sm font-semibold transition-colors ".concat("manual"===U?"bg-white text-[#FF9933] shadow-sm":"text-gray-600 hover:text-gray-900"),children:[(0,a.jsx)($.A,{className:"h-4 w-4"}),"تحويل يدوي"]}),(0,a.jsxs)("button",{type:"button",onClick:()=>Y("card"),className:"flex items-center justify-center gap-2 rounded-lg py-2.5 text-sm font-semibold transition-colors ".concat("card"===U?"bg-white text-[#FF9933] shadow-sm":"text-gray-600 hover:text-gray-900"),children:[(0,a.jsx)(X.A,{className:"h-4 w-4"}),"الدفع بالبطاقة (Visa)"]})]}),"card"===U?(0,a.jsxs)("div",{className:"space-y-4 mt-4",children:[(0,a.jsxs)("div",{className:"rounded-2xl border border-[#FF9933]/30 bg-[#FFF4EA] p-4 text-right",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 justify-end",children:[(0,a.jsx)("span",{className:"font-semibold text-[#2B241F]",children:"الدفع بـ فيزا أو ماستركارد"}),(0,a.jsx)(E.A,{className:"h-5 w-5 text-[#FF9933]"})]}),(0,a.jsx)("p",{className:"text-sm text-gray-600 mt-2",children:"اختر المبلغ أدناه. سيتم تحويلك إلى صفحة دفع آمنة (Stripe)، ويُضاف الرصيد إلى محفظتك فور إتمام الدفع."}),(0,a.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"الدفع بالبطاقة بالدولار الأمريكي (USD) فقط."})]}),H&&(0,a.jsx)("div",{className:"text-sm text-red-600 text-right bg-red-50 rounded-xl px-4 py-3",children:H}),(0,a.jsx)("div",{className:"grid grid-cols-2 gap-3",children:[10,20,50,100].map(e=>(0,a.jsx)(f.$,{disabled:null!==G,onClick:()=>ed(e),className:"bg-[#FF9933] hover:bg-[#E6801A] text-white rounded-xl font-semibold py-6 text-base disabled:opacity-60",children:G===e?(0,a.jsx)("span",{className:"animate-spin rounded-full h-5 w-5 border-2 border-white border-t-transparent"}):"$".concat(e," USD")},e))})]}):(0,a.jsxs)("div",{className:"space-y-4 mt-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(y.J,{className:"text-right block mb-2",children:"المبلغ"}),(0,a.jsx)(b.p,{type:"number",value:et.amount,onChange:e=>es({...et,amount:e.target.value}),className:"rounded-xl border-[#E5E7EB]"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(y.J,{className:"text-right block mb-2",children:"العملة"}),(0,a.jsx)(b.p,{value:et.currency,onChange:e=>es({...et,currency:e.target.value}),className:"rounded-xl border-[#E5E7EB]"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(y.J,{className:"text-right block mb-2",children:"طريقة الدفع"}),(0,a.jsx)(b.p,{value:et.paymentMethod,onChange:e=>es({...et,paymentMethod:e.target.value}),className:"rounded-xl border-[#E5E7EB]"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(y.J,{className:"text-right block mb-2",children:"رقم التأكيد"}),(0,a.jsx)(b.p,{value:et.confirmationCode,onChange:e=>es({...et,confirmationCode:e.target.value}),className:"rounded-xl border-[#E5E7EB]"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(y.J,{className:"text-right block mb-2",children:"رابط الإيصال (اختياري)"}),(0,a.jsx)(b.p,{value:et.receiptUrl,onChange:e=>es({...et,receiptUrl:e.target.value}),className:"rounded-xl border-[#E5E7EB]"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(y.J,{className:"text-right block mb-2",children:"ملاحظات (اختياري)"}),(0,a.jsx)(J.T,{value:et.notes,onChange:e=>es({...et,notes:e.target.value}),className:"rounded-xl border-[#E5E7EB]"})]}),(0,a.jsx)(f.$,{className:"w-full bg-[#FF9933] hover:bg-[#E6801A] text-white rounded-xl font-semibold py-6",onClick:ec,children:"إرسال الطلب"})]})]})}),(0,a.jsx)(O.lG,{open:k,onOpenChange:_,children:(0,a.jsxs)(O.Cf,{className:"max-w-md rounded-2xl border-[#
1E5E7EB]",children:[(0,a.jsx)(O.c7,{className:"text-right",children:(0,a.jsx)(O.L3,{children:"طلب سحب الرصيد"})}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(y.J,{className:"text-right block mb-2",children:"المبلغ"}),(0,a.jsx)(b.p,{type:"number",value:ea.amount,onChange:e=>er({...ea,amount:e.target.value}),className:"rounded-xl border-[#E5E7EB]"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(y.J,{className:"text-right block mb-2",children:"العملة"}),(0,a.jsx)(b.p,{value:ea.currency,onChange:e=>er({...ea,currency:e.target.value}),className:"rounded-xl border-[#E5E7EB]"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(y.J,{className:"text-right block mb-2",children:"طريقة الاستلام"}),(0,a.jsx)(b.p,{value:ea.paymentMethod,onChange:e=>er({...ea,paymentMethod:e.target.value}),className:"rounded-xl border-[#E5E7EB]"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(y.J,{className:"text-right block mb-2",children:"الحساب المستلم"}),(0,a.jsx)(b.p,{value:ea.recipientAccount,onChange:e=>er({...ea,recipientAccount:e.target.value}),className:"rounded-xl border-[#E5E7EB]"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(y.J,{className:"text-right block mb-2",children:"ملاحظات (اختياري)"}),(0,a.jsx)(J.T,{value:ea.notes,onChange:e=>er({...ea,notes:e.target.value}),className:"rounded-xl border-[#E5E7EB]"})]}),(0,a.jsx)(f.$,{className:"w-full bg-[#FF9933] hover:bg-[#E6801A] text-white rounded-xl font-semibold py-6",onClick:eo,children:"إرسال الطلب"})]})]})})]})};var G=s(91978),Q=s(62910),H=s(20710),ee=s(498),et=s(45884),es=s(99652),ea=s(11711),er=s(3609),el=s(5612),en=s(70801),ei=s(96108),ec=s(69518),ed=s(48100),eo=s(71449),ex=s(50526);let em=()=>{var e,t,s,r;let l=(0,x.useRouter)(),n=(0,g.A)(),[i,c]=(0,o.useState)(!1),[d,y]=(0,o.useState)(null),[w,E]=(0,o.useState)(null),[F,A]=(0,o.useState)(!1);if(!n)return null;let{user:S,isAuthenticated:C,userType:B,loading:k}=n;if(!k&&!C)return l.push("/auth"),null;if(!k&&C&&"vendor"===B)return l.push("/vendor-portal/dashboard"),null;let _=(0,o.useMemo)(()=>{let e=l.query.tab;return"orders"===e||"addresses"===e||"wallet"===e||"settings"===e?e:"profile"},[l.query.tab]),{data:T,isLoading:J,error:O,refetch:W}=(0,j.Z)({queryKey:["customer-orders",null==S?void 0:S.id],queryFn:()=>v.Ek.getCustomerOrders((null==S?void 0:S.id)||""),enabled:!!(null==S?void 0:S.id)}),R=(null==T?void 0:T.orders)||[],[M,Z]=(0,o.useState)("all"),$="all"===M?R:R.filter(e=>e.status===M),z=e=>{switch(e){case"pending":return"قيد الانتظار";case"confirmed":return"مؤكد";case"preparing":return"قيد التحضير";case"ready_for_pickup":return"جاهز للاستلام";case"out_for_delivery":return"في الطريق";case"delivered":return"تم التسليم";case"cancelled":return"ملغي";case"refunded":return"مسترد";default:return e}},L=async(e,t)=>{if(window.confirm((0,ex.ak)(t)))try{await v.Ek.cancelOrder(e),(0,N.oR)({title:"تم إلغاء الطلب",description:"تم الإلغاء بنجاح. إن دفعت بالمحفظة، راجع سجل المحفظة."}),W()}catch(e){(0,N.oR)({title:"تعذّر الإلغاء",description:e instanceof Error?e.message:"حاول مرة أخرى",variant:"destructive"})}},D=async()=>{if(null==S?void 0:S.id)try{A(!0);let[e,t]=await Promise.all([P.J.generateReferralLink(),P.J.getReferralStats()]);y(e),E(t)}catch(e){console.error("Error loading referral:",e)}finally{A(!1)}},I=async()=>{if(d)try{await navigator.clipboard.writeText(d),(0,N.oR)({title:"تم النسخ",description:"تم نسخ رابط الدعوة إلى الحافظة"})}catch(e){(0,N.oR)({title:"خطأ",description:"فشل نسخ الرابط",variant:"destructive"})}};return(0,o.useEffect)(()=>{(null==S?void 0:S.id)&&D()},[null==S?void 0:S.id]),(0,a.jsxs)("div",{className:"min-h-screen bg-[#F9FAFB]",children:[(0,a.jsx)(m.A,{}),(0,a.jsxs)("div",{className:"container mx-auto px-4 py-8 max-w-4xl",children:[(0,a.jsxs)("div",{className:"mb-6 text-right",children:[(0,a.jsx)("h1",{className:"text-2xl sm:text-3xl font-bold text-gray-900",children:"حسابي"}),(0,a.jsx)("p",{className:"text-gray-600 mt-1",children:"إدارة حسابك والطلبات والعناوين"})]}),(0,a.jsxs)(h.tU,{defaultValue:_,className:"w-full",children:[(0,a.jsxs)(h.j7,{className:"w-full justify-between flex-wrap h-auto p-1.5 rounded-xl bg-[#F3F4F6] gap-1 mb-6",children:[(0,a.jsx)(h.Xi,{value:"profile",className:"rounded-lg px-4 py-2.5 data-[state=active]:bg-white data-[state=active]:text-[#FF9933] data-[state=active]:shadow-sm",children:"الملف الشخصي"}),(0,a.jsx)(h.Xi,{value:"orders",className:"rounded-lg px-4 py-2.5 data-[state=active]:bg-white data-[state=active]:text-[#FF9933] data-[state=active]:shadow-sm",children:"طلباتي"}),(0,a.jsx)(h.Xi,{value:"addresses",className:"rounded-lg px-4 py-2.5 data-[state=active]:bg-white data-[state=active]:text-[#FF9933] data-[state=active]:shadow-sm",children:"العناوين"}),(0,a.jsx)(h.Xi,{value:"wallet",className:"rounded-lg px-4 py-2.5 data-[state=active]:bg-white data-[state=active]:text-[#FF9933] data-[state=active]:shadow-sm",children:"المحفظة"}),(0,a.jsx)(h.Xi,{value:"settings",className:"rounded-lg px-4 py-2.5 data-[state=active]:bg-white data-[state=active]:text-[#FF9933] data-[state=active]:shadow-sm",children:"الإعدادات"})]}),(0,a.jsx)(h.av,{value:"profile",children:(0,a.jsx)(q,{})}),(0,a.jsxs)(h.av,{value:"orders",children:[(0,a.jsx)("div",{className:"flex flex-wrap gap-2 mb-6",children:["all","pending","confirmed","preparing","ready_for_pickup","out_for_delivery","delivered","cancelled"].map(e=>(0,a.jsx)(f.$,{variant:M===e?"default":"outline",size:"sm",onClick:()=>
1Z(e),className:M===e?"bg-[#FF9933] hover:bg-[#E6801A] rounded-xl":"rounded-xl border-[#E5E7EB]",children:"all"===e?"الكل":z(e)},e))}),J?(0,a.jsxs)("div",{className:"text-center py-16",children:[(0,a.jsx)("div",{className:"animate-spin rounded-full h-12 w-12 border-2 border-[#FF9933] border-t-transparent mx-auto mb-4"}),(0,a.jsx)("p",{className:"text-gray-600",children:"جاري تحميل الطلبات..."})]}):O?(0,a.jsx)(u.Zp,{className:"rounded-2xl shadow-lg border-[#E5E7EB]",children:(0,a.jsx)(u.Wu,{className:"p-6 text-center text-red-600",children:"حدث خطأ أثناء تحميل الطلبات"})}):0===$.length?(0,a.jsx)(u.Zp,{className:"rounded-2xl shadow-lg border-[#E5E7EB] overflow-hidden",children:(0,a.jsxs)(u.Wu,{className:"p-12 text-center",children:[(0,a.jsx)("div",{className:"w-20 h-20 rounded-2xl bg-[#F3F4F6] flex items-center justify-center mx-auto mb-4",children:(0,a.jsx)(et.A,{className:"h-10 w-10 text-gray-400"})}),(0,a.jsx)("h3",{className:"text-lg font-semibold text-gray-900 mb-2",children:"لا توجد طلبات"}),(0,a.jsx)("p",{className:"text-gray-600",children:"لم تقم بأي طلبات بعد."})]})}):(0,a.jsx)("div",{className:"space-y-6",children:$.map(e=>{var t,s,r,n;return(0,a.jsxs)(u.Zp,{className:"overflow-hidden cursor-pointer rounded-2xl shadow-lg border-[#
1E5E7EB] hover:shadow-xl transition-all duration-200",onClick:()=>l.push("/orders/".concat(e.id)),children:[(0,a.jsxs)("div",{className:"bg-white border-b border-[#E5E7EB] p-4 sm:p-5 flex justify-between items-start",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"font-semibold",children:["طلب رقم #",e.id.slice(-8)]}),(0,a.jsx)("div",{className:"text-sm text-gray-500",children:new Date(e.created_at).toLocaleDateString("ar-SA",{year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit"})})]}),(0,a.jsxs)("div",{className:"flex flex-col items-end gap-2",children:[(0,a.jsxs)(p.E,{className:"".concat((e=>{switch(e){case"pending":return"bg-yellow-100 text-yellow-800";case"confirmed":return"bg-blue-100 text-blue-800";case"preparing":return"bg-orange-100 text-orange-800";case"ready_for_pickup":return"bg-purple-100 text-purple-800";case"out_for_delivery":return"bg-indigo-100 text-indigo-800";case"delivered":return"bg-green-100 text-green-800";case"cancelled":return"bg-red-100 text-red-800";default:return"bg-gray-100 text-gray-800"}})(e.status)," flex items-center gap-1"),children:[(e=>{switch(e){case"pending":return(0,a.jsx)(H.A,{className:"h-4 w-4"});case"confirmed":case"delivered":return(0,a.jsx)(ee.A,{className:"h-4 w-4"});case"preparing":default:return(0,a.jsx)(et.A,{className:"h-4 w-4"});case"ready_for_pickup":return(0,a.jsx)(es.A,{className:"h-4 w-4"});case"out_for_delivery":return(0,a.jsx)(ea.A,{className:"h-4 w-4"});case"cancelled":case"refunded":return(0,a.jsx)(er.A,{className:"h-4 w-4"})}})(e.status),z(e.status)]}),"delivered"===e.status&&e.delivery_proof_url&&(0,a.jsx)(Q.A,{deliveryProofUrl:e.delivery_proof_url,orderId:e.id})]})]}),(0,a.jsx)(u.Wu,{className:"p-6",children:(0,a.jsxs)("div",{className:"grid md:grid-cols-2 gap-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:"font-semibold text-gray-900 mb-3",children:"المنتجات"}),(0,a.jsx)("div",{className:"space-y-3",children:null==(t=e.order_items)?void 0:t.map((t,s)=>{var r,l;return(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(null==(r=t.product_snapshot)?void 0:r.image_url)&&(0,a.jsx)("img",{src:t.product_snapshot.image_url,alt:t.product_snapshot.name,className:"w-12 h-12 object-cover rounded-xl"}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("p",{className:"font-medium text-sm",children:null==(l=t.product_snapshot)?void 0:l.name}),(0,a.jsxs)("p",{className:"text-xs text-gray-500",children:["الكمية: ",t.quantity," \xd7 ",t.unit_price," ",e.currency]})]}),(0,a.jsxs)("p",{className:"font-semibold text-sm",children:[t.total_price," ",e.currency]})]},s)})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:"font-semibold text-gray-900 mb-3",children:"تفاصيل الطلب"}),(0,a.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"text-gray-600",children:"المجموع:"}),(0,a.jsxs)("span",{className:"font-semibold",children:[e.total_amount," ",e.currency]})]}),(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"text-gray-600",children:"طريقة الدفع:"}),(0,a.jsx)("span",{children:e.payment_method})]}),e.payment_receipt&&(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"text-gray-600",children:"رقم الإيصال:"}),(0,a.jsx)("span",{className:"font-mono text-xs",children:e.payment_receipt})]}),e.delivery_requested&&(0,a.jsxs)("div",{className:"mt-3 pt-3 border-t",children:[(0,a.jsx)("p",{className:"text-gray-600 mb-1",children:"عنوان التسليم:"}),(0,a.jsxs)("p",{className:"text-sm",children:[null==(s=e.delivery_address)?void 0:s.street,", ",null==(r=e.delivery_address)?void 0:r.city,", ",null==(n=e.delivery_address)?void 0:n.country]})]}),(0,ex.bh)(e.status)&&(0,a.jsx)("div",{className:"mt-3 pt-3 border-t border-[#E5E7EB]",children:(0,a.jsx)(f.$,{variant:"destructive",className:"rounded-xl",onClick:()=>L(e.id,e.payment_method),children:"إلغاء الطلب"})})]})]})]})})]},e.id)})})]}),(0,a.jsx)(h.av,{value:"addresses",children:(0,a.jsx)(U.A,{})}),(0,a.jsx)(h.av,{value:"wallet",children:(0,a.jsx)(Y,{})}),(0,a.jsxs)(h.av,{value:"settings",children:[(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsx)(u.Zp,{className:"rounded-2xl shadow-lg border-[#
1E5E7EB] overflow-hidden",children:(0,a.jsxs)(u.Wu,{className:"p-6 space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:"w-10 h-10 rounded-full bg-[#16A34A]/20 flex items-center justify-center",children:(0,a.jsx)(el.A,{className:"h-5 w-5 text-[#16A34A]"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"font-semibold text-[#111827]",children:"دعوة الأصدقاء"}),(0,a.jsx)("p",{className:"text-sm text-gray-600",children:"شارك رابطك واحصل على رصيد مجاني عند تسجيل أصدقائك"})]})]}),F?(0,a.jsx)("div",{className:"text-center py-4",children:(0,a.jsx)("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-[#FF8524] mx-auto"})}):d?(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-medium text-[#374151] mb-2",children:"رابط الدعوة الخاص بك:"}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(b.p,{value:d,readOnly:!0,className:"flex-1 bg-[#F9FAFB] text-sm border-[#
1E5E7EB] rounded-xl"}),(0,a.jsx)(f.$,{variant:"outline",size:"icon",onClick:I,title:"نسخ الرابط",className:"border-[#E5E7EB] rounded-xl",children:(0,a.jsx)(en.A,{className:"h-4 w-4"})}),(0,a.jsxs)(f.$,{onClick:()=>P.J.shareReferralLink(d),className:"bg-[#FF9933] hover:bg-[#E6801A] text-white rounded-xl",children:[(0,a.jsx)(el.A,{className:"h-4 w-4 ml-2"}),"مشاركة الرابط"]})]})]}),w&&(0,a.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 pt-4 border-t border-[#E5E7EB]",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs text-gray-500 mb-1",children:"النقرات"}),(0,a.jsx)("p",{className:"text-lg font-semibold text-[#111827]",children:null!=(e=w.totalClicks)?e:0})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs text-gray-500 mb-1",children:"التسجيلات"}),(0,a.jsx)("p",{className:"text-lg font-semibold text-[#111827]",children:null!=(t=w.totalSignups)?t:0})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs text-gray-500 mb-1",children:"الرصيد المكتسب"}),(0,a.jsx)("p",{className:"text-lg font-semibold text-[#16A34A]",children:null!=(s=w.totalEarned)?s:0})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs text-gray-500 mb-1",children:"معدل التحويل"}),(0,a.jsxs)("p",{className:"text-lg font-semibold text-[#111827]",children:[null!=(r=w.conversionRate)?r:0,"%"]})]})]}),(0,a.jsxs)("div",{className:"rounded-xl bg-[#EFF6FF] border border-[#BFDBFE] p-4 space-y-3",children:[(0,a.jsx)("p",{className:"font-semibold text-[#2563EB] text-center",children:"كيفية الحصول على رصيد مجاني"}),(0,a.jsxs)("ol",{className:"text-sm text-[#374151] space-y-2 list-decimal list-inside",children:[(0,a.jsx)("li",{children:"شارك رابطك مع الأصدقاء"}),(0,a.jsx)("li",{children:"اطلب منهم التسوق من الموقع أو تحميل التطبيق"}),(0,a.jsx)("li",{children:"اطلب منهم إنشاء حساب جديد"}),(0,a.jsx)("li",{children:"احصل على رصيد مجاني في محفظتك!"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 rounded-lg bg-[#DCFCE7] border border-[#86EFAC] p-3",children:[(0,a.jsx)("span",{className:"text-[#16A34A] text-lg",children:"✓"}),(0,a.jsx)("p",{className:"text-sm font-medium text-[#166534]",children:"الرصيد سيظهر في محفظتك فور تسجيل صديقك"})]})]})]}):(0,a.jsx)(f.$,{onClick:D,className:"bg-[#FF9933] hover:bg-[#E6801A] text-white rounded-xl",children:"تحميل رابط الدعوة"})]})}
1),(0,a.jsx)(u.Zp,{className:"rounded-2xl shadow-lg border-[#E5E7EB] overflow-hidden cursor-pointer hover:shadow-xl transition-shadow",onClick:()=>l.push("/affiliate"),children:(0,a.jsxs)(u.Wu,{className:"p-6 flex items-center justify-between",children:[(0,a.jsx)(ei.A,{className:"h-5 w-5 text-gray-400 flex-shrink-0"}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsxs)("div",{className:"text-right",children:[(0,a.jsx)("h3",{className:"font-semibold text-gray-900",children:"برنامج المسوّقين"}),(0,a.jsx)("p",{className:"text-sm text-gray-600 mt-0.5",children:"انضم وشارك روابط واكسب عمولة على كل طلب"})]}),(0,a.jsx)("div",{className:"w-10 h-10 rounded-xl bg-[#FFF4EA] flex items-center justify-center flex-shrink-0",children:(0,a.jsx)(ec.A,{className:"h-5 w-5 text-[#FF9933]"})})]})]})}),(0,a.jsx)(u.Zp,{className:"rounded-2xl shadow-lg border-[#E5E7EB] overflow-hidden cursor-pointer hover:shadow-xl transition-shadow",onClick:()=>l.push("/affiliate/commissions"),children:(0,a.jsxs)(u.Wu,{className:"p-6 flex items-center justify-between",children:[(0,a.jsx)(ei.A,{className:"h-5 w-5 text-gray-400 flex-shrink-0"}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsxs)("div",{className:"text-right",children:[(0,a.jsx)("h3",{className:"font-semibold text-gray-900",children:"سجل عمولاتي"}),(0,a.jsx)("p",{className:"text-sm text-gray-600 mt-0.5",children:"تابع عمولاتك ورصيدها في المحفظة"})]}),(0,a.jsx)("div",{className:"w-10 h-10 rounded-xl bg-[#FFF4EA] flex items-center justify-center flex-shrink-0",children:(0,a.jsx)(ed.A,{className:"h-5 w-5 text-[#FF9933]"})})]})]})}
1),(0,a.jsx)(u.Zp,{className:"rounded-2xl shadow-lg border-[#E5E7EB] overflow-hidden",children:(0,a.jsxs)(u.Wu,{className:"p-6 space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"w-10 h-10 rounded-xl bg-[#FFF4EA] flex items-center justify-center",children:(0,a.jsx)(eo.A,{className:"h-5 w-5 text-[#FF9933]"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"font-semibold text-gray-900",children:"إعدادات الحساب"}),(0,a.jsx)("p",{className:"text-sm text-gray-600 mt-0.5",children:"يمكنك حذف حسابك نهائياً من هنا. هذا الإجراء لا يمكن التراجع عنه."})]})]}),(0,a.jsx)(f.$,{variant:"destructive",className:"rounded-xl",onClick:()=>c(!0),children:"حذف الحساب"})]})})]}),(0,a.jsx)(G.A,{isOpen:i,onOpenChange:c})]})]})]})]})};var eh=s(48085),eu=s(39094),ep=s(77328),eg=s.n(ep);let ej="force-dynamic";function ev(){return(0,a.jsxs)(d.t,{children:[(0,a.jsxs)(eg(),{children:[(0,a.jsx)("title",{children:"حسابي - شاهين"}),(0,a.jsx)("meta",{name:"description",content:"إدارة حسابك على منصة شاهين"}),(0,a.jsx)("meta",{property:"og:title",content:"حسابي - شاهين"}),(0,a.jsx)("meta",{property:"og:description",content:"إدارة حسابك على منصة شاهين"}),(0,a.jsx)("meta",{property:"og:type",content:"website"}),(0,a.jsx)("meta",{property:"og:image",content:"/lovable-uploads/icon.png"}),(0,a.jsx)("meta",{name:"twitter:card",content:"summary_large_image"}),(0,a.jsx)("meta",{name:"twitter:title",content:"حسابي - شاهين"}),(0,a.jsx)("meta",{name:"twitter:description",content:"إدارة حسابك على منصة شاهين"}),(0,a.jsx)("meta",{name:"twitter:image",content:"/lovable-uploads/icon.png"})]}),(0,a.jsx)(n.Bc,{children:(0,a.jsxs)(i.e,{children:[(0,a.jsx)(eh.y,{}),(0,a.jsx)(r.l,{}),(0,a.jsx)(l.l,{}),(0,a.jsx)(c.t,{children:(0,a.jsx)(eu.M,{children:(0,a.jsx)(em,{})})})]})})]})}},50526:(e,t,s)=>{"use strict";function a(e){return String(null!=e?e:"").toLowerCase().trim()}function r(e){return"pending"===a(e)}function l(e){let t="هل أنت متأكد من إلغاء هذا الطلب؟";return"wallet"===a(e)?"".concat(t,"\n\n")+"إذا وُجد خصم من المحفظة لهذا الطلب، يُعاد المبلغ عادةً إلى محفظتك بعد نجاح الإلغاء. راجع تبويب \xabالمحفظة\xbb وسجل العمليات للتأكد.":t}s.d(t,{ak:()=>l,bh:()=>r})},62910:(e,t,s)=>{"use strict";s.d(t,{A:()=>x});var a=s(37876),r=s(14232),l=s(92161),n=s(77041),i=s(65682),c=s(42341),d=s(18465),o=s(98737);let x=e=>{let{deliveryProofUrl:t,orderId:s}=e,[x,m]=(0,r.useState)(!0),[h,u]=(0,r.useState)(!1),[p,g]=(0,r.useState)(!1),j=(0,o.pk)(t,"full");return(0,a.jsxs)(l.lG,{open:p,onOpenChange:g,children:[(0,a.jsx)(l.zM,{asChild:!0,children:(0,a.jsxs)(n.$,{variant:"outline",size:"sm",className:"flex items-center gap-2",children:[(0,a.jsx)(c.A,{className:"h-4 w-4"}),"عرض إثبات التسليم"]})}),(0,a.jsxs)(l.Cf,{className:"max-w-3xl",children:[(0,a.jsx)(l.c7,{children:(0,a.jsxs)(l.L3,{className:"flex items-center justify-between",children:[(0,a.jsxs)("span",{children:["إثبات التسليم - طلب #",s.slice(-8)]}),(0,a.jsxs)(i.E,{variant:"secondary",className:"bg-green-100 text-green-800",children:[(0,a.jsx)(d.A,{className:"h-3 w-3 mr-1"}),"تم التسليم"]})]})}),(0,a.jsxs)("div",{className:"relative",children:[x&&(0,a.jsx)("div",{className:"aspect-video bg-gray-100 rounded-lg flex items-center justify-center",children:(0,a.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-marketplace-primary"})}),h?(0,a.jsxs)("div",{className:"aspect-video bg-gray-100 rounded-lg flex flex-col items-center justify-center text-gray-500",children:[(0,a.jsx)(d.A,{className:"h-12 w-12 mb-2"}),(0,a.jsx)("p",{children:"تعذر تحميل صورة إثبات التسليم"})]}):(0,a.jsx)("img",{src:j,alt:"إثبات التسليم - طلب ".concat(s),className:"w-full rounded-lg shadow-lg transition-opacity duration-300 ".concat(x?"opacity-0":"opacity-100"),onLoad:()=>{m(!1)},onError:()=>{m(!1),u(!0)},loading:"lazy"})]}),(0,a.jsx)("div",{className:"text-sm text-gray-600 text-center",children:"هذه الصورة تم التقاطها عند تسليم الطلب كإثبات على وصول المنتجات بحالة جيدة"})]})]})}},65084:(e,t,s)=>{"use strict";s.d(t,{Z:()=>n});var a=s(91196);let r={products:{staleTime:3e5,gcTime:9e5},categories:{staleTime:6e5,gcTime:18e5},vendors:{staleTime:3e5,gcTime:9e5},specialOffers:{staleTime:12e4,gcTime:6e5},favorites:{staleTime:6e4,gcTime:3e5},userData:{staleTime:3e4,gcTime:12e4},videoMetadata:{staleTime:6e5,gcTime:18e5},default:{staleTime:3e5,gcTime:9e5}},l=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";return r[e]||r.default},n=e=>{var t,s;let r={staleTime:3e5,gcTime:9e5};try{let t=e.cacheType||"default";r=l(t)}catch(e){console.warn("Error getting cache config, using default:",e)}let n=!1===e.enabled,{cacheType:i,...c}=e;return(0,a.I)({...c,staleTime:null!=(t=e.staleTime)?t:r.staleTime,gcTime:null!=(s=e.gcTime)?s:r.gcTime,retry:(e,t)=>t instanceof Error&&(t.message.includes("CORS")||t.message.includes("401")||t.message.includes("preflight"))?e<2:e<3,retryDelay:e=>Math.min(1e3*2**e,3e4),refetchOnWindowFocus:!1,refetchOnReconnect:!1,enabled:!n})}},89774:(e,t,s)=>{"use strict";s.d(t,{F:()=>l});var a=s(96575),r=s(94108);class l{static async getWalletBalance(){var e,t,s;let l=a.AuthService.getJwt();if(!l)throw Error("Authentication required. Please sign in to view wallet.");let n=await a.AuthService.getCurrentUserId();if(!n)throw Error("User not authenticated.");let i=await fetch("".concat((0,r.getEdgeFunctionsUrl)(),"/wallet-balance"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(l),apikey:(0,r.getSupabaseAnonKey)()},body:JSON.stringify({userId:n})});if(!i.ok){let e=await i.text();throw Error("Failed to fetch wallet balance: ".concat(i.status," ").concat(e))}let c=await i.json();if(!(null==c?void 0:c.success))throw Error((null==c?void 0:c.error)||"Failed to fetch wallet balance");return{wallet:c.wallet||(null==(e=c.data)?void 0:e.wallet)||{syp_balance:0,usd_balance:0,try_balance:0},preferredCurrency:c.preferredCurrency||(null==(t=c.data)?void 0:t.preferredCurrency)||"SYP",recentTransactions:c.recentTransactions||(null==(s=c.data)?void 0:s.recentTransactions)||[]}}static async createChargeRequest(e){let t=a.AuthService.getJwt();if(!t)throw Error("Authentication required. Please sign in to create a charge request.");let s=await a.AuthService.getCurrentUserId();if(!s)throw Error("User not authenticated.");let l=await fetch("".concat((0,r.getEdgeFunctionsUrl)(),"/wallet-charge-request"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(t),apikey:(0,r.getSupabaseAnonKey)()},body:JSON.stringify({userId:s,amount:e.amount,currency:e.currency,paymentMethod:e.paymentMethod,receiptUrl:e.receiptUrl,notes:e.notes,confirmationCode:e.confirmationCode})});if(!l.ok){let e=await l.text();throw Error("Failed to create charge request: ".concat(l.status," ").concat(e))}let n=await l.json();if(!(null==n?void 0:n.success))throw Error((null==n?void 0:n.error)||"Failed to create charge request");return n.request}static async createWithdrawRequest(e){let t=a.AuthService.getJwt();if(!t)throw Error("Authentication required. Please sign in to create a withdrawal request.");let s=await a.AuthService.getCurrentUserId();if(!s)throw Error("User not authenticated.");let l=await fetch("".concat((0,r.getEdgeFunctionsUrl)(),"/wallet-withdraw-request"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(t),apikey:(0,r.getSupabaseAnonKey)()},body:JSON.stringify({userId:s,amount:e.amount,currency:e.currency,paymentMethod:e.paymentMethod,recipientAccount:e.recipientAccount,notes:e.notes})});if(!l.ok){let e=await l.text();throw Error("Failed to create withdraw request: ".concat(l.status," ").concat(e))}let n=await l.json();if(!(null==n?void 0:n.success))throw Error((null==n?void 0:n.error)||"Failed to create withdraw request");return n.request}static async getChargeRequests(){let e=a.AuthService.getJwt();if(!e)throw Error("Authentication required. Please sign in to view charge requests.");let t=await a.AuthService.getCurrentUserId();if(!t)throw Error("User not authenticated.");let s=await fetch("".concat((0,r.getEdgeFunctionsUrl)(),"/wallet-charge-requests"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(e),apikey:(0,r.getSupabaseAnonKey)()},body:JSON.stringify({userId:t})});if(!s.ok){let e=await s.text();throw Error("Failed to fetch charge requests: ".concat(s.status," ").concat(e))}let l=await s.json();if(!(null==l?void 0:l.success))throw Error((null==l?void 0:l.error)||"Failed to fetch charge requests");return l.data||[]}static async applyWalletToOrder(e){var t,s,l,n;let i=a.AuthService.getJwt();if(!i)throw Error("Authentication required.");let c=await a.AuthService.getCurrentUserId();if(!c)throw Error("User not authenticated.");let d=await fetch("".concat((0,r.getEdgeFunctionsUrl)(),"/wallet-apply"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(i),apikey:(0,r.getSupabaseAnonKey)()},body:JSON.stringify({userId:c,orderId:e.orderId,currency:e.currency,subtotal:e.subtotal,deliveryFee:null!=(t=e.deliveryFee)?t:0,couponsAppliedTotal:null!=(s=e.couponsAppliedTotal)?s:0,ruleCode:null!=(l=e.ruleCode)?l:"default",requestAmount:e.requestAmount})});if(!d.ok){let e=await d.text();throw Error("Wallet apply failed: ".concat(d.status," ").concat(e))}let o=await d.json();return(null==o?void 0:o.success)?{amount:null!=(n=o.amount)?n:0,success:!0}:null}static async applyWalletMulti(e){if(0===e.deductions.length)return!1;let t=a.AuthService.getJwt();if(!t)throw Error("Authentication required.");let s=await a.AuthService.getCurrentUserId();if(!s)throw Error("User not authenticated.");let l=e.deductions.filter(e=>e.amount>0);if(0===l.length)return!1;let n=await fetch("".concat((0,r.getEdgeFunctionsUrl)(),"/wallet-apply-multi"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(t),apikey:(0,r.getSupabaseAnonKey)()},body:JSON.stringify({userId:s,orderId:e.orderId,deductions:l})});if(!n.ok){let e=await n.text();throw Error("Wallet apply-multi failed: ".concat(n.status," ").concat(e))}let i=await n.json();return(null==i?void 0:i.success)===!0}static async getStripeWalletPaymentUrl(e){if(![10,20,50,100].includes(e))throw Error("المبلغ غير صالح. اختر أحد المبالغ: 10، 20، 50، 100");let t=a.AuthService.getJwt();if(!t)throw Error("يجب تسجيل الدخول لاستخدام الدفع بالبطاقة.");let s=await fetch("".concat((0,r.getEdgeFunctionsUrl)(),"/wallet-payment-links?amount=").concat(e),{method:"GET",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(t),apikey:(0,r.getSupabaseAnonKey)()}});if(!s.ok){let e=await s.text();throw Error("Failed to fetch payment link: ".concat(s.status," ").concat(e))}let l=await s.json(),n=null==l?void 0:l.url;if(!n||"string"!=typeof n)throw Error("تعذّر الحصول على رابط الدفع. حاول مرة أخرى.");return n}static async getWithdrawRequests(){let e=a.AuthService.getJwt();if(!e)throw Error("Authentication required. Please sign in to view withdraw requests.");let t=await a.AuthService.getCurrentUserId();if(!t)throw Error("User not authenticated.");let s=await fetch("".concat((0,r.getEdgeFunctionsUrl)(),"/wallet-withdraw-requests"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(e),apikey:(0,r.getSupabaseAnonKey)()},body:JSON.stringify({userId:t})});if(!s.ok){let e=await s.text();throw Error("Failed to fetch withdraw requests: ".concat(s.status," ").concat(e))}let l=await s.json();if(!(null==l?void 0:l.success))throw Error((null==l?void 0:l.error)||"Failed to fetch withdraw requests");return l.data||[]}}},98737:(e,t,s)=>{"use strict";s.d(t,{DD:()=>l,NN:()=>i,QC:()=>r,U$:()=>n,pk:()=>c,ue:()=>a});let a=()=>"/lovable-uploads/a321abf8-1dfc-42a4-8901-db2b1d1a203c.png",r=()=>"/lovable-uploads/a321abf8-1dfc-42a4-8901-db2b1d1a203c.png",l=()=>"/lovable-uploads/storelogo.png",n=()=>"https://images.unsplash.com/photo-1560472354-b33ff0c44a43?w=400&h=400&fit=crop&crop=center&auto=format",i=e=>
1new Promise(t=>{let s=new Image;s.onload=()=>t(!0),s.onerror=()=>t(!1),s.src=e}),c=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"medium";return e?e.includes("supabase.co/storage/v1/object/public/")?e+({thumbnail:"?width=300&height=200&resize=cover",medium:"?width=800&height=600&resize=contain",full:""})[t]:e:""}}},e=>{e.O(0,[1987,681,3740,633,7224,3595,6514,3058,1196,1144,445,5910,9958,5462,3909,5682,4894,2013,345,9398,636,6593,8792],()=>e(e.s=8172)),_N_E=e.O()}]);

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.