1"use strict";(globalThis.webpackChunkreact_ts=globalThis.webpackChunkreact_ts||[]).push([[9949],{54045(e,s,a){a.d(s,{A:()=>u});var t=a(5544),l=a(9950),r=a(15924),n=a(42461),i=a(10300),d=a(12810),c=a(96479),o=a(44414);const m=e=>{let s=e.professional,a=e.contractId,m=e.jobId,x=e.onClose;const u=(0,i.wA)(),h=(0,i.d4)(e=>e.auth.user),p=(0,l.useState)("off_platform_activity"),b=(0,t.A)(p,2),y=b[0],j=b[1],N=(0,l.useState)(""),g=(0,t.A)(N,2),f=g[0],v=g[1],w=(0,l.useState)(!1),A=(0,t.A)(w,2),k=A[0],C=A[1];return(0,o.jsx)("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm z-50 flex items-center justify-center p-4",children:(0,o.jsxs)("div",{className:"bg-white rounded-xl max-w-md w-full shadow-2xl",children:[(0,o.jsxs)("div",{className:"p-6 border-b flex items-center justify-between",children:[(0,o.jsxs)("div",{className:"flex items-center gap-2",children:[(0,o.jsx)(r.A,{className:"h-5 w-5 text-red-600"}),(0,o.jsx)("h2",{className:"text-xl font-semibold",children:"Report Professional"})]}),(0,o.jsx)("button",{onClick:x,className:"p-2 hover:bg-gray-100 rounded-full transition-colors",children:(0,o.jsx)(c.A,{className:"h-5 w-5"})})]}),(0,o.jsxs)("div",{className:"p-6 space-y-4",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Professional"}),(0,o.jsxs)("div",{className:"p-3 bg-gray-50 rounded-lg",children:[(0,o.jsxs)("p",{className:"font-medium",children:[s.firstName," ",s.lastName]}),(0,o.jsx)("p",{className:"text-sm text-gray-600",children:s.email})]})]}),(0,o.jsxs)("div",{children:[(0,o.jsxs)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:["Report Type ",(0,o.jsx)("span",{className:"text-red-600",children:"*"})]}),(0,o.jsxs)("select",{value:y,onChange:e=>j(e.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:[(0,o.jsx)("option",{value:"off_platform_activity",children:"Off-Platform Activity"}),(0,o.jsx)("option",{value:"contact_sharing",children:"Contact Sharing / External Contact"}),(0,o.jsx)("option",{value:"poor_service",children:"Poor Service Quality"}),(0,o.jsx)("option",{value:"no_show",children:"No Show / Didn't Appear"}),(0,o.jsx)("option",{value:"other",children:"Other Issue"})]})]}),(0,o.jsxs)("div",{children:[(0,o.jsxs)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:["Description ",(0,o.jsx)("span",{className:"text-red-600",children:"*"})]}),(0,o.jsx)("textarea",{value:f,onChange:e=>v(e.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent resize-none",rows:5,placeholder:"Please provide detailed information about the issue...",required:!0}),(0,o.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Minimum 20 characters"})]}),(0,o.jsx)("div",{className:"p-4 bg-yellow-50 border border-yellow-200 rounded-lg",children:(0,o.jsxs)("div",{className:"flex items-start gap-2",children:[(0,o.jsx)(r.A,{className:"h-5 w-5 text-yellow-600 mt-0.5 flex-shrink-0"}),(0,o.jsxs)("div",{className:"text-sm text-gray-700",children:[(0,o.jsx)("p",{className:"font-medium mb-1",children:"Important Notice"}),(0,o.jsxs)("ul",{className:"list-disc list-inside space-y-1 text-gray-600",children:[(0,o.jsx)("li",{children:"All reports are reviewed by our team"}),(0,o.jsx)("li",{children:"False reports may result in action against your account"}),(0,o.jsx)("li",{children:"This report will be logged and may affect the professional's standing"})]})]})]})})]}),(0,o.jsxs)("div",{className:"p-6 border-t bg-gray-50 rounded-b-xl flex gap-3",children:[(0,o.jsx)(n.$,{variant:"outline",onClick:x,className:"flex-1",disabled:k,children:"Cancel"}),(0,o.jsx)(n.$,{onClick:async()=>{if(f.trim()){C(!0);try{await u((0,d.LU)({professionalId:s.id||s._id,clientId:h.id,contractId:a,jobId:m,reportType:y,description:f})).unwrap(),x()}catch(e){console.error("Failed to submit report:",e)}finally{C(!1)}}},className:"flex-1 bg-red-600 hover:bg-red-700 text-white",disabled:k||f.trim().length<20,children:k?"Submitting...":"Submit Report"})]})]})})};var x=a(64767);const u=e=>{let s=e.professional,a=e.contractId,i=e.jobId,d=e.variant,c=void 0===d?"outline":d,u=e.size,h=void 0===u?"sm":u,p=e.className,b=void 0===p?"":p;const y=(0,x.Bd)().t,j=(0,l.useState)(!1),N=(0,t.A)(j,2),g=N[0],f=N[1];return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(n.$,{variant:c,size:h,onClick:()=>f(!0),className:`text-red-600 border-red-300 hover:bg-red-50 ${b}`,children:[(0,o.jsx)(r.A,{className:"h-4 w-4 mr-2"}),y("reportProfessionalButton.reportIssue")]}),g&&(0,o.jsx)(m,{professional:s,contractId:a,jobId:i,onClose:()=>f(!1)})]})}},16222(e,s,a){var t=a(5544),l=a(9950),r=a(54060),n=a(76429),i=a(50142),d=a(52828),c=a(42989),o=a(27255),m=a(7838),x=a(67637),u=a(96479),h=a(42461),p=a(60348),b=a(67590),y=a(84655),j=a(64767),N=a(44414);const g=e=>{var s;return"credit_note"===(null===(s=e.zohoMetadata)||void 0===s?void 0:s.type)||"credit_note"===e.invoiceType||(!(!e.invoiceNumber||!e.invoiceNumber.toUpperCase().includes("CN"))||!(!e.zohoInvoiceNumber||!e.zohoInvoiceNumber.toUpperCase().includes("CN")))},f=e=>{const s=e.amount||0,a=g(e)?-s:s;return`${(0,y.vO)()}${a.toFixed(2)}`},v=e=>{var s,a,y;let v=e.invoice,w=e.isOpen,A=e.onClose;const k=(0,j.Bd)().t,C=(0,l.useState)(""),S=(0,t.A)(C,2),M=S[0],F=S[1],P=(0,l.useState)(!1),E=(0,t.A)(P,2),I=E[0],D=E[1],T=(0,l.useState)(""),L=(0,t.A)(T,2),_=L[0],$=L[1],O=(0,l.useState)(!1),z=(0,t.A)(O,2),B=z[0],R=z[1];(0,l.useEffect)(()=>{w&&null!==v&&void 0!==v&&v.zohoInvoiceId&&U()},[w,v]);const U=async()=>{R(!0),D(!0),$("");try{const e=await(0,b.kQ)(v.id),s=window.URL.createObjectURL(e);F(s)}catch(e){console.error("Error loading PDF:",e),$(k("zohoInvoiceViewer.failedToLoadPDF"))}finally{D(!1),R(!1)}};(0,l.useEffect)(()=>()=>{M&&M.startsWith("blob:")&&window.URL.revokeObjectURL(M)},[M]);return w&&v?(0,N.jsxs)(n.N,{children:[B&&(0,N.jsx)(i.P.div,{initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/70 backdrop-blur-md z-[60] flex items-center justify-center px-4",children:(0,N.jsx)("div",{className:"bg-white rounded-xl p-6 sm:p-8 shadow-2xl max-w-sm w-full",children:(0,N.jsxs)("div",{className:"flex flex-col items-center gap-4",children:[(0,N.jsx)(c.A,{className:"h-10 w-10 sm:h-12 sm:w-12 animate-spin text-blue-600"}),(0,N.jsx)("p",{className:"text-base sm:text-lg font-medium text-gray-900 text-center",children:k("zohoInvoiceViewer.loadingPDF")}),(0,N.jsx)("p",{className:"text-xs sm:text-sm text-gray-500 text-center",children:k("zohoInvoiceViewer.loadingPDFWait")})]})})}),(0,N.jsx)(i.P.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/50 backdrop-blur-sm z-50 flex items-center justify-center p-2 sm:p-4",children:(0,N.jsxs)(i.P.div,{initial:{scale:.95},animate:{scale:1},exit:{scale:.95},className:"bg-white rounded-lg sm:rounded-xl w-full max-w-6xl max-h-[98vh] sm:max-h-[95vh] overflow-hidden flex flex-col",children:[(0,N.jsxs)("div",{className:"p-3 sm:p-4 md:p-6 border-b bg-gray-50",children:[(0,N.jsx)("div",{className:"flex justify-end mb-3",children:(0,N.jsx)(h.$,{variant:"ghost",size:"sm",onClick:A,className:"h-10 w-10 p-0 flex-shrink-0",children:(0,N.jsx)(u.A,{className:"h-6 w-6"})})}),(0,N.jsxs)("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-3 sm:gap-4",children:[(0,N.jsxs)("div",{className:"flex items-center gap-2 sm:gap-4 w-full sm:w-auto",children:[(0,N.jsx)("div",{className:"p-1.5 sm:p-2 bg-blue-100 rounded-lg flex-shrink-0",children:(0,N.jsx)(x.A,{className:"h-5 w-5 sm:h-6 sm:w-6 text-blue-600"})}),(0,N.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,N.jsx)("h2",{className:"text-base sm:text-lg md:text-xl font-semibold text-gray-900 truncate",children:v.invoiceNumber}),(0,N.jsx)("div",{className:"flex items-center gap-1.5 sm:gap-2 mt-1 flex-wrap",children:(0,N.jsx)(p.E,{variant:"outline",className:"Paid"===(null===(s=v.status)||void 0===s?void 0:s.name)?"border-green-200 text-green-700 text-xs":"Unpaid"===(null===(a=v.status)||void 0===a?void 0:a.name)?"border-yellow-200 text-yellow-700 text-xs":"border-red-200 text-red-700 text-xs",children:(null===(y=v.status)||void 0===y||null===(y=y.name)||void 0===y?void 0:y.toUpperCase())||"UNKNOWN"})})]})]}),(0,N.jsx)("div",{className:"flex items-center gap-1 sm:gap-2 w-full sm:w-auto justify-end flex-wrap",children:(0,N.jsx)(p.E,{variant:"outline",className:"text-sm font-semibold px-3 py-1",children:f(v)})})]})]}),(0,N.jsx)("div",{className:"flex-1 overflow-hidden",children:I&&!M?(0,N.jsx)("div",{className:"flex items-center justify-center h-full p-4",children:(0,N.jsxs)("div",{className:"text-center",children:[(0,N.jsx)(c.A,{className:"h-7 w-7 sm:h-8 sm:w-8 animate-spin text-blue-600 mx-auto mb-3 sm:mb-4"}),(0,N.jsx)("p",{className:"text-sm sm:text-base text-gray-600",children:k("zohoInvoiceViewer.loadingInvoice")})]})}):_?(0,N.jsx)("div",{className:"flex items-center justify-center h-full p-4",children:(0,N.jsxs)("div",{className:"text-center max-w-md",children:[(0,N.jsx)(d.A,{className:"h-7 w-7 sm:h-8 sm:w-8 text-red-600 mx-auto mb-3 sm:mb-4"}),(0,N.jsx)("p",{className:"text-sm sm:text-base text-gray-600 mb-4",children:_}),(0,N.jsx)(h.$,{onClick:U,variant:"outline",size:"sm",children:k("zohoInvoiceViewer.tryAgain")})]})}):M?(0,N.jsx)("div",{className:"h-full overflow-auto bg-gray-100",children:(0,N.jsx)("div",{className:"p-4 sm:p-6 md:p-8 h-full flex flex-col justify-center",children:(0,N.jsxs)("div",{className:"bg-white rounded-lg shadow-lg p-6 sm:p-8 max-w-md mx-auto w-full",children:[(0,N.jsxs)("div",{className:"text-center mb-6",children:[(0,N.jsx)("div",{className:"w-16 h-16 sm:w-20 sm:h-20 bg-blue-100 rounded-full flex items-center justify-center mx-auto mb-4",children:(0,N.jsx)(x.A,{className:"h-8 w-8 sm:h-10 sm:w-10 text-blue-600"})}),(0,N.jsx)("h3",{className:"text-lg sm:text-xl font-semibold text-gray-900 mb-2",children:k("zohoInvoiceViewer.viewInvoice")}),(0,N.jsx)("p",{className:"text-sm sm:text-base text-gray-600 mb-2",children:k("zohoInvoiceViewer.chooseHowToView")}),(0,N.jsx)("div",{className:"text-xs sm:text-sm text-gray-500",children:k("zohoInvoiceViewer.invoice",{number:v.invoiceNumber})})]}),(0,N.jsxs)("div",{className:"space-y-3",children:[(0,N.jsxs)(h.$,{onClick:()=>window.open(M,"_blank"),className:"w-full flex items-center justify-center gap-2 bg-blue-600 hover:bg-blue-700 h-11 sm:h-12 text-sm sm:text-base",children:[(0,N.jsx)(m.A,{className:"h-4 w-4 sm:h-5 sm:w-5"}),k("zohoInvoiceViewer.openPDFNewTab")]}),(0,N.jsxs)(h.$,{onClick:async()=>{try{R(!0),D(!0);const e=await(0,b.kQ)(v.id),s=window.URL.createObjectURL(e),a=document.createElement("a");a.href=s,a.download=`invoice-${v.invoiceNumber}.pdf`,document.body.appendChild(a),a.click(),a.remove(),window.URL.revokeObjectURL(s)}catch(e){console.error("Error downloading PDF:",e),alert(k("zohoInvoiceViewer.failedToDownloadPDF"))}finally{D(!1),R(!1)}},variant:"outline",className:"w-full flex items-center justify-center gap-2 h-11 sm:h-12 text-sm sm:text-base",disabled:I,children:[I?(0,N.jsx)(c.A,{className:"h-4 w-4 sm:h-5 sm:w-5 animate-spin"}):(0,N.jsx)(o.A,{className:"h-4 w-4 sm:h-5 sm:w-5"}),k("zohoInvoiceViewer.downloadPDF")]})]})]})})}):(0,N.jsx)("div",{className:"flex items-center justify-center h-full p-4",children:(0,N.jsxs)("div",{className:"text-center",children:[(0,N.jsx)(x.A,{className:"h-7 w-7 sm:h-8 sm:w-8 text-gray-400 mx-auto mb-3 sm:mb-4"}),(0,N.jsx)("p",{className:"text-sm sm:text-base text-gray-600",children:k("zohoInvoiceViewer.noPDFAvailable")})]})})}),(0,N.jsx)("div",{className:"p-3 sm:p-4 border-t bg-gray-50",children:(0,N.jsxs)("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-2 sm:gap-4 text-xs sm:text-sm text-gray-600",children:[(0,N.jsxs)("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1",children:[(0,N.jsx)("span",{className:"font-medium",children:k("zohoInvoiceViewer.invoiceId")}),(0,N.jsxs)("span",{className:"text-gray-900 font-mono text-xs",children:[v.id.slice(0,12),"..."]})]}),(0,N.jsxs)("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1",children:[(0,N.jsx)("span",{className:"font-medium",children:k("zohoInvoiceViewer.amount")}),(0,N.jsx)("span",{className:"font-semibold "+(g(v)?"text-red-600":"text-gray-900"),children:f(v)}),(0,N.jsx)("span",{className:"hidden sm:inline mx-1",children:"|"}),(0,N.jsx)("span",{className:"font-medium",children:k("zohoInvoiceViewer.date")}),(0,N.jsx)("span",{className:"text-gray-900",children:(0,r.lH)(v.createdAt)})]})]})})]})})]}):null};a.d(s,["A",0,v])},11057(e,s,a){var t=a(5544),l=a(9950),r=a(17119),n=a(76429),i=a(50142),d=a(98797),c=a(50288),o=a(52960),m=a(12673),x=a(84655),u=a(91412),h=a(42461),p=a(96419),b=a(52828),y=a(45833),j=a(42989),N=a(52257),g=a(61041),f=a(52607),v=a(96479),w=a(22129),A=a(74530),k=a(1801),C=a(74833),S=a(64767),M=a(44414);const F=e=>{let s=e.isOpen,a=e.onClose,F=e.onSuccess;const P=(0,S.Bd)().t,E=(0,d.m)(),I=E.paymentMethods,D=E.defaultPaymentMethod,T=E.refreshPaymentMethods,L=(0,c.GV)(e=>e.auth),_=L.user,$=L.currencies,O=(0,c.GV)(e=>e.categoryFormSettings).setting;console.log("setting123",O);const z=(0,c.jL)(),B=(0,l.useState)(!1),R=(0,t.A)(B,2),U=R[0],H=R[1],q=(0,l.useState)(null),Q=(0,t.A)(q,2),W=Q[0],G=Q[1],V=(0,l.useState)(!1),Y=(0,t.A)(V,2),K=Y[0],Z=Y[1],J=(0,l.useState)(!1),X=(0,t.A)(J,2),ee=X[0],se=X[1],ae=(0,l.useState)(!1),te=(0,t.A)(ae,2),le=te[0],re=te[1],ne=(0,l.useState)(!1),ie=(0,t.A)(ne,2),de=ie[0],ce=ie[1],oe=(0,l.useState)(!1),me=(0,t.A)(oe,2),xe=me[0],ue=me[1],he=(0,l.useState)(null),pe=(0,t.A)(he,2),be=pe[0],ye=pe[1],je=(0,l.useState)(null),Ne=(0,t.A)(je,2),ge=Ne[0],fe=Ne[1],ve=(0,l.useState)(!1),we=(0,t.A)(ve,2),Ae=we[0],ke=we[1],Ce=(0,l.useState)(null),Se=(0,t.A)(Ce,2),Me=Se[0],Fe=Se[1],Pe=(0,l.useState)({amount:"",currency:"EUR",selectedCurrencyId:"1",paymentMethodId:""}),Ee=(0,t.A)(Pe,2),Ie=Ee[0],De=Ee[1];(0,l.useEffect)(()=>(se(!0),s&&(document.body.style.overflow="hidden",$&&0!==$.length||z((0,o.VC)({isShowLoader:!1}))),()=>{document.body.style.overflow="unset"}),[s,z,$]),(0,l.useEffect)(()=>
1{if(Ie.selectedCurrencyId&&$&&$.length>0&&(null===be||void 0===be?void 0:be.id)!==Ie.selectedCurrencyId){const e=$.find(e=>e.value===Ie.selectedCurrencyId);e&&ye({id:Ie.selectedCurrencyId,name:e.label||"USD",code:e.initial||"USD"})}},[Ie.selectedCurrencyId,$,null===be||void 0===be?void 0:be.id]);(0,l.useEffect)(()=>{(async()=>{if($&&0!==$.length&&s){ue(!0);try{const e=(0,x.FL)();if(e){const s=$.find(s=>s.value===e);return De(a=>({...a,selectedCurrencyId:e,currency:(null===s||void 0===s?void 0:s.initial)||"USD"})),void ue(!1)}const s=await(0,x.qd)($,(e,s)=>{(0,x.Hm)(e)},z),a=$.find(e=>e.value===s);De(e=>({...e,selectedCurrencyId:s,currency:(null===a||void 0===a?void 0:a.initial)||"USD"})),Fe(s)}catch(W){console.error("Error detecting currency:",W);const s=$.find(e=>"EUR"===e.initial);s&&(De(e=>({...e,selectedCurrencyId:s.value,currency:"EUR"})),Fe(s.value))}finally{ue(!1)}}})()},[$,s]),(0,l.useEffect)(()=>{D&&!Ie.paymentMethodId&&De(e=>({...e,paymentMethodId:D.id}))},[D,Ie.paymentMethodId]),(0,l.useEffect)(()=>{if(ge&&I.length>0){const e=I.find(e=>e.stripePaymentMethodId===ge);e&&(De(s=>({...s,paymentMethodId:e.id})),fe(null))}},[ge,I]);const Te=()=>{Z(!1),G(null),H(!1),De({amount:"",currency:"USD",selectedCurrencyId:"1",paymentMethodId:""}),document.body.style.overflow="unset",a()};if(!ee||!s)return null;const Le=()=>{const e=parseFloat(Ie.amount)||0,s=(0,w.wL)(e,O);return{amount:e,customerTax:s,total:e+s}},_e=async e=>{fe(e.stripePaymentMethodId),await T(),re(!1),ce(!1)},$e=Le();return(0,r.createPortal)((0,M.jsxs)("div",{className:"fixed inset-0 bg-black bg-opacity-50 z-[9999] flex items-center justify-center p-2 sm:p-4 overflow-y-auto",onClick:e=>e.target===e.currentTarget&&Te(),style:{backdropFilter:"blur(4px)"},children:[(0,M.jsxs)(i.P.div,{initial:{scale:.95,opacity:0},animate:{scale:1,opacity:1},exit:{scale:.95,opacity:0},transition:{duration:.2,ease:"easeOut"}
1,className:"bg-white rounded-2xl w-full max-w-md sm:max-w-lg max-h-[85vh] overflow-y-auto shadow-2xl mx-2 sm:mx-4",onClick:e=>e.stopPropagation(),children:[(0,M.jsx)("div",{className:"bg-gradient-to-r from-blue-600 to-blue-700 px-6 py-4 rounded-t-2xl",children:(0,M.jsxs)("div",{className:"flex justify-between items-center",children:[(0,M.jsxs)("div",{className:"flex items-center gap-3",children:[(0,M.jsx)("div",{className:"p-2 bg-white/20 rounded-lg",children:(0,M.jsx)("span",{className:"text-2xl font-bold text-white",children:(0,x.vO)()})}),(0,M.jsxs)("div",{children:[(0,M.jsx)("h2",{className:"text-xl font-bold text-white",children:P("addFundsModal.title")}),(0,M.jsx)("p",{className:"text-blue-100 text-sm",children:P("addFundsModal.subtitle")})]})]}),(0,M.jsx)("button",{onClick:Te,className:"p-2 hover:bg-white/20 rounded-lg transition-colors",children:(0,M.jsx)(v.A,{className:"h-5 w-5 text-white"})})]})}),(0,M.jsx)("div",{className:"p-6",children:K?(0,M.jsxs)(i.P.div,{initial:{scale:.8,opacity:0},animate:{scale:1,opacity:1},className:"text-center py-8",children:[(0,M.jsx)("div",{className:"mx-auto w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mb-4",children:(0,M.jsx)(y.A,{className:"h-8 w-8 text-green-600"})}),(0,M.jsx)("h3",{className:"text-xl font-semibold text-gray-900 mb-2",children:P("addFundsModal.fundsAddedSuccess")}),(0,M.jsxs)("div",{className:"text-gray-600 space-y-2",children:[(0,M.jsx)("p",{children:P("addFundsModal.walletFundedSuccess")}),(0,M.jsxs)("div",{className:"bg-green-50 border border-green-200 rounded-lg p-3 mt-4",children:[(0,M.jsxs)("p",{className:"text-sm text-green-800",children:[(0,M.jsx)("strong",{children:P("addFundsModal.amountAdded")})," ",(0,x.vO)(),Ie.amount]}),$e.customerTax>0&&(0,M.jsxs)("p",{className:"text-sm text-green-800 mt-1",children:[(0,M.jsx)("strong",{children:P("addFundsModal.customerTaxLabel")})," ",(0,x.vO)(),$e.customerTax.toFixed(2)]}),(0,M.jsxs)("p",{className:"text-sm text-green-800 mt-1",children:[(0,M.jsx)("strong",{children:P("addFundsModal.totalCharged")})," ",(0,x.vO)(),$e.total.toFixed(2)]})]}),(0,M.jsx)("p",{className:"text-xs text-gray-500 mt-3",children:P("addFundsModal.fundsAvailable")})]})]}):(0,M.jsx)("div",{className:"space-y-6",children:(0,M.jsxs)("form",{onSubmit:async e=>{e.preventDefault(),H(!0),G(null);try{var s;if(!(!Ie.amount||parseFloat(Ie.amount)<=0?(G(P("addFundsModal.minimumAmountError",{symbol:(0,x.vO)()})),0):parseFloat(Ie.amount)<10?(G(P("addFundsModal.minimumAmountIs",{symbol:(0,x.vO)()})),0):Ie.paymentMethodId||(G(P("addFundsModal.selectPaymentMethodError")),0)))return;const e=Le(),a=e.amount,t=e.customerTax,i=e.total,d=Number(null===_||void 0===_||null===(s=_.role)||void 0===s?void 0:s.id)===A.U.client,c=d?_.id:null,o=d?null:_.id,u={amount:a,platformFee:t,customerTax:t,totalAmount:i,withdrawlAmount:a,currency:Ie.selectedCurrencyId};let h;d?u.clientId=c:u.professionalId=o;try{h=await m.sq.createEscrow(u)}catch(l){throw console.error("Escrow creation error:",l),new Error(P("addFundsModal.failedToCreateEscrow"))}const p=null===$||void 0===$?void 0:$.find(e=>e.value===Ie.selectedCurrencyId),b={amount:a,currency:(null===p||void 0===p?void 0:p.code)||"usd",paymentMethodId:Ie.paymentMethodId,notes:`Adding funds to wallet - ${(null===p||void 0===p?void 0:p.name)||"USD"} ${a}`,escrowId:h.id};try{const e=await m.sq.addFunds(b);await m.sq.updateEscrow(h.id,{status:"user_funded",stripePaymentIntentId:e.paymentIntentId})}catch(r){console.error("Add funds API error:",r);try{await m.sq.updateEscrow(h.id,{status:"failed"})}catch(n){console.error("Failed to update escrow status:",n)}throw r}Z(!0),setTimeout(()=>{Te(),null===F||void 0===F||F()},2e3)}catch(i){var a,t;console.error("Add funds error:",i),null!==i&&void 0!==i&&null!==(a=i.response)&&void 0!==a&&null!==(a=a.data)&&void 0!==a&&a.message?G(i.response.data.message):null!==i&&void 0!==i&&null!==(t=i.response)&&void 0!==t&&null!==(t=t.data)&&void 0!==t&&t.error?G(i.response.data.error):null!==i&&void 0!==i&&i.message?G(i.message):G(P("addFundsModal.unexpectedError"))}finally{H(!1)}},className:"space-y-6",children:[(0,M.jsxs)("div",{children:[(0,M.jsxs)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:[P("addFundsModal.amount")," ",(0,M.jsx)("span",{className:"text-red-500",children:P("addFundsModal.required")})]}),(0,M.jsxs)("div",{className:"relative",children:[(0,M.jsx)("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-lg font-bold text-gray-400",children:(0,x.vO)()}),(0,M.jsx)("input",{type:"number",step:"0.01",min:"10",value:Ie.amount,onChange:e=>{De({...Ie,amount:e.target.value}),G(null)},className:"w-full pl-10 pr-4 py-3 border rounded-xl focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-colors "+(Ie.amount&&parseFloat(Ie.amount)<10?"border-red-300":"border-gray-300"),placeholder:"0.00",required:!0})]}),Ie.amount&&parseFloat(Ie.amount)<10&&(0,M.jsx)("p",{className:"text-red-500 text-xs mt-1",children:P("addFundsModal.minimumAmountLabel",{symbol:(0,x.vO)()})}),(0,M.jsx)("p",{className:"text-gray-500 text-xs mt-1",children:P("addFundsModal.minimumLabel",{symbol:(0,x.vO)()})})]}),(0,M.jsxs)("div",{children:[(0,M.jsxs)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:[P("addFundsModal.currency"),xe&&(0,M.jsx)("span",{className:"ml-2 text-xs text-blue-600",children:P("addFundsModal.detectingCurrency")})]}),(0,M.jsx)(p.A,{selectedCurrency:be,onCurrencySelect:e=>{if(e){Me||Fe(Ie.selectedCurrencyId);const s=Me&&e.id!==Me;ke(s),ye(e),De(s=>({...s,selectedCurrencyId:e.id,currency:e.code})),(0,x.Hm)(e.id)}},placeholder:P("addFundsModal.selectCurrencyPlaceholder"),disabled:xe,autoDetect:!0}),xe&&(0,M.jsx)("p",{className:"mt-1 text-xs text-gray-500",children:P("addFundsModal.autoDetectingCurrency")})]}),(0,M.jsxs)("div",{children:[(0,M.jsxs)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:[P("addFundsModal.paymentMethod")," ",(0,M.jsx)("span",{className:"text-red-500",children:P("addFundsModal.required")})]}),(0,M.jsxs)("div",{className:"space-y-2",children:[I.filter(e=>"bank_account"!==e.type&&"us_bank_account"!==e.type&&"sepa_bank_account"!==e.type).length>0?I.filter(e=>"card"===e.type).map(e=>{var s;return(0,M.jsxs)("label",{className:"flex items-center justify-between p-3 border rounded-xl cursor-pointer transition-colors "+(Ie.paymentMethodId===e.id?"border-blue-500 bg-blue-50":"border-gray-300 hover:border-gray-400"),children:[(0,M.jsxs)("div",{className:"flex items-center gap-3",children:[(0,M.jsx)(g.A,{className:"h-5 w-5 text-gray-600"}),(0,M.jsxs)("div",{children:[(0,M.jsx)("div",{className:"font-medium text-sm",children:"card"===e.type?`${null===(s=e.brand)||void 0===s?void 0:s.toUpperCase()} **** ${e.last4}`:`${e.bankName} **** ${e.last4}`}),(0,M.jsx)("div",{className:"text-xs text-gray-500",children:"card"===e.type?P("addFundsModal.expires",{month:e.expMonth,year:e.expYear}):P("addFundsModal.paymentMethodLabel")})]})]}),(0,M.jsx)("input",{type:"radio",name:"paymentMethod",value:e.id,checked:Ie.paymentMethodId===e.id,onChange:e=>De({...Ie,paymentMethodId:e.target.value}),className:"h-4 w-4 text-blue-600 border-gray-300 focus:ring-blue-500"})]},e.id)}):(0,M.jsx)("div",{className:"p-4 border border-gray-300 rounded-xl text-center",children:(0,M.jsx)("p",{className:"text-sm text-gray-600 mb-3",children:P("addFundsModal.noPaymentMethods")})}),(0,M.jsx)("div",{className:"flex gap-2",children:(0,M.jsxs)(h.$,{type:"button",variant:"outline",onClick:()=>re(!0),className:"flex-1 text-xs py-2",children:[(0,M.jsx)(f.A,{className:"h-3 w-3 mr-1"}),P("addFundsModal.addCard")]})})]})]}),Ae&&Me&&Ie.selectedCurrencyId!==Me&&$&&$.length>0&&(0,M.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-xl p-4",children:(0,M.jsxs)("div",{className:"flex items-start gap-2",children:[(0,M.jsx)(N.A,{className:"h-5 w-5 text-blue-600 flex-shrink-0 mt-0.5"}),(0,M.jsxs)("div",{className:"flex-1",children:[(0,M.jsx)("h3",{className:"text-sm font-medium text-blue-900 mb-2",children:"Currency Conversion Applied"}),(0,M.jsx)("div",{className:"text-xs text-blue-800 space-y-1",children:(()=>
1{if(Ie.amount&&parseFloat(Ie.amount)>0){const e=(0,u.hZ)(parseFloat(Ie.amount),Me,Ie.selectedCurrencyId,$),s=(0,u.yA)(Me,$),a=(0,u.yA)(Ie.selectedCurrencyId,$);return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)("p",{children:["Original: ",(0,x.Qn)((null===s||void 0===s?void 0:s.initial)||"USD"),Ie.amount," ",(null===s||void 0===s?void 0:s.initial)||"USD"]}),(0,M.jsxs)("p",{children:["Converted: ",(0,x.Qn)((null===a||void 0===a?void 0:a.initial)||"USD"),e.convertedAmount.toFixed(2)," ",(null===a||void 0===a?void 0:a.initial)||"USD"]}),(0,M.jsxs)("p",{className:"text-xs text-blue-600 mt-1",children:["Exchange Rate: 1 ",null===s||void 0===s?void 0:s.initial," = ",e.exchangeRate.toFixed(4)," ",null===a||void 0===a?void 0:a.initial]})]})}return null})()})]})]})}),(0,M.jsxs)("div",{className:"bg-gray-50 border border-gray-200 rounded-xl p-4",children:[(0,M.jsx)("h3",{className:"text-sm font-medium text-gray-700 mb-3",children:P("addFundsModal.transactionSummary")}),(0,M.jsxs)("div",{className:"space-y-2",children:[(0,M.jsxs)("div",{className:"flex justify-between text-sm",children:[(0,M.jsx)("span",{className:"text-gray-600",children:P("addFundsModal.amountLabel")}),(0,M.jsxs)("span",{className:"font-medium",children:[(0,x.vO)(),$e.amount.toFixed(2)]})]}),$e.customerTax>0&&(0,M.jsxs)("div",{className:"flex justify-between text-sm",children:[(0,M.jsx)("span",{className:"text-gray-600",children:P("addFundsModal.customerTax")}),(0,M.jsxs)("span",{className:"font-medium",children:[(0,x.vO)(),$e.customerTax.toFixed(2)]})]}),(0,M.jsxs)("div",{className:"flex justify-between text-sm font-medium border-t pt-2",children:[(0,M.jsx)("span",{children:P("addFundsModal.total")}),(0,M.jsxs)("span",{children:[(0,x.vO)(),$e.total.toFixed(2)]})]})]})]}),(0,M.jsx)(n.N,{children:W&&(0,M.jsx)(i.P.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"bg-red-50 border border-red-200 rounded-lg p-4",children:(0,M.jsxs)("div",{className:"flex items-start gap-3",children:[(0,M.jsx)(b.A,{className:"h-5 w-5 text-red-600 flex-shrink-0 mt-0.5"}),(0,M.jsx)("div",{className:"flex-1",children:(0,M.jsx)("div",{className:"text-sm text-red-700",children:W})})]})})}),(0,M.jsxs)("div",{className:"flex gap-3 pt-4",children:[(0,M.jsx)(h.$,{type:"button",variant:"outline",onClick:Te,className:"flex-1 h-12",disabled:U,children:P("addFundsModal.cancel")}),(0,M.jsx)(h.$,{type:"submit",disabled:U||!Ie.amount||!Ie.paymentMethodId||parseFloat(Ie.amount)<10,className:"flex-1 h-12 bg-blue-600 hover:bg-blue-700",children:U?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(j.A,{className:"h-4 w-4 animate-spin mr-2"}),P("addFundsModal.addingFunds")]}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)("span",{className:"text-lg font-bold mr-2",children:(0,x.vO)()}),P("addFundsModal.addFunds")]})})]})]})})})]}),(0,M.jsx)(n.N,{children:le&&(0,M.jsx)(k.A,{onClose:()=>re(!1),onSuccess:_e})}),(0,M.jsx)(n.N,{children:de&&(0,M.jsx)(C.A,{onClose:()=>ce(!1),onSuccess:_e})})]}),document.body)};a.d(s,["A",0,F])},74833(e,s,a){var t=a(5544),l=a(9950),r=a(17119),n=a(76429),i=a(50142),d=a(98797),c=a(42461),o=a(52828),m=a(45833),x=a(42989),u=a(89284),h=a(81807),p=a(81946),b=a(81064),y=a(96479),j=a(44414);const N=e=>{let s=e.onClose,a=e.onSuccess;const N=(0,d.m)().addPaymentMethod,g=(0,l.useState)(!1),f=(0,t.A)(g,2),v=f[0],w=f[1],A=(0,l.useState)(null),k=(0,t.A)(A,2),C=k[0],S=k[1],M=(0,l.useState)(!1),F=(0,t.A)(M,2),P=F[0],E=F[1],I=(0,l.useState)(!1),D=(0,t.A)(I,2),T=D[0],L=D[1],_=(0,l.useState)({accountNumber:"",routingNumber:"",accountHolderName:"",accountHolderType:"individual",country:"US"}),$=(0,t.A)(_,2),O=$[0],z=$[1];(0,l.useEffect)(()=>(L(!0),document.body.style.overflow="hidden",()=>{document.body.style.overflow="unset"}),[]);const B=()=>{E(!1),S(null),w(!1),z({accountNumber:"",routingNumber:"",accountHolderName:"",accountHolderType:"individual",country:"US"}),document.body.style.overflow="unset",s()};if(!T)return null;return(0,r.createPortal)((0,j.jsx)("div",{className:"fixed inset-0 bg-black bg-opacity-50 z-[9999] flex items-center justify-center p-4",onClick:e=>e.target===e.currentTarget&&B(),style:{backdropFilter:"blur(4px)"},children:(0,j.jsxs)(i.P.div,{initial:{scale:.95,opacity:0}
1,animate:{scale:1,opacity:1},exit:{scale:.95,opacity:0},transition:{duration:.2,ease:"easeOut"},className:"bg-white rounded-2xl w-full max-w-md max-h-[90vh] overflow-y-auto shadow-2xl mx-4",onClick:e=>e.stopPropagation(),children:[(0,j.jsx)("div",{className:"bg-gradient-to-r from-green-600 to-green-700 px-6 py-4 rounded-t-2xl",children:(0,j.jsxs)("div",{className:"flex justify-between items-center",children:[(0,j.jsxs)("div",{className:"flex items-center gap-3",children:[(0,j.jsx)("div",{className:"p-2 bg-white/20 rounded-lg",children:(0,j.jsx)(u.A,{className:"h-6 w-6 text-white"})}),(0,j.jsxs)("div",{children:[(0,j.jsx)("h2",{className:"text-xl font-bold text-white",children:"Add Bank Account"}),(0,j.jsx)("p",{className:"text-green-100 text-sm",children:"For secure withdrawals"})]})]}),(0,j.jsx)("button",{onClick:B,className:"p-2 hover:bg-white/20 rounded-lg transition-colors",children:(0,j.jsx)(y.A,{className:"h-5 w-5 text-white"})})]})}),(0,j.jsx)("div",{className:"p-6",children:P?(0,j.jsxs)(i.P.div,{initial:{scale:.8,opacity:0}
1,animate:{scale:1,opacity:1},className:"text-center py-8",children:[(0,j.jsx)("div",{className:"mx-auto w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mb-4",children:(0,j.jsx)(m.A,{className:"h-8 w-8 text-green-600"})}),(0,j.jsx)("h3",{className:"text-xl font-semibold text-gray-900 mb-2",children:"Bank Account Added Successfully!"}),(0,j.jsx)("p",{className:"text-gray-600",children:"Your bank account has been added securely."})]}):(0,j.jsxs)("form",{onSubmit:async e=>{e.preventDefault(),w(!0),S(null);try{if(await N({stripePaymentMethodId:`bank_${Date.now()}`,type:"bank_account",accountNumber:O.accountNumber,routingNumber:O.routingNumber,accountHolderName:O.accountHolderName,accountHolderType:O.accountHolderType,country:O.country,isDefault:!1,status:"active"}),E(!0),a){const e={id:"bank_"+Date.now(),type:"bank_account",accountNumber:O.accountNumber,routingNumber:O.routingNumber,accountHolderName:O.accountHolderName,accountHolderType:O.accountHolderType,country:O.country};a(e)}setTimeout(()=>{B()},2e3)}catch(s){S("Failed to add bank account")}finally{w(!1)}},className:"space-y-6",children:[(0,j.jsx)("div",{className:"bg-green-50 border border-green-200 rounded-lg p-4",children:(0,j.jsxs)("div",{className:"flex items-start gap-3",children:[(0,j.jsx)(p.A,{className:"h-5 w-5 text-green-600 flex-shrink-0 mt-0.5"}),(0,j.jsxs)("div",{children:[(0,j.jsx)("h4",{className:"text-sm font-medium text-green-800",children:"Secure & Encrypted"}),(0,j.jsx)("p",{className:"text-sm text-green-700 mt-1",children:"Your bank information is encrypted and processed securely."})]})]})}),(0,j.jsxs)("div",{children:[(0,j.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Account Holder Name"}),(0,j.jsxs)("div",{className:"relative",children:[(0,j.jsx)(b.A,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-5 w-5 text-gray-400"}),(0,j.jsx)("input",{type:"text",value:O.accountHolderName,onChange:e=>z({...O,accountHolderName:e.target.value}),className:"w-full pl-10 pr-4 py-3 border border-gray-300 rounded-xl focus:ring-2 focus:ring-green-500 focus:border-green-500 transition-colors",placeholder:"Enter full name",required:!0})]})]}),(0,j.jsxs)("div",{children:[(0,j.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Account Number"}),(0,j.jsxs)("div",{className:"relative",children:[(0,j.jsx)(h.A,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-5 w-5 text-gray-400"}),(0,j.jsx)("input",{type:"text",value:O.accountNumber,onChange:e=>z({...O,accountNumber:e.target.value}),className:"w-full pl-10 pr-4 py-3 border border-gray-300 rounded-xl focus:ring-2 focus:ring-green-500 focus:border-green-500 transition-colors",placeholder:"Enter account number",required:!0})]})]}),(0,j.jsxs)("div",{children:[(0,j.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Routing Number"}),(0,j.jsxs)("div",{className:"relative",children:[(0,j.jsx)(h.A,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-5 w-5 text-gray-400"}),(0,j.jsx)("input",{type:"text",value:O.routingNumber,onChange:e=>z({...O,routingNumber:e.target.value}),className:"w-full pl-10 pr-4 py-3 border border-gray-300 rounded-xl focus:ring-2 focus:ring-green-500 focus:border-green-500 transition-colors",placeholder:"Enter routing number",required:!0})]})]}),(0,j.jsxs)("div",{children:[(0,j.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Account Type"}),(0,j.jsxs)("div",{className:"relative",children:[(0,j.jsx)(u.A,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-5 w-5 text-gray-400"}),(0,j.jsxs)("select",{value:O.accountHolderType,onChange:e=>z({...O,accountHolderType:e.target.value}),className:"w-full pl-10 pr-4 py-3 border border-gray-300 rounded-xl focus:ring-2 focus:ring-green-500 focus:border-green-500 transition-colors appearance-none",children:[(0,j.jsx)("option",{value:"individual",children:"Individual"}),(0,j.jsx)("option",{value:"company",children:"Company"})]})]})]}),(0,j.jsx)(n.N,{children:C&&(0,j.jsx)(i.P.div,{initial:{opacity:0,y:-10}
1,animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"bg-red-50 border border-red-200 rounded-lg p-4",children:(0,j.jsxs)("div",{className:"flex items-start gap-3",children:[(0,j.jsx)(o.A,{className:"h-5 w-5 text-red-600 flex-shrink-0 mt-0.5"}),(0,j.jsxs)("div",{children:[(0,j.jsx)("h4",{className:"text-sm font-medium text-red-800",children:"Error"}),(0,j.jsx)("p",{className:"text-sm text-red-700 mt-1",children:C})]})]})})}),(0,j.jsxs)("div",{className:"flex gap-3 pt-4",children:[(0,j.jsx)(c.$,{type:"button",variant:"outline",onClick:B,className:"flex-1 h-12",disabled:v,children:"Cancel"}),(0,j.jsx)(c.$,{type:"submit",disabled:v,className:"flex-1 h-12 bg-green-600 hover:bg-green-700",children:v?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(x.A,{className:"h-4 w-4 animate-spin mr-2"}),"Adding Account..."]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(u.A,{className:"h-4 w-4 mr-2"}),"Add Bank Account"]})})]})]})})]})}),document.body)};a.d(s,["A",0,N])},1801(e,s,a){var t=a(5544),l=a(9950),r=a(64767),n=a(17119),i=a(76429),d=a(50142),c=a(98797),o=a(42461),m=a(52828),x=a(45833),u=a(42989),h=a(61041),p=a(81946),b=a(96479),y=a(48232),j=a(91627),N=a(44414);let g=null;const f=e=>{let s=e.onClose,a=e.onSuccess;const g=(0,r.Bd)().t,f=(0,j.t2)(),v=(0,j.HH)(),w=(0,c.m)().addPaymentMethod,A=(0,l.useState)(!1),k=(0,t.A)(A,2),C=k[0],S=k[1],M=(0,l.useState)(null),F=(0,t.A)(M,2),P=F[0],E=F[1],I=(0,l.useState)(!1),D=(0,t.A)(I,2),T=D[0],L=D[1],_=(0,l.useState)(!1),$=(0,t.A)(_,2),O=$[0],z=$[1];(0,l.useEffect)(()=>(z(!0),document.body.style.overflow="hidden",()=>{document.body.style.overflow="unset"}),[]);const B=()=>{L(!1),E(null),S(!1),document.body.style.overflow="unset",s()};if(!O)return null;return(0,n.createPortal)((0,N.jsx)("div",{className:"fixed inset-0 bg-black bg-opacity-50 z-[9999] flex items-center justify-center p-4",onClick:e=>e.target===e.currentTarget&&B(),style:{backdropFilter:"blur(4px)"},children:(0,N.jsxs)(d.P.div,{initial:{scale:.95,opacity:0},animate:{scale:1,opacity:1},exit:{scale:.95,opacity:0},transition:{duration:.2,ease:"easeOut"},className:"bg-white rounded-2xl w-full max-w-md max-h-[90vh] overflow-y-auto shadow-2xl mx-4",onClick:e=>e.stopPropagation(),children:[(0,N.jsx)("div",{className:"bg-gradient-to-r from-blue-600 to-blue-700 px-6 py-4 rounded-t-2xl",children:(0,N.jsxs)("div",{className:"flex justify-between items-center",children:[(0,N.jsxs)("div",{className:"flex items-center gap-3",children:[(0,N.jsx)("div",{className:"p-2 bg-white/20 rounded-lg",children:(0,N.jsx)(h.A,{className:"h-6 w-6 text-white"})}),(0,N.jsxs)("div",{children:[(0,N.jsx)("h2",{className:"text-xl font-bold text-white",children:g("cardPaymentForm.addCreditCard")}),(0,N.jsx)("p",{className:"text-blue-100 text-sm",children:g("cardPaymentForm.securePaymentMethod")})]})]}),(0,N.jsx)("button",{onClick:B,className:"p-2 hover:bg-white/20 rounded-lg transition-colors",children:(0,N.jsx)(b.A,{className:"h-5 w-5 text-white"})})]})}),(0,N.jsx)("div",{className:"p-6",children:T?(0,N.jsxs)(d.P.div,{initial:{scale:.8,opacity:0}
1,animate:{scale:1,opacity:1},className:"text-center py-8",children:[(0,N.jsx)("div",{className:"mx-auto w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mb-4",children:(0,N.jsx)(x.A,{className:"h-8 w-8 text-green-600"})}),(0,N.jsx)("h3",{className:"text-xl font-semibold text-gray-900 mb-2",children:g("cardPaymentForm.cardAddedSuccess")}),(0,N.jsx)("p",{className:"text-gray-600",children:g("cardPaymentForm.cardAddedSecurely")})]}):(0,N.jsxs)("form",{onSubmit:async e=>{if(e.preventDefault(),f&&v){S(!0),E(null);try{const e=(await y.K.createSetupIntent()).client_secret,s=await f.confirmCardSetup(e,{payment_method:{card:v.getElement(j.hA),billing_details:{name:"Card Holder Name"}}}),t=s.error,l=s.setupIntent;if(t)return void E(t.message||"An error occurred");if("succeeded"===(null===l||void 0===l?void 0:l.status)){const e=l.payment_method;await w({stripePaymentMethodId:e,type:"card"}),L(!0),a&&a({stripePaymentMethodId:e}),setTimeout(()=>{B()},2e3)}}catch(s){E("Failed to add payment method")}finally{S(!1)}}},className:"space-y-6",children:[(0,N.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:(0,N.jsxs)("div",{className:"flex items-start gap-3",children:[(0,N.jsx)(p.A,{className:"h-5 w-5 text-blue-600 flex-shrink-0 mt-0.5"}),(0,N.jsxs)("div",{children:[(0,N.jsx)("h4",{className:"text-sm font-medium text-blue-800",children:g("cardPaymentForm.secureEncrypted")}),(0,N.jsx)("p",{className:"text-sm text-blue-700 mt-1",children:g("cardPaymentForm.cardInfoEncrypted")})]})]})}),(0,N.jsxs)("div",{children:[(0,N.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-3",children:g("cardPaymentForm.cardInformation")}),(0,N.jsx)("div",{className:"border-2 border-gray-200 rounded-xl p-4 focus-within:border-blue-500 transition-colors",children:(0,N.jsx)(j.hA,{options:{style:{base:{fontSize:"16px",color:"#374151",fontFamily:"system-ui, sans-serif","::placeholder":{color:"#9CA3AF"}},invalid:{color:"#EF4444"}},hidePostalCode:!0}})})]}),(0,N.jsx)(i.N,{children:P&&(0,N.jsx)(d.P.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"bg-red-50 border border-red-200 rounded-lg p-4",children:(0,N.jsxs)("div",{className:"flex items-start gap-3",children:[(0,N.jsx)(m.A,{className:"h-5 w-5 text-red-600 flex-shrink-0 mt-0.5"}),(0,N.jsxs)("div",{children:[(0,N.jsx)("h4",{className:"text-sm font-medium text-red-800",children:g("common.error")}),(0,N.jsx)("p",{className:"text-sm text-red-700 mt-1",children:P})]})]})})}),(0,N.jsxs)("div",{className:"flex gap-3 pt-4",children:[(0,N.jsx)(o.$,{type:"button",variant:"outline",onClick:B,className:"flex-1 h-12",disabled:C,children:g("cardPaymentForm.cancel")}),(0,N.jsx)(o.$,{type:"submit",disabled:!f||C,className:"flex-1 h-12 bg-blue-600 hover:bg-blue-700",children:C?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(u.A,{className:"h-4 w-4 animate-spin mr-2"}),"Adding Card..."]}):(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(h.A,{className:"h-4 w-4 mr-2"}),g("cardPaymentForm.addCard")]})})]})]})})]})}),document.body)},v=e=>(0,N.jsx)(j.S8,{stripe:(g||(g=a.e(3988).then(a.bind(a,97202)).then(e=>(0,e.loadStripe)("pk_live_51RCj0qCWH1PcsowBzyn9e1np9DMAY11FG9xwntvJ1IncfSOKEZ9LwEy43qzw1SO25HN9rDeIdyeUpbZ6Ci6iMTsb00lAMQWNDo"))),g),children:(0,N.jsx)(f,{...e})}),w=v;a.d(s,["A",0,w])},95003(e,s,a){var t=a(5544),l=a(9950),r=a(17119),n=a(76429),i=a(50142),d=a(42461),c=a(14697),o=a(41591),m=a(52828),x=a(45833),u=a(42989),h=a(61041),p=a(96479),b=a(98797),y=a(44414);const j=e=>{let s=e.onClose,a=e.onSuccess;const j=(0,b.m)().addPayPalPaymentMethod,N=(0,l.useState)({paypalEmail:""}),g=(0,t.A)(N,2),f=g[0],v=g[1],w=(0,l.useState)(!1),A=(0,t.A)(w,2),k=A[0],C=A[1],S=(0,l.useState)(""),M=(0,t.A)(S,2),F=M[0],P=M[1],E=(0,l.useState)(!1),I=(0,t.A)(E,2),D=I[0],T=I[1],L=(0,l.useState)(!1),_=(0,t.A)(L,2),$=_[0],O=_[1];(0,l.useEffect)(()=>(O(!0),document.body.style.overflow="hidden",()=>{document.body.style.overflow="unset"}),[]);const z=()=>{T(!1),P(""),C(!1),document.body.style.overflow="unset",s()};if(!$)return null;return(0,r.createPortal)((0,y.jsx)("div",{className:"fixed inset-0 bg-black bg-opacity-50 z-[9999] flex items-center justify-center p-4",onClick:e=>e.target===e.currentTarget&&z(),style:{backdropFilter:"blur(4px)"},children:(0,y.jsxs)(i.P.div,{initial:{scale:.95,opacity:0}
1,animate:{scale:1,opacity:1},exit:{scale:.95,opacity:0},transition:{duration:.2,ease:"easeOut"},className:"bg-white rounded-2xl w-full max-w-md max-h-[90vh] overflow-y-auto shadow-2xl mx-4",onClick:e=>e.stopPropagation(),children:[(0,y.jsx)("div",{className:"bg-gradient-to-r from-blue-600 to-blue-700 px-6 py-4 rounded-t-2xl",children:(0,y.jsxs)("div",{className:"flex justify-between items-center",children:[(0,y.jsxs)("div",{className:"flex items-center gap-3",children:[(0,y.jsx)("div",{className:"p-2 bg-white/20 rounded-lg",children:(0,y.jsx)(h.A,{className:"h-6 w-6 text-white"})}),(0,y.jsxs)("div",{children:[(0,y.jsx)("h2",{className:"text-xl font-bold text-white",children:"Add PayPal Account"}),(0,y.jsx)("p",{className:"text-blue-100 text-sm",children:"Secure payment method"})]})]}),(0,y.jsx)("button",{onClick:z,className:"p-2 hover:bg-white/20 rounded-lg transition-colors",children:(0,y.jsx)(p.A,{className:"h-5 w-5 text-white"})})]})}),(0,y.jsx)("div",{className:"p-6",children:D?(0,y.jsxs)(i.P.div,{initial:{scale:.8,opacity:0}
1,animate:{scale:1,opacity:1},className:"text-center py-8",children:[(0,y.jsx)("div",{className:"mx-auto w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mb-4",children:(0,y.jsx)(x.A,{className:"h-8 w-8 text-green-600"})}),(0,y.jsx)("h3",{className:"text-xl font-semibold text-gray-900 mb-2",children:"PayPal Account Linked Successfully!"}),(0,y.jsx)("p",{className:"text-gray-600",children:"Your PayPal account has been linked and is ready to use for withdrawals."})]}):(0,y.jsxs)("form",{onSubmit:async e=>{e.preventDefault(),P(""),C(!0);try{if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(f.paypalEmail))throw new Error("Please enter a valid email address");await j(f.paypalEmail),T(!0),setTimeout(()=>{a(),z()},2e3)}catch(s){P(s.message||"Failed to link PayPal account")}finally{C(!1)}},className:"space-y-6",children:[(0,y.jsx)(n.N,{children:F&&(0,y.jsx)(i.P.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"bg-red-50 border border-red-200 rounded-lg p-4",children:(0,y.jsxs)("div",{className:"flex items-start gap-3",children:[(0,y.jsx)(m.A,{className:"h-5 w-5 text-red-600 flex-shrink-0 mt-0.5"}),(0,y.jsxs)("div",{children:[(0,y.jsx)("h4",{className:"text-sm font-medium text-red-800",children:"Error"}),(0,y.jsx)("p",{className:"text-sm text-red-700 mt-1",children:F})]})]})})}),(0,y.jsxs)("div",{children:[(0,y.jsx)(o.A,{htmlFor:"paypalEmail",className:"block text-sm font-medium text-gray-700 mb-3",children:"PayPal Email Address"}),(0,y.jsx)("div",{className:"border-2 border-gray-200 rounded-xl p-4 focus-within:border-blue-500 transition-colors",children:(0,y.jsx)(c.p,{id:"paypalEmail",name:"paypalEmail",type:"email",value:f.paypalEmail,onChange:e=>{v(s=>({...s,[e.target.name]:e.target.value})),P("")},placeholder:"[email protected]",required:!0,className:"border-0 p-0 focus:ring-0 focus:outline-none",disabled:k})}),(0,y.jsx)("p",{className:"text-xs text-gray-500 mt-2",children:"Enter the email address associated with your PayPal account"})]}),(0,y.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:(0,y.jsxs)("div",{className:"flex items-start gap-3",children:[(0,y.jsx)("svg",{className:"h-5 w-5 text-blue-600 flex-shrink-0 mt-0.5",viewBox:"0 0 20 20",fill:"currentColor",children:(0,y.jsx)("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})}),(0,y.jsxs)("div",{children:[(0,y.jsx)("h4",{className:"text-sm font-medium text-blue-800",children:"Important"}),(0,y.jsx)("p",{className:"text-sm text-blue-700 mt-1",children:"Make sure you have access to this PayPal account. Withdrawals will be sent to this email address."})]})]})}),(0,y.jsxs)("div",{className:"flex gap-3 pt-4",children:[(0,y.jsx)(d.$,{type:"button",variant:"outline",onClick:z,className:"flex-1 h-12",disabled:k,children:"Cancel"}),(0,y.jsx)(d.$,{type:"submit",className:"flex-1 h-12 bg-blue-600 hover:bg-blue-700",disabled:k||!f.paypalEmail,children:k?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(u.A,{className:"h-4 w-4 animate-spin mr-2"}),"Linking Account..."]}):"Link PayPal Account"})]})]})})]})}),document.body)};a.d(s,["A",0,j])},89012(e,s,a){a.d(s,{A:()=>w});var t=a(5544),l=a(9950),r=a(76429),n=a(98797),i=a(42461),d=a(16255),c=a(60348),o=a(64767),m=a(61041),x=a(2263),u=a(84814),h=a(89284),p=a(52828),b=a(44414);const y=()=>{const e=(0,o.Bd)().t,s=(0,n.m)(),a=s.paymentMethods,r=s.deletePaymentMethod,y=s.setDefaultPaymentMethod,j=s.loading,N=(0,l.useState)(null),g=(0,t.A)(N,2),f=g[0],v=g[1],w=(0,l.useState)(null),A=(0,t.A)(w,2),k=A[0],C=A[1],S=async s=>{if(window.confirm(e("paymentMethodsList.confirmDelete")))try{v(s),await r(s)}catch(a){alert(e("paymentMethodsList.deleteError"))}finally{v(null)}},M=async s=>{try{C(s),await y(s)}catch(a){alert(e("paymentMethodsList.setDefaultError"))}finally{C(null)}},F=a.filter(e=>"paypal"!==e.type);return j?(0,b.jsxs)("div",{className:"flex flex-col sm:flex-row items-center justify-center p-6 sm:p-8",children:[(0,b.jsx)("div",{className:"animate-spin rounded-full h-6 w-6 sm:h-8 sm:w-8 border-b-2 border-blue-600"}),(0,b.jsx)("span",{className:"ml-0 sm:ml-3 mt-2 sm:mt-0 text-sm sm:text-base text-gray-600",children:e("paymentMethodsList.loading")})]}):0===F.length?(0,b.jsxs)("div",{className:"text-center p-6 sm:p-8",children:[(0,b.jsx)(m.A,{className:"h-10 w-10 sm:h-12 sm:w-12 text-gray-400 mx-auto mb-4"}),(0,b.jsx)("h3",{className:"text-base sm:text-lg font-medium text-gray-900 mb-2",children:e("paymentMethodsList.noPaymentMethods")}),(0,b.jsx)("p",{className:"text-sm sm:text-base text-gray-600 px-4",children:e("paymentMethodsList.emptyState")})]}):(0,b.jsx)("div",{className:"space-y-3 sm:space-y-4",children:F.filter(e=>"card"===e.type).map(s=>{var a;return(0,b.jsxs)(d.Zp,{className:"p-4 sm:p-6 relative "+(s.isDefault?"border-blue-200 bg-blue-50":"us_bank_account"!==s.type&&"bank_account"!==s.type||2!==Number(s.status)?"":"border-yellow-200 bg-yellow-50"),children:[(0,b.jsxs)("div",{className:"absolute top-3 right-3 sm:hidden flex items-center gap-1",children:[!s.isDefault&&(0,b.jsx)(i.$,{variant:"ghost",size:"sm",onClick:()=>M(s.id),disabled:k===s.id,className:"text-blue-600 hover:text-blue-800 p-1 h-9 w-9",title:e("paymentMethodsList.setAsDefault"),children:k===s.id?(0,b.jsx)("div",{className:"animate-spin rounded-full h-5 w-5 border-b-2 border-blue-600"}):(0,b.jsx)(x.A,{className:"h-5 w-5"})}),(0,b.jsx)(i.$,{variant:"ghost",size:"sm",onClick:()=>S(s.id),disabled:f===s.id,className:"text-red-600 hover:text-red-800 p-1 h-9 w-9",title:e("paymentMethodsList.deletePaymentMethod"),children:f===s.id?(0,b.jsx)("div",{className:"animate-spin rounded-full h-5 w-5 border-b-2 border-red-600"}):(0,b.jsx)(u.A,{className:"h-5 w-5"})})]}),(0,b.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[(0,b.jsxs)("div",{className:"flex items-start gap-3",children:["card"===s.type?(0,b.jsx)(m.A,{className:"h-6 w-6 sm:h-8 sm:w-8 text-gray-600 flex-shrink-0 mt-1"}):"us_bank_account"===s.type||"bank_account"===s.type?(0,b.jsx)(h.A,{className:"h-6 w-6 sm:h-8 sm:w-8 text-gray-600 flex-shrink-0 mt-1"}):(0,b.jsx)(m.A,{className:"h-6 w-6 sm:h-8 sm:w-8 text-gray-600 flex-shrink-0 mt-1"}),(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2",children:[(0,b.jsxs)("h4",{className:"text-sm sm:text-base font-medium text-gray-900 truncate",children:["card"===s.type&&`${null===(a=s.brand)||void 0===a?void 0:a.toUpperCase()} ****${s.last4}`,"us_bank_account"===s.type&&`${s.bankName} ****${s.last4}`,"bank_account"===s.type&&`${s.bankName} ****${s.last4}`]}),(0,b.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,b.jsxs)(c.E,{className:"bg-gray-100 text-gray-700 text-xs px-2 py-1",variant:void 0,children:["card"===s.type&&e("paymentMethodsList.types.card"),"us_bank_account"===s.type&&e("paymentMethodsList.types.bankAccount"),"bank_account"===s.type&&e("paymentMethodsList.types.bankAccount")]}),s.isDefault&&(0,b.jsx)(c.E,{className:"bg-blue-100 text-blue-800 text-xs px-2 py-1",variant:void 0,children:e("paymentMethodsList.default")})]})]}),(0,b.jsxs)("p",{className:"text-xs sm:text-sm text-gray-600 mt-1 break-words",children:["card"===s.type&&e("paymentMethodsList.expires",{month:s.expMonth,year:s.expYear}),"us_bank_account"===s.type&&(0,b.jsxs)("span",{className:"block sm:inline",children:[(0,b.jsxs)("span",{className:"hidden sm:inline",children:[s.accountHolderName," \u2022 ",s.routingNumber]}),(0,b.jsx)("span",{className:"sm:hidden",children:s.accountHolderName})]}),"bank_account"===s.type&&(0,b.jsxs)("span",{className:"block sm:inline",children:[(0,b.jsxs)("span",{className:"hidden sm:inline",children:[s.accountHolderName," \u2022 ",s.routingNumber]}),(0,b.jsx)("span",{className:"sm:hidden",children:s.accountHolderName})]})]}),("us_bank_account"===s.type||"bank_account"===s.type)&&(0,b.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2 mt-2",children:[(0,b.jsx)("span",{className:"text-xs px-2 py-1 rounded-full "+(1===Number(s.status)?"bg-green-100 text-green-800":2===Number(s.status)?"bg-yellow-100 text-yellow-800":3===Number(s.status)?"bg-blue-100 text-blue-800":"bg-gray-100 text-gray-800"),children:1===Number(s.status)?e("paymentMethodsList.status.verified"):2===Number(s.status)?e("paymentMethodsList.status.pendingVerification"):3===Number(s.status)?e("paymentMethodsList.status.verified"):e("paymentMethodsList.status.unknown")}),2===Number(s.status)&&(0,b.jsxs)("span",{className:"text-xs text-yellow-600 flex items-center gap-1",children:[(0,b.jsx)(p.A,{className:"h-3 w-3 flex-shrink-0"}),(0,b.jsx)("span",{className:"hidden sm:inline",children:e("paymentMethodsList.verificationRequired")}),(0,b.jsx)("span",{className:"sm:hidden",children:e("paymentMethodsList.verifyRequired")})]})]})]})]}),(0,b.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2 sm:gap-2",children:[("us_bank_account"===s.type||"bank_account"===s.type)&&2===Number(s.status)&&(0,b.jsxs)(i.$,{variant:"outline",size:"sm",onClick:()=>{alert(e("paymentMethodsList.verificationAlert"))},className:"text-yellow-600 border-yellow-300 hover:bg-yellow-50 text-xs sm:text-sm px-3 py-2 w-full sm:w-auto",children:[(0,b.jsx)(p.A,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1 sm:mr-2"}),(0,b.jsx)("span",{className:"hidden sm:inline",children:e("paymentMethodsList.verify")}),(0,b.jsx)("span",{className:"sm:hidden",children:e("paymentMethodsList.verifyAccount")}
1)]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[!s.isDefault&&(0,b.jsx)(i.$,{variant:"ghost",size:"sm",onClick:()=>M(s.id),disabled:k===s.id,className:"text-blue-600 hover:text-blue-800 p-2 hidden sm:flex",title:e("paymentMethodsList.setAsDefault"),children:k===s.id?(0,b.jsx)("div",{className:"animate-spin rounded-full h-3 w-3 sm:h-4 sm:w-4 border-b-2 border-blue-600"}):(0,b.jsx)(x.A,{className:"h-3 w-3 sm:h-4 sm:w-4"})}),(0,b.jsx)(i.$,{variant:"ghost",size:"sm",onClick:()=>S(s.id),disabled:f===s.id,className:"text-red-600 hover:text-red-800 p-2 hidden sm:flex",title:e("paymentMethodsList.deletePaymentMethod"),children:f===s.id?(0,b.jsx)("div",{className:"animate-spin rounded-full h-3 w-3 sm:h-4 sm:w-4 border-b-2 border-red-600"}):(0,b.jsx)(u.A,{className:"h-3 w-3 sm:h-4 sm:w-4"})})]})]})]})]},s.id)})})};var j=a(1801),N=a(74833),g=a(95003),f=a(42989),v=a(10300);const w=e=>{e.availableBalance;const s=(0,o.Bd)().t,a=(0,n.m)(),d=a.loading,c=a.error,x=(a.paymentMethods,(0,v.d4)(e=>e.auth).user,(0,l.useState)(!1)),u=(0,t.A)(x,2),h=u[0],p=u[1],w=(0,l.useState)(!1),A=(0,t.A)(w,2),k=A[0],C=A[1],S=(0,l.useState)(!1),M=(0,t.A)(S,2),F=M[0],P=M[1],E=(0,l.useState)({addCard:!1,addBankAccount:!1,addPayPal:!1}),I=(0,t.A)(E,2),D=I[0],T=I[1];return d?(0,b.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(f.A,{className:"h-6 w-6 animate-spin text-blue-600"}),(0,b.jsx)("span",{className:"text-gray-600",children:s("paymentMethodsManager.loadingPaymentMethods")})]})}):(0,b.jsxs)("div",{className:"space-y-6",children:[c&&(0,b.jsx)("div",{className:"bg-red-50 border border-red-200 rounded-lg p-4",children:(0,b.jsxs)("div",{className:"flex",children:[(0,b.jsx)("div",{className:"flex-shrink-0",children:(0,b.jsx)("svg",{className:"h-5 w-5 text-red-400",viewBox:"0 0 20 20",fill:"currentColor",children:(0,b.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})}),(0,b.jsxs)("div",{className:"ml-3",children:[(0,b.jsx)("h3",{className:"text-sm font-medium text-red-800",children:s("paymentMethodsManager.error")}),(0,b.jsx)("div",{className:"mt-2 text-sm text-red-700",children:(0,b.jsx)("p",{children:c})})]})]})}),(0,b.jsxs)("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h3",{className:"text-lg font-medium text-gray-900",children:s("paymentMethodsManager.paymentMethods")}),(0,b.jsx)("p",{className:"text-sm text-gray-600",children:s("paymentMethodsManager.managePaymentMethods")})]}),(0,b.jsx)("div",{className:"flex gap-2 flex-wrap",children:(0,b.jsxs)(i.$,{onClick:()=>p(!0),disabled:D.addCard,className:"flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",children:[D.addCard?(0,b.jsx)(f.A,{className:"h-4 w-4 animate-spin"}):(0,b.jsx)(m.A,{className:"h-4 w-4"}),D.addCard?s("paymentMethodsManager.processing"):s("paymentMethodsManager.addCard")]})})]}),(0,b.jsx)(y,{}),(0,b.jsx)(r.N,{children:h&&(0,b.jsx)(j.A,{onClose:()=>{p(!1),T(e=>({...e,addCard:!1}))},onSuccess:()=>{T(e=>({...e,addCard:!0})),p(!1),setTimeout(()=>{T(e=>({...e,addCard:!1}))},1e3)}})}),(0,b.jsx)(r.N,{children:F&&(0,b.jsx)(g.A,{onClose:()=>{P(!1),T(e=>({...e,addPayPal:!1}))},onSuccess:()=>{T(e=>({...e,addPayPal:!0})),P(!1),setTimeout(()=>{T(e=>({...e,addPayPal:!1}))},1e3)}})}),(0,b.jsx)(r.N,{children:k&&(0,b.jsx)(N.A,{onClose:()=>{C(!1),T(e=>({...e,addBankAccount:!1}))},onSuccess:e=>{T(e=>({...e,addBankAccount:!0})),C(!1),null!==e&&void 0!==e&&e.requiresVerification?(console.log("Bank account requires verification:",e.verificationDetails),alert(s("paymentMethods.bankAccountAddedSuccess"))):console.log("Bank account added successfully"),setTimeout(()=>{T(e=>({...e,addBankAccount:!1}))},1e3)}})})]})}},86872(e,s,a){var t=a(5544),l=a(9950),r=a(17119),n=a(76429),i=a(50142),d=a(64767),c=a(37018),o=a(98797),m=a(50288),x=a(42461),u=a(52828),h=a(45833),p=a(42989),b=a(89284),y=a(61041),j=a(52607),N=a(81946),g=a(96479),f=a(96419),v=a(44325),w=a(84655),A=a(44414);const k=e=>{var s;let a=e.onClose,k=e.availableBalance,C=e.onNavigateToWithdrawalMethods;const S=(0,d.Bd)().t,M=(0,c.S)().createWithdrawal,F=(0,o.m)(),P=F.paymentMethods,E=F.refreshPaymentMethods,I=(0,m.GV)(e=>e.auth.user),D=(0,l.useState)(!1),T=(0,t.A)(D,2),L=T[0],_=T[1],$=(0,l.useState)(null),O=(0,t.A)($,2),z=O[0],B=O[1],R=(0,l.useState)(!1),U=(0,t.A)(R,2),H=U[0],q=U[1],Q=(0,l.useState)(!1),W=(0,t.A)(Q,2),G=W[0],V=W[1],Y=(0,l.useState)(null),K=(0,t.A)(Y,2),Z=K[0],J=K[1],X=(0,l.useState)(null),ee=(0,t.A)(X,2),se=ee[0],ae=ee[1],te=(0,l.useState)(!1),le=(0,t.A)(te,2),re=le[0],ne=le[1],ie=(0,l.useState)({amount:k?k.toString():"",currency:"USD",withdrawalMethod:"stripe",notes:"",selectedBankAccountId:""}),de=(0,t.A)(ie,2),ce=de[0],oe=de[1],me=P.filter(e=>"paypal"===e.type),xe=me.length>0,ue=null===(s=me[0])||void 0===s?void 0:s.paypalEmail,he=P.filter(e=>"bank_account"===e.type||"us_bank_account"===e.type||"sepa_bank_account"===e.type),pe=he.length>0;(0,l.useEffect)(()=>(V(!0),document.body.style.overflow="hidden",()=>{document.body.style.overflow="unset"}),[]),(0,l.useEffect)(()=>{G&&E()},[G,E]),(0,l.useEffect)(()=>{G&&(async()=>{const e=null===I||void 0===I?void 0:I.stripeConnectedAccountId;if(e)try{ne(!0);const s=await v.w.getAccountStatus(e),a=s.chargesEnabled&&s.payoutsEnabled;ae({hasAccount:!0,isEnabled:a,accountId:e})}catch(s){console.error("Error checking Stripe Connect status:",s),ae({hasAccount:!0,isEnabled:!1,accountId:e})}finally{ne(!1)}else ae({hasAccount:!1,isEnabled:!1})})()},[G,I]);const be=()=>{q(!1),B(null),_(!1),J(null),oe({amount:k?k.toString():"",currency:"USD",withdrawalMethod:"stripe",notes:"",selectedBankAccountId:""}),document.body.style.overflow="unset",a()};if(!G)return null;return(0,r.createPortal)((0,A.jsx)("div",{className:"fixed inset-0 bg-black bg-opacity-50 z-[9999] flex items-center justify-center p-4",onClick:e=>e.target===e.currentTarget&&be(),style:{backdropFilter:"blur(4px)"},children:(0,A.jsxs)(i.P.div,{initial:{scale:.95,opacity:0}
1,animate:{scale:1,opacity:1},exit:{scale:.95,opacity:0},transition:{duration:.2,ease:"easeOut"},className:"bg-white rounded-2xl w-full max-w-lg max-h-[90vh] overflow-y-auto shadow-2xl mx-4",onClick:e=>e.stopPropagation(),children:[(0,A.jsx)("div",{className:"bg-gradient-to-r from-purple-600 to-purple-700 px-6 py-4 rounded-t-2xl",children:(0,A.jsxs)("div",{className:"flex justify-between items-center",children:[(0,A.jsxs)("div",{className:"flex items-center gap-3",children:[(0,A.jsx)("div",{className:"p-2 bg-white/20 rounded-lg",children:(0,A.jsx)("span",{className:"text-2xl font-bold text-white",children:(0,w.vO)()})}),(0,A.jsxs)("div",{children:[(0,A.jsx)("h2",{className:"text-xl font-bold text-white",children:S("withdrawalForm.title")}),(0,A.jsx)("p",{className:"text-purple-100 text-sm",children:S("withdrawalForm.subtitle")})]})]}),(0,A.jsx)("button",{onClick:be,className:"p-2 hover:bg-white/20 rounded-lg transition-colors",children:(0,A.jsx)(g.A,{className:"h-5 w-5 text-white"})})]})}),(0,A.jsx)("div",{className:"p-6",children:H?(0,A.jsxs)(i.P.div,{initial:{scale:.8,opacity:0}
1,animate:{scale:1,opacity:1},className:"text-center py-8",children:[(0,A.jsx)("div",{className:"mx-auto w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mb-4",children:(0,A.jsx)(h.A,{className:"h-8 w-8 text-green-600"})}),(0,A.jsx)("h3",{className:"text-xl font-semibold text-gray-900 mb-2",children:S("withdrawalForm.successTitle")})]}):(0,A.jsx)("div",{className:"space-y-6",children:(0,A.jsxs)("form",{onSubmit:async e=>{e.preventDefault(),_(!0),B(null);try{if(!(!ce.amount||parseFloat(ce.amount)<=0?(B(S("withdrawalForm.errors.invalidAmount",{currencySymbol:(0,w.vO)()})),0):parseFloat(ce.amount)<1?(B(S("withdrawalForm.errors.minimumAmount",{currencySymbol:(0,w.vO)()})),0):parseFloat(ce.amount)>1e4?(B(S("withdrawalForm.errors.maximumAmount",{currencySymbol:(0,w.vO)()})),0):k&&parseFloat(ce.amount)>k?(B(S("withdrawalForm.errors.exceedsBalance",{currencySymbol:(0,w.vO)(),balance:k.toFixed(2)})),0):Z&&ce.currency||(B(S("withdrawalForm.errors.selectCurrency")),0)))return;if("stripe"===ce.withdrawalMethod){if(null===se||void 0===se||!se.hasAccount)return void B(S("withdrawalForm.errors.stripeAccountRequired"));if(null===se||void 0===se||!se.isEnabled)return void B(S("withdrawalForm.errors.stripeNotEnabled"))}else if("paypal"===ce.withdrawalMethod){if(!xe||!ue)return void B(S("withdrawalForm.errors.paypalRequired"))}else if("bank_account"===ce.withdrawalMethod){if(!pe)return void B(S("withdrawalForm.errors.bankAccountRequired"));if(!ce.selectedBankAccountId)return void B(S("withdrawalForm.errors.selectBankAccount"))}"bank_account"===ce.withdrawalMethod&&he.find(e=>e.id===ce.selectedBankAccountId);await M({amount:parseFloat(ce.amount),currency:ce.currency,withdrawalMethod:ce.withdrawalMethod,paypalEmail:"paypal"===ce.withdrawalMethod?ue:void 0,bankAccountId:"bank_account"===ce.withdrawalMethod?ce.selectedBankAccountId:void 0,notes:ce.notes}),q(!0),setTimeout(()=>{be()},2e3)}catch(n){var s,a,t,l,r;if(console.error("Withdrawal creation error:",n),null!==n&&void 0!==n&&null!==(s=n.response)&&void 0!==s&&null!==(s=s.data)&&void 0!==s&&s.message)B(n.response.data.message);else if(null!==n&&void 0!==n&&null!==(a=n.response)&&void 0!==a&&null!==(a=a.data)&&void 0!==a&&a.error)B(n.response.data.error);else if(null!==n&&void 0!==n&&null!==(t=n.response)&&void 0!==t&&null!==(t=t.data)&&void 0!==t&&null!==(t=t.details)&&void 0!==t&&t.message)B(n.response.data.details.message);else if(null!==n&&void 0!==n&&null!==(l=n.response)&&void 0!==l&&null!==(l=l.data)&&void 0!==l&&null!==(l=l.details)&&void 0!==l&&l.reason){const e=n.response.data.details.reason;B("MISSING_STRIPE_CONNECT_ACCOUNT"===e?S("withdrawalForm.errors.stripeAccountRequired"):"INSUFFICIENT_BALANCE"===e?S("withdrawalForm.errors.insufficientBalance"):"WITHDRAWAL_LIMIT_EXCEEDED"===e?S("withdrawalForm.errors.withdrawalLimitExceeded"):"DAILY_LIMIT_EXCEEDED"===e?S("withdrawalForm.errors.dailyLimitExceeded"):"STRIPE_ERROR"===e?S("withdrawalForm.errors.stripeError"):"ACCOUNT_NOT_VERIFIED"===e?S("withdrawalForm.errors.accountNotVerified"):`Error: ${e}`)}else null!==n&&void 0!==n&&n.message?B(n.message):null!==n&&void 0!==n&&null!==(r=n.response)&&void 0!==r&&r.status?B(S("withdrawalForm.errors.requestFailed",{status:n.response.status})):B(S("withdrawalForm.errors.unexpectedError"))}finally{_(!1)}},className:"space-y-6",children:[(0,A.jsx)("div",{className:"bg-purple-50 border border-purple-200 rounded-lg p-4",children:(0,A.jsxs)("div",{className:"flex items-start gap-3",children:[(0,A.jsx)(N.A,{className:"h-5 w-5 text-purple-600 flex-shrink-0 mt-0.5"}),(0,A.jsxs)("div",{children:[(0,A.jsx)("h4",{className:"text-sm font-medium text-purple-800",children:S("withdrawalForm.secureWithdrawal")}),(0,A.jsx)("p",{className:"text-sm text-purple-700 mt-1",children:S("withdrawalForm.secureWithdrawalDesc")})]})]})}),(0,A.jsxs)("div",{children:[(0,A.jsx)("div",{className:"flex items-center justify-between mb-2",children:(0,A.jsxs)("label",{className:"block text-sm font-medium text-gray-700",children:[S("withdrawalForm.withdrawalMethod")," ",(0,A.jsx)("span",{className:"text-red-500",children:S("withdrawalForm.required")})]})}),!(null!==se&&void 0!==se&&se.hasAccount&&null!==se&&void 0!==se&&se.isEnabled)&&!xe&&!pe&&(0,A.jsx)("div",{className:"bg-yellow-50 border border-yellow-200 rounded-lg p-4 mb-3",children:(0,A.jsxs)("div",{className:"flex items-start gap-3",children:[(0,A.jsx)(u.A,{className:"h-5 w-5 text-yellow-600 flex-shrink-0 mt-0.5"}),(0,A.jsxs)("div",{className:"flex-1",children:[(0,A.jsx)("h4",{className:"text-sm font-medium text-yellow-800",children:S("withdrawalForm.noWithdrawalMethodsAvailable")}),(0,A.jsx)("p",{className:"text-sm text-yellow-700 mt-1",children:S("withdrawalForm.noWithdrawalMethodsDesc")})]})]})}),(0,A.jsxs)("div",{className:"grid grid-cols-1 gap-3",children:[(null===se||void 0===se?void 0:se.hasAccount)&&(null===se||void 0===se?void 0:se.isEnabled)&&(0,A.jsxs)("button",{type:"button",onClick:()=>oe({...ce,withdrawalMethod:"stripe"}),className:"relative flex items-start gap-3 p-4 border-2 rounded-xl transition-all "+("stripe"===ce.withdrawalMethod?"border-purple-500 bg-purple-50":"border-gray-200 hover:border-purple-300"),children:[(0,A.jsx)("div",{className:"flex-shrink-0 mt-0.5 "+("stripe"===ce.withdrawalMethod?"text-purple-600":"text-gray-400"),children:(0,A.jsx)(y.A,{className:"h-5 w-5"})}),(0,A.jsxs)("div",{className:"flex-1 text-left",children:[(0,A.jsxs)("div",{className:"flex items-center gap-2",children:[(0,A.jsx)("span",{className:"text-sm font-medium text-gray-900",children:S("withdrawalForm.stripeConnect")}),(0,A.jsx)(h.A,{className:"h-4 w-4 text-green-600"})]}),(0,A.jsx)("p",{className:"text-xs text-gray-600 mt-1",children:S("withdrawalForm.bankPayoutViaStripe")})]}),"stripe"===ce.withdrawalMethod&&(0,A.jsx)("div",{className:"absolute top-2 right-2",children:(0,A.jsx)(h.A,{className:"h-5 w-5 text-purple-600"})})]}),xe&&(0,A.jsxs)("button",{type:"button",onClick:()=>oe({...ce,withdrawalMethod:"paypal"}),className:"relative flex items-start gap-3 p-4 border-2 rounded-xl transition-all "+("paypal"===ce.withdrawalMethod?"border-purple-500 bg-purple-50":"border-gray-200 hover:border-purple-300"),children:[(0,A.jsx)("div",{className:"flex-shrink-0 mt-0.5 "+("paypal"===ce.withdrawalMethod?"text-purple-600":"text-gray-400"),children:(0,A.jsx)("span",{className:"text-lg font-bold",children:(0,w.vO)()})}),(0,A.jsxs)("div",{className:"flex-1 text-left",children:[(0,A.jsxs)("div",{className:"flex items-center gap-2",children:[(0,A.jsx)("span",{className:"text-sm font-medium text-gray-900",children:S("withdrawalForm.paypal")}),(0,A.jsx)(h.A,{className:"h-4 w-4 text-green-600"})]}),(0,A.jsx)("p",{className:"text-xs text-gray-600 mt-1 truncate",children:ue})]}),"paypal"===ce.withdrawalMethod&&(0,A.jsx)("div",{className:"absolute top-2 right-2",children:(0,A.jsx)(h.A,{className:"h-5 w-5 text-purple-600"})})]})]}),pe&&(0,A.jsx)("div",{className:"grid grid-cols-1 gap-3 mt-3",children:(0,A.jsxs)("div",{className:"space-y-2",children:[(0,A.jsxs)("button",{type:"button",onClick:()=>oe({...ce,withdrawalMethod:"bank_account"}),className:"relative flex items-start gap-3 p-4 border-2 rounded-xl transition-all w-full "+("bank_account"===ce.withdrawalMethod?"border-purple-500 bg-purple-50":"border-gray-200 hover:border-purple-300"),children:[(0,A.jsx)("div",{className:"flex-shrink-0 mt-0.5 "+("bank_account"===ce.withdrawalMethod?"text-purple-600":"text-gray-400"),children:(0,A.jsx)(b.A,{className:"h-5 w-5"})}),(0,A.jsxs)("div",{className:"flex-1 text-left",children:[(0,A.jsxs)("div",{className:"flex items-center gap-2",children:[(0,A.jsx)("span",{className:"text-sm font-medium text-gray-900",children:S("withdrawalForm.bankAccount")}
1),(0,A.jsx)(h.A,{className:"h-4 w-4 text-green-600"})]}),(0,A.jsx)("p",{className:"text-xs text-gray-600 mt-1",children:S("withdrawalForm.manualBankTransfer")})]}),"bank_account"===ce.withdrawalMethod&&(0,A.jsx)("div",{className:"absolute top-2 right-2",children:(0,A.jsx)(h.A,{className:"h-5 w-5 text-purple-600"})})]}),"bank_account"===ce.withdrawalMethod&&(0,A.jsxs)("div",{className:"ml-4 pl-4 border-l-2 border-purple-200",children:[(0,A.jsxs)("label",{className:"block text-xs font-medium text-gray-700 mb-2",children:[S("withdrawalForm.selectBankAccount")," ",(0,A.jsx)("span",{className:"text-red-500",children:S("withdrawalForm.required")})]}),(0,A.jsxs)("select",{value:ce.selectedBankAccountId,onChange:e=>oe({...ce,selectedBankAccountId:e.target.value}),className:"w-full px-3 py-2 text-sm border border-gray-300 rounded-lg focus:ring-2 focus:ring-purple-500 focus:border-purple-500",children:[(0,A.jsx)("option",{value:"",children:S("withdrawalForm.selectBankAccountPlaceholder")}),he.map(e=>{var s,a;return(0,A.jsxs)("option",{value:e.id,children:[e.bankName," - ",e.accountHolderName,"sepa_bank_account"===e.type?` (****${null===(s=e.iban)||void 0===s?void 0:s.slice(-4)})`:` (****${e.last4||(null===(a=e.accountNumber)||void 0===a?void 0:a.slice(-4))})`]},e.id)})]})]})]})}),!(null!==se&&void 0!==se&&se.hasAccount&&null!==se&&void 0!==se&&se.isEnabled)&&!xe&&!pe&&C&&(0,A.jsx)("div",{className:"mt-3",children:(0,A.jsxs)("button",{type:"button",onClick:()=>{be(),C()},className:"w-full flex items-center justify-center gap-2 px-4 py-3 text-sm font-medium text-white bg-purple-600 hover:bg-purple-700 rounded-lg transition-colors",children:[(0,A.jsx)(j.A,{className:"h-4 w-4"}),S("withdrawalForm.setupWithdrawalMethods")]})})]}),(0,A.jsxs)("div",{children:[(0,A.jsxs)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:[S("withdrawalForm.amount")," ",(0,A.jsx)("span",{className:"text-red-500",children:S("withdrawalForm.required")})]}),(0,A.jsxs)("div",{className:"relative",children:[(0,A.jsx)("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-lg font-bold text-gray-400",children:(0,w.vO)()}),(0,A.jsx)("input",{type:"number",step:"0.01",min:"1",max:"10000",value:ce.amount,onChange:e=>{oe({...ce,amount:e.target.value}),B(null)},className:"w-full pl-10 pr-4 py-3 border rounded-xl focus:ring-2 focus:ring-purple-500 focus:border-purple-500 transition-colors "+(ce.amount&&(parseFloat(ce.amount)<1||parseFloat(ce.amount)>1e4||k&&parseFloat(ce.amount)>k)?"border-red-300":"border-gray-300"),placeholder:S("withdrawalForm.amountPlaceholder"),required:!0})]}),ce.amount&&parseFloat(ce.amount)<1&&(0,A.jsx)("p",{className:"text-red-500 text-xs mt-1",children:S("withdrawalForm.minimumWithdrawal",{currencySymbol:(0,w.vO)()})}),ce.amount&&parseFloat(ce.amount)>1e4&&(0,A.jsx)("p",{className:"text-red-500 text-xs mt-1",children:S("withdrawalForm.maximumWithdrawal",{currencySymbol:(0,w.vO)()})}),ce.amount&&k&&parseFloat(ce.amount)>k&&(0,A.jsx)("p",{className:"text-red-500 text-xs mt-1",children:S("withdrawalForm.exceedsAvailableBalance",{currencySymbol:(0,w.vO)(),balance:k.toFixed(2)})}),(0,A.jsxs)("div",{className:"flex items-center justify-between mt-2",children:[(0,A.jsx)("p",{className:"text-gray-500 text-xs",children:S("withdrawalForm.minMaxInfo",{currencySymbol:(0,w.vO)()})}),k&&k>0&&(0,A.jsx)("button",{type:"button",onClick:()=>{oe({...ce,amount:k.toString()}),B(null)},className:"text-blue-600 hover:text-blue-700 text-xs font-medium underline",children:S("withdrawalForm.useAvailableBalance",{currencySymbol:(0,w.vO)(),balance:k.toFixed(2)})})]}),k&&(0,A.jsx)("p",{className:"text-blue-600 text-xs mt-1 font-medium",children:S("withdrawalForm.availableBalance",{currencySymbol:(0,w.vO)(),balance:k.toFixed(2)})})]}),(0,A.jsxs)("div",{children:[(0,A.jsxs)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:[S("withdrawalForm.currency")," ",(0,A.jsx)("span",{className:"text-red-500",children:S("withdrawalForm.required")})]}),(0,A.jsx)(f.A,{selectedCurrency:Z,onCurrencySelect:e=>{J(e),oe({...ce,currency:(null===e||void 0===e?void 0:e.code)||"USD"})},placeholder:S("withdrawalForm.selectCurrency")}),!Z&&(0,A.jsx)("p",{className:"text-gray-500 text-xs mt-1",children:S("withdrawalForm.selectCurrencyHelper")})]}),(0,A.jsxs)("div",{children:[(0,A.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:S("withdrawalForm.notes")}),(0,A.jsx)("textarea",{value:ce.notes,onChange:e=>oe({...ce,notes:e.target.value}),rows:3,className:"w-full px-4 py-3 border border-gray-300 rounded-xl focus:ring-2 focus:ring-purple-500 focus:border-purple-500 transition-colors resize-none",placeholder:S("withdrawalForm.notesPlaceholder")})]}),(0,A.jsx)(n.N,{children:z&&(0,A.jsx)(i.P.div,{initial:{opacity:0,y:-10}
1,animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"bg-red-50 border border-red-200 rounded-lg p-4",children:(0,A.jsxs)("div",{className:"flex items-start gap-3",children:[(0,A.jsx)(u.A,{className:"h-5 w-5 text-red-600 flex-shrink-0 mt-0.5"}),(0,A.jsx)("div",{className:"flex-1",children:(0,A.jsx)("div",{className:"text-sm text-red-700",children:z})})]})})}),(0,A.jsxs)("div",{className:"flex gap-3 pt-4",children:[(0,A.jsx)(x.$,{type:"button",variant:"outline",onClick:be,className:"flex-1 h-12",disabled:L,children:S("withdrawalForm.cancel")}),(0,A.jsx)(x.$,{type:"submit",disabled:L||re||!ce.amount||"paypal"===ce.withdrawalMethod&&!xe||"bank_account"===ce.withdrawalMethod&&!ce.selectedBankAccountId,className:"flex-1 h-12 bg-purple-600 hover:bg-purple-700",children:L?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(p.A,{className:"h-4 w-4 animate-spin mr-2"}),S("withdrawalForm.creating")]}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("span",{className:"text-lg font-bold mr-2",children:(0,w.vO)()}),S("withdrawalForm.createWithdrawal")]})})]})]})})})]})}),document.body)};a.d(s,["A",0,k])},58993(e,s,a){a.d(s,{A:()=>P});var t=a(5544),l=a(9950),r=a(54060),n=a(64767),i=a(76429),d=a(42461),c=a(61041),o=a(14215),m=a(42989),x=a(45833),u=a(81872),h=a(84814),p=a(52607),b=a(89284),y=a(71865),j=a(95003),N=a(17119),g=a(50142),f=a(14697),v=a(41591),w=a(96479),A=a(52828),k=a(29126),C=a(98797),S=a(44414);const M=e=>{let s=e.onClose,a=e.onSuccess,r=e.existingMethod,n=void 0===r?null:r;const o=(0,C.m)(),u=o.addPaymentMethod,h=o.updatePaymentMethod,p=(0,l.useState)("sepa_bank_account"===(null===n||void 0===n?void 0:n.type)?"sepa":"international"),y=(0,t.A)(p,2),j=y[0],M=y[1],F=(0,l.useState)({accountHolderName:(null===n||void 0===n?void 0:n.accountHolderName)||"",bankName:(null===n||void 0===n?void 0:n.bankName)||"",accountNumber:(null===n||void 0===n?void 0:n.accountNumber)||"",routingNumber:(null===n||void 0===n?void 0:n.routingNumber)||"",iban:(null===n||void 0===n?void 0:n.iban)||"",bic:(null===n||void 0===n?void 0:n.bic)||"",swift:(null===n||void 0===n?void 0:n.swift)||"",bankCountry:(null===n||void 0===n?void 0:n.bankCountry)||"",accountType:(null===n||void 0===n?void 0:n.accountType)||"personal"}),P=(0,t.A)(F,2),E=P[0],I=P[1],D=(0,l.useState)(!1),T=(0,t.A)(D,2),L=T[0],_=T[1],$=(0,l.useState)(""),O=(0,t.A)($,2),z=O[0],B=O[1],R=(0,l.useState)(!1),U=(0,t.A)(R,2),H=U[0],q=U[1],Q=(0,l.useState)(!1),W=(0,t.A)(Q,2),G=W[0],V=W[1];(0,l.useEffect)(()=>(V(!0),document.body.style.overflow="hidden",()=>{document.body.style.overflow="unset"}),[]);const Y=()=>{q(!1),B(""),_(!1),document.body.style.overflow="unset",s()};if(!G)return null;const K=e=>{I(s=>({...s,[e.target.name]:e.target.value})),B("")},Z=e=>{M(e),B("")};return(0,N.createPortal)((0,S.jsx)("div",{className:"fixed inset-0 bg-black bg-opacity-50 z-[9999] flex items-center justify-center p-4",onClick:e=>e.target===e.currentTarget&&Y(),style:{backdropFilter:"blur(4px)"},children:(0,S.jsxs)(g.P.div,{initial:{scale:.95,opacity:0},animate:{scale:1,opacity:1},exit:{scale:.95,opacity:0},transition:{duration:.2,ease:"easeOut"},className:"bg-white rounded-2xl w-full max-w-2xl max-h-[90vh] overflow-y-auto shadow-2xl mx-4",onClick:e=>e.stopPropagation(),children:[(0,S.jsx)("div",{className:"bg-gradient-to-r from-blue-600 to-blue-700 px-6 py-4 rounded-t-2xl",children:(0,S.jsxs)("div",{className:"flex justify-between items-center",children:[(0,S.jsxs)("div",{className:"flex items-center gap-3",children:[(0,S.jsx)("div",{className:"p-2 bg-white/20 rounded-lg",children:(0,S.jsx)(b.A,{className:"h-6 w-6 text-white"})}),(0,S.jsxs)("div",{children:[(0,S.jsxs)("h2",{className:"text-xl font-bold text-white",children:[n?"Update":"Add"," Bank Account"]}),(0,S.jsx)("p",{className:"text-blue-100 text-sm",children:"Add your bank account details"})]})]}),(0,S.jsx)("button",{onClick:Y,className:"p-2 hover:bg-white/20 rounded-lg transition-colors",children:(0,S.jsx)(w.A,{className:"h-5 w-5 text-white"})})]})}),(0,S.jsx)("div",{className:"p-6",children:H?(0,S.jsxs)(g.P.div,{initial:{scale:.8,opacity:0}
1,animate:{scale:1,opacity:1},className:"text-center py-8",children:[(0,S.jsx)("div",{className:"mx-auto w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mb-4",children:(0,S.jsx)(x.A,{className:"h-8 w-8 text-green-600"})}),(0,S.jsxs)("h3",{className:"text-xl font-semibold text-gray-900 mb-2",children:["Bank Account ",n?"Updated":"Added"," Successfully!"]}),(0,S.jsx)("p",{className:"text-gray-600",children:"Your bank account details have been saved successfully."})]}):(0,S.jsxs)("form",{onSubmit:async e=>{e.preventDefault(),B(""),_(!0);try{if(!(()=>{if(!E.accountHolderName||!E.bankName)return B("Please fill in all required fields"),!1;if("sepa"===j){if(!E.iban||!E.bic)return B("Please fill in IBAN and BIC/SWIFT for SEPA transfers"),!1}else if(!E.accountNumber||!E.routingNumber||!E.swift||!E.bankCountry)return B("Please fill in all required fields for international transfers"),!1;return!0})())return;const e={type:"sepa"===j?"sepa_bank_account":"bank_account",bankName:E.bankName,accountHolderName:E.accountHolderName,accountType:E.accountType,isDefault:!1,metadata:{transferType:j,accountType:E.accountType}};"sepa"===j?(e.iban=E.iban,e.bic=E.bic):(e.accountNumber=E.accountNumber,e.routingNumber=E.routingNumber,e.swift=E.swift,e.bankCountry=E.bankCountry),n?await h(n.id,{metadata:{...n.metadata,...e.metadata,accountHolderName:E.accountHolderName,bankName:E.bankName,accountType:E.accountType,transferType:j}}):await u(e),q(!0),setTimeout(()=>{a(),Y()},2e3)}catch(t){var s;B((null===t||void 0===t||null===(s=t.response)||void 0===s||null===(s=s.data)||void 0===s?void 0:s.message)||t.message||"Failed to save bank account")}finally{_(!1)}},className:"space-y-6",children:[(0,S.jsx)(i.N,{children:z&&(0,S.jsx)(g.P.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"bg-red-50 border border-red-200 rounded-lg p-4",children:(0,S.jsxs)("div",{className:"flex items-start gap-3",children:[(0,S.jsx)(A.A,{className:"h-5 w-5 text-red-600 flex-shrink-0 mt-0.5"}),(0,S.jsxs)("div",{children:[(0,S.jsx)("h4",{className:"text-sm font-medium text-red-800",children:"Error"}),(0,S.jsx)("p",{className:"text-sm text-red-700 mt-1",children:z})]})]})})}),(0,S.jsxs)("div",{children:[(0,S.jsxs)(v.A,{className:"block text-sm font-medium text-gray-700 mb-3",children:["Bank Transfer Type ",(0,S.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,S.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[(0,S.jsxs)("button",{type:"button",onClick:()=>Z("sepa"),className:"relative flex items-start gap-3 p-4 border-2 rounded-xl transition-all "+("sepa"===j?"border-blue-500 bg-blue-50":"border-gray-200 hover:border-blue-300"),children:[(0,S.jsx)("div",{className:"flex-shrink-0 mt-0.5 "+("sepa"===j?"text-blue-600":"text-gray-400"),children:(0,S.jsx)(c.A,{className:"h-5 w-5"})}),(0,S.jsxs)("div",{className:"flex-1 text-left",children:[(0,S.jsxs)("div",{className:"flex items-center gap-2",children:[(0,S.jsx)("span",{className:"text-sm font-medium text-gray-900",children:"European (SEPA) Bank Transfer"}),"sepa"===j&&(0,S.jsx)(x.A,{className:"h-4 w-4 text-blue-600"})]}),(0,S.jsx)("p",{className:"text-xs text-gray-600 mt-1",children:"For European bank accounts"})]}),"sepa"===j&&(0,S.jsx)("div",{className:"absolute top-2 right-2",children:(0,S.jsx)(x.A,{className:"h-5 w-5 text-blue-600"})})]}),(0,S.jsxs)("button",{type:"button",onClick:()=>Z("international"),className:"relative flex items-start gap-3 p-4 border-2 rounded-xl transition-all "+("international"===j?"border-blue-500 bg-blue-50":"border-gray-200 hover:border-blue-300"),children:[(0,S.jsx)("div",{className:"flex-shrink-0 mt-0.5 "+("international"===j?"text-blue-600":"text-gray-400"),children:(0,S.jsx)(k.A,{className:"h-5 w-5"})}),(0,S.jsxs)("div",{className:"flex-1 text-left",children:[(0,S.jsxs)("div",{className:"flex items-center gap-2",children:[(0,S.jsx)("span",{className:"text-sm font-medium text-gray-900",children:"Extra-European / International Bank Transfer"}),"international"===j&&(0,S.jsx)(x.A,{className:"h-4 w-4 text-blue-600"})]}),(0,S.jsx)("p",{className:"text-xs text-gray-600 mt-1",children:"For international bank accounts"})]}),"international"===j&&(0,S.jsx)("div",{className:"absolute top-2 right-2",children:(0,S.jsx)(x.A,{className:"h-5 w-5 text-blue-600"})})]})]})]}),(0,S.jsxs)("div",{children:[(0,S.jsxs)(v.A,{htmlFor:"accountHolderName",className:"block text-sm font-medium text-gray-700 mb-2",children:["Account Holder Name ",(0,S.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,S.jsx)(f.p,{id:"accountHolderName",name:"accountHolderName",type:"text",value:E.accountHolderName,onChange:K,placeholder:"e.g. John Doe",required:!0,className:"w-full",disabled:L})]}),(0,S.jsxs)("div",{children:[(0,S.jsxs)(v.A,{htmlFor:"bankName",className:"block text-sm font-medium text-gray-700 mb-2",children:["Bank Name ",(0,S.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,S.jsx)(f.p,{id:"bankName",name:"bankName",type:"text",value:E.bankName,onChange:K,placeholder:"sepa"===j?"e.g. Deutsche Bank":"e.g. Bank of America",required:!0,className:"w-full",disabled:L})]}),"sepa"===j&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)("div",{children:[(0,S.jsxs)(v.A,{htmlFor:"iban",className:"block text-sm font-medium text-gray-700 mb-2",children:["IBAN ",(0,S.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,S.jsx)(f.p,{id:"iban",name:"iban",type:"text",value:E.iban,onChange:K,placeholder:"e.g. DE89370400440532013000",required:!0,className:"w-full",disabled:L})]}),(0,S.jsxs)("div",{children:[(0,S.jsxs)(v.A,{htmlFor:"bic",className:"block text-sm font-medium text-gray-700 mb-2",children:["BIC / SWIFT ",(0,S.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,S.jsx)(f.p,{id:"bic",name:"bic",type:"text",value:E.bic,onChange:K,placeholder:"e.g. DEUTDEDBFRA",required:!0,className:"w-full",disabled:L})]})]}),"international"===j&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)("div",{children:[(0,S.jsxs)(v.A,{htmlFor:"accountNumber",className:"block text-sm font-medium text-gray-700 mb-2",children:["Account Number ",(0,S.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,S.jsx)(f.p,{id:"accountNumber",name:"accountNumber",type:"text",value:E.accountNumber,onChange:K,placeholder:"e.g. 1234567890",required:!0,className:"w-full",disabled:L})]}),(0,S.jsxs)("div",{children:[(0,S.jsxs)(v.A,{htmlFor:"routingNumber",className:"block text-sm font-medium text-gray-700 mb-2",children:["Routing / Transit / Institution Code ",(0,S.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,S.jsx)(f.p,{id:"routingNumber",name:"routingNumber",type:"text",value:E.routingNumber,onChange:K,placeholder:"e.g. 021000021 (US) or 00011-003 (Canada)",required:!0,className:"w-full",disabled:L})]}),(0,S.jsxs)("div",{children:[(0,S.jsxs)(v.A,{htmlFor:"swift",className:"block text-sm font-medium text-gray-700 mb-2",children:["SWIFT / BIC ",(0,S.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,S.jsx)(f.p,{id:"swift",name:"swift",type:"text",value:E.swift,onChange:K,placeholder:"e.g. BOFAUS3N",required:!0,className:"w-full",disabled:L})]}),(0,S.jsxs)("div",{children:[(0,S.jsxs)(v.A,{htmlFor:"bankCountry",className:"block text-sm font-medium text-gray-700 mb-2",children:["Bank Country ",(0,S.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,S.jsx)(f.p,{id:"bankCountry",name:"bankCountry",type:"text",value:E.bankCountry,onChange:K,placeholder:"e.g. United States",required:!0,className:"w-full",disabled:L})]})]}),(0,S.jsxs)("div",{children:[(0,S.jsx)(v.A,{htmlFor:"accountType",className:"block text-sm font-medium text-gray-700 mb-2",children:"Account Type"}),(0,S.jsxs)("select",{id:"accountType",name:"accountType",value:E.accountType,onCh
1ange:K,className:"w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500",disabled:L,children:[(0,S.jsx)("option",{value:"",children:"-- Select Type --"}),(0,S.jsx)("option",{value:"personal",children:"Personal"}),(0,S.jsx)("option",{value:"business",children:"Business"})]})]}),(0,S.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:(0,S.jsxs)("div",{className:"flex items-start gap-3",children:[(0,S.jsx)("svg",{className:"h-5 w-5 text-blue-600 flex-shrink-0 mt-0.5",viewBox:"0 0 20 20",fill:"currentColor",children:(0,S.jsx)("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})}),(0,S.jsxs)("div",{children:[(0,S.jsx)("h4",{className:"text-sm font-medium text-blue-800",children:"Secure Storage"}),(0,S.jsx)("p",{className:"text-sm text-blue-700 mt-1",children:"Your bank account information is encrypted and stored securely. This information will be used for manual payment processing."})]})]})}),(0,S.jsxs)("div",{className:"flex gap-3 pt-4",children:[(0,S.jsx)(d.$,{type:"button",variant:"outline",onClick:Y,className:"flex-1 h-12",disabled:L,children:"Cancel"}),(0,S.jsx)(d.$,{type:"submit",className:"flex-1 h-12 bg-blue-600 hover:bg-blue-700",disabled:L,children:L?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(m.A,{className:"h-4 w-4 animate-spin mr-2"}),n?"Updating...":"Saving..."]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(b.A,{className:"h-4 w-4 mr-2"}),n?"Update":"Add"," Bank Account"]})})]})]})})]})}),document.body)},F=e=>{let s=e.onClose,a=e.onSuccess,r=e.existingMethod;const n=(0,C.m)().updatePayPalEmail,c=(0,l.useState)({paypalEmail:(null===r||void 0===r?void 0:r.paypalEmail)||""}),u=(0,t.A)(c,2),h=u[0],p=u[1],b=(0,l.useState)(!1),y=(0,t.A)(b,2),j=y[0],k=y[1],M=(0,l.useState)(""),F=(0,t.A)(M,2),P=F[0],E=F[1],I=(0,l.useState)(!1),D=(0,t.A)(I,2),T=D[0],L=D[1],_=(0,l.useState)(!1),$=(0,t.A)(_,2),O=$[0],z=$[1];(0,l.useEffect)(()=>(z(!0),document.body.style.overflow="hidden",()=>{document.body.style.overflow="unset"}),[]);const B=()=>{L(!1),E(""),k(!1),document.body.style.overflow="unset",s()};if(!O)return null;return(0,N.createPortal)((0,S.jsx)("div",{className:"fixed inset-0 bg-black bg-opacity-50 z-[9999] flex items-center justify-center p-4",onClick:e=>e.target===e.currentTarget&&B(),style:{backdropFilter:"blur(4px)"},children:(0,S.jsxs)(g.P.div,{initial:{scale:.95,opacity:0},animate:{scale:1,opacity:1},exit:{scale:.95,opacity:0},transition:{duration:.2,ease:"easeOut"},className:"bg-white rounded-2xl w-full max-w-md max-h-[90vh] overflow-y-auto shadow-2xl mx-4",onClick:e=>e.stopPropagation(),children:[(0,S.jsx)("div",{className:"bg-gradient-to-r from-blue-600 to-blue-700 px-6 py-4 rounded-t-2xl",children:(0,S.jsxs)("div",{className:"flex justify-between items-center",children:[(0,S.jsxs)("div",{className:"flex items-center gap-3",children:[(0,S.jsx)("div",{className:"p-2 bg-white/20 rounded-lg",children:(0,S.jsx)(o.A,{className:"h-6 w-6 text-white"})}),(0,S.jsxs)("div",{children:[(0,S.jsx)("h2",{className:"text-xl font-bold text-white",children:"Update PayPal Email"}),(0,S.jsx)("p",{className:"text-blue-100 text-sm",children:"Change your PayPal withdrawal email"})]})]}),(0,S.jsx)("button",{onClick:B,className:"p-2 hover:bg-white/20 rounded-lg transition-colors",children:(0,S.jsx)(w.A,{className:"h-5 w-5 text-white"})})]})}),(0,S.jsx)("div",{className:"p-6",children:T?(0,S.jsxs)(g.P.div,{initial:{scale:.8,opacity:0}
1,animate:{scale:1,opacity:1},className:"text-center py-8",children:[(0,S.jsx)("div",{className:"mx-auto w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mb-4",children:(0,S.jsx)(x.A,{className:"h-8 w-8 text-green-600"})}),(0,S.jsx)("h3",{className:"text-xl font-semibold text-gray-900 mb-2",children:"PayPal Email Updated!"}),(0,S.jsx)("p",{className:"text-gray-600",children:"Your PayPal email has been updated successfully."})]}):(0,S.jsxs)("form",{onSubmit:async e=>{e.preventDefault(),E(""),k(!0);try{if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(h.paypalEmail))throw new Error("Please enter a valid email address");await n(r.id,h.paypalEmail),L(!0),setTimeout(()=>{a(),B()},2e3)}catch(t){var s;E((null===t||void 0===t||null===(s=t.response)||void 0===s||null===(s=s.data)||void 0===s?void 0:s.message)||t.message||"Failed to update PayPal email")}finally{k(!1)}},className:"space-y-6",children:[(0,S.jsx)(i.N,{children:P&&(0,S.jsx)(g.P.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"bg-red-50 border border-red-200 rounded-lg p-4",children:(0,S.jsxs)("div",{className:"flex items-start gap-3",children:[(0,S.jsx)(A.A,{className:"h-5 w-5 text-red-600 flex-shrink-0 mt-0.5"}),(0,S.jsxs)("div",{children:[(0,S.jsx)("h4",{className:"text-sm font-medium text-red-800",children:"Error"}),(0,S.jsx)("p",{className:"text-sm text-red-700 mt-1",children:P})]})]})})}),(0,S.jsxs)("div",{className:"bg-gray-50 border border-gray-200 rounded-lg p-4",children:[(0,S.jsx)(v.A,{className:"block text-sm font-medium text-gray-700 mb-1",children:"Current PayPal Email"}),(0,S.jsx)("p",{className:"text-gray-900 font-medium",children:null===r||void 0===r?void 0:r.paypalEmail})]}),(0,S.jsxs)("div",{children:[(0,S.jsxs)(v.A,{htmlFor:"paypalEmail",className:"block text-sm font-medium text-gray-700 mb-2",children:["New PayPal Email Address ",(0,S.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,S.jsx)(f.p,{id:"paypalEmail",name:"paypalEmail",type:"email",value:h.paypalEmail,onChange:e=>{p(s=>({...s,[e.target.name]:e.target.value})),E("")},placeholder:"[email protected]",required:!0,className:"w-full",disabled:j}),(0,S.jsx)("p",{className:"text-xs text-gray-500 mt-2",children:"Enter the new email address associated with your PayPal account"})]}),(0,S.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:(0,S.jsxs)("div",{className:"flex items-start gap-3",children:[(0,S.jsx)("svg",{className:"h-5 w-5 text-blue-600 flex-shrink-0 mt-0.5",viewBox:"0 0 20 20",fill:"currentColor",children:(0,S.jsx)("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})}),(0,S.jsxs)("div",{children:[(0,S.jsx)("h4",{className:"text-sm font-medium text-blue-800",children:"Important"}),(0,S.jsx)("p",{className:"text-sm text-blue-700 mt-1",children:"Make sure you have access to the new PayPal account. Future withdrawals will be sent to this email."})]})]})}),(0,S.jsxs)("div",{className:"flex gap-3 pt-4",children:[(0,S.jsx)(d.$,{type:"button",variant:"outline",onClick:B,className:"flex-1 h-12",disabled:j,children:"Cancel"}),(0,S.jsx)(d.$,{type:"submit",className:"flex-1 h-12 bg-blue-600 hover:bg-blue-700",disabled:j||!h.paypalEmail||h.paypalEmail===(null===r||void 0===r?void 0:r.paypalEmail),children:j?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(m.A,{className:"h-4 w-4 animate-spin mr-2"}),"Updating..."]}):"Update PayPal Email"})]})]})})]})}),document.body)},P=e=>{let s=e.onComplete,a=e.onError,N=e.className,g=void 0===N?"":N;const f=(0,n.Bd)().t,v=(0,C.m)(),w=v.paymentMethods,A=v.loading,k=v.deletePaymentMethod,P=(0,l.useState)(!1),E=(0,t.A)(P,2),I=E[0],D=E[1],T=(0,l.useState)(!1),L=(0,t.A)(T,2),_=L[0],$=L[1],O=(0,l.useState)(!1),z=(0,t.A)(O,2),B=z[0],R=z[1],U=(0,l.useState)(!1),H=(0,t.A)(U,2),q=H[0],Q=H[1],W=(0,l.useState)(null),G=(0,t.A)(W,2),V=G[0],Y=G[1],K=(0,l.useState)(!1),Z=(0,t.A)(K,2),J=Z[0],X=Z[1],ee=(0,l.useState)(null),se=(0,t.A)(ee,2),ae=se[0],te=se[1],le=w.filter(e=>"paypal"===e.type),re=w.filter(e=>"bank_account"===e.type||"us_bank_account"===e.type||"sepa_bank_account"===e.type),ne=le.length>0,ie=re.length>0,de=async(e,s)=>{if(window.confirm(f("paypal"===s?"withdrawalMethodsSetup.confirmDeletePaypal":"withdrawalMethodsSetup.confirmDeleteBank")))try{te(e),await k(e)}catch(t){var a;alert((null===t||void 0===t||null===(a=t.response)||void 0===a||null===(a=a.data)||void 0===a?void 0:a.message)||f("withdrawalMethodsSetup.deletePaymentMethodFailed"))}finally{te(null)}};return(0,S.jsxs)("div",{className:`space-y-6 ${g}`,children:[(0,S.jsxs)("div",{children:[(0,S.jsx)("h3",{className:"text-lg font-medium text-gray-900",children:f("withdrawalMethodsSetup.title")}),(0,S.jsx)("p",{className:"text-sm text-gray-600 mt-1",children:f("withdrawalMethodsSetup.subtitle")})]}),(0,S.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg p-6",children:[(0,S.jsxs)("div",{className:"flex items-start gap-4 mb-4",children:[(0,S.jsx)("div",{className:"p-2 bg-blue-100 rounded-lg",children:(0,S.jsx)(c.A,{className:"h-6 w-6 text-blue-600"})}),(0,S.jsxs)("div",{className:"flex-1",children:[(0,S.jsx)("h4",{className:"text-base font-semibold text-gray-900",children:f("withdrawalMethodsSetup.stripeConnectTitle")}),(0,S.jsx)("p",{className:"text-sm text-gray-600 mt-1",children:f("withdrawalMethodsSetup.stripeConnectDesc")})]})]}),(0,S.jsx)(y.A,{onComplete:()=>{console.log("Stripe Connect setup completed successfully"),s&&s()},onError:e=>{console.error("Stripe Connect setup error:",e),a&&a(e)}})]}),(0,S.jsxs)("div",{className:"relative",children:[(0,S.jsx)("div",{className:"absolute inset-0 flex items-center",children:(0,S.jsx)("div",{className:"w-full border-t border-gray-200"})}),(0,S.jsx)("div",{className:"relative flex justify-center text-sm",children:(0,S.jsx)("span",{className:"px-2 bg-gray-50 text-gray-500",children:f("withdrawalMethodsSetup.or")})})]}),(0,S.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg p-6",children:[(0,S.jsxs)("div",{className:"flex items-start gap-4 mb-4",children:[(0,S.jsx)("div",{className:"p-2 bg-blue-100 rounded-lg",children:(0,S.jsx)(o.A,{className:"h-6 w-6 text-blue-600"})}),(0,S.jsxs)("div",{className:"flex-1",children:[(0,S.jsx)("h4",{className:"text-base font-semibold text-gray-900",children:f("withdrawalMethodsSetup.paypalAccountsTitle")}),(0,S.jsx)("p",{className:"text-sm text-gray-600 mt-1",children:f("withdrawalMethodsSetup.paypalAccountsDesc")})]})]}),A?(0,S.jsxs)("div",{className:"flex items-center gap-2 text-sm text-gray-600",children:[(0,S.jsx)(m.A,{className:"h-4 w-4 animate-spin"}),(0,S.jsx)("span",{children:f("withdrawalMethodsSetup.loadingPaypalAccounts")})]}):(0,S.jsxs)("div",{className:"space-y-3",children:[le.map(e=>(0,S.jsx)("div",{className:"bg-green-50 border border-green-200 rounded-lg p-4",children:(0,S.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,S.jsxs)("div",{className:"flex items-start gap-3 flex-1",children:[(0,S.jsx)(x.A,{className:"h-5 w-5 text-green-600 flex-shrink-0 mt-0.5"}),(0,S.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,S.jsx)("h5",{className:"text-sm font-medium text-green-800",children:f("withdrawalMethodsSetup.paypalConnected")}),(0,S.jsx)("p",{className:"text-sm text-green-700 mt-1 truncate",children:e.paypalEmail}),(0,S.jsx)("p",{className:"text-xs text-green-600 mt-1",children:f("withdrawalMethodsSetup.addedOn",{date:(0,r.lH)(e.createdAt)})})]})]}),(0,S.jsxs)("div",{className:"flex items-center gap-2",children:[(0,S.jsx)("button",{onClick:()=>{Y(e),R(!0)},className:"p-2 text-blue-600 hover:bg-blue-100 rounded-lg transition-colors",title:f("withdrawalMethodsSetup.updatePaypalEmail"),children:(0,S.jsx)(u.A,{className:"h-4 w-4"})}),(0,S.jsx)("button",{onClick:()=>de(e.id,"paypal"),disabled:ae===e.id,className:"p-2 text-red-600 hover:bg-red-100 rounded-lg transition-colors disabled:opacity-50",title:f("withdrawalMethodsSetup.removePaypalAccount"),children:ae===e.id?(0,S.jsx)(m.A,{className:"h-4 w-4 animate-spin"}):(0,S.jsx)(h.A,{className:"h-4 w-4"})})]})]})},e.id)),!ne&&(0,S.jsx)(d.$,{onClick:()=>D(!0),disabled:J,className:"w-full flex items-center justify-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",variant:"outline",children:J?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(m.A,{className:"h-4 w-4 animate-spin"}),f("withdrawalMethodsSetup.processing")]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(p.A,{className:"h-4 w-4"}),f("withdrawalMethodsSetup.addPaypalAccount")]})})]})]}),(0,S.jsxs)("div",{className:"relative",children:[(0,S.jsx)("div",{className:"absolute inset-0 flex items-center",children:(0,S.jsx)("div",{className:"w-full border-t border-gray-200"})}),(0,S.jsx)("div",{className:"relative flex justify-center text-sm",children:(0,S.jsx)("span",{className:"px-2 bg-gray-50 text-gray-500",children:f("withdrawalMethodsSetup.or")})})]}),(0,S.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg p-6",children:[(0,S.jsxs)("div",{className:"flex items-start gap-4 mb-4",children:[(0,S.jsx)("div",{className:"p-2 bg-green-100 rounded-lg",children:(0,S.jsx)(b.A,{className:"h-6 w-6 text-green-600"})}),(0,S.jsxs)("div",{className:"flex-1",children:[(0,S.jsx)("h4",{className:"text-base font-semibold text-gray-900",children:f("withdrawalMethodsSetup.bankAccountsTitle")}),(0,S.jsx)("p",{className:"text-sm text-gray-600 mt-1",children:f("withdrawalMethodsSetup.bankAccountsDesc")})]})]}),A?(0,S.jsxs)("div",{className:"flex items-center gap-2 text-sm text-gray-600",children:[(0,S.jsx)(m.A,{className:"h-4 w-4 animate-spin"}),(0,S.jsx)("span",{children:f("withdrawalMethodsSetup.loadingBankAccounts")})]}):(0,S.jsxs)("div",{className:"space-y-3",children:[re.map(e=>{var s,a;return(0,S.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:(0,S.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,S.jsxs)("div",{className:"flex items-start gap-3 flex-1",children:[(0,S.jsx)(b.A,{className:"h-5 w-5 text-blue-600 flex-shrink-0 mt-0.5"}),(0,S.jsxs)("div",{className:"flex-1",children:[(0,S.jsx)("h5",{className:"text-sm font-medium text-blue-800",children:e.bankName}),(0,S.jsx)("p",{className:"text-sm text-blue-700 mt-1",children:e.accountHolderName}),(0,S.jsx)("p",{className:"text-xs text-blue-600 mt-1",children:"sepa_bank_account"===e.type?`${f("withdrawalMethodsSetup.iban")}: ****${null===(s=e.iban)||void 0===s?void 0:s.slice(-4)}`:`${f("withdrawalMethodsSetup.accountEndingIn")} ****${e.last4||(null===(a=e.accountNumber)||void 0===a?void 0:a.slice(-4))}`}),(0,S.jsxs)("p",{className:"text-xs text-blue-600",children:["sepa_bank_account"===e.type?f("withdrawalMethodsSetup.sepaTransfer"):f("withdrawalMethodsSetup.internationalTransfer")," |",f("withdrawalMethodsSetup.addedOn",{date:(0,r.lH)(e.createdAt)})]})]})]}),(0,S.jsxs)("div",{className:"flex items-center gap-2",children:[(0,S.jsx)("button",{onClick:()=>{Y(e),Q(!0)},className:"p-2 text-blue-600 hover:bg-blue-100 rounded-lg transition-colors",title:f("withdrawalMethodsSetup.editBankAccount"),children:(0,S.jsx)(u.A,{className:"h-4 w-4"})}),(0,S.jsx)("button",{onClick:()=>de(e.id,"bank_account"),disabled:ae===e.id,className:"p-2 text-red-600 hover:bg-red-100 rounded-lg transition-colors disabled:opacity-50",title:f("withdrawalMethodsSetup.removeBankAccount"),children:ae===e.id?(0,S.jsx)(m.A,{className:"h-4 w-4 animate-spin"}):(0,S.jsx)(h.A,{className:"h-4 w-4"})})]})]})},e.id)}),!ie&&(0,S.jsx)(d.$,{onClick:()=>$(!0),disabled:J,className:"w-full flex items-center justify-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",variant:"outline",children:J?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(m.A,{className:"h-4 w-4 animate-spin"}),f("withdrawalMethodsSetup.processing")]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(p.A,{className:"h-4 w-4"}),f("withdrawalMethodsSetup.addBankAccount")]})})]})]}),(0,S.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:(0,S.jsxs)("div",{className:"flex items-start gap-3",children:[(0,S.jsx)("svg",{className:"h-5 w-5 text-blue-600 flex-shrink-0 mt-0.5",viewBox:"0 0 20 20",fill:"currentColor",children:(0,S.jsx)("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})}),(0,S.jsxs)("div",{children:[(0,S.jsx)("h4",{className:"text-sm font-medium text-blue-800",children:f("withdrawalMethodsSetup.importantInformation")}),(0,S.jsxs)("ul",{className:"text-sm text-blue-700 mt-2 space-y-1 list-disc list-inside",children:[(0,S.jsx)("li",{children:f("withdrawalMethodsSetup.stripeConnectInfo")}),(0,S.jsx)("li",{children:f("withdrawalMethodsSetup.paypalInfo")}),(0,S.jsx)("li",{children:f("withdrawalMethodsSetup.bankAccountInfo")})]})]})]})}),(0,S.jsx)(i.N,{children:I&&(0,S.jsx)(j.A,{onClose:()=>{D(!1),X(!1)},onSuccess:()=>{X(!0),D(!1),setTimeout(()=>{X(!1),s&&s()},1e3)}})}),(0,S.jsx)(i.N,{children:_&&(0,S.jsx)(M,{onClose:()=>{$(!1),X(!1)},onSuccess:()=>{X(!0),$(!1),setTimeout(()=>{X(!1),s&&s()},1e3)}})}),(0,S.jsx)(i.N,{children:q&&V&&(0,S.jsx)(M,{existingMethod:V,onClose:()=>{Q(!1),Y(null),X(!1)},onSuccess:()=>{X(!0),Q(!1),Y(null),setTimeout(()=>{X(!1),s&&s()},1e3)}})}),(0,S.jsx)(i.N,{children:B&&V&&(0,S.jsx)(F,{existingMethod:V,onClose:()=>{R(!1),Y(null),X(!1)},onSuccess:()=>{X(!0),R(!1),Y(null),setTimeout(()=>{X(!1),s&&s()},1e3)}})})]})}},76464(e,s,a){var t=a(5544),l=a(9950),r=a(54060),n=a(76429),i=a(50142),d=a(45833),c=a(59469),o=a(89284),m=a(77737),x=a(61041),u=a(14215),h=a(27255),p=a(67637),b=a(65107),y=a(81064),j=a(96479),N=a(42461),g=a(60348),f=
1a(16255),v=a(72543),w=a(84655),A=a(44414);const k=e=>{let s=e.isOpen,k=e.onClose,C=e.withdrawal;const S=(0,l.useState)(!1),M=(0,t.A)(S,2),F=M[0],P=M[1];if(!C||!s)return null;const E=e=>{switch(e){case v.Qd.COMPLETED:return"bg-green-100 text-green-700";case v.Qd.PROCESSING:return"bg-yellow-100 text-yellow-700";case v.Qd.PENDING:return"bg-blue-100 text-blue-700";case v.Qd.FAILED:return"bg-red-100 text-red-700";case v.Qd.CANCELLED:default:return"bg-gray-100 text-gray-700"}},I=e=>{switch(e){case v.Qd.COMPLETED:return"Completed";case v.Qd.PROCESSING:return"Processing";case v.Qd.PENDING:return"Pending";case v.Qd.FAILED:return"Failed";case v.Qd.CANCELLED:return"Cancelled";default:return"Unknown"}},D=e=>(0,w.vO)(),T=(()=>{return"paypal"===C.withdrawalMethod?{name:"PayPal",details:C.paypalEmail||"N/A",id:C.paypalPayoutBatchId}:"bank_account"===C.withdrawalMethod?{name:"Bank Account",details:null!==(e=C.paymentMethod)&&void 0!==e&&e.bankName?`${C.paymentMethod.bankName} - ****${C.paymentMethod.last4}`:"Manual Bank Transfer",id:C.bankAccountId}:{name:"Stripe Connect",details:"Bank Transfer",id:C.stripeTransferId};var e})();return(0,A.jsx)(n.N,{children:(0,A.jsx)(i.P.div,{initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/50 backdrop-blur-sm z-50 flex items-center justify-center p-4",children:(0,A.jsxs)(i.P.div,{initial:{scale:.95},animate:{scale:1},exit:{scale:.95},className:"bg-white rounded-xl max-w-4xl w-full max-h-[90vh] overflow-y-auto",children:[(0,A.jsx)("div",{className:"p-6 border-b bg-gradient-to-r from-purple-50 to-blue-50",children:(0,A.jsxs)("div",{className:"flex justify-between items-start",children:[(0,A.jsxs)("div",{children:[(0,A.jsxs)("div",{className:"flex items-center gap-3 mb-2",children:[(0,A.jsx)(p.A,{className:"h-6 w-6 text-purple-600"}),(0,A.jsx)("h2",{className:"text-2xl font-bold text-gray-900",children:"Withdrawal Receipt"})]}),(0,A.jsxs)("div",{className:"flex items-center gap-3",children:[(0,A.jsx)(g.E,{variant:void 0,className:E(C.status||v.Qd.PENDING),children:I(C.status||v.Qd.PENDING).toUpperCase()}),(0,A.jsx)(g.E,{variant:"outline",className:"border-purple-200 text-purple-700",children:T.name.toUpperCase()})]}),(0,A.jsxs)("p",{className:"text-sm text-gray-600 mt-2",children:["Receipt #",C.id," | ",(0,r.lH)(C.createdAt)]})]}),(0,A.jsx)("button",{onClick:k,className:"p-2 hover:bg-gray-100 rounded-full transition-colors",children:(0,A.jsx)(j.A,{className:"h-5 w-5"})})]})}),(0,A.jsxs)("div",{className:"p-6 space-y-6",id:"receipt-content",children:[(0,A.jsxs)("div",{className:"text-center py-6 border-b",children:[(0,A.jsx)("h1",{className:"text-3xl font-bold text-purple-600 mb-2",children:"KOKOBEO"}),(0,A.jsx)("p",{className:"text-gray-600",children:"Withdrawal Receipt"}),(0,A.jsx)("p",{className:"text-sm text-gray-500 mt-1",children:new Date(C.createdAt).toLocaleString()})]}),(0,A.jsx)(f.Zp,{className:"p-6 bg-gradient-to-r from-purple-50 to-blue-50 border-purple-200",children:(0,A.jsxs)("div",{className:"flex items-center justify-between",children:[(0,A.jsxs)("div",{className:"flex items-center gap-3",children:[(e=>{switch(e){case v.Qd.COMPLETED:return(0,A.jsx)(d.A,{className:"h-5 w-5 text-green-600"});case v.Qd.PROCESSING:return(0,A.jsx)(m.A,{className:"h-5 w-5 text-yellow-600"});case v.Qd.FAILED:return(0,A.jsx)(c.A,{className:"h-5 w-5 text-red-600"});default:return(0,A.jsx)(m.A,{className:"h-5 w-5 text-blue-600"})}})(C.status||v.Qd.PENDING),(0,A.jsxs)("div",{children:[(0,A.jsx)("h3",{className:"font-semibold text-gray-900",children:I(C.status||v.Qd.PENDING)}),(0,A.jsx)("p",{className:"text-sm text-gray-600",children:C.status===v.Qd.COMPLETED&&C.completedAt?`Completed on ${(0,r.lH)(C.completedAt)}`:C.status===v.Qd.PROCESSING?"Currently processing":C.status===v.Qd.FAILED?"Withdrawal failed":"Pending processing"})]})]}),(0,A.jsxs)("div",{className:"text-right",children:[(0,A.jsxs)("p",{className:"text-2xl font-bold text-red-600",children:["-",D(C.currency)," ",(C.amount||0).toFixed(2)]}),(0,A.jsx)("p",{className:"text-sm text-gray-600",children:"Withdrawal Amount"})]})]})}),(0,A.jsx)(f.Zp,{className:"p-6 bg-gray-50",children:(0,A.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[(0,A.jsxs)("div",{children:[(0,A.jsx)("h3",{className:"font-semibold text-gray-900 mb-3",children:"Withdrawal Information"}),(0,A.jsxs)("div",{className:"space-y-2",children:[(0,A.jsxs)("div",{className:"flex justify-between",children:[(0,A.jsx)("span",{className:"text-gray-600",children:"Receipt ID:"}),(0,A.jsx)("span",{className:"font-medium",children:C.id})]}),(0,A.jsxs)("div",{className:"flex justify-between",children:[(0,A.jsx)("span",{className:"text-gray-600",children:"Status:"}),(0,A.jsx)(g.E,{variant:void 0,className:E(C.status||v.Qd.PENDING),children:I(C.status||v.Qd.PENDING)})]}),(0,A.jsxs)("div",{className:"flex justify-between",children:[(0,A.jsx)("span",{className:"text-gray-600",children:"Method:"}),(0,A.jsx)("span",{className:"font-medium",children:T.name})]})]})]}),(0,A.jsxs)("div",{children:[(0,A.jsx)("h3",{className:"font-semibold text-gray-900 mb-3",children:"Amount Summary"}),(0,A.jsxs)("div",{className:"space-y-2",children:[(0,A.jsxs)("div",{className:"flex justify-between",children:[(0,A.jsx)("span",{className:"text-gray-600",children:"Amount:"}),(0,A.jsxs)("span",{className:"font-bold text-lg text-red-600",children:["-",D(C.currency)," ",(C.amount||0).toFixed(2)]})]}),(0,A.jsxs)("div",{className:"flex justify-between",children:[(0,A.jsx)("span",{className:"text-gray-600",children:"Currency:"}),(0,A.jsx)("span",{className:"font-medium",children:D(C.currency)})]})]})]})]})}),C.user&&(0,A.jsxs)(f.Zp,{className:"p-6",children:[(0,A.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,A.jsx)(y.A,{className:"h-5 w-5 text-blue-600"}),(0,A.jsx)("h3",{className:"font-semibold text-gray-900",children:"User Information"})]}),(0,A.jsxs)("div",{className:"space-y-2",children:[(0,A.jsxs)("p",{className:"font-medium text-lg",children:[C.user.firstName," ",C.user.lastName]}),(0,A.jsx)("p",{className:"text-gray-600",children:C.user.email})]})]}),(0,A.jsxs)(f.Zp,{className:"p-6",children:[(0,A.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:["payp
1al"===C.withdrawalMethod?(0,A.jsx)(u.A,{className:"h-5 w-5 text-purple-600"}):"bank_account"===C.withdrawalMethod?(0,A.jsx)(o.A,{className:"h-5 w-5 text-green-600"}):(0,A.jsx)(x.A,{className:"h-5 w-5 text-blue-600"}),(0,A.jsx)("h3",{className:"font-semibold text-gray-900",children:"Payment Method Details"})]}),(0,A.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,A.jsxs)("div",{children:[(0,A.jsx)("span",{className:"text-gray-600",children:"Method:"}),(0,A.jsx)("p",{className:"font-medium",children:T.name})]}),(0,A.jsxs)("div",{children:[(0,A.jsx)("span",{className:"text-gray-600",children:"Details:"}),(0,A.jsx)("p",{className:"font-medium",children:T.details})]}),T.id&&(0,A.jsxs)("div",{className:"col-span-2",children:[(0,A.jsx)("span",{className:"text-gray-600",children:"Transaction ID:"}),(0,A.jsx)("p",{className:"font-medium font-mono text-sm break-all",children:T.id})]}),(0,A.jsxs)("div",{children:[(0,A.jsx)("span",{className:"text-gray-600",children:"Created:"}),(0,A.jsx)("p",{className:"font-medium",children:new Date(C.createdAt).toLocaleString()})]}),C.processedAt&&(0,A.jsxs)("div",{children:[(0,A.jsx)("span",{className:"text-gray-600",children:"Processed:"}),(0,A.jsx)("p",{className:"font-medium",children:new Date(C.processedAt).toLocaleString()})]}),C.completedAt&&(0,A.jsxs)("div",{children:[(0,A.jsx)("span",{className:"text-gray-600",children:"Completed:"}),(0,A.jsx)("p",{className:"font-medium",children:new Date(C.completedAt).toLocaleString()})]})]})]}),(C.notes||C.failureReason)&&(0,A.jsxs)(f.Zp,{className:"p-6",children:[(0,A.jsx)("h3",{className:"font-semibold text-gray-900 mb-4",children:"Additional Information"}),(0,A.jsxs)("div",{className:"space-y-4",children:[C.failureReason&&(0,A.jsxs)("div",{className:"bg-red-50 border border-red-200 rounded-lg p-4",children:[(0,A.jsx)("span",{className:"text-gray-600 font-medium",children:"Failure Reason:"}),(0,A.jsx)("p",{className:"text-red-700 mt-1",children:C.failureReason})]}),C.notes&&(0,A.jsxs)("div",{children:[(0,A.jsx)("span",{className:"text-gray-600 font-medium",children:"Notes:"}),(0,A.jsx)("p",{className:"font-medium text-gray-700 mt-1 whitespace-pre-wrap",children:C.notes})]})]})]}),(0,A.jsxs)("div",{className:"text-center py-6 border-t",children:[(0,A.jsx)("p",{className:"text-gray-600 mb-2",children:"Thank you for using Kokobeo!"}),(0,A.jsx)("p",{className:"text-sm text-gray-500",children:"This is an automated receipt. No signature required."}),(0,A.jsx)("p",{className:"text-xs text-gray-400 mt-2",children:"For support, contact: [email protected]"})]})]}),(0,A.jsx)("div",{className:"p-6 border-t bg-gray-50",children:(0,A.jsxs)("div",{className:"flex flex-col sm:flex-row gap-3 justify-end",children:[(0,A.jsxs)(N.$,{variant:"outline",onClick:()=>{window.print()},className:"flex items-center gap-2",children:[(0,A.jsx)(b.A,{className:"h-4 w-4"}),"Print Receipt"]}),(0,A.jsxs)(N.$,{onClick:async()=>{if(C){P(!0);try{const e=(await Promise.all([a.e(7514),a.e(359),a.e(4400),a.e(6770),a.e(1370),a.e(2255),a.e(6310),a.e(5269),a.e(2384),a.e(8691),a.e(5043),a.e(8732),a.e(5599),a.e(2678),a.e(1811),a.e(7098)]).then(a.bind(a,74962))).jsPDF,s=((await Promise.all([a.e(7514),a.e(359),a.e(4400),a.e(6770),a.e(1370),a.e(2255),a.e(6310),a.e(5269),a.e(2384),a.e(8691),a.e(5043),a.e(8732),a.e(5599),a.e(2678),a.e(1811),a.e(7098)]).then(a.bind(a,74620))).default,new e),t=s.internal.pageSize.getWidth(),l=20;let n=20;const i=function(e,a,t){let l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};s.setFontSize(l.fontSize||12),s.setTextColor(l.color||"#000000"),"center"===l.align?s.text(e,a,t,{align:"center"}):"right"===l.align?s.text(e,a,t,{align:"right"}):s.text(e,a,t)},d=e=>{s.setDrawColor(200,200,200),s.line(l,e,t-l,e)};if(i("KOKOBEO",t/2,n,{fontSize:24,color:"#2563eb",align:"center"}),n+=10,i("Withdrawal Receipt",t/2,n,{fontSize:16,align:"center"}),n+=20,i(`Receipt #: ${C.id}`,l,n),i(`Date: ${(0,r.lH)(C.createdAt)}`,t-l,n,{align:"right"}),n+=15,d(n),n+=10,i("WITHDRAWAL DETAILS",l,n,{fontSize:14,color:"#374151"}
1),n+=10,i(`Status: ${I(C.status||v.Qd.PENDING).toUpperCase()}`,l,n),n+=8,i(`Method: ${T.name}`,l,n),n+=8,T.id&&(i(`Transaction ID: ${T.id}`,l,n,{fontSize:10}),n+=8),i(`Created: ${new Date(C.createdAt).toLocaleString()}`,l,n),n+=8,C.completedAt&&(i(`Completed: ${new Date(C.completedAt).toLocaleString()}`,l,n),n+=8),n+=7,d(n),n+=10,C.user){i("USER INFORMATION",l,n,{fontSize:14,color:"#374151"}),n+=10;const e=`${C.user.firstName||""} ${C.user.lastName||""}`.trim()||"Unknown User";i(`Name: ${e}`,l,n),n+=8,i(`Email: ${C.user.email||"N/A"}`,l,n),n+=15,d(n),n+=10}i("AMOUNT BREAKDOWN",l,n,{fontSize:14,color:"#374151"}),n+=10;const c=D(C.currency),o=C.amount||0;if(i("Withdrawal Amount:",l,n),i(`${c} ${o.toFixed(2)}`,t-l,n,{align:"right"}),n+=8,i("Currency:",l,n),i(c,t-l,n,{align:"right"}),n+=8,d(n),n+=8,i("TOTAL AMOUNT:",l,n,{fontSize:14,color:"#374151"}),i(`${c} ${o.toFixed(2)}`,t-l,n,{fontSize:14,color:"#374151",align:"right"}),n+=15,d(n),n+=10,i("PAYMENT METHOD",l,n,{fontSize:14,color:"#374151"}),n+=10,i(`Method: ${T.name}`,l,n),n+=8,i(`Details: ${T.details}`,l,n),n+=8,T.id?(i(`Transaction ID: ${T.id}`,l,n,{fontSize:10}),n+=15):n+=7,C.notes){d(n),n+=10,i("NOTES",l,n,{fontSize:14,color:"#374151"}),n+=10;C.notes.split("\n").slice(0,3).forEach(e=>{i(e,l,n,{fontSize:10}),n+=6}),n+=10}d(n),n+=10,i("Thank you for using Kokobeo!",t/2,n,{fontSize:12,color:"#6b7280",align:"center"}),n+=8,i("This is an automated receipt. No signature required.",t/2,n,{fontSize:10,color:"#9ca3af",align:"center"});const m=`withdrawal-receipt-${C.id}-${(new Date).toISOString().split("T")[0]}.pdf`;s.save(m)}catch(e){console.error("Error generating PDF:",e),alert("Failed to generate PDF. Please try again.")}finally{P(!1)}}},disabled:F,className:"flex items-center gap-2 bg-purple-600 hover:bg-purple-700",children:[(0,A.jsx)(h.A,{className:"h-4 w-4"}),F?"Generating PDF...":"Download PDF"]})]})})]})})})};a.d(s,["A",0,k])},10747(e,s,a){var t=a(5544),l=a(9950),r=a(54060),n=a(64767),i=a(37018),d=a(72543),c=a(42461),o=a(52828),m=a(45833),x=a(59469),u=a(42989),h=a(77737),p=a(27255),b=a(84814),y=a(96479),j=a(75540),N=a(84655),g=a(44414);const f=()=>{const e=(0,n.Bd)().t,s=(0,i.S)(),a=s.withdrawals,f=s.cancelWithdrawal,v=s.deleteWithdrawal,w=s.loading,A=(0,l.useState)(new Set),k=(0,t.A)(A,2),C=k[0],S=k[1],M=e=>{switch(e){case d.Qd.PENDING:return"bg-yellow-100 text-yellow-800";case d.Qd.PROCESSING:return"bg-blue-100 text-blue-800";case d.Qd.COMPLETED:return"bg-green-100 text-green-800";case d.Qd.FAILED:return"bg-red-100 text-red-800";case d.Qd.CANCELLED:default:return"bg-gray-100 text-gray-800"}},F=e=>{switch(e){case d.Qd.PENDING:case d.Qd.PROCESSING:return(0,g.jsx)(h.A,{className:"h-4 w-4"});case d.Qd.COMPLETED:return(0,g.jsx)(m.A,{className:"h-4 w-4"});case d.Qd.FAILED:return(0,g.jsx)(x.A,{className:"h-4 w-4"});case d.Qd.CANCELLED:return(0,g.jsx)(y.A,{className:"h-4 w-4"});default:return(0,g.jsx)(o.A,{className:"h-4 w-4"})}},P=s=>{var a;return"card"===s.type?e("withdrawalsList.paymentMethods.card",{brand:null===(a=s.brand)||void 0===a?void 0:a.toUpperCase(),last4:s.last4}):"bank_account"===s.type||"us_bank_account"===s.type?e("withdrawalsList.paymentMethods.bankAccount",{bankName:s.bankName,last4:s.last4}):"paypal"===s.type?e("withdrawalsList.paymentMethods.paypal",{email:s.paypalEmail}):e("withdrawalsList.unknownPaymentMethod")};return w?(0,g.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,g.jsxs)("div",{className:"flex items-center gap-2",children:[(0,g.jsx)("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600"}),(0,g.jsx)("span",{className:"text-gray-600",children:e("withdrawalsList.loading")})]})}):0===a.length?(0,g.jsxs)("div",{className:"text-center py-8",children:[(0,g.jsx)("div",{className:"text-gray-400 mb-4",children:(0,g.jsx)(h.A,{className:"h-12 w-12 mx-auto"})}),(0,g.jsx)("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:e("withdrawalsList.noWithdrawals")}),(0,g.jsx)("p",{className:"text-gray-600",children:e("withdrawalsList.noWithdrawalsDesc")})]}):(0,g.jsx)("div",{className:"space-y-4",children:a.map(s=>{var a,t;return(0,g.jsx)("div",{className:"border rounded-lg p-4 bg-white",children:(0,g.jsxs)("div",{className:"flex justify-between items-start",children:[(0,g.jsxs)("div",{className:"flex-1",children:[(0,g.jsxs)("div",{className:"flex items-center gap-3 mb-2",children:[(0,g.jsx)("div",{className:`p-2 rounded-full ${M(s.status)}`,children:F(s.status)}),(0,g.jsxs)("div",{children:[(0,g.jsxs)("div",{className:"font-medium text-lg text-red-600",children:["-",(0,N.vO)(),null===(a=s.amount)||void 0===a?void 0:a.toLocaleStr
1ing("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})]}),(0,g.jsx)("div",{className:"text-sm text-gray-500",children:s.paymentMethod?P(s.paymentMethod):"Unknown Payment Method"})]})]}),s.notes&&(0,g.jsxs)("div",{className:"text-sm text-gray-600 mt-2",children:[(0,g.jsxs)("strong",{children:[e("withdrawalsList.notes"),":"]})," ",s.notes]}),s.failureReason&&(0,g.jsxs)("div",{className:"text-sm text-red-600 mt-2 bg-red-50 p-2 rounded",children:[(0,g.jsxs)("strong",{children:[e("withdrawalsList.error"),":"]})," ",s.failureReason]}),(0,g.jsxs)("div",{className:"text-xs text-gray-500 mt-2",children:[(0,g.jsxs)("div",{children:[e("withdrawalsList.created"),": ",(0,r.lH)(s.createdAt)]}),s.processedAt&&(0,g.jsxs)("div",{children:[e("withdrawalsList.processed"),": ",(0,r.lH)(s.processedAt)]}),s.completedAt&&(0,g.jsxs)("div",{children:[e("withdrawalsList.completed"),": ",(0,r.lH)(s.completedAt)]})]})]}),(0,g.jsxs)("div",{className:"flex flex-col items-end gap-2",children:[(0,g.jsxs)("span",{className:`inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium ${M(s.status)}`,children:[F(s.status),(t=s.status,null===t?e("walletDashboard.statusLabels.unknown"):d.db[t]||e("walletDashboard.statusLabels.unknown"))]}),(0,g.jsxs)("div",{className:"flex gap-1",children:[(0,g.jsx)(c.$,{variant:"outline",size:"sm",onClick:()=>(async s=>{if(!s)return void alert(e("withdrawalsList.noReceiptData"));const a=s.id;try{S(e=>new Set(e).add(a));const e=new j.Yr,t=(0,j.II)(s);await new Promise(e=>setTimeout(e,500)),e.generateReceipt(t)}catch(t){console.error("Error generating withdrawal receipt:",t),alert(e("withdrawalsList.receiptGenerateFailed"))}finally{S(e=>{const s=new Set(e);return s.delete(a),s})}})(s),disabled:C.has(s.id),className:"text-blue-600 hover:text-blue-700 flex items-center gap-1 disabled:opacity-50 disabled:cursor-not-allowed",children:C.has(s.id)?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(u.A,{className:"h-4 w-4 animate-spin"}),e("withdrawalsList.generating")]}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(p.A,{className:"h-4 w-4"}),e("withdrawalsList.receipt")]})}),s.status===d.Qd.PENDING&&(0,g.jsx)(c.$,{variant:"outline",size:"sm",onClick:()=>(async s=>{if(window.confirm(e("withdrawalsList.confirmCancel")))try{await f(s)}catch(a){alert(e("withdrawalsList.cancelFailed"))}})(s.id),className:"text-red-600 hover:text-red-700",children:e("withdrawalsList.cancel")}),(s.status===d.Qd.CANCELLED||s.status===d.Qd.FAILED)&&(0,g.jsx)(c.$,{variant:"outline",size:"sm",onClick:()=>(async s=>{if(window.confirm(e("withdrawalsList.confirmDelete")))try{await v(s)}catch(a){alert(e("withdrawalsList.deleteFailed"))}})(s.id),className:"text-red-600 hover:text-red-700",children:(0,g.jsx)(b.A,{className:"h-4 w-4"})})]})]})]})},s.id)})})};a.d(s,["A",0,f])}}]);
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.