1import{r as d,j as e,t as Y,X as O,ac as U,aE as $,bO as A,bz as z,z as H,s as T,v as f,bA as q,a1 as K,a7 as L}from"./index-BNrdOJig.js";import{I as X}from"./info-BRKP8n8_.js";function F({facing:s,label:x,hint:n,countdown:i,onCapture:l}){const t=d.useRef(null),c=d.useRef(null),[u,y]=d.useState(!1),[N,_]=d.useState(""),[j,h]=d.useState(""),[w,b]=d.useState(null),k=async()=>{_(""),h("");try{const o=await navigator.mediaDevices.getUserMedia({video:{facingMode:{ideal:s},width:{ideal:1920},height:{ideal:1080}},audio:!1});c.current=o,t.current&&(t.current.srcObject=o,await t.current.play()),y(!0)}catch(o){_(o?.message||"Camera permission denied. Allow camera access to continue."),y(!1)}},g=()=>{c.current?.getTracks().forEach(o=>o.stop()),c.current=null,y(!1)};d.useEffect(()=>(k(),()=>g()),[s]);const I=()=>{const o=t.current;if(!o||!o.videoWidth)return;const p=document.createElement("canvas");p.width=o.videoWidth,p.height=o.videoHeight;const v=p.getContext("2d");v&&(s==="user"&&(v.translate(p.width,0),v.scale(-1,1)),v.drawImage(o,0,0,p.width,p.height),p.toBlob(r=>{if(!r)return;const m=p.toDataURL("image/jpeg",.9);h(m),l(r,m),g()},"image/jpeg",.92))},a=()=>{if(!i)return I();b(i);let o=i;const p=setInterval(()=>{o-=1,o<=0?(clearInterval(p),b(null),I()):b(o)},1e3)},P=()=>{h(""),k()};return e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"text-[10px] uppercase tracking-wider font-bold text-muted-foreground",children:x}),n&&e.jsx("p",{className:"text-xs text-muted-foreground",children:n}),e.jsxs("div",{className:"relative aspect-video w-full rounded-2xl overflow-hidden bg-black border border-border",children:[j?e.jsx("img",{src:Y(j,960),className:"w-full h-full object-contain",alt:"",loading:"lazy",decoding:"async"}):e.jsx("video",{ref:t,className:"w-full h-full object-cover",playsInline:!0,muted:!0,style:s==="user"?{transform:"scaleX(-1)"}:void 0}),w!==null&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/40",children:e.jsx("div",{className:"text-6xl font-black text-white drop-shadow-lg",children:w})}),N&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center p-6 text-center text-xs text-destructive bg-black/70",children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(O,{className:"w-6 h-6"}),N]})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[!j&&e.jsxs("button",{type:"button",disabled:!u||w!==null,onClick:a,className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-primary text-primary-foreground text-[11px] font-bold uppercase tracking-wider disabled:opacity-50",children:[e.jsx(U,{className:"w-4 h-4"})," Capture"]}),j&&e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"inline-flex items-center gap-1 text-[11px] font-bold uppercase tracking-wider text-emerald-500",children:[e.jsx($,{className:"w-4 h-4"})," Captured"]}),e.jsxs("button",{type:"button",onClick:P,className:"inline-flex items-center gap-2 px-3 py-1.5 rounded-full border border-border text-[11px] font-bold uppercase tracking-wider hover:border-primary/40",children:[e.jsx(A,{className:"w-3.5 h-3.5"})," Retake"]})]}),N&&e.jsxs("button",{type:"button",onClick:k,className:"inline-flex items-center gap-2 px-3 py-1.5 rounded-full border border-border text-[11px] font-bold uppercase tracking-wider",children:[e.jsx(A,{className:"w-3.5 h-3.5"})," Try again"]})]}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Live capture only â uploading from your gallery is disabled for security and tax compliance."})]})}function J(){return e.jsxs("div",{className:"rounded-2xl border border-primary/30 bg-primary/5 p-5 text-sm space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(X,{className:"w-4 h-4 text-primary"}),e.jsx("p",{className:"font-bold uppercase tracking-wider text-[11px] text-primary",children:"Why we're asking for this"})]}),e.jsxs("p",{className:"text-foreground",children:[e.jsx("strong",{children:"For tax purposes."})," When you withdraw earnings from MO STREAMS, the IRS requires us to keep a verified record of your identity so we can issue your year-end tax form (1099) and send it to your back office."]}),e.jsx("p",{className:"text-muted-foreground",children:"We only collect this from artists, labels, DJs, and producers â anyone eligible for payouts. Your ID images and face scan are stored privately and used solely for identity verification and tax reporting. They are never shown publicly."}),e.jsx("p",{className:"text-foreground font-semibold",children:"We do not sell your information. We do not sell your data. Your data is used for tax purposes only â that is our promise."})]})}const V={account_type:"",legal_name:"",business_name:"",tax_id_type:"",tax_id_last4:"",dob:"",email:"",ph
1one:"",address_line1:"",address_line2:"",city:"",state:"",postal_code:"",country:"United States",method:"",method_details:""};function ee(){const s=z(),x=H(),[n,i]=d.useState(null),[l,t]=d.useState(null),[c,u]=d.useState("intro"),[y,N]=d.useState(!1),[_,j]=d.useState(!1),[h,w]=d.useState(null),[b,k]=d.useState(null),[g,I]=d.useState(null),[a,P]=d.useState(V),[o,p]=d.useState(!1);d.useEffect(()=>{s?.id&&(async()=>{const{data:r}=await T.from("kyc_verifications").select("status, admin_notes").eq("user_id",s.id).maybeSingle();r&&(i(r.status),t(r.admin_notes),(r.status==="verified"||r.status==="pending")&&u("done"))})()},[s?.id]),d.useEffect(()=>{s&&(s.role==="fan"||s.role==="advertiser")&&(f.info("Identity verification isn't required for your account type."),x({to:"/dashboard"}))},[s,x]);const v=async()=>{if(s?.id){if(!h||!b||!g){f.error("Please capture all three photos before submitting.");return}if(!_){f.error("Please confirm the legal acknowledgement to continue.");return}if(!a.account_type||!a.legal_name||!a.tax_id_type||!a.tax_id_last4||!a.address_line1||!a.city||!a.state||!a.postal_code||!a.method){f.error("Please complete the payout information form.");return}if(a.account_type==="business"&&!a.business_name){f.error("Please enter your business / legal entity name.");return}if(!/^\d{4}$/.test(a.tax_id_last4)){f.error("Tax ID last 4 must be exactly 4 digits.");return}p(!0);try{const r=Date.now(),m=s.id,M=[{key:"front",blob:h.blob},{key:"back",blob:b.blob},{key:"selfie",blob:g.blob}],S={};for(const R of M){const E=`${m}/${R.key}-${r}.jpg`,{error:B}=await T.storage.from("kyc-documents").upload(E,R.blob,{contentType:"image/jpeg",upsert:!0});if(B)throw B;S[R.key]=E}const{error:W}=await T.from("kyc_verifications").upsert({user_id:s.id,status:"pending",id_front_path:S.front,id_back_path:S.back,selfie_path:S.selfie,submitted_at:new Date().toISOString(),admin_notes:null,payout_account_type:a.account_type,payout_legal_name:a.legal_name,payout_business_name:a.business_name||null,payout_tax_id_type:a.tax_id_type,payout_tax_id_last4:a.tax_id_last4,payout_dob:a.dob||null,payout_email:a.email||null,payout_phone:a.phone||null,payout_address_line1:a.address_line1,payout_address_line2:a.address_line2||null,payout_city:a.city,payout_state:a.state,payout_postal_code:a.postal_code,payout_country:a.country,payout_method:a.method,payout_details:a.method_details?{note:a.method_details}:null},{onConflict:"user_id"});if(W)throw W;f.success("Verification submitted â we'll review within 24â48 hours."),i("pending"),u("done")}catch(r){f.error(r?.message||"Could not submit verification.")}finally{p(!1)}}};return e.jsx(q,{profile:s,title:"Identity verification",subtitle:"Required for payouts and uploads",children:e.jsxs("div",{className:"max-w-3xl space-y-6",children:[e.jsx(J,{}),c==="done"&&e.jsx("div",{className:"rounded-3xl border border-border bg-card p-8 text-center space-y-3",children:n==="verified"?e.jsxs(e.Fragment,{children:[e.jsx(K,{className:"w-12 h-12 text-emerald-500 mx-auto"}),e.jsx("h2",{className:"text-xl font-black",children:"You're verified"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Your identity is on file. You can withdraw earnings and upload without restrictions."})]}):n==="pending"?e.jsxs(e.Fragment,{children:[e.jsx(L,{className:"w-12 h-12 text-primary mx-auto"}),e.jsx("h2",{className:"text-xl font-black",children:"Under review"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"We received your ID and live face scan. Reviews usually take 24â48 hours. You'll get a notification when it's complete."})]}):e.jsxs(e.Fragment,{children:[e.jsx(L,{className:"w-12 h-12 text-destructive mx-auto"}),e.jsx("h2",{className:"text-xl font-black",children:"Action needed"}),l&&e.jsxs("p",{className:"text-sm text-destructive",children:["Reviewer note: ",l]}),e.jsx("button",{onClick:()=>{u("intro"),i(null)},className:"mt-2 inline-flex items-center gap-2 px-4 py-2 rounded-full bg-primary text-primary-foreground text-[11px] font-bold uppercase tracking-wider",children:"Resubmit"})]})}),c==="intro"&&e.jsxs("div",{className:"rounded-3xl border border-border bg-card p-6 space-y-4",children:[e.jsx("h2",{className:"text-lg font-black",children:"Before you start"}),e.jsxs("ul",{className:"text-sm text-muted-foreground space-y-2 list-disc pl-5",children:[e.jsx("li",{children:"You'll take three live photos with your camera â uploading from your gallery is disabled."}),e.jsx("li",{children:"Have a government-issued ID ready (driver's license, state ID, or passport)."}),e.jsx("li",{children:"Find good lighting and remove glare from your ID."}),e.jsx("li",{children:"Your face must be clearly visible in the live face scan."})]}),e.jsxs("label",{className:"flex items-start gap-2 text-sm",children:[e.jsx("input",{type:"checkbox",checked:y,onChange:r=>N(r.target.checked),className:"mt-1"}),e.jsx("span",{children:"I understand my ID and face scan are collected for identity verification and tax reporting (1099) only."})]}),e.jsx("button",{disabled:!y,onClick:()=>u("front"),className:"btn-gradient rounded-full px-6 py-2.5 text-xs font-bold uppercase tracking-wider disabled:opacity-50",children:"Begin verification"})]}),c==="front"&&e.jsxs("div",{className:"rounded-3xl border border-border bg-card p-6 space-y-4",children:[e.jsx(C,{current:1}),e.jsx(F,{facing:"environment",label:"ID â Front",hint:"Hold the front of your government ID inside the frame. All four corners visible, no glare.",onCapture:(r,m)=>w({blob:r,preview:m})}),e.jsx(D,{disabled:!h,back:()=>u("intro"),next:()=>u("back")})]}),c==="back"&&e.jsxs("div",{className:"rounded-3xl border border-border bg-card p-6 space-y-4",children:[e.jsx(C,{current:2}),e.jsx(F,{facing:"environment",label:"ID â Back",hint:"Now flip your ID and capture the back side.",onCapture:(r,m)=>k({blob:r,preview:m})}),e.jsx(D,{disabled:!b,back:()=>u("front"),next:()=>u("selfie")})]}),c==="selfie"&&e.jsxs("div",{className:"rounded-3xl border border-border bg-card p-6 space-y-4",children:[e.jsx(C,{current:3}),e.jsx(F,{facing:"user",label:"Live face scan",hint:"Look straight at the camera. We'll count down 3 seconds and capture a live frame â no upload allowed.",countdown:3,onCapture:(r,m)=>I({blob:r,preview:m})}),e.jsx(D,{disabled:!g,back:()=>u("back"),next:()=>u("payout")})]}),c==="payout"&&e.jsxs("div",{className:"rounded-3xl border border-border bg-card p-6 space-y-4",children:[e.jsx(C,{current:4}),e.jsx(Z,{value:a,onChange:P}),e.jsx(D,{disabled:!a.account_type||!a.legal_name||!a.tax_id_type||!a.tax_id_last4||!a.address_line1||!a.city||!a.state||!a.postal_code||!a.method||a.account_type==="business"&&!a.business_name,back:()=>u("selfie"),next:()=>u("review")})]}),c==="review"&&e.jsxs("div",{className:"rounded-3xl border border-border bg-card p-6 space-y-4",children:[e.jsx(C,{current:5}),e.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider",children:"Review your captures"}),e.jsx("div",{className:"grid grid-cols-3 gap-3",children:[{label:"ID Front",c:h},{label:"ID Back",c:b},{label:"Face scan",c:g}].map(r=>e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"aspect-video rounded-xl overflow-hidden border border-border bg-black",children:r.c&&e.jsx("img",{src:Y(r.c.preview,960),className:"w-full h-full object-cover",alt:r.label,loading:"lazy",decoding:"async"})}),e.jsx("div",{className:"text-[10px] uppercase tracking-wider font-bold text-muted-foreground",children:r.label})]},r.label))}),e.jsxs("label",{className:"flex items-start gap-2 text-sm",children:[e.jsx("input",{type:"checkbox",checked:_,onChange:r=>j(r.target.checked),className:"mt-1"}),e.jsx("span",{children:"I confirm the ID shown is mine, the face scan is a live photo of me, and I authorize MO STREAMS to retain these records for identity verification and IRS tax reporting (1099)."})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("button",{type:"button",onClick:()=>u("payout"),className:"px-4 py-2 rounded-full border border-border text-[11px] font-bold uppercase tracking-wider",children:"Back"}),e.jsx("button",{disabled:o,onClick:v,className:"btn-gradient rounded-full px-6 py-2.5 text-xs font-bold uppercase tracking-wider disabled:opacity-50",children:o?"Submittingâ¦":"Submit for review"})]})]})]})})}function C({current:s}){const x=["ID Front","ID Back","Face scan","Payout info","Review"];return e.jsx("div",{className:"flex items-center gap-2 text-[10px] uppercase tracking-wider font-bold",children:x.map((n,i)=>{const l=i+1,t=l===s,c=l<s;return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`w-6 h-6 rounded-full flex items-center justify-center border ${t?"bg-primary text-primary-foreground border-primary":c?"bg-emerald-500/15 text-emerald-500 border-emerald-500/40":"border-border text-muted-foreground"}`,children:l}),e.jsx("span",{className:t?"text-primary":c?"text-emerald-500":"text-muted-foreground",children:n}
1),l<5&&e.jsx("span",{className:"text-muted-foreground/40",children:"âº"})]},n)})})}function Z({value:s,onChange:x}){const n=(t,c)=>x({...s,[t]:c}),i="w-full px-3 py-2 rounded-lg bg-background border border-border text-sm",l="text-[10px] uppercase tracking-wider font-bold text-muted-foreground";return e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider",children:"Payout information"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Tell us how you want to get paid. This goes on your year-end 1099. Your data is used for tax purposes only â we never sell it."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:l,children:"Who is being paid?"}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:["individual","business"].map(t=>e.jsxs("button",{type:"button",onClick:()=>n("account_type",t),className:`px-4 py-3 rounded-xl border text-sm font-semibold text-left capitalize ${s.account_type===t?"border-primary bg-primary/10":"border-border"}`,children:[t,e.jsx("div",{className:"text-[10px] font-normal text-muted-foreground mt-1",children:t==="individual"?"Paid as a person (SSN/ITIN)":"Paid to an LLC, S-Corp, label, etc. (EIN)"})]},t))})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:l,children:"Legal full name"}),e.jsx("input",{className:i,value:s.legal_name,onChange:t=>n("legal_name",t.target.value),placeholder:"As shown on your ID"})]}),s.account_type==="business"&&e.jsxs("div",{children:[e.jsx("div",{className:l,children:"Business / entity name"}),e.jsx("input",{className:i,value:s.business_name,onChange:t=>n("business_name",t.target.value),placeholder:"LLC, S-Corp, label name"})]}),e.jsxs("div",{children:[e.jsx("div",{className:l,children:"Date of birth"}),e.jsx("input",{type:"date",className:i,value:s.dob,onChange:t=>n("dob",t.target.value)})]}),e.jsxs("div",{children:[e.jsx("div",{className:l,children:"Tax ID type"}),e.jsxs("select",{className:i,value:s.tax_id_type,onChange:t=>n("tax_id_type",t.target.value),children:[e.jsx("option",{value:"",children:"Selectâ¦"}),e.jsx("option",{value:"ssn",children:"SSN (Individual)"}),e.jsx("option",{value:"itin",children:"ITIN (Individual)"}),e.jsx("option",{value:"ein",children:"EIN (Business)"}),e.jsx("option",{value:"foreign",children:"Foreign Tax ID"})]})]}),e.jsxs("div",{children:[e.jsx("div",{className:l,children:"Last 4 of tax ID"}),e.jsx("input",{inputMode:"numeric",maxLength:4,className:i,value:s.tax_id_last4,onChange:t=>n("tax_id_last4",t.target.value.replace(/\D/g,"").slice(0,4)),placeholder:"1234"}),e.jsx("p",{className:"text-[10px] text-muted-foreground mt-1",children:"We only store the last 4 digits here. Full ID is collected at year-end via secure W-9/W-8 form."})]}),e.jsxs("div",{children:[e.jsx("div",{className:l,children:"Contact email"}),e.jsx("input",{type:"email",className:i,value:s.email,onChange:t=>n("email",t.target.value)})]}),e.jsxs("div",{children:[e.jsx("div",{className:l,children:"Phone"}),e.jsx("input",{className:i,value:s.phone,onChange:t=>n("phone",t.target.value)})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:l,children:"Mailing address (for tax forms)"}),e.jsx("input",{className:i,value:s.address_line1,onChange:t=>n("address_line1",t.target.value),placeholder:"Street address"}),e.jsx("input",{className:i,value:s.address_line2,onChange:t=>n("address_line2",t.target.value),placeholder:"Apt, suite, etc. (optional)"}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[e.jsx("input",{className:i,value:s.city,onChange:t=>n("city",t.target.value),placeholder:"City"}),e.jsx("input",{className:i,value:s.state,onChange:t=>n("state",t.target.value),placeholder:"State / Region"}),e.jsx("input",{className:i,value:s.postal_code,onChange:t=>n("postal_code",t.target.value),placeholder:"ZIP / Postal"}),e.jsx("input",{className:i,value:s.country,onChange:t=>n("country",t.target.value),placeholder:"Country"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:l,children:"How do you want to be paid?"}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2",children:[{v:"ach",label:"ACH / Bank"},{v:"paypal",label:"PayPal"},{v:"check",label:"Paper check"},{v:"wire",label:"Wire transfer"}].map(t=>e.jsx("button",{type:"button",onClick:()=>n("method",t.v),className:`px-3 py-2 rounded-xl border text-xs font-semibold ${s.method===t.v?"border-primary bg-primary/10":"border-border"}`,children:t.label},t.v))}),e.jsx("textarea",{className:i,rows:2,value:s.method_details,onChange:t=>n("method_details",t.target.value),placeholder:"Optional notes (e.g. PayPal email, preferred bank). Full bank details are collected later via a secure form."})]}),e.jsx("div",{className:"rounded-xl border border-border bg-muted/30 p-3 text-[11px] text-muted-foreground",children:"We do not sell your information. We do not sell your data. This information is used solely to verify your identity and to prepare your year-end tax form (1099). That is our promise."})]})}function D({back:s,next:x,disabled:n}){return e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("button",{type:"button",onClick:s,className:"px-4 py-2 rounded-full border border-border text-[11px] font-bold uppercase tracking-wider",children:"Back"}),e.jsx("button",{type:"button",disabled:n,onClick:x,className:"btn-gradient rounded-full px-6 py-2.5 text-xs font-bold uppercase tracking-wider disabled:opacity-50",children:"Continue"})]})}
1export{ee as component};
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.