PageSourceSearch

https://www.yeslawyer.com/_next/static/chunks/1062-e1bfb2fb6c5a5ead.js

js yeslawyer.com collected 2026-10-04 01:44:56 UTC 145,968 bytes, 1 lines download raw bytes

1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="da145534-6bcd-475d-910c-2280de40c8db",e._sentryDebugIdIdentifier="sentry-dbid-da145534-6bcd-475d-910c-2280de40c8db")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1062],{80438:function(e,t,s){s.r(t);var a=s(57437),r=s(2265),l=s(22137),i=s(55026),n=s(43836),o=s(73509);let d="p-2 text-white hover:bg-gray-700 rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white disabled:opacity-50";t.default=e=>{let{fileUrl:t,fileType:c,title:m}=e,[u,x]=(0,r.useState)(null),[h,p]=(0,r.useState)(!0),[g,f]=(0,r.useState)(null),[b,y]=(0,r.useState)(1),[v,j]=(0,r.useState)({x:0,y:0}),[w,N]=(0,r.useState)(!1),k=(0,r.useRef)(null),_=(0,r.useRef)(null),C=(0,r.useRef)({x:0,y:0}),E=(0,r.useRef)(null);(0,r.useEffect)(()=>{let e;p(!0),f(null),x(null),y(1),j({x:0,y:0});let a=(null==c?void 0:c.toLowerCase().includes("heic"))||(null==t?void 0:t.toLowerCase().endsWith(".heic")),r=!0,l=new AbortController;return(async()=>{try{if(a){let a=(await s.e(2156).then(s.t.bind(s,39140,23))).default,i="/API/image-proxy?url=".concat(encodeURIComponent(t)),n=await (0,o.T)(i,{maxBytes:o.cQ,signal:l.signal,timeoutMs:o.xe});if(0===n.size)throw Error("Fetched HEIC file is empty.");let d=await a({blob:n,toType:"image/jpeg"});if(e=URL.createObjectURL(d),!r){URL.revokeObjectURL(e);return}x(e)}else{if(!r)return;x(t)}}catch(e){if(!r)return;console.error("Failed to process image:",e),f("Could not display this image."),p(!1)}})(),()=>{r=!1,l.abort(),e&&URL.revokeObjectURL(e)}},[t,c]);let S=e=>{let t=Math.max(1,Math.min(e,5));y(t),1===t&&j({x:0,y:0})},F=e=>{if(k.current&&_.current){if(b>1)y(1),j({x:0,y:0});else{let t,s,a,r;let l=_.current,i=k.current,n=l.getBoundingClientRect(),o=i.naturalWidth/i.naturalHeight;o>l.clientWidth/l.clientHeight?(s=(t=l.clientWidth)/o,a=0,r=(l.clientHeight-s)/2):(t=(s=l.clientHeight)*o,r=0,a=(l.clientWidth-t)/2);let d=e.clientX-n.left,c=e.clientY-n.top,m=d-a,u=c-r;if(m<0||m>t||u<0||u>s)return;let x=m-t/2,h=u-s/2,p=2.5*s,g=Math.max(0,(2.5*t-l.clientWidth)/2),f=Math.max(0,(p-l.clientHeight)/2);y(2.5),j({x:Math.max(-g,Math.min(-(2.5*x),g)),y:Math.max(-f,Math.min(-(2.5*h),f))})}}};if(g)return(0,a.jsx)("div",{className:"flex items-center justify-center p-4 h-full",children:(0,a.jsx)("p",{className:"text-red-500",children:g})});let A=(null==c?void 0:c.toLowerCase().includes("heic"))||(null==t?void 0:t.toLowerCase().endsWith(".heic"));return(0,a.jsxs)("div",{className:"relative w-full h-full flex flex-col bg-gray-100",children:[(0,a.jsxs)("div",{ref:_,className:"flex-grow w-full h-full overflow-hidden relative flex items-center justify-center",onMouseMove:e=>{if(w){if(E.current){let t=Math.abs(e.clientX-E.current.x),s=Math.abs(e.clientY-E.current.y);(t>5||s>5)&&(E.current=null)}if(!E.current){let t=e.clientX-C.current.x,s=e.clientY-C.current.y,a=_.current.getBoundingClientRect(),{naturalWidth:r,naturalHeight:l}=k.current,i=r/l,n=a.width,o=n/i;o>a.height&&(n=(o=a.height)*i);let d=n*b,c=o*b,m=Math.max(0,(d-a.width)/2),u=Math.max(0,(c-a.height)/2);j({x:Math.max(-m,Math.min(t,m)),y:Math.max(-u,Math.min(s,u))})}}},onMouseUp:e=>{E.current&&Date.now()-E.current.time<250&&F(e),N(!1)},onMouseLeave:()=>N(!1),onWheel:e=>{e.preventDefault(),e.deltaY<0?S(b+.2):S(b-.2)},style:{cursor:b>1?w?"grabbing":"grab":"zoom-in"},onMouseDown:e=>{e.preventDefault(),E.current={x:e.clientX,y:e.clientY,time:Date.now()},b>1&&(C.current={x:e.clientX-v.x,y:e.clientY-v.y},N(!0))},children:[h&&(0,a.jsxs)("div",{className:"absolute inset-0 flex items-center justify-center bg-white z-10",children:[(0,a.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-[#F04E23]"}),(0,a.jsx)("p",{className:"ml-2",children:A?"Converting image...":"Loading image..."})]}),u&&(0,a.jsx)("img",{ref:k,src:u,alt:m,className:"transition-opacity duration-300 ".concat(h?"opacity-0":"opacity-100"),style:{transform:"scale(".concat(b,") translate(").concat(v.x,"px, ").concat(v.y,"px)"),transition:w?"none":"transform 0.2s ease-out",maxWidth:"100%",maxHeight:"100%",objectFit:"contain"},onLoad:()=>{p(!1),y(1),j({x:0,y:0})},onError:()=>{f("Failed to load image."),p(!1)},draggable:"false"})]}),!h&&u&&(0,a.jsxs)("div",{className:"absolute bottom-4 right-4 bg-gray-800 bg-opacity-60 rounded-lg p-1 flex items-center gap-1 z-20",children:[(0,a.jsx)("button",{type:"button",onClick:()=>S(b-.2),className:d,disabled:b<=1,"aria-label":"Zoom out",title:"Zoom out",children:(0,a.jsx)(l.Z,{className:"w-5 h-5","aria-hidden":"true"})}),(0,a.jsx)("button",{type:"button",onClick:()=>{y(1),j({x:0,y:0})},className:d,"aria-label":"Reset image view",title:"Reset image view",children:(0,a.jsx)(i.Z,{className:"w-5 h-5","aria-hidden":"true"})}),(0,a.jsx)("button",{type:"button",onClick:()=>S(b+.2),className:d,disabled:b>=5,"aria-label":"Zoom in",title:"Zoom in",children:(0,a.jsx)(n.Z,{className:"w-5 h-5","aria-hidden":"true"})})]})]})}},96898:function(e,t,s){s.r(t);var a=s(57437),r=s(2265),l=s(4810),i=s.n(l),n=s(73509);i().setAppElement("body"),t.default=e=>{let{isOpen:t,onClose:l,docxUrl:o}=e,d=r.useRef(null);return r.useEffect(()=>{let e=!1,a=new AbortController;return(async()=>
1{if(t&&o&&d.current)try{let t=await (0,n.T)(o,{maxBytes:n.f_,signal:a.signal,timeoutMs:n.sd}),{renderAsync:r}=await Promise.all([s.e(7635),s.e(3480)]).then(s.bind(s,83480));!e&&d.current&&await r(t,d.current)}catch(t){e||console.error("Error rendering docx:",t)}})(),()=>{e=!0,a.abort()}},[t,o]),(0,a.jsxs)(i(),{isOpen:t,onRequestClose:l,contentLabel:"DOCX Viewer",style:{content:{width:"80%",height:"90%",margin:"auto"},overlay:{zIndex:1e3}},children:[(0,a.jsx)("button",{onClick:l,className:"absolute top-2 right-2 text-white bg-gray-800 bg-opacity-70 rounded-full p-1 z-20 hover:bg-gray-700",title:"Close",children:(0,a.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),(0,a.jsx)("div",{ref:d,className:"docx-container",style:{height:"calc(100% - 40px)"}})]})}},42874:function(e,t,s){s.r(t);var a=s(57437),r=s(55375);s(2265);var l=s(4810),i=s.n(l);i().setAppElement("body"),t.default=e=>{let{isOpen:t,onClose:s,pdfUrl:l}=e;return(0,a.jsxs)(i(),{isOpen:t,onRequestClose:s,contentLabel:"PDF Viewer",style:{content:{width:"80%",height:"90%",margin:"auto",padding:"20px"},overlay:{zIndex:1e3}},children:[(0,a.jsx)("button",{type:"button",onClick:s,className:"absolute top-2 right-2 text-white bg-gray-800 bg-opacity-70 rounded-full p-1 z-20 hover:bg-gray-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#F04E23] focus-visible:ring-offset-2 focus-visible:ring-offset-white",title:"Close","aria-label":"Close PDF preview",children:(0,a.jsx)(r.Z,{className:"h-6 w-6","aria-hidden":"true"})}),(0,a.jsx)("div",{className:"h-full w-full pt-8",children:(0,a.jsx)("iframe",{src:l,className:"w-full h-full",title:"PDF Viewer"})})]})}},23915:function(e,t,s){var a=s(57437),r=s(2265),l=s(76710),i=s(40281);let n={earnings:{label:"Earnings",color:"bg-emerald-100 text-emerald-700 border-emerald-200"},evidence:{label:"Evidence",color:"bg-blue-100 text-blue-700 border-blue-200"},jobsearch:{label:"Job Search",color:"bg-purple-100 text-purple-700 border-purple-200"},medical:{label:"Medical",color:"bg-rose-100 text-rose-700 border-rose-200"},ssdi:{label:"SSDI / Disability",color:"bg-amber-100 text-amber-700 border-amber-200"}};t.Z=e=>{let{fileQuestions:t=[],onSubmit:s,initialValues:o={},isSubmitting:d=!1,buttonText:c="Next",userData:m,userTokenParam:u}=e,[x,h]=(0,r.useState)(()=>{let e={};return t.forEach(t=>{t.questions.forEach(t=>{e[t.name]=o[t.name]||""})}),e}),[p,g]=(0,r.useState)({}),[f,b]=(0,r.useState)(!1);(0,r.useEffect)(()=>{let e;e=!0,t.forEach(t=>{t.questions.forEach(t=>{x[t.name]||(e=!1)})}),b(e)},[x,t]);let y=e=>{let{name:t,value:s}=e.target;h(e=>({...e,[t]:s})),p[t]&&g(e=>({...e,[t]:""}))},v=()=>{let e={},s=!0;return t.forEach(t=>{t.questions.forEach(t=>{x[t.name]||(e[t.name]="This field is required",s=!1)})}),g(e),s},j=async e=>{var a;if(e.preventDefault(),await (0,i.ME)(null==m?void 0:null===(a=m.case)||void 0===a?void 0:a.id,{documents_uploaded:!0},u),v()){let e={};t.forEach(t=>{t.questions.forEach(t=>{e[t.question+Date.now()+Math.random()]={...t,value:x[t.name]}})}),s(e)}};return(0,a.jsxs)("div",{className:"w-full md:w-[70%]  mx-auto bg-white p-6 rounded-lg shadow-md",children:[(0,a.jsx)("h2",{className:"text-2xl font-semibold mb-6 text-center text-[#F04E23]",children:"Document Information"}),(0,a.jsxs)("form",{onSubmit:j,className:"space-y-8",children:[t.map((e,t)=>(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center gap-4 mb-3",children:[e.fileUrl&&(/\.(jpe?g|png|webp|gif)$/i.test(e.fileName)?(0,a.jsx)("img",{src:e.fileUrl,alt:e.fileName,className:"w-16 h-16 object-cover rounded border"}):(0,a.jsx)("div",{className:"w-16 h-16 flex items-center justify-center rounded border bg-gray-100 text-gray-600 text-sm",children:"PDF"})),(0,a.jsx)("div",{className:"flex-1",children:(0,a.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-gray-700",children:e.fileName}),e.category&&n[e.category]&&(0,a.jsx)("span",{className:"text-[10px] font-medium px-2 py-0.5 rounded-full border ".concat(n[e.category].color),children:n[e.category].label})]})})]}),e.questions.map(e=>(0,a.jsx)("div",{className:"mb-4",children:(0,a.jsx)(l.Z,{label:e.question,name:e.name,type:e.type||"text",value:x[e.name],onChange:y,error:p[e.name],placeholder:"Please answer the question: ".concat(e.question),className:"border-[black] !py-1.5",newClassName:"!bg-slate-100 ]",disabled:d})},e.id))]},t)),(0,a.jsx)("div",{className:"mt-6",children:(0,a.jsx)("button",{type:"submit",disabled:d||!f,className:"px-6 py-3 bg-[#F04E23] text-white text-sm font-medium rounded hover:bg-[#d9441f] disabled:opacity-50 disabled:cursor-not-allowed",children:d?"Submitting...":c})})]})]})}},61062:function(e,t,s){s.r(t),s.d(t,{default:function(){return ep}});var a=s(57437),r=s(2265),l=s(37618),i=s(71903),n=s(68933),o=s(33145),d=s(17653),c=s(7409),m=s(99376),u=s(17671),x=s(9289),h=s(41700),p=s(33287),g=s(40281),f=s(23915),b=s(80438),y=s(42874),v=s(96898),j=s(756);s(64131);var w=s(15155),N=s(97558);let k=e=>(null==e?void 0:e.name)||"",_=e=>((null==e?void 0:e.type)||"").toLowerCase(),C=e=>{let t=String(e||"").trim(),s=t.lastIndexOf(".");return s<=0||s===t.length-1?"":t.slice(s)},E=(e,t)=>{let s=k(e).toLowerCase();return t.some(e=>s.endsWith(e))},S=e=>{let t=_(e);return"image/heic"===t||"image/heif"===t||E(e,[".heic",".heif"])},F=e=>"application/pdf"===_(e)||E(e,[".pdf"]),A=e=>"application/vnd.openxmlformats-officedocument.wordprocessingml.document"===_(e)||E(e,[".docx"]),Z=e=>_(e).startsWith("text/")||E(e,[".txt",".csv",".md",".json"]),P=e=>!S(e)&&(_(e).startsWith("image/")||E(e,[".jpg",".jpeg",".png",".webp",".gif"])),R=new Set(["image/bmp","image/gif","
1image/jpeg","image/jpg","image/png","image/svg+xml","image/webp"]),D=/\.(bmp|gif|jpe?g|png|svg|webp)$/i,W=/\.(heic|heif)$/i,L=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",s=e.toLowerCase();return!("image/heic"===s||"image/heif"===s||W.test(t))&&(R.has(s)||s.startsWith("image/")&&D.test(t))},z=e=>{var t;(null==e?void 0:null===(t=e.url)||void 0===t?void 0:t.startsWith("blob:"))&&URL.revokeObjectURL(e.url)};function M(e){let{caseId:t,userToken:l,onStepChange:i,userData:n,currentStep:g,onParticipantsUpdate:_,initialFiles:E=[],pendingAdaReviewHref:S="",onInitialFilesConsumed:R}=e,D=(0,m.useSearchParams)().get("ticketId");(0,m.useRouter)();let W=(0,w.nw)(null==n?void 0:n.second_intake_response),[M,q]=(0,r.useState)(!1),[I,T]=(0,r.useState)(!1),[U,B]=(0,r.useState)(0),[O,H]=(0,r.useState)(null),[Y,V]=(0,r.useState)(null),[X,J]=(0,r.useState)(null),[$,G]=(0,r.useState)(null),K=(0,r.useRef)(null),Q=(0,r.useRef)(null),ee=!!O;(0,r.useEffect)(()=>{var e;if(!ee)return;let t=document.activeElement;null===(e=K.current)||void 0===e||e.focus({preventScroll:!0});let s=e=>{if(e.defaultPrevented)return;if("Escape"===e.key){e.preventDefault(),H(null);return}let t=Q.current;if("Tab"!==e.key||!t)return;let s=Array.from(t.querySelectorAll('button:not([disabled]), a[href], [tabindex]:not([tabindex="-1"])')).filter(e=>e.getClientRects().length>0);if(0===s.length)return;let a=s[0],r=s[s.length-1],l=document.activeElement;t.contains(l)&&(e.shiftKey?l!==a:l!==r)||(e.preventDefault(),(e.shiftKey?r:a).focus())};return document.addEventListener("keydown",s),()=>{document.removeEventListener("keydown",s),t&&t!==document.body&&t.isConnected&&"function"==typeof t.focus&&t.focus({preventScroll:!0})}},[ee]);let[et,es]=(0,r.useState)([]),[ea,er]=(0,r.useState)([]),[el,ei]=(0,r.useState)(!1),[en,eo]=(0,r.useState)(!1),[ed,ec]=(0,r.useState)(!1),[em,eu]=(0,r.useState)(!1),[ex,eh]=(0,r.useState)(!1),ep=(0,r.useRef)([]),[eg,ef]=(0,r.useState)({court_state:"",employer_name:""}),eb=async e=>{if(!e)return"";try{if(F(e)){let t=await s.e(9980).then(s.bind(s,27781)),a=await e.arrayBuffer(),r=await t.getDocument({data:a}).promise,l="";for(let e=1;e<=r.numPages;e++){let t=await r.getPage(e),s=(await t.getTextContent()).items.map(e=>e.str).join(" ");l+=s+"\n"}return l}if(A(e)){let t=await Promise.all([s.e(7635),s.e(5904)]).then(s.t.bind(s,25904,19)),a=await e.arrayBuffer();return(await t.extractRawText({arrayBuffer:a})).value}{if(Z(e))return await e.text();if(!P(e))return"";let t=await s.e(5525).then(s.t.bind(s,25525,23));return(await t.recognize(e,"eng")).data.text}}catch(e){return c.toast.error("Error extracting text from file"),""}},ey=(0,r.useCallback)(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"general",s=[],a=[];for(let r of e){if(!r||"number"!=typeof r.size){a.push({name:k(r)||"Unknown file",reason:"invalid"});continue}if(!(0,N.MR)(r)){a.push({name:k(r),reason:"unsupported"});continue}let e=(0,N.Rc)(r),{limit:l}=(0,N.Mi)(r);e>l?a.push({file:r,reason:"too-large"}):s.push({id:Date.now()+Math.random(),name:k(r),type:r.type||"",file:r,url:URL.createObjectURL(r),category:t})}if(a.length>0)for(let e of a)"invalid"===e.reason?c.toast.error('"'.concat(e.name,'" could not be read. Please choose a valid file.'),{autoClose:8e3}):"unsupported"===e.reason?c.toast.error((0,N.SZ)(e.name),{autoClose:8e3}):c.toast.error((0,N.Im)(e.file),{autoClose:8e3});s.length>0&&es(e=>[...e,...s])},[]);(0,r.useEffect)(()=>{ep.current=et},[et]),(0,r.useEffect)(()=>()=>{ep.current.forEach(z)},[]),(0,r.useEffect)(()=>{E&&0!==E.length&&(ey(E,"general"),null==R||R())},[E,R,ey]);let ev=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"general";ey(Array.from(e.target.files||[]),t),e.target.value=""},ej=e=>{e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="copy"},ew=(e,t)=>{e.preventDefault(),e.stopPropagation(),G(t)},eN=(e,t)=>{e.preventDefault(),e.stopPropagation(),e.currentTarget.contains(e.relatedTarget)||G(e=>e===t?null:e)},ek=(e,t)=>{var s;e.preventDefault(),e.stopPropagation(),G(null);let a=Array.from((null===(s=e.dataTransfer)||void 0===s?void 0:s.files)||[]);a.length>0&&ey(a,t)},e_=e=>({onDragOver:ej,onDragEnter:t=>ew(t,e),onDragLeave:t=>eN(t,e),onDrop:t=>ek(t,e)}),eC=(e,t,s)=>"bg-white border rounded-xl overflow-hidden transition-all ".concat($===e?s:"border-gray-200 ".concat(t)),eE=(e,t,s)=>"flex items-center justify-center gap-2 px-4 py-2.5 border-t border-gray-100 cursor-pointer transition-colors ".concat($===e?s:"bg-gray-50 ".concat(t)),eS=e=>{let t=et.filter(t=>t.category===e);return 0===t.length?null:(0,a.jsx)("div",{className:"flex flex-wrap gap-2 px-4 py-3 bg-gray-50/50 border-t border-gray-100",children:t.map(e=>(0,a.jsxs)("div",{className:"relative group",children:[(0,a.jsx)("button",{type:"button",onClick:()=>eA(e.id),className:"absolute -top-1 -right-1 z-10 bg-red-500 text-white rounded-full w-5 h-5 text-[10px] flex items-center justify-center shadow-md hover:bg-red-600 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#F04E23] focus-visible:ring-offset-2",title:"Remove","aria-label":"Remove ".concat(e.name||"uploaded file"),children:(0,a.jsx)("span",{"aria-hidden":"true",children:"✕"})}),eF(e)]},e.id))})},eF=e=>{let{type:t="",url:s,name:r=""}=e;return L(t,r)?(0,a.jsxs)("button",{type:"button",className:"w-16 cursor-pointer block rounded-lg text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#F04E23] focus-visible:ring-offset-2",onClick:()=>H(e),"aria-label":"Preview ".concat(r||"uploaded file"),children:[(0,a.jsx)("div",{className:"h-14 w-14 roun
1ded-lg border border-gray-200 overflow-hidden",children:(0,a.jsx)(o.default,{unoptimized:!0,src:s,alt:r,className:"h-full w-full object-cover",width:56,height:56})}),(0,a.jsx)("p",{className:"mt-1 truncate text-[10px] text-center text-gray-600",title:r,children:r})]}):F(e)?(0,a.jsxs)("button",{type:"button",className:"w-16 cursor-pointer block rounded-lg text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#F04E23] focus-visible:ring-offset-2",onClick:()=>V(s),"aria-label":"Preview ".concat(r||"uploaded file"),children:[(0,a.jsx)("div",{className:"h-14 w-14 rounded-lg border border-gray-200 bg-white flex items-center justify-center",children:(0,a.jsx)(o.default,{src:"/dummy/pdf2.svg",alt:"PDF",className:"h-8 w-8",width:32,height:32})}),(0,a.jsx)("p",{className:"mt-1 truncate text-[10px] text-center text-gray-600",title:r,children:r})]}):A(e)?(0,a.jsxs)("div",{className:"w-16",children:[(0,a.jsx)("div",{className:"h-14 w-14 rounded-lg border border-gray-200 bg-white flex items-center justify-center",children:(0,a.jsx)(o.default,{src:"/dummy/docx.svg",alt:"DOCX",className:"h-8 w-8",width:32,height:32})}),(0,a.jsx)("p",{className:"mt-1 truncate text-[10px] text-center text-gray-600",title:r,children:r})]}):(0,a.jsxs)("div",{className:"w-16",children:[(0,a.jsx)("div",{className:"h-14 w-14 rounded-lg border border-gray-200 flex items-center justify-center bg-gray-50 p-1",children:(0,a.jsx)("span",{className:"text-[8px] text-gray-500 text-center leading-tight",children:t||"File"})}),(0,a.jsx)("p",{className:"mt-1 truncate text-[10px] text-center text-gray-600",title:r,children:r})]})},eA=e=>{let t=et.find(t=>t.id===e);t&&(z(t),H(t=>(null==t?void 0:t.id)===e?null:t),V(e=>e===t.url?null:e)),es(t=>t.filter(t=>t.id!==e))},eZ=async()=>{if(!ex){if(0===et.length){c.toast.error("Please select at least one file to proceed.");return}if(eh(!0),await eP()){let e={user_id:null==n?void 0:n.id,data:{success:!0}};await (0,j.u)(e),q(!0)}eh(!1)}},eP=async()=>{try{let o=0,d=[],c=null;for(let m=0;m<et.length;m++){var e,s,a,r,i,n;let p=et[m];try{let n;let g=p.file;if(!g)throw Error("Missing selected file");let f=P(g);n=f?await (0,u.s)(g):await eb(g);let b="You are a legal intake classifier for employment-law matters".concat(W?" and potential Social Security disability (SSDI) review":"",'.\n          TASK\n          1. Read the full text (or OCR) of ONE uploaded file plus any embedded metadata I pass you.\n          1a. The client placed this file in the "').concat(p.category||"general",'" upload bucket. Use that as a hint, but trust the document contents if they conflict.\n          2. Choose the single best bucket for that file from the list below and output it as the value for key "type".\n          3. Extract the employer\'s **full legal name exactly as it appears in the document, including any entity suffix such as "Inc.", "LLC", "Corp.", "Ltd.", "PLC", or "Corporation".**\n             • If you cannot confidently identify the employer, return an empty string "".\n             • Output this value under the key "employer_name".\n             • **Never output a warning, error, or request for a different file if the name is missing.**\n          3a. Extract the **U.S. state (two-letter postal abbreviation)** where the employer is incorporated or headquartered **exactly as it appears in the document**.\n             • If you cannot confidently identify the state, return an empty string "".\n             • Output this value under the key "employer_state".\n             • **Never output a warning, error, or request for a different file if the state is missing.**\n          4. Generate **no more than two** short, plain-language questions that would help a lawyer use this document').concat(W?" to evaluate the employment case or a potential SSDI/disability claim, depending on the document":" at the pre-litigation EEOC stage",'. Put them in an array called "questions".\n          5. **Return exactly one JSON object and absolutely no other text, warnings, or validation messages.**\n          BUCKET OPTIONS (use exactly these lowercase values)\n          - email_chat\n          - text_message_screenshot\n          - performance_review_pip\n          - disciplinary_memo_termination_letter\n          - offer_letter_comp_change\n          - timesheet_paystub_w2\n          - medical_fmla_ada_paperwork\n          - internal_complaint_ethics_report\n          - comparator_evidence_public\n          - mitigation_doc_job_search\n          - chronology_memo\n          ').concat(W?"- ssa_notice_or_application\n          - medical_record_or_provider_statement\n          - prescription_medication_list\n          - disability_work_limitations_form":"",'\n          - unknown   # if nothing fits\n          EXAMPLES\n          **Input:** HR termination letter pdf\n          **Return:**\n          {\n            "type": "disciplinary_memo_termination_letter",\n            "employer_name": "Acme Corporation",\n            "employer_state": "NY",\n            "questions": [\n              "On what date was this letter delivered to you?",\n              "Who handed or emailed it to you?"\n            ]\n          }\n          **Input:** Screenshot of Slack chat with supervisor denying ADA accommodation\n          **Return:**\n          {\n            "type": "email_chat",\n            "employer_name": "BrightTech LLC",\n            "employer_state": "CA",\n            "questions": [\n              "Did HR or your manager acknowledge this chat? If yes, how?",\n              "Are any file attachments mentioned in this thread still missing?"\n            ]\n          }\n          **Input:** Paystub JPEG\n          **Return:**\n          {\n            "type": "timesheet_paystub_w2",\n            "employer_name": "Global Staffing Solutions, Inc.",\n            "employer_state": "TX",\n            "questions": [\n              "Were any hours or overtime missing on this pay period?",\n              "Do you have the next or previous paystub for comparison?"\n            ]\n          }\n          **Input:** Unknown or unreadable file\n          **Return:**\n          {\n            "type": "unknown",\n            "employer_name": "",\n            "employer_state": "",\n            "questions": [\n              "What kind of document is this?",\n              "Why is it important to your case?"\n            ]\n          }\n          ').concat(W?'**Input:** SSA disability denial notice PDF\n          **Return:**\n          {\n            "type": "ssa_notice_or_application",\n            "employer_name": "",\n            "employer_state": "",\n            "questions": [\n              "When did you first file for disability benefits?",\n              "Do you have the medical records or doctor notes you sent with this filing?"\n            ]\n          }':""),y=await (0,h.N)(b,n,f),v=function(e){let t={};try{let s=e;"string"==typeof e&&(s=(s=(s=(s=(s=e.trim()).replace(/^```json\s*/i,"")).replace(/^```\s*/,"")).replace(/\s*```$/,"")).trim()),t=JSON.parse(s)}catch(e){return console.error("Invalid JSON in 'content':",e),{error:"Invalid JSON format in 'content'"}}return{content:t}}(y),j=[];if(null==v?void 0:null===(e=v.content)||void 0===e?void 0:e.employer_name){c={employer_name:v.content.employer_name,employer_state:v.content.employer_state,alternate_name:v.content.employer_name};let e=await (0,x.CL)(t,l);if(e&&Array.isArray(null==e?void 0:e.results)&&(null==e?void 0:null===(r=e.results)||void 0===r?void 0:r.length)>0){let s=null==e?void 0:e.results;if(s.some(e=>"employer"===e.role)){let e=s.find(e=>"employer"===e.role),a={name:c.employer_name,alternate_name:c.employer_name,data:e.data};
1a.data.employer_state=c.employer_state,await (0,x.HX)(t,e.id,a,l)}else{let e={name:c.employer_name,alternate_name:c.employer_name,role:"employer",data:{}};e.data.employer_state=c.employer_state,await (0,x.YS)(t,e,l)}}_&&_(c)}if((null==v?void 0:null===(s=v.content)||void 0===s?void 0:s.employer_state)&&ef(e=>{var t,s;return{...e,court_state:null==v?void 0:null===(t=v.content)||void 0===t?void 0:t.employer_state,employer_name:null==v?void 0:null===(s=v.content)||void 0===s?void 0:s.employer_name}}),(null==v?void 0:null===(a=v.content)||void 0===a?void 0:a.questions)&&v.content.questions.length>0&&(j=v.content.questions.map(e=>({question:e,type:"text",name:e.replace(/[^\w\s]/g,"").trim().toLowerCase().replace(/\s+/g,"_")+Date.now()+Math.random(),value:"",id:Date.now()+Math.random()}))),(!j||0===j.length)&&et.length>1){if(0===m){let e=d.length-1>=0?d.length-1:d.length-2>=0?d.length-2:-1;e>=0&&(j=d[e].questions.map(e=>({...e,id:Date.now()+Math.random()})))}else j=(null===(i=d[m-1])||void 0===i?void 0:i.questions.map(e=>({...e,id:Date.now()+Math.random()})))||[]}let w=k(g)||"uploaded_file",N="".concat(p.id,"_").concat(w.replace(/\W/g,""));d.push({fileName:w,fileUrl:p.url,category:p.category,questions:j.map((e,t)=>{var s;return{...e,name:"".concat(N,"-").concat(e.name),id:"".concat(N,"_").concat(t),file:g,formType:(null==v?void 0:null===(s=v.content)||void 0===s?void 0:s.type)||"unknown"}})}),o++}catch(e){console.error("Error processing file ".concat(null===(n=p.file)||void 0===n?void 0:n.name,":"),e)}}if(o===et.length)return er(d),!0;return!1}catch(e){return!1}},eR=async e=>{var s,a,r,i;try{let r=new FormData,i=e.file,n=Date.now(),o=C(i.name),d="".concat(n).concat(o),m=new File([i],d,{type:i.type});r.append("file",m),D&&r.append("ticket",D);let u=await (0,x.SO)(t,r,l);if((null==u?void 0:u.status)===202){if((null==u?void 0:null===(a=u.data)||void 0===a?void 0:a.document_ids)&&Array.isArray(u.data.document_ids))for(let s of u.data.document_ids)try{let a=e.questions.map(e=>{var t,a,r;return{question:null!==(t=null==e?void 0:e.question)&&void 0!==t?t:"",type:"text",name:null!==(a=null==e?void 0:e.name)&&void 0!==a?a:"",value:(null==e?void 0:e.value)||"",id:s,questionType:null!==(r=null==e?void 0:e.formType)&&void 0!==r?r:""}});await (0,x.Yx)(t,s,{source_metadata:a},l),D&&await (0,x.Yx)(t,s,{ticket:D},l)}catch(e){console.error("Failed to update metadata for document ".concat(s,":"),e)}return!0}return(null==u?void 0:null===(s=u.data)||void 0===s?void 0:s.error)&&c.toast.error(u.data.error),!1}catch(e){return console.error("Upload error:",e),(null==e?void 0:null===(i=e.response)||void 0===i?void 0:null===(r=i.data)||void 0===r?void 0:r.error)?c.toast.error(e.response.data.error):c.toast.error("Upload failed. Please try again."),!1}},eD=()=>{T(!1),i((0,w.CN)({secondIntakeResponses:null==n?void 0:n.second_intake_response,followupIntakeResponses:null==n?void 0:n.followup_intake_response,hasSecureSsn:!!(null==n?void 0:n.has_ssn),userData:n}))},eW=async e=>{try{eu(!0);let t=function(e){let t=Object.values(e),s=[];for(let e=0;e<t.length;e+=2){let a=t[e],r=t[e+1],l={file:a.file||{},questions:[a,r].filter(Boolean)};s.push(l)}return s}(e),s=0;for(let e of t)await eR(e)&&s++;if(await (0,p.Nq)({followup_intake_completed:!0},n.id,l),s===t.length)return B(s),T(!0),S||setTimeout(eD,4e3),!0;return c.toast.error("Some files failed to upload."),!1}catch(e){return console.error("Upload error:",e),c.toast.error("Upload failed. Please try again."),!1}finally{eu(!1)}};return(0,a.jsxs)(a.Fragment,{children:[I&&(0,a.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 backdrop-blur-sm",children:(0,a.jsxs)("div",{className:"bg-white rounded-2xl shadow-2xl p-8 mx-4 max-w-md w-full text-center animate-in fade-in zoom-in duration-300",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)("svg",{className:"w-8 h-8 text-green-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.5,d:"M5 13l4 4L19 7"})})}),(0,a.jsx)("h3",{className:"text-xl font-bold text-gray-900 mb-2",children:"Documents Received!"}),(0,a.jsxs)("p",{className:"text-gray-600 text-sm mb-1",children:[U," ",1===U?"file has":"files have"," been uploaded successfully."]}),(0,a.jsx)("p",{className:"text-gray-500 text-xs",children:"Your legal team has been notified and will review your documents shortly."}),S&&(0,a.jsxs)("div",{className:"mt-6 space-y-3",children:[(0,a.jsx)("a",{href:S,className:"flex min-h-12 w-full items-center justify-center rounded-xl bg-[#F04E23] px-5 py-3 text-sm font-semibold text-white transition hover:bg-[#d53f17]",children:"Review possible accessibility claims"}),(0,a.jsx)("button",{type:"button",onClick:eD,className:"inline-flex min-h-10 items-center justify-center px-4 text-sm font-semibold text-slate-600 underline decoration-slate-300 underline-offset-4",children:"Continue without review"}),(0,a.jsx)("p",{className:"text-xs text-gray-400",children:"Optional and separate from your document upload. About 60 seconds."})]})]})}),(0,a.jsxs)("div",{className:"mx-auto w-full max-w-4xl px-4 sm:px-6 lg:px-8",children:[M&&(0,a.jsx)(f.Z,{fileQuestions:ea,onSubmit:eW,isSubmitting:em,userData:n}),!M&&(0,a.jsxs)("div",{className:"w-full md:w-[95%] lg:w-[85%] xl:w-[80%] mx-auto",children:[(0,a.jsxs)("div",{className:"text-center mb-6",children:[(0,a.jsx)("h2",{className:"text-2xl md:text-3xl font-bold text-gray-900 mb-2",children:"Upload Your Documents"}),(0,a.jsx)("p",{className:"text-sm md:text-base text-gray-600 max-w-2xl mx-auto leading-relaxed",children:"Help us build the strongest case possible. Upload documents from the categories below."}),(0,a.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:(0,a.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,a.jsx)("svg",{className:"w-3.5 h-3.5 text-amber-500",fill:"currentColor",viewBox:"0 0 20 20",children:(0,a.jsx)("path",{fillRule:"evenodd",d:"M8.485 2.495c.673-1.167 2.357-1.16
17 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495zM10 5a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 0110 5zm0 9a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})}),"Not all categories are required, but more evidence = stronger case"]})})]}),(0,a.jsxs)("div",{className:"space-y-3 mb-6",children:[(0,a.jsxs)("div",{...e_("earnings"),className:eC("earnings","hover:border-emerald-300","border-emerald-400 ring-2 ring-emerald-100 shadow-sm"),children:[(0,a.jsxs)("div",{className:"flex items-center gap-4 px-4 py-3 bg-gradient-to-r from-emerald-50 to-white",children:[(0,a.jsx)("div",{className:"flex-shrink-0 w-9 h-9 bg-emerald-500 rounded-lg flex items-center justify-center",children:(0,a.jsx)("svg",{className:"w-4 h-4 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("h3",{className:"font-semibold text-gray-900 text-sm",children:"Earnings"}),(0,a.jsx)("span",{className:"text-xs text-gray-400",children:"—"}),(0,a.jsx)("span",{className:"text-xs text-emerald-600 font-medium",children:"Paystubs, W-2s"})]}),(0,a.jsx)("p",{className:"text-xs text-gray-500 mt-0.5",children:"To calculate exactly how much money they owe you."})]})]}),(0,a.jsxs)("label",{htmlFor:"dropzone-earnings",className:"relative block focus-within:ring-2 focus-within:ring-inset focus-within:ring-emerald-500",children:[(0,a.jsxs)("div",{className:eE("earnings","hover:bg-emerald-50","bg-emerald-100"),children:[(0,a.jsx)(d.Z,{className:"h-4 w-4 text-gray-400"}),(0,a.jsxs)("span",{className:"text-xs text-gray-500",children:["Drop files here or"," ",(0,a.jsx)("span",{className:"text-emerald-600 font-medium",children:"browse"})]})]}),(0,a.jsx)("input",{id:"dropzone-earnings",type:"file",className:"sr-only","aria-label":"Upload earnings documents (paystubs, W-2s)",multiple:!0,onChange:e=>ev(e,"earnings"),accept:N.oB})]}),eS("earnings")]}),(0,a.jsxs)("div",{...e_("evidence"),className:eC("evidence","hover:border-blue-300","border-blue-400 ring-2 ring-blue-100 shadow-sm"),children:[(0,a.jsxs)("div",{className:"flex items-center gap-4 px-4 py-3 bg-gradient-to-r from-blue-50 to-white",children:[(0,a.jsx)("div",{className:"flex-shrink-0 w-9 h-9 bg-blue-500 rounded-lg flex items-center justify-center",children:(0,a.jsx)("svg",{className:"w-4 h-4 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})})}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("h3",{className:"font-semibold text-gray-900 text-sm",children:"Evidence"}),(0,a.jsx)("span",{className:"text-xs text-gray-400",children:"—"}),(0,a.jsx)("span",{className:"text-xs text-blue-600 font-medium",children:"Emails, EEOC Letter"})]}),(0,a.jsx)("p",{className:"text-xs text-gray-500 mt-0.5",children:"To prove the company broke the law."})]})]}),(0,a.jsxs)("label",{htmlFor:"dropzone-evidence",className:"relative block focus-within:ring-2 focus-within:ring-inset focus-within:ring-blue-500",children:[(0,a.jsxs)("div",{className:eE("evidence","hover:bg-blue-50","bg-blue-100"),children:[(0,a.jsx)(d.Z,{className:"h-4 w-4 text-gray-400"}),(0,a.jsxs)("span",{className:"text-xs text-gray-500",children:["Drop files here or"," ",(0,a.jsx)("span",{className:"text-blue-600 font-medium",children:"browse"})]})]}),(0,a.jsx)("input",{id:"dropzone-evidence",type:"file",className:"sr-only","aria-label":"Upload evidence documents (emails, EEOC letter)",multiple:!0,onChange:e=>ev(e,"evidence"),accept:N.oB})]}),eS("evidence")]}),(0,a.jsxs)("div",{...e_("jobsearch"),className:eC("jobsearch","hover:border-purple-300","border-purple-400 ring-2 ring-purple-100 shadow-sm"),children:[(0,a.jsxs)("div",{className:"flex items-center gap-4 px-4 py-3 bg-gradient-to-r from-purple-50 to-white",children:[(0,a.jsx)("div",{className:"flex-shrink-0 w-9 h-9 bg-purple-500 rounded-lg flex items-center justify-center",children:(0,a.jsx)("svg",{className:"w-4 h-4 text-white",f
1ill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 13.255A23.931 23.931 0 0112 15c-3.183 0-6.22-.62-9-1.745M16 6V4a2 2 0 00-2-2h-4a2 2 0 00-2 2v2m4 6h.01M5 20h14a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})})}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("h3",{className:"font-semibold text-gray-900 text-sm",children:"Job Search"}),(0,a.jsx)("span",{className:"text-xs text-gray-400",children:"—"}),(0,a.jsx)("span",{className:"text-xs text-purple-600 font-medium",children:"Job Apps, New Paystubs"})]}),(0,a.jsx)("p",{className:"text-xs text-gray-500 mt-0.5",children:"To show you've been working hard to find a new role."})]})]}),(0,a.jsxs)("label",{htmlFor:"dropzone-jobsearch",className:"relative block focus-within:ring-2 focus-within:ring-inset focus-within:ring-purple-500",children:[(0,a.jsxs)("div",{className:eE("jobsearch","hover:bg-purple-50","bg-purple-100"),children:[(0,a.jsx)(d.Z,{className:"h-4 w-4 text-gray-400"}),(0,a.jsxs)("span",{className:"text-xs text-gray-500",children:["Drop files here or"," ",(0,a.jsx)("span",{className:"text-purple-600 font-medium",children:"browse"})]})]}),(0,a.jsx)("input",{id:"dropzone-jobsearch",type:"file",className:"sr-only","aria-label":"Upload job search documents (job applications, new paystubs)",multiple:!0,onChange:e=>ev(e,"jobsearch"),accept:N.oB})]}),eS("jobsearch")]}),(0,a.jsxs)("div",{...e_("medical"),className:eC("medical","hover:border-rose-300","border-rose-400 ring-2 ring-rose-100 shadow-sm"),children:[(0,a.jsxs)("div",{className:"flex items-center gap-4 px-4 py-3 bg-gradient-to-r from-rose-50 to-white",children:[(0,a.jsx)("div",{className:"flex-shrink-0 w-9 h-9 bg-rose-500 rounded-lg flex items-center justify-center",children:(0,a.jsx)("svg",{className:"w-4 h-4 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z"})})}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("h3",{className:"font-semibold text-gray-900 text-sm",children:"Medical"}),(0,a.jsx)("span",{className:"text-xs text-gray-400",children:"—"}),(0,a.jsx)("span",{className:"text-xs text-rose-600 font-medium",children:"Doctor notes, therapy bills, Rx info"})]}),(0,a.jsx)("p",{className:"text-xs text-gray-500 mt-0.5",children:"To show how this situation has affected your health and well-being."})]})]}),(0,a.jsxs)("label",{htmlFor:"dropzone-medical",className:"relative block focus-within:ring-2 focus-within:ring-inset focus-within:ring-rose-500",children:[(0,a.jsxs)("div",{className:eE("medical","hover:bg-rose-50","bg-rose-100"),children:[(0,a.jsx)(d.Z,{className:"h-4 w-4 text-gray-400"}),(0,a.jsxs)("span",{className:"text-xs text-gray-500",children:["Drop files here or"," ",(0,a.jsx)("span",{className:"text-rose-600 font-medium",children:"browse"})]})]}),(0,a.jsx)("input",{id:"dropzone-medical",type:"file",className:"sr-only","aria-label":"Upload medical documents (doctor notes, therapy bills, prescription info)",multiple:!0,onChange:e=>ev(e,"medical"),accept:N.oB})]}),eS("medical")]})]}),et.length>0&&(0,a.jsx)("div",{className:"mt-4 px-4 py-3 bg-green-50 border border-green-200 rounded-lg",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("svg",{className:"w-5 h-5 text-green-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,a.jsxs)("span",{className:"text-sm font-medium text-green-800",children:[et.length," file",1!==et.length?"s":""," selected"]})]})}),(0,a.jsx)("div",{className:"text-center mt-8 mb-6",children:(0,a.jsx)("button",{onClick:eZ,disabled:ex||0===et.length,className:"w-full md:w-[200px] mx-auto bg-[#F04E23] text-white text-sm font-semibold py-3 px-6 rounded-lg hover:bg-[#d9441f] disabled:opacity-50 disabled:cursor-not-allowed transition-all duration-200 shadow-md hover:shadow-lg",children:ex?(0,a.jsxs)("span",{className:"flex items-center justify-center gap-2",children:[(0,a.jsxs)("svg",{className:"animate-spin h-4 w-4 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[(0,a.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,a.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Analyzing..."]}):em?(0,a.jsxs)("span",{className:"flex items-center justify-center gap-2",children:[(0,a.jsxs)("svg",{className:"animate-spin h-4 w-4 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[(0,a.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,a.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Loading..."]}):"Continue"})})]})]}),O&&(0,a.jsx)("div",{className:"fixed inset-0 bg-black bg-opacity-75 flex items-center justify-center z-[1000]",children:(0,a.jsxs)("div",{ref:Q,role:"dialog","aria-modal":"true","aria-label":"Preview of ".concat(O.name||"uploaded image"),className:"relative w-full max-w-5xl h-[90vh] bg-gray-900 rounded-lg overflow-hidden",children:[(0,a.jsx)("button",{ref:K,type:"button",onClick:()=>H(null),className:"absolute top-2 right-2 text-white bg-gray-800 bg-opacity-70 rounded-full p-1 z-20 hover:bg-gray-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#F04E23] focus-visible:ring-offset-2 focus-visible:ring-offset-gray-900",title:"Close","aria-label":"Close image preview",children:(0,a.jsx)("svg",{"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),(0,a.jsx)(b.default,{fileUrl:O.url,fileType:O.type,title:O.name})]})}),Y&&(0,a.jsx)(y.default,{isOpen:!!Y,onClose:()=>V(null),pdfUrl:Y}),X&&(0,a.jsx)(v.default,{isOpen:!!X,onClose:()=>J(null),docxUrl:X})]})}var q=s(76710);let I=e=>({...(0,w.lV)(null==e?void 0:e.followup_intake_response),ssdi_last_day_worked:(0,w.UJ)({secondIntakeResponses:null==e?void 0:e.second_intake_response,followupIntakeResponses:null==e?void 0:e.followup_intake_response})}),T=e=>(0,w.aB)(e);function U(e){let{userData:t,userToken:s,onStepChange:l,onUserDataUpdate:i}=e,[n,o]=(0,r.useState)(()=>I(t)),[d,m]=(0,r.useState)(()=>T(t)),[u,x]=(0,r.useState)({}),[h,g]=(0,r.useState)(!1),f=(0,w.yY)(t),b=!String((0,w.UJ)({secondIntakeResponses:null==t?void 0:t.second_intake_response,followupIntakeResponses:null==t?void 0:t.followup_intake_response})||"").trim();(0,r.useEffect)(()=>{o(I(t))},[null==t?void 0:t.followup_intake_response]),(0,r.useEffect)(()=>{m(T(t))},[null==t?void 0:t.dob,null==t?void 0:t.phone,null==t?void 0:t.phone_number,null==t?void 0:t.address,null==t?void 0:t.city,null==t?void 0:t.state,null==t?void 0:t.zip_code,null==t?void 0:t.second_intake_response]);let y=(e,t)=>{o(s=>({...s,[e]:t})),u[e]&&x(t=>({...t,[e]:""}))},v=(e,t)=>
1{m(s=>({...s,[e]:t})),u[e]&&x(t=>({...t,[e]:""}))},j=()=>{let e={};return w.XS.forEach(t=>{t.required&&!String(n[t.id]||"").trim()&&(e[t.id]="This field is required")}),b&&!String(n.ssdi_last_day_worked||"").trim()&&(e.ssdi_last_day_worked="This field is required"),f.dob&&!String(d.dob||"").trim()&&(e.dob="This field is required"),f.phone&&!String(d.phone||"").trim()&&(e.phone="This field is required"),f.mailingAddress&&["address","city","state","zip_code"].forEach(t=>{String(d[t]||"").trim()||(e[t]="This field is required")}),x(e),0===Object.keys(e).length},N=async e=>{if(e.preventDefault(),j()&&!h){g(!0);try{let e=(0,w.HF)(null==t?void 0:t.followup_intake_response,n),a={followup_intake_completed:!0,followup_intake_response:e};f.dob&&(a.dob=d.dob),f.phone&&(a.phone=d.phone.trim()),f.mailingAddress&&(a.address=d.address.trim(),a.city=d.city.trim(),a.state=d.state.trim(),a.zip_code=d.zip_code.trim());let r=await (0,p.Nq)(a,null==t?void 0:t.id,s);if(!r||r.status<200||r.status>=300)throw Error("Unable to save SSDI details");null==i||i(t=>({...t,followup_intake_completed:!0,followup_intake_response:e,dob:f.dob?d.dob:null==t?void 0:t.dob,phone:f.phone?d.phone.trim():null==t?void 0:t.phone,address:f.mailingAddress?d.address.trim():null==t?void 0:t.address,city:f.mailingAddress?d.city.trim():null==t?void 0:t.city,state:f.mailingAddress?d.state.trim():null==t?void 0:t.state,zip_code:f.mailingAddress?d.zip_code.trim():null==t?void 0:t.zip_code})),c.toast.success("Disability details saved"),l(w.O7)}catch(e){console.error("Error saving SSDI details",e),c.toast.error("We couldn't save your disability details. Please try again.")}finally{g(!1)}}};return(0,a.jsxs)("div",{className:"mx-auto w-full max-w-3xl px-4 sm:px-6 lg:px-8",children:[(0,a.jsxs)("div",{className:"rounded-2xl border border-amber-200 bg-amber-50 px-5 py-4 shadow-sm",children:[(0,a.jsx)("p",{className:"text-sm font-semibold text-amber-900",children:"Disability application details"}),(0,a.jsx)("p",{className:"mt-1 text-sm leading-relaxed text-amber-800",children:"We use these answers to prepare your Social Security disability paperwork for review. If something does not apply, write No or None."})]}),(0,a.jsxs)("form",{onSubmit:N,className:"mt-5 rounded-2xl border border-gray-200 bg-white p-5 shadow-sm",children:[(0,a.jsxs)("div",{className:"space-y-5",children:[(f.dob||f.phone||f.mailingAddress)&&(0,a.jsxs)("div",{className:"rounded-2xl border border-gray-200 bg-gray-50 px-4 py-4",children:[(0,a.jsx)("p",{className:"text-sm font-semibold text-gray-900",children:"A few contact details are still missing"}),(0,a.jsx)("p",{className:"mt-1 text-sm text-gray-600",children:"We use these to finish your Social Security paperwork without needing to chase you down later."})]}),f.dob&&(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block my-2 text-sm font-medium",children:"Date of birth"}),(0,a.jsx)("input",{type:"date",name:"dob",value:d.dob||"",onChange:e=>v("dob",e.target.value),className:"block w-full rounded-[5px] border border-[#ccd1d9] bg-white px-4 py-3 text-sm ".concat(u.dob?"!border-red-600 !text-red-600":""),disabled:h}),u.dob&&(0,a.jsx)("p",{className:"pl-2 pt-1 text-xs font-semibold text-red-700",children:u.dob})]}),f.phone&&(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block my-2 text-sm font-medium",children:"Best phone number"}),(0,a.jsx)("input",{type:"tel",name:"phone",autoComplete:"tel",value:d.phone||"",onChange:e=>v("phone",e.target.value),placeholder:"(555) 555-5555",className:"block w-full rounded-[5px] border border-[#ccd1d9] bg-white px-4 py-3 text-sm ".concat(u.phone?"!border-red-600 !text-red-600":""),disabled:h}),u.phone&&(0,a.jsx)("p",{className:"pl-2 pt-1 text-xs font-semibold text-red-700",children:u.phone})]}),f.mailingAddress&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block my-2 text-sm font-medium",children:"Mailing address"}),(0,a.jsx)("input",{type:"text",name:"address",autoComplete:"street-address",value:d.address||"",onChange:e=>v("address",e.target.value),placeholder:"Street address",className:"block w-full rounded-[5px] border border-[#ccd1d9] bg-white px-4 py-3 text-sm ".concat(u.address?"!border-red-600 !text-red-600":""),disabled:h}),u.address&&(0,a.jsx)("p",{className:"pl-2 pt-1 text-xs font-semibold text-red-700",children:u.address})]}),(0,a.jsxs)("div",{className:"grid gap-4 sm:grid-cols-3",children:[(0,a.jsxs)("div",{className:"sm:col-span-1",children:[(0,a.jsx)("label",{className:"block my-2 text-sm font-medium",children:"City"}),(0,a.jsx)("input",{type:"text",name:"city",autoComplete:"address-level2",value:d.city||"",onChange:e=>v("city",e.target.value),placeholder:"City",className:"block w-full rounded-[5px] border border-[#ccd1d9] bg-white px-4 py-3 text-sm ".concat(u.city?"!border-red-600 !text-red-600":""),disabled:h}),u.city&&(0,a.jsx)("p",{className:"pl-2 pt-1 text-xs font-semibold text-red-700",children:u.city})]}),(0,a.jsxs)("div",{className:"sm:col-span-1",children:[(0,a.jsx)("label",{className:"block my-2 text-sm font-medium",children:"State"}),(0,a.jsx)("input",{type:"text",name:"state",autoComplete:"address-level1",value:d.state||"",onChange:e=>v("state",e.target.value),placeholder:"State",className:"block w-full rounded-[5px] border border-[#ccd1d9] bg-white px-4 py-3 text-sm ".concat(u.state?"!border-red-600 !text-red-600":""),disabled:h}),u.state&&(0,a.jsx)("p",{className:"pl-2 pt-1 text-xs font-semibold text-red-700",children:u.state})]}),(0,a.jsxs)("div",{className:"sm:col-span-1",children:[(0,a.jsx)("label",{className:"block my-2 text-sm font-medium",children:"ZIP code"}),(0,a.jsx)("input",{type:"text",name:"zip_code",autoComplete:"postal-code",value:d.zip_code||"",onChange:e=>v("zip_code",e.target.value),placeholder:"ZIP code",className:"block w-full rounded-[5px] border border-[#ccd1d9] bg-white px-4 py-3 text-sm ".concat(u.zip_code?"!border-red-600 !text-red-600":""),disabled:h}),u.zip_code&&(0,a.jsx)("p",{className:"pl-2 pt-1 text-xs font-semibold text-red-700",children:u.zip_code})]})]})]}),w.XS.map(e=>("ssdi_last_day_worked"!==e.id||b)&&(0,a.jsx)("div",{children:"select"===e.type?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("label",{className:"block my-2 text-sm font-medium",children:e.label}),(0,a.jsxs)("select",{value:n[e.id]||"",onChange:t=>y(e.id,t.target.value),className:"block w-full rounded-[5px] border border-[#ccd1d9] bg-white px-4 py-3 text-sm ".concat(u[e.id]?"!border-red-600 !text-red-600":""),disabled:h,children:[(0,a.jsx)("option",{value:"",children:"Select one"}
1),e.options.map(e=>(0,a.jsx)("option",{value:e,children:e},e))]}),u[e.id]&&(0,a.jsx)("p",{className:"pl-2 pt-1 text-xs font-semibold text-red-700",children:u[e.id]})]}):(0,a.jsx)(q.Z,{label:e.label,name:e.id,type:"textarea"===e.type?"text":e.type,value:n[e.id]||"",onChange:t=>y(e.id,t.target.value),error:u[e.id],placeholder:e.label,expand:"textarea"===e.type,disabled:h})},e.id))]}),(0,a.jsxs)("div",{className:"mt-8 flex flex-col gap-3 sm:flex-row sm:justify-between",children:[(0,a.jsx)("button",{type:"button",onClick:()=>l(2),className:"rounded-lg border border-gray-300 px-5 py-3 text-sm font-medium text-gray-700 hover:bg-gray-50",disabled:h,children:"Back to documents"}),(0,a.jsx)("button",{type:"submit",className:"rounded-lg bg-[#F04E23] px-6 py-3 text-sm font-semibold text-white hover:bg-[#d9441f] disabled:cursor-not-allowed disabled:opacity-50",disabled:h,children:h?"Saving...":"Save and continue"})]})]})]})}var B=s(96970),O=s(99588),H=s(61601),Y=s(338),V=s(89399),X=s(89453),J=s(13363),$=s(19672),G=s(52484),K=s(56422),Q=s(43836),ee=s(22175),et=s(27431),es=s(8500),ea=s(47842),er=s(73910),el=s(52700);let ei=[{page:1,header:"Add Related Parties",subheader:"We need to know who was involved so we can file your claim.",body:"Based on the files you've uploaded, we've already added some people. Please confirm or add anyone we missed. You'll be able to review everything at the end."},{page:2,category:"supervisor",header:"Your Supervisor",subheader:"Who directly supervised you?",body:"Add the person who managed your day-to-day work (even if they no longer work there). Provide name, title, and an email if you have it. Add at least one supervisor to continue."},{page:4,category:"human_resources",header:"Human Resources Contact",subheader:"Add the HR representative involved in your case.",body:"If HR never contacted you, list the main HR email or the person you believe handled your file. Add at least one HR contact to continue."},{page:5,category:"comparative_coworker",header:"Comparator Coworker",subheader:"Coworker who was treated differently (better) than you.",body:"This helps show unfair treatment. If none apply or you don't know, click 'Skip.' Otherwise, add as many as you'd like, then 'Continue.'"},{page:7,category:"witness",header:"Witnesses",subheader:"List anyone—inside or outside the company—who witnessed the incident.",body:"Family, friends, clients, or vendors count too. Add as many as you have, or 'Skip' if none."},{page:8,header:"Review & Confirm",subheader:"Make sure the list below is complete and accurate.",body:"Your entries are sorted by category. Use the ✏️ Edit or \uD83D\uDDD1️ Delete icons to make changes. When everything looks correct, click 'Submit' to move on to the narrative step."}],en=[{value:"supervisor",label:"Supervisor"},{value:"human_resources",label:"Human Resources"},{value:"comparative_coworker",label:"Comparative Coworker"},{value:"witness",label:"Witness"},{value:"other",label:"Other"}];var eo=e=>{let{caseId:t,userToken:s,onFinish:l,initialParticipants:i=[],skipWitnessStep:n=!1}=e,o=n?ei.filter(e=>"witness"!==e.category):ei,[d,m]=(0,r.useState)(1),[u,h]=(0,r.useState)([]),[p,f]=(0,r.useState)([]),[b,y]=(0,r.useState)(!1),[v,j]=(0,r.useState)(!1),[w,N]=(0,r.useState)(null),[k,_]=(0,r.useState)(null),[C,E]=(0,r.useState)({}),[S,F]=(0,r.useState)(!1),[A,Z]=(0,r.useState)(!1),[P,R]=(0,r.useState)(!1),[D,W]=(0,r.useState)(!1),[L,z]=(0,r.useState)(null),[M,q]=(0,r.useState)(""),[I,T]=(0,r.useState)({name:"",job_title:"",role:"",email:"",phone:"",address:""});(0,r.useEffect)(()=>{let e=async()=>{try{let e=await (0,x.CL)(t,s),a=Array.isArray(null==e?void 0:e.results)?e.results:[];h(a),f([]),!n&&a.some(e=>"witness"===e.role)&&y(!0)}catch(e){console.error("Failed to fetch participants:",e),h(i||[]),!n&&(null==i?void 0:i.some(e=>"witness"===e.role))&&y(!0)}};t&&s?e():(h(i||[]),!n&&(null==i?void 0:i.some(e=>"witness"===e.role))&&y(!0))},[t,s,i,n]);let U=()=>{d<o.length&&m(d+1)},B=()=>{U()},et=()=>o[d-1]||(console.warn("Step ".concat(d," not found, returning first step")),o[0]),es=e=>e?e.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()):"",eo=e=>({employer:"bg-purple-100 text-purple-600",supervisor:"bg-blue-100 text-blue-600",human_resources:"bg-green-100 text-green-600",comparative_coworker:"bg-indigo-100 text-indigo-600",witness:"bg-gray-100 text-gray-600",other:"bg-yellow-100 text-yellow-600"})[e]||"bg-[#F04E23]/10 text-[#F04E23]",ed=e=>({employer:"text-purple-600",supervisor:"text-blue-600",human_resources:"text-green-600",comparative_coworker:"text-indigo-600",witness:"text-gray-600",other:"text-yellow-600"})[e]||"text-[#F04E23]",ec=e=>{let t={id:"local_".concat(Date.now(),"_").concat(Math.random()),name:e.name||"",job_title:e.job_title||"",role:e.role||"",email:e.email||"",phone:e.phone||"",address:e.address||"",isLocal:!0};f(e=>[...e,t])},em=e=>{let{name:t,value:s}=e.target;T(e=>({...e,[t]:s}))},eu=e=>!e||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e),ex=()=>
1{if(!I.name){c.toast.error("Please fill in the name");return}if(I.email&&!eu(I.email)){c.toast.error("Please enter a valid email address");return}let e=et(),t=(null==e?void 0:e.category)||I.role;if(!t){c.toast.error("Role is required");return}ec({...I,role:t}),F(!1),T({name:"",job_title:"",role:"",email:"",phone:"",address:""})},eh=()=>{F(!1),T({name:"",job_title:"",role:"",email:"",phone:"",address:""})},ep=e=>{_(e.id),E({name:e.name||"",role:e.role||"",email:e.email||"",phone:e.phone||"",address:e.address||""})},eg=async e=>{if(!C.name||!C.role){c.toast.error("Please fill in name and role");return}if(C.email&&!eu(C.email)){c.toast.error("Please enter a valid email address");return}if(e.isLocal)f(t=>t.map(t=>t.id===e.id?{...t,...C}:t));else try{let a={name:C.name,role:C.role,email:C.email,phone:C.phone,address:C.address},r=await (0,x.HX)(t,e.id,a,s);if(r&&!r.error)h(t=>t.map(t=>t.id===e.id?{...t,...C}:t));else{c.toast.error((null==r?void 0:r.error)||"Failed to update participant."),_(null),E({});return}}catch(e){console.error("Error updating participant:",e),c.toast.error("An error occurred while updating the participant."),_(null),E({});return}_(null),E({})},ef=()=>{_(null),E({})},eb=e=>{let{name:t,value:s}=e.target;E({...C,[t]:s})},ey=e=>{N(e),j(!0)},ev=()=>j(!1),ej=async()=>{if(!w)return;let e=p.find(e=>e.id===w),a=u.find(e=>e.id===w);if(e)f(e=>e.filter(e=>e.id!==w));else if(a)try{await (0,x.oS)(t,w,s),h(e=>e.filter(e=>e.id!==w))}catch(e){console.error("Error deleting participant:",e),c.toast.error("Failed to delete participant")}j(!1),N(null)},ew=()=>[...u,...p].some(e=>"other"===e.role),eN=()=>[...u,...p].filter(e=>"other"===e.role),ek=e=>{z(e),q(""),W(!0)},e_=async()=>{if(!M||!L){c.toast.error("Please select a role");return}if(L.isLocal)f(e=>e.map(e=>e.id===L.id?{...e,role:M}:e));else try{let e=await (0,x.HX)(t,L.id,{role:M},s);if(e&&!e.error)h(e=>e.map(e=>e.id===L.id?{...e,role:M}:e));else{c.toast.error((null==e?void 0:e.error)||"Failed to update participant role."),W(!1),z(null),q("");return}}catch(e){console.error("Error updating participant role:",e),c.toast.error("An error occurred while updating the participant role."),W(!1),z(null),q("");return}W(!1),z(null),q(""),c.toast.success("Role assigned successfully")},eC=()=>{W(!1),z(null),q("")},eE=async()=>{if(ew()){c.toast.error("Please assign specific roles to all participants before submitting");return}let e=[...u,...p].filter(e=>e.email&&!eu(e.email));if(e.length>0){let t=e.map(e=>e.name).join(", ");c.toast.error("Please fix invalid email addresses for: ".concat(t));return}Z(!0);try{for(let e of p.filter(e=>e.isLocal)){let a={name:e.name,role:e.role,email:e.email,phone:e.phone||"",address:e.address||""},r=await (0,x.YS)(t,a,s);if(r&&r.error){c.toast.error("Failed to save ".concat(e.name,": ").concat(r.error)),Z(!1);return}}await (0,g.ME)(t,{participants_added:!0},s),l()}catch(e){console.error("Error saving participants:",e),c.toast.error("Failed to save participants")}finally{Z(!1)}},[eS,eF]=(0,r.useState)(!1),[eA,eZ]=(0,r.useState)({name:"",email:"",phone:""}),[eP,eR]=(0,r.useState)(!1),eD=e=>{let{name:t,value:s}=e.target;eZ(e=>({...e,[t]:s}))},eW=async()=>{if(!eA.name.trim()){c.toast.error("Please enter the witness name");return}if(eA.email&&!eu(eA.email)){c.toast.error("Please enter a valid email address");return}eR(!0);try{let e={name:eA.name.trim(),email:eA.email.trim()||"",phone:eA.phone.trim()||"",role:"witness",job_title:"",address:""},a=await (0,x.YS)(t,e,s);a&&a.id?(h(e=>[...e,a]),c.toast.success("Witness added successfully"),eZ({name:"",email:"",phone:""}),eF(!1)):c.toast.error("Failed to add witness")}catch(e){console.error("Error adding witness:",e),c.toast.error("Failed to add witness. Please try again.")}finally{eR(!1)}},eL=()=>{let e=et();return!e.category&&"Review & Confirm"===e.header};return(0,a.jsxs)("div",{className:"w-full",children:[!b&&(et().category&&d>1||eL())&&(0,a.jsxs)("div",{className:"text-center mb-8",children:[(0,a.jsx)("h2",{className:"text-2xl font-bold text-[#F04E23] mb-4",children:et().header}),(0,a.jsx)("h3",{className:"text-lg text-gray-700 mb-4",children:et().subheader}),(0,a.jsx)("p",{className:"text-gray-600 mb-8",children:et().body})]}),!b&&(0,a.jsxs)("div",{className:"mb-8",children:[(0,a.jsx)("div",{className:"flex justify-between items-center mb-2",children:(0,a.jsxs)("span",{className:"text-sm text-gray-600",children:["Step ",d," of ",o.length]})}),(0,a.jsx)("div",{className:"w-full bg-gray-200 rounded-full h-2",children:(0,a.jsx)("div",{className:"bg-[#F04E23] h-2 rounded-full transition-all duration-300",style:{width:"".concat(d/o.length*100,"%")}})})]}),b?(()=>{u.filter(e=>"other"!==e.role&&"witness"!==e.role);let e=u.filter(e=>"witness"===e.role);return(0,a.jsxs)("div",{className:"text-center max-w-4xl mx-auto py-8 px-4",children:[(0,a.jsx)("h2",{className:"text-2xl sm:text-3xl font-bold text-[#F04E23] mb-2",children:"Add Related Parties"}),(0,a.jsx)("p",{className:"text-gray-600 mb-8",children:"We need to know who was involved so we can file your claim."}),(0,a.jsxs)("div",{className:"bg-white border border-gray-200 rounded-2xl shadow-lg overflow-hidden",children:[(0,a.jsxs)("div",{className:"bg-gradient-to-b from-amber-50/50 to-orange-50/30 border-t border-gray-100 p-6 sm:p-8",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"w-10 h-10 bg-amber-100 rounded-full flex items-center justify-center",children:(0,a.jsxs)("svg",{className:"h-5 w-5 text-amber-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]})}),(0,a.jsxs)("div",{className:"text-left",children:[(0,a.jsx)("h4",{className:"text-lg font-semibold text-gray-900",children:"Witnesses"}),(0,a.jsx)("p",{className:"text-sm text-gray-500",children:"People who can support your case"})]})]}),!eS&&(0,a.jsxs)("button",{onClick:()=>eF(!0),className:"bg-amber-500 hover:bg-amber-600 text-white px-4 py-2 rounded-lg font-medium transition-all duration-200 inline-flex items-center gap-2 shadow-sm hover:shadow-md",children:[(0,a.jsx)(Q.Z,{className:"h-4 w-4"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:"Add W
1itness"})]})]}),e.length>0&&(0,a.jsx)("div",{className:"space-y-3 mb-5",children:e.map(e=>{var t,s;return(0,a.jsx)("div",{className:"bg-white border border-gray-200 rounded-xl p-4 hover:shadow-md transition-all duration-200",children:(0,a.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[(0,a.jsx)("div",{className:"w-10 h-10 bg-amber-100 rounded-full flex items-center justify-center flex-shrink-0",children:(0,a.jsx)("span",{className:"text-sm font-semibold text-amber-700",children:(null===(s=e.name)||void 0===s?void 0:null===(t=s.charAt(0))||void 0===t?void 0:t.toUpperCase())||"?"})}),(0,a.jsxs)("div",{className:"text-left min-w-0 flex-1",children:[(0,a.jsx)("h5",{className:"font-semibold text-gray-900",children:e.name}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-x-4 gap-y-1 mt-1",children:[e.email&&(0,a.jsxs)("span",{className:"text-sm text-gray-500 flex items-center gap-1.5",children:[(0,a.jsx)(V.Z,{className:"h-4 w-4 text-gray-400"}),(0,a.jsx)("span",{className:"truncate max-w-[180px]",children:e.email})]}),e.phone&&(0,a.jsxs)("span",{className:"text-sm text-gray-500 flex items-center gap-1.5",children:[(0,a.jsx)(X.Z,{className:"h-4 w-4 text-gray-400"}),e.phone]})]})]})]}),(0,a.jsx)("div",{className:"px-3 py-1.5 rounded-full text-xs font-semibold bg-amber-100 text-amber-700",children:"Witness"})]})},e.id)})}),0===e.length&&!eS&&(0,a.jsxs)("div",{className:"bg-white/60 border-2 border-dashed border-amber-200 rounded-xl p-6 text-center mb-5",children:[(0,a.jsx)("div",{className:"w-12 h-12 bg-amber-100 rounded-full flex items-center justify-center mx-auto mb-3",children:(0,a.jsx)(Y.Z,{className:"h-6 w-6 text-amber-500"})}),(0,a.jsx)("p",{className:"text-gray-600 mb-1",children:"No witnesses added yet"}),(0,a.jsx)("p",{className:"text-sm text-gray-500",children:'Click "Add Witness" to add someone who can support your case'})]}),eS&&(0,a.jsxs)("div",{className:"bg-white border border-amber-200 rounded-xl p-5 shadow-sm",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-5 pb-4 border-b border-gray-100",children:[(0,a.jsx)("div",{className:"w-8 h-8 bg-amber-100 rounded-full flex items-center justify-center",children:(0,a.jsx)(Q.Z,{className:"h-4 w-4 text-amber-600"})}),(0,a.jsx)("h5",{className:"font-semibold text-gray-900",children:"Add New Witness"})]}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{className:"block text-sm font-medium text-gray-700 mb-2 text-left",children:["Full Name ",(0,a.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:(0,a.jsx)(Y.Z,{className:"h-5 w-5 text-gray-400"})}),(0,a.jsx)("input",{type:"text",name:"name",value:eA.name,onChange:eD,className:"w-full border border-gray-300 rounded-xl pl-10 pr-4 py-3 focus:ring-2 focus:ring-amber-500 focus:border-amber-500 outline-none transition-all duration-200",placeholder:"John Doe"})]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-2 text-left",children:"Email Address"}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:(0,a.jsx)(V.Z,{className:"h-5 w-5 text-gray-400"})}),(0,a.jsx)("input",{type:"email",name:"email",value:eA.email,onChange:eD,className:"w-full border border-gray-300 rounded-xl pl-10 pr-4 py-3 focus:ring-2 focus:ring-amber-500 focus:border-amber-500 outline-none transition-all duration-200",placeholder:"[email protected]"})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-2 text-left",children:"Phone Number"}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:(0,a.jsx)(X.Z,{className:"h-5 w-5 text-gray-400"})}),(0,a.jsx)("input",{type:"tel",name:"phone",value:eA.phone,onChange:eD,className:"w-full border border-gray-300 rounded-xl pl-10 pr-4 py-3 focus:ring-2 focus:ring-amber-500 focus:border-amber-500 outline-none transition-all duration-200",placeholder:"(555) 123-4567"})]})]})]})]}),(0,a.jsxs)("div",{className:"flex justify-end gap-3 mt-6 pt-4 border-t border-gray-100",children:[(0,a.jsx)("button",{onClick:()=>
1{eF(!1),eZ({name:"",email:"",phone:""})},className:"px-5 py-2.5 text-gray-600 hover:text-gray-800 hover:bg-gray-100 font-medium rounded-lg transition-all duration-200",disabled:eP,children:"Cancel"}),(0,a.jsx)("button",{onClick:eW,disabled:eP||!eA.name.trim(),className:"bg-amber-500 hover:bg-amber-600 disabled:bg-gray-300 disabled:cursor-not-allowed text-white px-6 py-2.5 rounded-lg font-semibold transition-all duration-200 inline-flex items-center gap-2 shadow-sm hover:shadow-md",children:eP?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("svg",{className:"animate-spin h-4 w-4 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[(0,a.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,a.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Adding..."]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(Q.Z,{className:"h-4 w-4"}),"Add Witness"]})})]})]})]}),(0,a.jsxs)("div",{className:"bg-gray-50 border-t border-gray-200 p-6 sm:p-8",children:[(0,a.jsx)("p",{className:"text-gray-600 mb-5 text-center",children:"Would you like to add more participants or modify the existing ones?"}),(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row gap-3 justify-center",children:[(0,a.jsxs)("button",{onClick:()=>y(!1),className:"bg-white border-2 border-[#F04E23] text-[#F04E23] px-8 py-3 rounded-xl hover:bg-[#F04E23] hover:text-white font-semibold inline-flex items-center justify-center gap-2 transition-all duration-200 shadow-sm",children:[(0,a.jsx)(Q.Z,{className:"h-5 w-5"}),"Modify Participants"]}),(0,a.jsx)("button",{onClick:async()=>{R(!0);try{l&&await l()}finally{R(!1)}},disabled:P,className:"bg-green-600 hover:bg-green-700 text-white px-8 py-3 rounded-xl font-semibold inline-flex items-center justify-center gap-2 transition-all duration-200 shadow-sm hover:shadow-md",children:P?"Loading...":(0,a.jsxs)(a.Fragment,{children:["Continue",(0,a.jsx)(er.Z,{className:"h-5 w-5"})]})})]})]})]})]})})():(0,a.jsxs)(a.Fragment,{children:[1===d&&(()=>{let e=et();return(0,a.jsxs)("div",{className:"text-center max-w-2xl mx-auto py-8",children:[(0,a.jsx)("h2",{className:"text-2xl font-bold text-[#F04E23] mb-4",children:e.header}),(0,a.jsx)("h3",{className:"text-lg text-gray-700 mb-4",children:e.subheader}),(0,a.jsx)("p",{className:"text-gray-600 mb-8",children:e.body})]})})(),et().category&&d>1&&(()=>{let e=et(),t=[...u,...p].filter(t=>t.role===e.category);return(0,a.jsxs)("div",{className:"max-w-6xl mx-auto",children:[t.length>0&&(0,a.jsxs)("div",{className:"mb-8",children:[(0,a.jsxs)("h4",{className:"text-lg font-semibold mb-6 flex items-center gap-2 ".concat(ed(e.category)),children:[(0,a.jsx)(Y.Z,{className:"h-5 w-5"}),"Added ",es(e.category),"s",t.length>1?" (".concat(t.length,")"):""]}),(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:t.map(e=>{let t=k===e.id;return(0,a.jsxs)("div",{className:"bg-white border border-gray-200 rounded-xl shadow-sm hover:shadow-md transition-all p-4 relative ".concat(t?"border-blue-300 ring-2 ring-blue-100":""),children:[(0,a.jsxs)("div",{className:"absolute top-2 right-2 z-10 flex gap-1",children:[!t&&(0,a.jsx)("button",{onClick:()=>ep(e),className:"bg-white text-blue-500 hover:text-blue-700 p-2 rounded-full hover:bg-blue-50 transition-colors shadow-sm",title:"Edit participant",children:(0,a.jsx)(O.Z,{className:"h-4 w-4"})}),t&&(0,a.jsx)("button",{onClick:()=>eg(e),className:"bg-white text-green-500 hover:text-green-700 p-2 rounded-full hover:bg-green-50 transition-colors shadow-sm",title:"Save changes",children:(0,a.jsx)("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),(0,a.jsx)("button",{onClick:()=>ey(e.id),className:"bg-white text-red-500 hover:text-red-700 p-2 rounded-full hover:bg-red-50 transition-colors shadow-sm",title:"Remove participant",children:(0,a.jsx)(H.Z,{className:"h-4 w-4"})})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4 pt-6",children:[(0,a.jsx)("div",{className:"w-7 h-7 rounded-full flex items-center justify-center ".concat(eo(e.role)),children:(0,a.jsx)(Y.Z,{className:"h-4 w-4"})}),(0,a.jsxs)("div",{className:"flex-1",children:[t?(0,a.jsx)("input",{type:"text",name:"name",value:C.name,onChange:eb,className:"w-full text-md font-semibold bg-gray-50 border border-gray-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none",placeholder:"Enter name"}):(0,a.jsx)("h3",{className:"font-semibold text-gray-900 text-md",children:e.name||"No name provided"}),(0,a.jsx)("p",{className:"text-sm text-gray-500 mt-1",children:es(e.role)||"No role assigned"})]})]}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 text-sm",children:[(0,a.jsx)(V.Z,{className:"h-4 w-4 text-gray-400 flex-shrink-0"}),t?(0,a.jsx)("input",{type:"email",name:"email",value:C.email,onChange:eb,className:"flex-1 bg-gray-50 border border-gray-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none",placeholder:"Enter email"}):e.email?(0,a.jsx)("span",{className:"text-gray-700 truncate",children:e.email}):(0,a.jsx)("span",{className:"text-gray-400 italic text-sm",children:"No email"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3 text-sm",children:[(0,a.jsx)(X.Z,{className:"h-4 w-4 text-gray-400 flex-shrink-0"}),t?(0,a.jsx)("input",{type:"tel",name:"phone",value:C.phone,onChange:eb,className:"flex-1 bg-gray-50 border border-gray-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none",placeholder:"Enter phone"}):e.phone?(0,a.jsx)("span",{className:"text-gray-700",children:e.phone}):(0,a.jsx)("span",{className:"text-gray-400 italic text-sm",children:"No phone"})]}),e.job_title&&(0,a.jsxs)("div",{className:"flex items-center gap-3 text-sm",children:[(0,a.jsx)(J.Z,{className:"h-4 w-4 text-gray-400 flex-shrink-0"}),(0,a.jsx)("span",{className:"text-gray-700 bg-gray-50 px-3 py-2 rounded-lg border border-gray-200 flex-1",children:e.job_title})]}),e.description&&(0,a.jsxs)("div",{className:"flex items-start gap-3 text-sm",children:[(0,a.jsx)($.Z,{className:"h-4 w-4 text-gray-400 flex-shrink-0 mt-0.5"}),(0,a.jsx)("span",{className:"text-gray-700 bg-gray-50 px-3 py-2 rounded-lg border border-gray-200 flex-1",children:e.description})]}),e.affidavit&&(0,a.jsxs)("div",{className:"flex items-center gap-3 text-sm",children:[(0,a.jsx)(G.Z,{className:"h-4 w-4 text-gray-400 flex-shrink-0"}),(0,a.jsx)("a",{href:e.affidavit,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 bg-gray-50 px-3 py-2 rounded-lg border border-gray-200 flex-1 truncate underline",children:"View Affidavit"})]}),(0,a.jsxs)("div",{className:"flex items-start gap-3 text-sm",children:[(0,a.jsx)(K.Z,{className:"h-4 w-4 text-gray-400 flex-shrink-0 mt-0.5"}),t?(0,a.jsx)("textarea",{name:"address",value:C.address,onChange:eb,rows:"2",className:"flex-1 bg-gray-50 border border-gray-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none resize-none",placeholder:"Enter address"}):e.address?(0,a.jsx)("span",{className:"text-gray-700",children:e.address}):(0,a.jsx)("span",{className:"text-gray-400 italic text-sm",children:"No address"})]})]}),t&&(0,a.jsxs)("div",{className:"flex gap-2 mt-4 pt-4 border-t",children:[(0,a.jsx)("button",{onClick:()=>eg(e),className:"flex-1 bg-[#F04E23] text-white px-3 py-2 rounded-lg text-sm font-medium hover:bg-[#d9441f] transition-colors",children:"Save"}),(0,a.jsx)("button",{onClick:ef,className:"flex-1 bg-gray-200 text-gray-700 px-3 py-2 rounded-lg text-sm font-medium hover:bg-gray-300 transition-colors",children:"Cancel"})]})]},e.id)})})]}),S?(0,a.jsxs)("div",{className:"bg-white border-2 border-dashed border-[#F04E23] rounded-xl p-6 mb-8",children:[(0,a.jsxs)("h4",{className:"text-lg font-semibold text-[#F04E23] mb-4",children:["Add New ",es(e.category)]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Name*"}),(0,a.jsx)("input",{type:"text",name:"name",value:I.name,onChange:em,className:"w-full border border-gray-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-[#F04E23] focus:border-[#F04E23] outline-none",placeholder:"Enter full name"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Email"}),(0,a.jsx)("input",{type:"email",name:"email",value:I.email,onChange:em,className:"w-full border border-gray-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-[#F04E23] focus:border-[#F04E23] outline-none",placeholder:"Enter email address"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Phone"}),(0,a.jsx)("input",{type:"tel",name:"phone",value:I.phone,onChange:em,className:"w-full border border-gray-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-[#F04E23] focus:border-[#F04E23] outline-none",placeholder:"Enter phone number"})]}),(0,a.jsxs)("div",{className:"md:col-span-2",children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Address"}),(0,a.jsx)("textarea",{name:"address",value:I.address,onChange:em,rows:"3",className:"w-full border border-gray-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-[#F04E23] focus:border-[#F04E23] outline-none resize-none",placeholder:"Enter address"})]})]}),(0,a.jsxs)("div",{className:"flex gap-3 mt-6",children:[(0,a.jsxs)("button",{onClick:ex,className:"bg-[#F04E23] text-white px-6 py-2 rounded-lg hover:bg-[#d9441f] font-medium transition-colors inline-flex items-center gap-2",children:[(0,a.jsx)(Q.Z,{className:"h-4 w-4"}),"Add ",es(e.category)]}),(0,a.jsx)("button",{onClick:eh,className:"bg-gray-200 text-gray-700 px-6 py-2 rounded-lg hover:bg-gray-300 font-medium transition-colors",children:"Cancel"})]})]}):(0,a.jsx)("div",{className:"text-center mb-8",children:(0,a.jsxs)("button",{onClick:()=>{let e=et();T({name:"",job_title:"",role:(null==e?void 0:e.category)||"",email:"",ph
1one:"",address:""}),F(!0)},className:"bg-[#F04E23] text-white px-8 py-4 rounded-xl hover:bg-[#d9441f] font-semibold inline-flex items-center gap-3 transition-colors shadow-md hover:shadow-lg",children:[(0,a.jsx)(Q.Z,{className:"h-5 w-5"}),"Add ",es(e.category)]})})]})})(),eL()&&(()=>{let e=[...u,...p],t=[...new Set(e.map(e=>e.role))].reduce((t,s)=>(t[s]=e.filter(e=>e.role===s),t),{}),s=["employer","supervisor","human_resources","comparative_coworker","witness","other"],r=Object.keys(t).sort((e,t)=>{let a=s.indexOf(e),r=s.indexOf(t);return -1===a&&-1===r?0:-1===a?1:-1===r?-1:a-r}),l=eN();return(0,a.jsxs)("div",{className:"max-w-2xl mx-auto",children:[l.length>0&&(0,a.jsx)("div",{className:"mb-8 bg-amber-50 border border-amber-200 rounded-xl p-6",children:(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)(ea.Z,{className:"h-6 w-6 text-amber-500 flex-shrink-0 mt-0.5"}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold text-amber-800 mb-2",children:"Role Assignment Required"}),(0,a.jsx)("p",{className:"text-amber-700 mb-4",children:"The following participants need specific roles assigned before you can continue:"}),(0,a.jsx)("div",{className:"space-y-2",children:l.map(e=>(0,a.jsxs)("div",{className:"flex items-center justify-between bg-white rounded-lg p-3 border border-amber-200",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)(Y.Z,{className:"h-5 w-5 text-gray-400"}),(0,a.jsx)("span",{className:"font-medium text-gray-900",children:e.name}),(0,a.jsxs)("span",{className:"text-sm text-gray-500",children:["(",e.email,")"]})]}),(0,a.jsx)("button",{onClick:()=>ek(e),className:"bg-amber-600 text-white px-4 py-2 rounded-lg hover:bg-amber-700 transition-colors font-medium text-sm",children:"Assign Role"})]},e.id))})]})]})}),r.map(e=>{let s=t[e];if(0===s.length||"employer"===e)return null;if("other"===e)return(0,a.jsxs)("div",{className:"mb-12",children:[(0,a.jsxs)("h3",{className:"text-xl font-semibold mb-6 flex items-center gap-3 text-amber-600",children:[(0,a.jsx)(ea.Z,{className:"h-6 w-6"}),"Unassigned Participants",s.length>1?" (".concat(s.length,")"):""]}),(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:s.map(e=>(e.id,(0,a.jsxs)("div",{className:"bg-amber-50 rounded-xl shadow-md border-2 transition-all relative border-amber-200 hover:border-amber-300",children:[(0,a.jsxs)("div",{className:"absolute top-2 right-2 z-10 flex gap-1",children:[(0,a.jsx)("button",{onClick:()=>ek(e),className:"bg-white text-amber-600 hover:text-amber-800 p-2 rounded-full hover:bg-amber-100 transition-colors",title:"Assign role",children:(0,a.jsx)(O.Z,{className:"h-4 w-4"})}),(0,a.jsx)("button",{onClick:()=>ey(e.id),className:"bg-white text-red-600 hover:text-red-800 p-2 rounded-full hover:bg-red-100 transition-colors",title:"Delete participant",children:(0,a.jsx)(H.Z,{className:"h-4 w-4"})})]}),(0,a.jsx)("div",{className:"p-4 pb-0 pt-10",children:(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"w-8 h-8 rounded-full bg-amber-100 text-amber-600 flex items-center justify-center",children:(0,a.jsx)(ea.Z,{className:"h-4 w-4"})}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("h3",{className:"text-md font-semibold text-gray-900",children:e.name}),(0,a.jsx)("p",{className:"text-sm text-amber-600 mt-1 font-medium",children:"Role Required"})]})]})}),(0,a.jsxs)("div",{className:"px-4 pb-6",children:[(0,a.jsxs)("div",{className:"space-y-4",children:[e.email&&(0,a.jsxs)("div",{className:"flex items-center gap-3",title:e.email,children:[(0,a.jsx)(V.Z,{className:"h-4 w-4 text-gray-400 flex-shrink-0"}),(0,a.jsx)("span",{className:"text-gray-700 text-sm truncate",children:e.email})]}),e.phone&&(0,a.jsxs)("div",{className:"flex items-center gap-3",title:e.phone,children:[(0,a.jsx)(X.Z,{className:"h-4 w-4 text-gray-400 flex-shrink-0"}),(0,a.jsx)("span",{className:"text-gray-700 text-sm",children:e.phone})]}),e.job_title&&(0,a.jsxs)("div",{className:"flex items-center gap-3",title:e.job_title,children:[(0,a.jsx)(J.Z,{className:"h-4 w-4 text-gray-400 flex-shrink-0"}),(0,a.jsx)("span",{className:"text-gray-700 text-sm bg-gray-50 px-3 py-2 rounded-lg border border-gray-200",children:e.job_title})]}),e.description&&(0,a.jsxs)("div",{className:"flex items-start gap-3",title:e.description,children:[(0,a.jsx)($.Z,{className:"h-4 w-4 text-gray-400 flex-shrink-0 mt-0.5"}),(0,a.jsx)("span",{className:"text-gray-700 text-sm bg-gray-50 px-3 py-2 rounded-lg border border-gray-200",children:e.description})]}),e.affidavit&&(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)(G.Z,{className:"h-4 w-4 text-gray-400 flex-shrink-0"}),(0,a.jsx)("a",{href:e.affidavit,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 text-sm bg-gray-50 px-3 py-2 rounded-lg border border-gray-200 truncate underline",children:"View Affidavit"})]}),e.address&&(0,a.jsxs)("div",{className:"flex items-start gap-3",title:e.address,children:[(0,a.jsx)(K.Z,{className:"h-4 w-4 text-gray-400 flex-shrink-0 mt-0.5"}),(0,a.jsx)("span",{className:"text-gray-700 text-sm",children:e.address})]})]}),(0,a.jsx)("div",{className:"mt-4 pt-4 border-t border-amber-200",children:(0,a.jsx)("button",{onClick:()=>
1ek(e),className:"w-full bg-amber-600 text-white py-2 px-4 rounded-lg hover:bg-amber-700 transition-colors font-medium text-sm",children:"Assign Role"})})]})]},e.id)))})]},e);let r=es(e);return(0,a.jsxs)("div",{className:"mb-12",children:[(0,a.jsxs)("h3",{className:"text-xl font-semibold mb-6 flex items-center gap-3 ".concat(ed(e)),children:[(0,a.jsx)(Y.Z,{className:"h-6 w-6"}),r,s.length>1?" (".concat(s.length,")"):""]}),(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:s.map(e=>{let t=k===e.id;return(0,a.jsxs)("div",{className:"bg-white rounded-xl shadow-md border-2 transition-all relative ".concat(t?"border-blue-300 ring-2 ring-blue-100":"border-gray-200 hover:border-gray-300"),children:[(0,a.jsxs)("div",{className:"absolute top-2 right-2 z-10 flex gap-1",children:[!t&&(0,a.jsx)("button",{onClick:()=>ep(e),className:"bg-white text-blue-600 hover:text-blue-800 p-2 rounded-full hover:bg-blue-100 transition-colors shadow-sm",title:"Edit participant",children:(0,a.jsx)(O.Z,{className:"h-4 w-4"})}),t&&(0,a.jsx)("button",{onClick:()=>eg(e),className:"bg-white text-green-500 hover:text-green-700 p-2 rounded-full hover:bg-green-50 transition-colors shadow-sm",title:"Save changes",children:(0,a.jsx)("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),(0,a.jsx)("button",{onClick:()=>ey(e.id),className:"bg-white text-red-600 hover:text-red-800 p-2 rounded-full hover:bg-red-100 transition-colors shadow-sm",title:"Delete participant",children:(0,a.jsx)(H.Z,{className:"h-4 w-4"})})]}),(0,a.jsx)("div",{className:"p-4 pb-0 pt-10",children:(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"w-8 h-8 rounded-full flex items-center justify-center ".concat(eo(e.role)),children:(0,a.jsx)(Y.Z,{className:"h-4 w-4"})}),(0,a.jsxs)("div",{className:"flex-1",children:[t?(0,a.jsx)("input",{type:"text",name:"name",value:C.name,onChange:eb,className:"w-full text-md font-semibold bg-gray-50 border border-gray-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none",placeholder:"Enter name"}):(0,a.jsx)("h3",{className:"text-md font-semibold text-gray-900",children:e.name}),(0,a.jsx)("p",{className:"text-sm text-gray-500 mt-1",children:es(e.role)})]})]})}),(0,a.jsxs)("div",{className:"px-4 pb-6",children:[(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)(V.Z,{className:"h-4 w-4 text-gray-400 flex-shrink-0"}),t?(0,a.jsx)("input",{type:"email",name:"email",value:C.email,onChange:eb,className:"flex-1 bg-gray-50 border border-gray-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none",placeholder:"Enter email"}):e.email?(0,a.jsx)("span",{className:"text-gray-700 text-sm truncate",children:e.email}):(0,a.jsx)("span",{className:"text-gray-400 italic text-sm",children:"No email"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)(X.Z,{className:"h-4 w-4 text-gray-400 flex-shrink-0"}),t?(0,a.jsx)("input",{type:"tel",name:"phone",value:C.phone,onChange:eb,className:"flex-1 bg-gray-50 border border-gray-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none",placeholder:"Enter phone"}):e.phone?(0,a.jsx)("span",{className:"text-gray-700 text-sm",children:e.phone}):(0,a.jsx)("span",{className:"text-gray-400 italic text-sm",children:"No phone"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)(J.Z,{className:"h-4 w-4 text-gray-400 flex-shrink-0"}),t?(0,a.jsx)("input",{type:"text",name:"job_title",value:C.job_title,onChange:eb,className:"flex-1 bg-gray-50 border border-gray-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none",placeholder:"Enter job title"}):e.job_title?(0,a.jsx)("span",{className:"text-gray-700 text-sm",children:e.job_title}):(0,a.jsx)("span",{className:"text-gray-400 italic text-sm",children:"No job title"})]}),(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)(K.Z,{className:"h-4 w-4 text-gray-400 flex-shrink-0 mt-0.5"}),t?(0,a.jsx)("textarea",{name:"address",value:C.address,onChange:eb,rows:"2",className:"flex-1 bg-gray-50 border border-gray-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none resize-none",placeholder:"Enter address"}):e.address?(0,a.jsx)("span",{className:"text-gray-700 text-sm",children:e.address}):(0,a.jsx)("span",{className:"text-gray-400 italic text-sm",children:"No address"})]})]}),t&&(0,a.jsxs)("div",{className:"flex gap-2 mt-4 pt-4 border-t",children:[(0,a.jsx)("button",{onClick:()=>eg(e),className:"flex-1 bg-[#F04E23] text-white px-3 py-2 rounded-lg text-sm font-medium hover:bg-[#d9441f] transition-colors",children:"Save"}),(0,a.jsx)("button",{onClick:ef,className:"flex-1 bg-gray-200 text-gray-700 px-3 py-2 rounded-lg text-sm font-medium hover:bg-gray-300 transition-colors",children:"Cancel"})]})]})]},e.id)})})]},e)}),0===e.length&&(0,a.jsxs)("div",{className:"text-center py-12",children:[(0,a.jsx)(Y.Z,{className:"h-16 w-16 text-gray-300 mx-auto mb-4"}),(0,a.jsx)("h3",{className:"text-lg font-medium text-gray-500 mb-2",children:"No participants added yet"}),(0,a.jsx)("p",{className:"text-gray-400",children:"Start by adding participants in the previous steps."})]})]})})()]}),!b&&(0,a.jsxs)("div",{className:"flex justify-between items-center mt-8 pt-6 border-t",children:[(0,a.jsxs)("button",{onClick:()=>{d>1&&m(d-1)},disabled:1===d,className:"flex items-center gap-2 px-4 py-2 rounded-lg font-semibold ".concat(1===d?"bg-gray-200 text-gray-400 cursor-not-allowed":"bg-gray-500 text-white hover:bg-gray-600"),children:[(0,a.jsx)(el.Z,{className:"h-4 w-4"}),"Previous"]}),(0,a.jsx)("div",{className:"flex gap-4",children:eL()?(0,a.jsx)("button",{onClick:eE,disabled:A||ew(),className:"px-6 py-2 rounded-lg font-semibold ".concat(ew()?"bg-gray-300 text-gray-500 cursor-not-allowed":"bg-[#F04E23] text-white hover:bg-[#d9441f]"," disabled:opacity-50"),title:ew()?"Please assign roles to all participants before submitting":"",children:A?"Submitting...":"Submit & Continue"}):et().category&&d>1?(()=>{let e=et();return[...u,...p].filter(t=>t.role===e.category).length>0?(0,a.jsxs)("button",{onClick:U,className:"flex items-center gap-2 px-4 py-2 bg-[#F04E23] text-white rounded-lg hover:bg-[#d9441f] font-semibold",children:["Continue",(0,a.jsx)(er.Z,{className:"h-4 w-4"})]}):(0,a.jsx)("button",{onClick:B,className:"px-4 py-2 border border-gray-300 text-gray-700 rounded-lg hover:bg-gray-50 font-semibold",children:"Skip"})})():(0,a.jsxs)("button",{onClick:U,className:"flex items-center gap-2 px-4 py-2 bg-[#F04E23] text-white rounded-lg hover:bg-[#d9441f] font-semibold",children:["Continue",(0,a.jsx)(er.Z,{className:"h-4 w-4"})]})})]}),v&&(0,a.jsx)(ee.Z,{labelledBy:"wizard-participant-remove-dialog-title",onClose:ev,children:(0,a.jsxs)("div",{className:"bg-white rounded-xl shadow-2xl p-0 max-w-md w-full mx-auto overflow-hidden",children:[(0,a.jsx)("div",{className:"px-6 py-4 border-b border-gray-200",children:(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"flex-shrink-0 w-10 h-10 bg-red-100 rounded-full flex items-center justify-center",children:(0,a.jsx)(H.Z,{className:"h-5 w-5 text-red-600"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{id:"wizard-participant-remove-dialog-title",className:"text-lg font-semibold text-gray-900",children:"Remove Participant"}),(0,a.jsx)("p",{className:"text-sm text-gray-600",children:"This action cannot be undone"})]})]})}),(0,a.jsx)("div",{className:"px-6 py-4",children:(0,a.jsx)("p",{className:"text-gray-700",children:"Are you sure you want to remove this participant? This will permanently delete their information."})}),(0,a.jsxs)("div",{className:"bg-gray-50 px-6 py-4 border-t border-gray-200 flex justify-end gap-3",children:[(0,a.jsx)("button",{onClick:ev,className:"px-4 py-2 border border-gray-300 text-gray-700 rounded-lg hover:bg-gray-50 transition-colors font-medium",children:"Cancel"}),(0,a.jsxs)("button",{onClick:ej,className:"px-4 py-2 bg-red-600 text-white rounded-lg hover:bg-red-700 transition-colors font-medium inline-flex items-center gap-2",children:[(0,a.jsx)(H.Z,{className:"h-4 w-4"}),"Remove"]})]})]})}),D&&L&&(0,a.jsx)(ee.Z,{labelledBy:"wizard-participant-dialog-title",onClose:eC,children:(0,a.jsxs)("div",{className:"bg-white rounded-xl shadow-2xl p-0 max-w-lg w-full mx-auto overflow-hidden",children:[(0,a.jsx)("div",{className:"bg-amber-50 px-6 py-4 border-b border-amber-200",children:(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"flex-shrink-0 w-10 h-10 bg-amber-100 rounded-full flex items-center justify-center",children:(0,a.jsx)(Y.Z,{className:"h-5 w-5 text-amber-600"})}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("h2",{id:"wizard-participant-dialog-title",className:"text-xl font-semibold text-gray-900",children:["Assign Role to ",L.name]}),(0,a.jsx)("p",{className:"text-sm text-gray-600",children:"Select the most appropriate role for this participant"})]})]})}),(0,a.jsx)("div",{className:"px-6 py-6",children:(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-3",children:"Select Role *"}),(0,a.jsx)("div",{className:"space-y-2",children:en.filter(e=>"other"!==e.value).map(e=>(0,a.jsxs)("label",{className:"flex items-start gap-3 p-3 border rounded-lg hover:bg-gray-50 cursor-pointer",children:[(0,a.jsx)("input",{type:"radio",name:"role",value:e.value,checked:M===e.value,onChange:e=>q(e.target.value),className:"mt-1 text-[#F04E23] focus:ring-[#F04E23]"}),(0,a.jsx)("div",{className:"flex-1",children:(0,a.jsx)("div",{className:"font-medium text-gray-900",children:e.label})})]},e.value))})]}),(0,a.jsxs)("div",{className:"bg-gray-50 rounded-lg p-4 mt-6",children:[(0,a.jsx)("h4",{className:"font-medium text-gray-900 mb-2",children:"Participant Information:"}),(0,a.jsxs)("div",{className:"space-y-1 text-sm text-gray-600",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("strong",{children:"Name:"})," ",L.name]}),L.email&&(0,a.jsxs)("div",{children:[(0,a.jsx)("strong",{children:"Email:"})," ",L.email]}),L.job_title&&(0,a.jsxs)("div",{children:[(0,a.jsx)("strong",{children:"Job Title:"})," ",L.job_title]})]})]})]})}),(0,a.jsxs)("div",{className:"bg-gray-50 px-6 py-4 border-t border-gray-200 flex justify-end gap-3",children:[(0,a.jsx)("button",{onClick:eC,className:"px-4 py-2 border border-gray-300 text-gray-700 rounded-lg hover:bg-gray-50 transition-colors font-medium",children:"Cancel"}),(0,a.jsx)("button",{onClick:e_,disabled:!M,className:"px-6 py-2 bg-[#F04E23] text-white rounded-lg hover:bg-[#d9441f] transition-colors font-medium disabled:opacity-50 disabled:cursor-not-allowed",children:"Assign Role"})]})]})})]})};let ed=[{value:"witness",label:"Witness"},{value:"complaint_recipient",label:"Complaint Recipient"},{value:"primary_decision_maker",label:"Primary Decision Maker"},{value:"human_resources",label:"Human Resources"},{value:"other",label:"Other"}];function ec(e){var t,s;let{caseId:l,userToken:i,onStepChange:n,userData:o,currentStep:d,useParticipantsWizard:u=!1,extractedData:h,returnToWitnessSection:p=!1,onWizardComplete:f}=e,b=(0,m.useRouter)(),[y,v]=(0,r.useState)([]),[j,w]=(0,r.useState)(null),[N,k]=(0,r.useState)({}),[_,C]=(0,r.useState)(null),[E,S]=(0,r.useState)(""),[F,A]=(0,r.useState)(""),[Z,P]=(0,r.useState)({}),[R,D]=(0,r.useState)(!1),[W,L]=(0,r.useState)({name:"",job_title:"",role:"",email:"",ph
1one:"",address:""}),[z,M]=(0,r.useState)(!1),[I,T]=(0,r.useState)(!1),[U,B]=(0,r.useState)(!1),[ea,er]=(0,r.useState)(!0);(0,r.useEffect)(()=>{3===d&&(async()=>{er(!0);let e=await (0,x.CL)(l,i);v(Array.isArray(null==e?void 0:e.results)?e.results.filter(e=>"other"!==e.role):[]),er(!1)})()},[d,l,i]);let el=e=>e?e.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()):"",ei=e=>({employer:"bg-purple-100 text-purple-600",witness:"bg-gray-100 text-gray-600",complaint_recipient:"bg-red-100 text-red-600",primary_decision_maker:"bg-blue-100 text-blue-600",human_resources:"bg-green-100 text-green-600",other:"bg-yellow-100 text-yellow-600"})[e]||"bg-[#F04E23]/10 text-[#F04E23]",en=e=>{let{name:t,value:s}=e.target;L(e=>({...e,[t]:s})),"email"===t&&"other"!==W.role&&(""!==s.trim()?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(s)?P(e=>({...e,modal:{...e.modal,email:null}})):P(e=>({...e,modal:{...e.modal,email:"Please enter a valid email address."}})):P(e=>({...e,modal:{...e.modal,email:"Email is required."}}))),"role"===t&&"other"===s&&P(e=>({...e,modal:{...e.modal,email:null}}))},ec=async()=>{var e;let t="other"!==W.role;if(!(W.name&&W.role&&(!t||W.email))){c.toast.error("Please fill all required fields ".concat(t?"(Name, Role, Email)":"(Name, Role)"));return}if(t&&(null===(e=Z.modal)||void 0===e?void 0:e.email)){c.toast.error("Please fix the email validation error before adding the participant.");return}if(t&&W.email&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(W.email)){c.toast.error("Please enter a valid email address.");return}try{let e={name:W.name,role:W.role,email:W.email,phone:W.phone||"",address:W.address||""},t=await (0,x.YS)(l,e,i);t&&!t.error?(v(e=>[...e,{...t,isNew:!1}]),c.toast.success("Participant added successfully.")):c.toast.error((null==t?void 0:t.error)||"Failed to add participant.")}catch(e){console.error("Error adding participant:",e),c.toast.error("An error occurred while adding the participant.")}D(!1),L({name:"",job_title:"",role:"",email:"",phone:"",address:""}),P(e=>({...e,modal:{}}))},em=e=>{v(t=>t.filter(t=>t.id!==e)),S("")},eu=async(e,t,s)=>{if("job_title"===t||"affidavit"===t||"description"===t)return;let a=y.find(t=>t.id===e);if(e.includes("new")){v(a=>a.map(a=>a.id===e?{...a,[t]:s}:a));return}if(v(a=>a.map(a=>a.id===e?{...a,[t]:s}:a)),E&&S(""),"email"===t&&"other"!==a.role&&(s.trim()&&""!==s.trim()?s.includes("@")?P(t=>({...t,[e]:{...t[e],email:null}})):P(t=>({...t,[e]:{...t[e],email:"Please enter a valid email address."}})):P(t=>({...t,[e]:{...t[e],email:"Email is required."}}))),null==a?void 0:a.isNew){let r={...a,[t]:s},n="other"!==r.role;if(r.name&&r.role&&(!n||r.email)&&(!n||!r.email||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(r.email)))try{let t={name:r.name,role:r.role,email:r.email,phone:r.phone||"",address:r.address||""},s=await (0,x.YS)(l,t,i);s&&!s.error&&(v(t=>t.map(t=>t.id===e?{...s,isNew:!1}:t)),c.toast.success("Participant created automatically."))}catch(e){console.error("Error auto-creating participant:",e)}}},ex=()=>{let e={},t=(null==y?void 0:y.filter(e=>"other"!==e.role))||[];if((null==t?void 0:t.filter(e=>"witness"===e.role).length)>1)return"Only 1 participant can have a Witness role.";let s=null==t?void 0:t.map(e=>e.email);if([...new Set(s)].length!==s.length)return"No duplicated emails are allowed.";for(let s of t){if(!(s.name||s.job_title||s.role||s.phone||s.address||s.email))continue;if(!s.name)return"Please fill in the Name field.";if(!s.role)return"Please select the Role field.";if(!s.email)return"Please fill in the Email field.";let t=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;s.email&&!t.test(s.email)&&(e[s.id]={...e[s.id],email:"Please enter a valid email address."})}return(P(t=>({...t,...e})),Object.keys(e).length>0)?"Please fix the email validation errors before proceeding.":""},eh=async()=>{T(!0);try{let e=ex();if(e){S(e),c.toast.error(e),T(!1);return}let t=y.filter(e=>e.id.includes("new")),s=y.filter(e=>!e.id.includes("new")&&"other"!==e.role),a=t.map(async e=>{let t={name:e.name,role:e.role,email:e.email,phone:e.phone,address:e.address};return await (0,x.YS)(l,t,i)}),[r]=await Promise.all([Promise.all(a)]),n=r.every(e=>e&&!e.error);if((null==h?void 0:h.court_state)&&await (0,g.ME)(l,{court_state:null==h?void 0:h.court_state},i),n){let e=r.filter(e=>e&&!e.error),t=[...s,...e].filter(e=>"other"!==e.role);v(t),S(""),ep()}else c.toast.error("Some parties failed to save.")}catch(e){console.error("Save error:",e),c.toast.error("Failed to save information. Please try again.")}finally{T(!1)}},ep=()=>{var e,t,s,a,r;let l=null==o?void 0:null===(t=o.case)||void 0===t?void 0:null===(e=t.consult)||void 0===e?void 0:e.engagement_letter,i=Array.isArray(null==l?void 0:l.signers)&&(null==l?void 0:null===(s=l.signers)||void 0===s?void 0:s.length)>0&&(null==l?void 0:null===(a=l.signers)||void 0===a?void 0:a.find(e=>(null==e?void 0:e.type)==="user")),n=(null==i?void 0:i.status)==="signed";(null==o?void 0:null===(r=o.case)||void 0===r?void 0:r.type)!=="contingency"||n?b.push("/home"):b.push("/engagement")},eg=e=>{C(e),M(!0)},ef=()=>{D(!1),P(e=>({...e,modal:{}}))},eb=()=>M(!1),ey=async()=>
1{if(!_)return;await (0,x.oS)(l,_,i);let e=await (0,x.CL)(l,i);v(Array.isArray(null==e?void 0:e.results)?e.results.filter(e=>"other"!==e.role):[]),M(!1),C(null),c.toast.success("Participant deleted")},ev=e=>{w(e.id),k({name:e.name,role:e.role,email:e.email,phone:e.phone,address:e.address})},ej=()=>{w(null),k({})},ew=()=>{let e="new_".concat(Date.now()),t={id:e,name:"",job_title:"",role:"",email:"",phone:"",address:"",isNew:!0};return v(e=>[...e,t]),e},eN=async e=>{let t="other"!==e.role;if(!(e.name&&e.role&&(!t||e.email))){c.toast.error("Please fill all required fields ".concat(t?"(Name, Role, Email)":"(Name, Role)"));return}if(t&&e.email&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.email)){c.toast.error("Please enter a valid email address.");return}try{let t={name:e.name,role:e.role,email:e.email,phone:e.phone||"",address:e.address||""},s=await (0,x.YS)(l,t,i);s&&!s.error?(v(t=>t.map(t=>t.id===e.id?{...s,isNew:!1}:t)),c.toast.success("Participant saved successfully.")):c.toast.error((null==s?void 0:s.error)||"Failed to save participant.")}catch(e){console.error("Error saving participant:",e),c.toast.error("An error occurred while saving the participant.")}},ek=async e=>{let t={name:N.name,role:N.role,email:N.email,phone:N.phone,address:N.address},s=await (0,x.HX)(l,e.id,t,i);if(s&&!s.error){let e=await (0,x.CL)(l,i);v(Array.isArray(null==e?void 0:e.results)?e.results.filter(e=>"other"!==e.role):[]),w(null),k({}),c.toast.success("Participant updated")}else c.toast.error(s.error||"Failed to update participant.")},e_=e=>{let{name:t,value:s}=e.target;k({...N,[t]:s}),"email"===t&&"other"!==N.role&&(s&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(s)?A("Please enter a valid email address."):A(""))},eC=async(e,t,s)=>{if("job_title"===t||"affidavit"===t||"description"===t)return;if(null==e?void 0:e.includes("new")){v(a=>a.map(a=>a.id===e?{...a,[t]:s}:a));return}let a=y.find(t=>t.id===e);if(!a||a[t]===s)return;if("email"===t&&"other"!==a.role){if(s&&""!==s.trim()){if(/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(s))P(t=>({...t,[e]:{...t[e],email:null}}));else{P(t=>({...t,[e]:{...t[e],email:"Please enter a valid email address."}}));return}}else{P(t=>({...t,[e]:{...t[e],email:"Email is required."}}));return}}let r=[...y],n=y.map(a=>a.id===e?{...a,[t]:s}:a);v(n);let o=n.find(t=>t.id===e);try{if(a.isNew){let t="other"!==o.role;if(o.name&&o.role&&(!t||o.email)){let t={name:o.name,role:o.role,email:o.email,phone:o.phone||"",address:o.address||""},s=await (0,x.YS)(l,t,i);if(s&&!s.error){let t=n.map(t=>t.id===e?{...s,isNew:!1}:t);v(t),c.toast.success("Participant created successfully.")}else v(r),c.toast.error((null==s?void 0:s.error)||"Failed to create participant.")}}else{if("job_title"===t||"affidavit"===t||"description"===t)return;let a=await (0,x.HX)(l,e,{[t]:s},i);a&&a.error?(v(r),c.toast.error(a.error||"Failed to update participant.")):a?c.toast.success("Participant updated."):(v(r),c.toast.error("Failed to update participant."))}}catch(e){v(r),c.toast.error("An error occurred while processing the participant.")}};if(u)return(0,a.jsx)("div",{className:"mx-auto w-full max-w-4xl",children:(0,a.jsx)(eo,{caseId:l,userToken:i,onFinish:()=>{if(p&&f){f();return}ep()},initialParticipants:y,skipWitnessStep:p})});let eE=y.filter(e=>"other"!==e.role||e.isNew),eS=["employer","witness","complaint_recipient","primary_decision_maker","human_resources"],eF=eE.sort((e,t)=>{if(e.isNew&&!e.role)return 1;if(t.isNew&&!t.role)return -1;let s=eS.indexOf(e.role),a=eS.indexOf(t.role);return -1===s&&-1===a?0:-1===s?1:-1===a?-1:s-a});return(0,a.jsxs)("div",{className:"mx-auto w-full max-w-7xl",children:[(0,a.jsxs)("div",{className:"text-center mb-8",children:[(0,a.jsx)("h2",{className:"text-2xl font-bold text-[#F04E23] mb-4",children:"Add Case Participants"}),(0,a.jsx)("h3",{className:"text-lg text-gray-700 mb-4",children:"Identify the key people involved in your case"}),(0,a.jsx)("p",{className:"text-gray-600",children:"Add relevant parties who played a role in the incidents you're reporting."})]}),E&&(0,a.jsx)("div",{className:"mb-6 p-4 bg-red-50 border border-red-200 rounded-lg text-red-700 text-sm",children:E}),ea?(0,a.jsx)("div",{className:"animate-pulse",children:(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:[...Array(6)].map((e,t)=>(0,a.jsxs)("div",{className:"bg-white rounded-xl shadow-md p-6",children:[(0,a.jsx)("div",{className:"h-4 bg-gray-300 rounded w-3/4 mb-3"}),(0,a.jsx)("div",{className:"h-3 bg-gray-200 rounded w-1/2 mb-4"}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)("div",{className:"h-3 bg-gray-200 rounded w-full"}),(0,a.jsx)("div",{className:"h-3 bg-gray-200 rounded w-2/3"}),(0,a.jsx)("div",{className:"h-3 bg-gray-200 rounded w-1/2"})]})]},"skeleton-card-".concat(t)))})}):(0,a.jsxs)(a.Fragment,{children:[eF.length>0&&(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 mb-12",children:[eF.map(e=>{var t,s,r,l;let i=j===e.id,n=e.isNew;return(0,a.jsxs)("div",{className:"bg-white rounded-xl shadow-md border-2 transition-all relative ".concat(i?"border-blue-300 ring-2 ring-blue-100":"border-gray-200 hover:border-gray-300"," ").concat(n?"border-l-4 border-l-green-400":""),children:[(0,a.jsxs)("div",{className:"absolute top-3 right-3 z-10 flex gap-1",children:[!i&&!n&&(0,a.jsx)("button",{onClick:()=>ev(e),className:"bg-white text-blue-600 hover:text-blue-800 p-2 rounded-full hover:bg-blue-100 transition-colors shadow-sm",title:"Edit participant",children:(0,a.jsx)(O.Z,{className:"h-4 w-4"})}),(n||i)&&(0,a.jsx)("button",{onClick:()=>n?eN(e):ek(e),className:"bg-white text-green-600 hover:text-green-800 p-2 rounded-full hover:bg-green-100 transition-colors shadow-sm",title:"Save participant",disabled:I||n&&(!e.name||!e.role||"other"!==e.role&&!e.email),children:(0,a.jsx)("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),(0,a.jsx)("button",{onClick:()=>n?em(e.id):eg(e.id),className:"bg-white text-red-600 hover:text-red-800 p-2 rounded-full hover:bg-red-100 transition-colors shadow-sm",title:n?"Remove participant":"Delete participant",children:(0,a.jsx)(H.Z,{className:"h-4 w-4"})})]}),(0,a.jsx)("div",{className:"p-6 pb-4 pt-12",children:(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"w-8 h-8 rounded-full flex items-center justify-center ".concat(ei(e.role)),children:(0,a.jsx)(Y.Z,{className:"h-4 w-4"})}),(0,a.jsxs)("div",{className:"flex-1",children:[i||n?(0,a.jsx)("input",{className:"w-full border rounded-lg px-3 py-2 text-sm font-semibold focus:ring-2 focus:ring-[#F04E23] outline-none",value:n?e.name:N.name||"",onChange:t=>n?eu(e.id,"name",t.target.value):e_(t),name:n?void 0:"name",placeholder:"Enter name*",disabled:I}):e.name?(0,a.jsx)("h3",{className:"text-md font-semibold text-gray-900",children:e.name}):(0,a.jsx)("input",{className:"w-full border rounded-lg px-3 py-2 text-sm font-semibold focus:ring-2 focus:ring-[#F04E23] outline-none",defaultValue:e.name,onBlur:t=>eC(e.id,"name",t.target.value),placeholder:"Enter name*",disabled:I}),(0,a.jsx)("p",{className:"text-sm text-gray-500 mt-1",children:el(e.role)})]})]})}),(0,a.jsx)("div",{className:"px-6 pb-6",children:(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)(V.Z,{className:"h-4 w-4 text-gray-400 flex-shrink-0"}),i||n?(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("input",{className:"w-full border rounded-lg px-3 py-2 text-sm focus:ring-2 focus:ring-[#F04E23] outline-none ".concat((null===(t=Z[e.id])||void 0===t?void 0:t.email)?"border-red-500":""),value:n?e.email:N.email||"",onChange:t=>n?eu(e.id,"email",t.target.value):e_(t),name:n?void 0:"email",placeholder:"other"===e.role?"Enter email (optional)":"Enter email*",disabled:I,type:"email"}),F&&!n&&(0,a.jsx)("p",{className:"text-xs text-red-600 mt-1 font-medium",children:F}),(null===(s=Z[e.id])||void 0===s?void 0:s.email)&&(0,a.jsx)("p",{className:"text-xs text-red-600 mt-1 font-medium",children:Z[e.id].email})]}):e.email?(0,a.jsx)("span",{className:"text-gray-700 text-sm truncate flex-1",children:e.email}):(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("input",{className:"w-full border rounded-lg px-3 py-2 text-sm focus:ring-2 focus:ring-[#F04E23] outline-none ".concat((null===(r=Z[e.id])||void 0===r?void 0:r.email)?"border-red-500":""),defaultValue:e.email,onBlur:t=>eC(e.id,"email",t.target.value),placeholder:"other"===e.role?"Enter email (optional)":"Enter email*",disabled:I,type:"email"}),(null===(l=Z[e.id])||void 0===l?void 0:l.email)&&(0,a.jsx)("p",{className:"text-xs text-red-600 mt-1 font-medium",children:Z[e.id].email})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)(X.Z,{className:"h-4 w-4 text-gray-400 flex-shrink-0"}),i||n?(0,a.jsx)("input",{className:"w-full border rounded-lg px-3 py-2 text-sm focus:ring-2 focus:ring-[#F04E23] outline-none",value:n?e.phone:N.phone||"",onChange:t=>n?eu(e.id,"phone",t.target.value):e_(t),name:n?void 0:"phone",placeholder:"Enter phone (optional)",disabled:I,type:"tel"}):e.phone?(0,a.jsx)("span",{className:"text-gray-700 text-sm",children:e.phone}):(0,a.jsx)("input",{className:"w-full border rounded-lg px-3 py-2 text-sm focus:ring-2 focus:ring-[#F04E23] outline-none",defaultValue:e.phone,onBlur:t=>eC(e.id,"phone",t.target.value),placeholder:"Enter phone (optional)",disabled:I,type:"tel"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)(Y.Z,{className:"h-4 w-4 text-gray-400 flex-shrink-0"}),i||n?(0,a.jsxs)("select",{className:"w-full border rounded-lg px-3 py-2 text-sm focus:ring-2 focus:ring-[#F04E23] outline-none",value:n?e.role:N.role||"",onChange:t=>n?eu(e.id,"role",t.target.value):e_(t),name:n?void 0:"role",disabled:I,children:[(0,a.jsx)("option",{value:"",children:"Select role*"}),ed.map(e=>(0,a.jsx)("option",{value:e.value,children:e.label},e.value))]}):(0,a.jsx)("span",{className:"text-gray-700 text-sm",children:el(e.role)})]}),e.job_title&&(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)(J.Z,{className:"h-4 w-4 text-gray-400 flex-shrink-0"}),(0,a.jsx)("span",{className:"text-gray-700 text-sm bg-gray-50 px-3 py-2 rounded-lg border border-gray-200 w-full",children:e.job_title})]}),e.description&&(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)($.Z,{className:"h-4 w-4 text-gray-400 flex-shrink-0 mt-0.5"}),(0,a.jsx)("span",{className:"text-gray-700 text-sm bg-gray-50 px-3 py-2 rounded-lg border border-gray-200 w-full",children:e.description})]}),e.affidavit&&(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)(G.Z,{className:"h-4 w-4 text-gray-400 flex-shrink-0"}),(0,a.jsx)("a",{href:e.affidavit,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 text-sm bg-gray-50 px-3 py-2 rounded-lg border border-gray-200 w-full truncate underline",children:"View Affidavit"})]}),(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)(K.Z,{className:"h-4 w-4 text-gray-400 flex-shrink-0 mt-0.5"}),i||n?(0,a.jsx)("textarea",{className:"w-full border rounded-lg px-3 py-2 text-sm focus:ring-2 focus:ring-[#F04E23] outline-none resize-y min-h-[60
1px]",value:n?e.address:N.address||"",onChange:t=>n?eu(e.id,"address",t.target.value):e_(t),name:n?void 0:"address",placeholder:"Enter address (optional)",disabled:I}):e.address?(0,a.jsx)("span",{className:"text-gray-700 text-sm",children:e.address}):(0,a.jsx)("input",{className:"w-full border rounded-lg px-3 py-2 text-sm focus:ring-2 focus:ring-[#F04E23] outline-none",defaultValue:e.address,onBlur:t=>eC(e.id,"address",t.target.value),placeholder:"Enter address (optional)",disabled:I})]}),i&&(0,a.jsxs)("div",{className:"flex gap-2 pt-2",children:[(0,a.jsx)("button",{onClick:()=>ek(e),className:"bg-green-600 text-white px-3 py-1 rounded-lg text-xs font-semibold hover:bg-green-700 transition",disabled:!!F,children:"Save"}),(0,a.jsx)("button",{onClick:ej,className:"bg-gray-200 text-gray-700 px-3 py-1 rounded-lg text-xs font-semibold hover:bg-gray-300 transition",children:"Cancel"})]})]})})]},e.id)}),(0,a.jsx)("button",{type:"button",onClick:()=>ew(),disabled:I,className:"w-full bg-white rounded-xl shadow-md border-2 border-dashed border-gray-300 hover:border-[#F04E23] transition-all flex items-center justify-center min-h-[200px] cursor-pointer group focus:outline-none focus-visible:border-[#F04E23] focus-visible:ring-2 focus-visible:ring-[#F04E23] focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",children:(0,a.jsxs)("span",{className:"text-center",children:[(0,a.jsx)("span",{"aria-hidden":"true",className:"w-12 h-12 rounded-full bg-[#F04E23] bg-opacity-10 flex items-center justify-center mx-auto mb-2 group-hover:bg-opacity-20 transition-all",children:(0,a.jsx)(Q.Z,{className:"h-6 w-6 text-[#F04E23]"})}),(0,a.jsx)("span",{className:"block text-gray-500 text-sm font-medium",children:"Add Participant"})]})})]}),0===eF.length&&(0,a.jsxs)("div",{className:"text-center py-12",children:[(0,a.jsx)(Y.Z,{className:"h-16 w-16 text-gray-300 mx-auto mb-4"}),(0,a.jsx)("h3",{className:"text-lg font-medium text-gray-500 mb-2",children:"No participants added yet"}),(0,a.jsx)("p",{className:"text-gray-400 mb-6",children:"Start by adding relevant parties involved in your case."}),(0,a.jsxs)("button",{onClick:()=>{D(!0),P(e=>({...e,modal:{}}))},disabled:I,className:"bg-[#F04E23] text-white px-8 py-4 rounded-xl hover:bg-[#d9441f] font-semibold inline-flex items-center gap-3 transition-colors shadow-md hover:shadow-lg disabled:opacity-50",children:[(0,a.jsx)(Q.Z,{className:"h-5 w-5"}),"Add Your First Participant"]})]})]}),(0,a.jsx)("div",{className:"text-center flex justify-center gap-4 mt-12 pt-8 border-t",children:(0,a.jsx)("button",{onClick:eh,disabled:I||U,className:"px-8 py-3 bg-[#F04E23] text-white text-sm font-semibold rounded-xl hover:bg-[#d9441f] disabled:opacity-50 disabled:cursor-not-allowed transition-colors shadow-md hover:shadow-lg",children:I||U?"Saving...":"Finish & Save"})}),R&&(0,a.jsx)(ee.Z,{labelledBy:"participant-add-dialog-title",onClose:ef,children:(0,a.jsxs)("div",{className:"bg-white rounded-xl shadow-2xl p-0 max-w-lg w-full mx-auto overflow-hidden",children:[(0,a.jsxs)("div",{className:"bg-gray-50 px-6 py-4 border-b border-gray-200",children:[(0,a.jsx)("h2",{id:"participant-add-dialog-title",className:"text-xl font-semibold text-gray-900",children:"Add New Participant"}),(0,a.jsx)("p",{className:"text-sm text-gray-600 mt-1",children:"Fill in the details for the new participant"})]}),(0,a.jsx)("div",{className:"px-6 py-6",children:(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)("div",{children:(0,a.jsx)(q.Z,{name:"name",className:"!py-3 w-full",label:"Name*",value:W.name,onChange:en,placeholder:"Enter full name"})}),(0,a.jsx)("div",{children:(0,a.jsx)(es.Z,{label:"Role*",name:"role",options:ed,value:W.role,onChange:en,placeholder:"Select role"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)(q.Z,{name:"email",className:"!py-3 w-full ".concat((null===(t=Z.modal)||void 0===t?void 0:t.email)?"border-red-500":""),label:"other"===W.role?"Email":"Email*",value:W.email,onChange:en,placeholder:"other"===W.role?"Enter email (optional)":"Enter email address",type:"email"}),(null===(s=Z.modal)||void 0===s?void 0:s.email)&&(0,a.jsx)("p",{className:"text-xs text-red-600 mt-1 font-medium",children:Z.modal.email})]}),(0,a.jsx)("div",{children:(0,a.jsx)(q.Z,{name:"phone",className:"!py-3 w-full",label:"Phone",value:W.phone,onChange:en,placeholder:"Enter phone number (optional)",type:"tel"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Address"}),(0,a.jsx)(et.Z,{onSelect:e=>{en({target:{name:"address",value:e}})},className:"!py-3 w-full",placeholder:"Enter address (optional)"})]})]})}),(0,a.jsxs)("div",{className:"bg-gray-50 px-6 py-4 border-t border-gray-200 flex justify-end gap-3",children:[(0,a.jsx)("button",{onClick:ef,className:"px-4 py-2 border border-gray-300 text-gray-700 rounded-lg hover:bg-gray-50 transition-colors font-medium",children:"Cancel"}),(0,a.jsxs)("button",{onClick:ec,className:"px-6 py-2 bg-[#F04E23] text-white rounded-lg hover:bg-[#d9441f] transition-colors font-medium inline-flex items-center gap-2",children:[(0,a.jsx)(Q.Z,{className:"h-4 w-4"}),"Add Participant"]})]})]})}),z&&(0,a.jsx)(ee.Z,{labelledBy:"participant-delete-dialog-title",onClose:eb,children:(0,a.jsxs)("div",{className:"bg-white rounded shadow-lg p-6 max-w-sm mx-auto text-center",children:[(0,a.jsx)("h2",{id:"participant-delete-dialog-title",className:"text-lg font-semibold mb-4",children:"Delete Participant"}),(0,a.jsx)("p",{className:"mb-6",children:"Are you sure you want to delete this participant?"}),(0,a.jsxs)("div",{className:"flex justify-center gap-4",children:[(0,a.jsx)("button",{onClick:eb,className:"px-4 py-2 bg-gray-200 text-gray-800 rounded hover:bg-gray-300",children:"Cancel"}),(0,a.jsx)("button",{onClick:ey,className:"px-4 py-2 bg-red-600 text-white rounded hover:bg-red-700",children:"Delete"})]})]})})]})}var em=s(81801),eu=s(77165),ex=e=>{let{caseId:t,userToken:s,userData:l,onBack:i,onModifyParticipants:n}=e,o=(0,m.useRouter)(),[d,u]=(0,r.useState)([]),[h,p]=(0,r.useState)([]),[g,f]=(0,r.useState)([]),[b,y]=(0,r.useState)(!0),[v,j]=(0,r.useState)(!1),[w,N]=(0,r.useState)(!1),[k,_]=(0,r.useState)(!1),[C,E]=(0,r.useState)(null),[S,F]=(0,r.useState)(null),[A,Z]=(0,r.useState)({}),[P,R]=(0,r.useState)(!1),[D,W]=(0,r.useState)(!1),[L,z]=(0,r.useState)([]),[M,q]=(0,r.useState)(!1),[I,T]=(0,r.useState)({}),[U,B]=(0,r.useState)(null),[O,V]=(0,r.useState)({name:"",phone:"",jobTitle:"",description:"",affidavit:""});(0,r.useEffect)(()=>{let e=async()=>{y(!0);try{let e=await (0,x.CL)(t,s,1,50),a=Array.isArray(null==e?void 0:e.results)?e.results.filter(e=>
1"witness"===e.role):[],r=await (0,x.Zp)(t,s,1,50),l=Array.isArray(null==r?void 0:r.results)?r.results:[],i=new Map;l.forEach(e=>{i.has(e.participant)||i.set(e.participant,e)});let n=a.map(e=>{let t=i.get(e.id),s=e.affidavit||(null==t?void 0:t.affidavit)||null;return s&&"string"==typeof s?(s=s.trim(),('""'===s||"''"===s||'\\"\\"'===s||'"\\"\\""'===s)&&(s=null)):s=null,{...e,affidavit:s,affidavitObj:t||null}});u(n),p(l);let o=n.filter(e=>{let t=e.affidavit;if(!t||"string"!=typeof t)return!1;let s=t.trim();return'""'!==s&&""!==s&&"''"!==s&&'\\"\\"'!==s&&!(s.length<10)&&s.split(/\s+/).filter(e=>e.length>0).length>=5});f(o.map(e=>e.id))}catch(e){console.error("Error loading witness data:",e),c.toast.error("Failed to load witness information")}finally{y(!1)}};t&&s&&e()},[t,s]),(0,r.useEffect)(()=>{if(!M&&d.length>0&&!b){let e=d.filter(e=>{let t=e.affidavit;if(!t||"string"!=typeof t)return!1;let s=t.trim();return'""'!==s&&""!==s&&"''"!==s&&'\\"\\"'!==s&&!(s.length<10)&&s.split(/\s+/).filter(e=>e.length>0).length>=5});1===e.length&&z([e[0].id]),q(!0)}},[d,b,M]);let X=e=>{if(!e)return"";let t=e.replace(/\D/g,""),s=t.length;return s<4?t:s<7?"(".concat(t.slice(0,3),") ").concat(t.slice(3)):"(".concat(t.slice(0,3),") ").concat(t.slice(3,6),"-").concat(t.slice(6,10))},J=e=>{if(!e)return"";let t=e.replace(/\D/g,"");return 10===t.length?"(".concat(t.slice(0,3),") ").concat(t.slice(3,6),"-").concat(t.slice(6)):t.length>10?"(".concat(t.slice(0,3),") ").concat(t.slice(3,6),"-").concat(t.slice(6,10)):e},$=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:150;return e&&"string"==typeof e?e.length<=t?e:e.substring(0,t)+"...":""},G=e=>{if(!e||"string"!=typeof e)return!1;let t=e.trim();return'""'!==t&&""!==t&&!(t.length<10)&&t.split(/\s+/).filter(e=>e.length>0).length>=5},K=e=>{if(!e||"string"!=typeof e)return null;let t=e.trim();return'""'!==t&&""!==t&&"''"!==t&&'\\"\\"'!==t&&G(e)?t:null},et=d.filter(e=>null!==K(e.affidavit)).length>0,es=g.length>0,el=(e,t)=>{var s;if((null===(s=I[e])||void 0===s?void 0:s[t])!==void 0)return I[e][t];let a=d.find(t=>t.id===e);return a?"name"===t?a.name||"":"email"===t?a.email||"":"phone"===t?J(a.phone)||"":"job_title"===t&&a.job_title||"":""},ei=(e,t,s)=>{"phone"===t&&(s=X(s)),T(a=>({...a,[e]:{...a[e],[t]:s}}))},en=async(e,a)=>{let r=el(e,a),l=d.find(t=>t.id===e);if(!l)return;let i="";if("name"===a&&(i=l.name||""),"email"===a&&(i=l.email||""),"phone"===a&&(i=J(l.phone)||""),"job_title"===a&&(i=l.job_title||""),r===i)return;let n=null!==K(l.affidavit);if(("name"===a||n&&("phone"===a||"job_title"===a))&&!r.trim()){c.toast.error("".concat({name:"Name",phone:"Phone",job_title:"Job Title"}[a]," is required")),T(t=>({...t,[e]:{...t[e],[a]:i}}));return}B(e);try{let l={};"name"===a&&(l.name=r.trim()),"email"===a&&(l.email=r.trim()),"phone"===a&&(l.phone=r.replace(/\D/g,"")),"job_title"===a&&(l.job_title=r.trim()),await (0,x.HX)(t,e,l,s),u(t=>t.map(t=>t.id===e?{...t,...l}:t)),T(t=>{let s={...t};return s[e]&&(delete s[e][a],0===Object.keys(s[e]).length&&delete s[e]),s})}catch(e){console.error("Error saving:",e),c.toast.error("Failed to save")}finally{B(null)}},eo=()=>{var e,t;let s={};return(null===(e=O.name)||void 0===e?void 0:e.trim())||(s.name="Required"),(null===(t=O.phone)||void 0===t?void 0:t.trim())||(s.phone="Required"),Z(s),0===Object.keys(s).length},ed=(e,t)=>{"phone"===e&&(t=X(t)),V(s=>({...s,[e]:t})),A[e]&&Z(t=>({...t,[e]:null}))},ec=()=>{_(!1),F(null),V({name:"",phone:"",jobTitle:"",description:"",affidavit:""}),Z({})},ex=async()=>{if(eo()){j(!0);try{var e;let a={name:O.name.trim(),phone:O.phone.replace(/\D/g,""),role:"witness"};if(a.job_title=(null===(e=O.jobTitle)||void 0===e?void 0:e.trim())||"",S){await (0,x.HX)(t,S.id,a,s);
1let e=await (0,x.CL)(t,s,1,50),r=await (0,x.Zp)(t,s,1,50),l=Array.isArray(null==e?void 0:e.results)?e.results.filter(e=>"witness"===e.role):[],i=Array.isArray(null==r?void 0:r.results)?r.results:[],n=l.find(e=>e.id===S.id);if(n){let e=i.find(e=>e.participant===n.id),t=n.affidavit||(null==e?void 0:e.affidavit)||null;t&&"string"==typeof t?(t=t.trim(),('""'===t||"''"===t||'\\"\\"'===t||'"\\"\\""'===t)&&(t=null)):t=null,u(s=>s.map(s=>s.id===S.id?{...n,affidavit:t,affidavitObj:e||null}:s))}else u(e=>e.map(e=>e.id===S.id?{...e,...a,name:O.name.trim()}:e));c.toast.success("Witness updated successfully")}else{let e=await (0,x.YS)(t,a,s);(null==e?void 0:e.id)&&(u(t=>[...t,{...e,affidavit:null}]),c.toast.success("Witness added successfully"))}ec()}catch(e){console.error("Error saving witness:",e),c.toast.error("Failed to save witness")}finally{j(!1)}}},eh=()=>{N(!1),E(null)},ep=async()=>{if(C){j(!0);try{var e;(null===(e=C.affidavit)||void 0===e?void 0:e.id)&&await (0,x.Y5)(t,C.affidavit.id,s),await (0,x.oS)(t,C.id,s),u(e=>e.filter(e=>e.id!==C.id)),f(e=>e.filter(e=>e!==C.id)),c.toast.success("Witness deleted successfully")}catch(e){console.error("Error deleting witness:",e),c.toast.error("Failed to delete witness")}finally{j(!1),N(!1),E(null)}}},eg=()=>{var e,t,s,a,r;let i=null==l?void 0:null===(t=l.case)||void 0===t?void 0:null===(e=t.consult)||void 0===e?void 0:e.engagement_letter,n=Array.isArray(null==i?void 0:i.signers)&&(null==i?void 0:null===(s=i.signers)||void 0===s?void 0:s.length)>0&&(null==i?void 0:null===(a=i.signers)||void 0===a?void 0:a.find(e=>(null==e?void 0:e.type)==="user")),d=(null==n?void 0:n.status)==="signed";(null==l?void 0:null===(r=l.case)||void 0===r?void 0:r.type)!=="contingency"||d?o.push("/home"):o.push("/engagement")},ef=async()=>{if(!et||0===g.length){eg();return}if(g.length>0&&!P){c.toast.error("Please grant permission to contact witnesses");return}W(!0);try{if(g.length>0){c.toast.info("Sending ".concat(g.length," witness declaration(s) for signing..."));let a=await (0,x.gQ)(t,g,s);if(a.success)c.toast.success("Successfully sent ".concat(g.length," witness declaration(s) for signing")),eg();else{var e;let t=(null===(e=a.error)||void 0===e?void 0:e.message)||a.error||"Failed to send witness declarations";c.toast.error(t)}}else eg()}catch(e){console.error("Error sending affidavits:",e),c.toast.error("Error sending witness declarations. Please try again.")}finally{W(!1)}},eb=e=>{z(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},ey=e=>L.includes(e);return b?(0,a.jsx)("div",{className:"w-full",children:(0,a.jsxs)("div",{className:"animate-pulse",children:[(0,a.jsx)("div",{className:"h-12 bg-gray-100 rounded mb-2"}),[1,2,3].map(e=>(0,a.jsx)("div",{className:"h-16 bg-gray-50 rounded mb-2 border border-gray-100"},e))]})}):(0,a.jsxs)("div",{className:"w-full",children:[(0,a.jsx)("div",{className:"text-center mb-8",children:(0,a.jsx)("h2",{className:"text-2xl font-bold text-[#F04E23] mb-4",children:"Witness Information"})}),(0,a.jsx)("div",{className:"bg-gradient-to-br from-[#F04E23]/5 via-[#F04E23]/10 to-[#F04E23]/5 border-l-4 border-[#F04E23] rounded-r-xl p-5 mb-6 shadow-md",children:(0,a.jsxs)("div",{className:"flex items-start gap-4",children:[(0,a.jsx)("div",{className:"flex-shrink-0 w-10 h-10 bg-[#F04E23] rounded-full flex items-center justify-center shadow-sm",children:(0,a.jsx)(ea.Z,{className:"h-5 w-5 text-white"})}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("h3",{className:"text-sm font-bold text-[#F04E23] mb-2 uppercase tracking-wide",children:"Why this helps"}),et?(0,a.jsx)("p",{className:"text-sm text-gray-700 leading-relaxed",children:"Witness statements can help support your case. If you are comfortable sharing witness contact information and giving us permission to reach out, we may be able to gather signed statements that help show what happened. Please share the best contact information you have for each witness."}):(0,a.jsx)("p",{className:"text-sm text-gray-700 leading-relaxed",children:"We have your witness contacts on file. You can review or update them here, then continue to finish your upload."})]})]})}),(0,a.jsx)("div",{className:"overflow-x-auto bg-white rounded-xl border border-gray-200",children:(0,a.jsxs)("table",{className:"w-full border-collapse",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{className:"border-b border-gray-200 bg-gray-50",children:[(0,a.jsx)("th",{className:"w-8 py-3 px-1"}),(0,a.jsxs)("th",{className:"text-left py-3 px-2 text-xs font-semibold text-gray-600 min-w-[100px]",children:["Name ",(0,a.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,a.jsxs)("th",{className:"text-left py-3 px-2 text-xs font-semibold text-gray-600 min-w-[80px]",children:["Job Title ",et&&(0,a.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,a.jsxs)("th",{className:"text-left py-3 px-2 text-xs font-semibold text-gray-600 min-w-[100px]",children:["Mobile ",et&&(0,a.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,a.jsx)("th",{className:"text-left py-3 px-2 text-xs font-semibold text-gray-600 min-w-[120px]",children:"Email"}),(0,a.jsx)("th",{className:"text-left py-3 px-2 text-xs font-semibold text-gray-600",children:"Affidavit"}),(0,a.jsx)("th",{className:"text-center py-3 px-2 text-xs font-semibold text-gray-600",children:"Request Witness Report"})]})}),(0,a.jsxs)("tbody",{children:[d.map((e,t)=>{let s=K(e.affidavit);e.description&&e.description.trim();
1let l=null!==s,i=U===e.id,n=ey(e.id),o=el(e.id,"name"),d=el(e.id,"email"),c=el(e.id,"phone"),m=el(e.id,"job_title");return(0,a.jsxs)(r.Fragment,{children:[(0,a.jsxs)("tr",{className:"border-b border-gray-100 ".concat(t%2==1?"bg-gray-50/30":""," ").concat(n?"bg-orange-50/30":""),children:[(0,a.jsx)("td",{className:"py-2 px-1",children:(0,a.jsx)("button",{onClick:()=>eb(e.id),className:"p-1 rounded transition-all ".concat(n?"text-[#F04E23] bg-[#F04E23]/10":"text-gray-400 hover:text-gray-600 hover:bg-gray-100"),title:n?"Collapse":"Expand to view full affidavit",children:(0,a.jsx)(em.Z,{className:"h-4 w-4 transition-transform duration-200 ".concat(n?"rotate-180":"")})})}),(0,a.jsx)("td",{className:"py-2 px-2",children:(0,a.jsx)("input",{type:"text",value:o,onChange:t=>ei(e.id,"name",t.target.value),onBlur:()=>en(e.id,"name"),disabled:i,placeholder:"Enter name",className:"w-full px-2 py-1 text-xs border rounded outline-none transition-all ".concat(o.trim()?"border-gray-300 bg-white hover:border-gray-400 focus:border-[#F04E23] focus:ring-1 focus:ring-orange-100":"border-red-300 bg-red-50/50 focus:border-red-400 focus:ring-1 focus:ring-red-100"," ").concat(i?"opacity-50":"")})}),(0,a.jsx)("td",{className:"py-2 px-2",children:(0,a.jsx)("input",{type:"text",value:m,onChange:t=>ei(e.id,"job_title",t.target.value),onBlur:()=>en(e.id,"job_title"),disabled:i,placeholder:"Job title",className:"w-full px-2 py-1 text-xs border rounded outline-none transition-all ".concat(l&&!m.trim()?"border-red-300 bg-red-50/50 focus:border-red-400 focus:ring-1 focus:ring-red-100":"border-gray-300 bg-white hover:border-gray-400 focus:border-[#F04E23] focus:ring-1 focus:ring-orange-100"," ").concat(i?"opacity-50":"")})}),(0,a.jsx)("td",{className:"py-2 px-2",children:(0,a.jsx)("input",{type:"tel",value:c,onChange:t=>ei(e.id,"phone",t.target.value),onBlur:()=>en(e.id,"phone"),disabled:i,maxLength:14,placeholder:"(555) 555-5555",className:"w-full px-2 py-1 text-xs border rounded outline-none transition-all ".concat(l&&!c.trim()?"border-red-300 bg-red-50/50 focus:border-red-400 focus:ring-1 focus:ring-red-100":"border-gray-300 bg-white hover:border-gray-400 focus:border-[#F04E23] focus:ring-1 focus:ring-orange-100"," ").concat(i?"opacity-50":"")})}),(0,a.jsx)("td",{className:"py-2 px-2",children:(0,a.jsx)("input",{type:"email",value:d,onChange:t=>ei(e.id,"email",t.target.value),onBlur:()=>en(e.id,"email"),disabled:i,placeholder:"[email protected]",className:"w-full px-2 py-1 text-xs border border-gray-300 bg-white rounded outline-none hover:border-gray-400 focus:border-[#F04E23] focus:ring-1 focus:ring-orange-100 transition-all ".concat(i?"opacity-50":"")})}),(0,a.jsx)("td",{className:"py-2 px-2",children:l?(0,a.jsx)("p",{className:"text-xs text-gray-600 line-clamp-1",title:s,children:$(s,50)}):(0,a.jsx)("span",{className:"text-xs text-gray-400",children:"-"})}),(0,a.jsx)("td",{className:"py-2 px-2 text-center",children:(0,a.jsx)("input",{type:"checkbox",checked:g.includes(e.id),disabled:!l,title:l?"Request witness report":"A witness report can be requested after an affidavit is prepared.",onChange:t=>{t.target.checked?f(t=>[...t,e.id]):f(t=>t.filter(t=>t!==e.id))},className:"h-4 w-4 text-[#F04E23] border-gray-300 rounded focus:ring-[#F04E23] cursor-pointer disabled:cursor-not-allowed disabled:opacity-40"})})]}),n&&(0,a.jsx)("tr",{className:"bg-gray-50/70",children:(0,a.jsx)("td",{colSpan:7,className:"px-4 py-4",children:(0,a.jsx)("div",{className:"pl-8 pr-4",children:(0,a.jsxs)("div",{className:"bg-white rounded-lg border border-gray-200 p-4",children:[(0,a.jsx)("h4",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide mb-2",children:"Affidavit"}),l?(0,a.jsx)("p",{className:"text-[12px] text-gray-700 whitespace-pre-wrap max-h-64 overflow-y-auto",children:s}):(0,a.jsx)("p",{className:"text-[12px] text-gray-400 italic",children:"No affidavit provided"})]})})})})]},e.id)}),0===d.length&&(0,a.jsx)("tr",{children:(0,a.jsx)("td",{colSpan:7,className:"py-12 text-center",children:(0,a.jsxs)("div",{className:"flex flex-col items-center",children:[(0,a.jsx)("div",{className:"w-12 h-12 bg-gray-100 rounded-full flex items-center justify-center mb-3",children:(0,a.jsx)(Y.Z,{className:"h-6 w-6 text-gray-400"})}),(0,a.jsx)("p",{className:"text-gray-500 mb-1",children:"No witnesses added yet"}),(0,a.jsx)("p",{className:"text-gray-400 text-sm",children:"Use Add Witness to share witness contact information."})]})})})]})]})}),(0,a.jsx)("div",{className:"mt-6 flex justify-center",children:(0,a.jsxs)("button",{onClick:()=>{V({name:"",phone:"",jobTitle:"",description:"",affidavit:""}),F(null),Z({}),_(!0)},className:"inline-flex items-center gap-2 px-5 py-2.5 text-sm font-medium text-[#F04E23] border-2 border-[#F04E23] rounded-lg hover:bg-[#F04E23] hover:text-white transition-colors",children:[(0,a.jsx)(Q.Z,{className:"h-4 w-4"}),"Add Witness"]})}),(0,a.jsxs)("div",{className:"mt-8 bg-gray-50 rounded-xl p-5 border border-gray-200 flex flex-col items-center gap-4",children:[es&&(0,a.jsxs)("label",{className:"flex items-start gap-3 cursor-pointer",children:[(0,a.jsx)("input",{type:"checkbox",checked:P,onChange:e=>R(e.target.checked),className:"mt-1 h-7 w-7 text-[#F04E23] border-gray-300 rounded focus:ring-[#F04E23] cursor-pointer"}),(0,a.jsx)("span",{className:"text-sm text-gray-700 leading-relaxed",children:"By checking, you are giving us permission to reach out to these witnesses on your behalf to secure signed witness statements. You should notify them they will be receiving these from you."})]}),(0,a.jsx)("button",{onClick:ef,disabled:D,className:"bg-green-600 hover:bg-green-700 text-white px-8 py-3 rounded-xl font-semibold inline-flex items-center justify-center gap-2 transition-all duration-200 shadow-sm hover:shadow-md disabled:opacity-50 disabled:cursor-not-allowed",children:D?"Loading...":(0,a.jsxs)(a.Fragment,{children:["Continue",(0,a.jsx)(er.Z,{className:"h-5 w-5"})]})})]}
1),k&&(0,a.jsx)(ee.Z,{labelledBy:"witness-edit-dialog-title",onClose:v?void 0:ec,children:(0,a.jsxs)("div",{className:"bg-white rounded-2xl shadow-2xl w-full max-w-lg mx-auto overflow-hidden",children:[(0,a.jsxs)("div",{className:"bg-[#F04E23] px-6 py-4 flex items-center justify-between",children:[(0,a.jsx)("h3",{id:"witness-edit-dialog-title",className:"text-lg font-semibold text-white",children:S?"Edit Witness":"Add Witness"}),(0,a.jsx)("button",{type:"button",onClick:ec,"aria-label":"Close",className:"text-white/80 hover:text-white p-1 rounded-lg hover:bg-white/10 transition-colors",children:(0,a.jsx)(eu.Z,{className:"h-5 w-5","aria-hidden":"true"})})]}),(0,a.jsxs)("div",{className:"p-6",children:[(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsxs)("label",{className:"block text-sm font-medium text-gray-700 mb-1.5",children:["Name ",(0,a.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,a.jsx)("input",{type:"text",value:O.name,onChange:e=>ed("name",e.target.value),className:"w-full px-4 py-2.5 text-sm border rounded-lg outline-none transition-colors ".concat(A.name?"border-red-300 bg-red-50 focus:border-red-400":"border-gray-200 focus:border-[#F04E23] focus:ring-2 focus:ring-orange-100"),placeholder:"Enter full name"}),A.name&&(0,a.jsx)("p",{className:"text-xs text-red-500 mt-1",children:A.name})]}),(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsxs)("label",{className:"block text-sm font-medium text-gray-700 mb-1.5",children:["Mobile number ",(0,a.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,a.jsx)("input",{type:"tel",value:O.phone,onChange:e=>ed("phone",e.target.value),className:"w-full px-4 py-2.5 text-sm border rounded-lg outline-none transition-colors ".concat(A.phone?"border-red-300 bg-red-50 focus:border-red-400":"border-gray-200 focus:border-[#F04E23] focus:ring-2 focus:ring-orange-100"),placeholder:"(833) 406-3369",maxLength:14}),A.phone&&(0,a.jsx)("p",{className:"text-xs text-red-500 mt-1",children:A.phone})]}),(0,a.jsxs)("div",{className:"mb-6",children:[(0,a.jsxs)("label",{className:"block text-sm font-medium text-gray-700 mb-1.5",children:["Job title ",(0,a.jsx)("span",{className:"text-gray-400",children:"(optional)"})]}),(0,a.jsx)("input",{type:"text",value:O.jobTitle,onChange:e=>ed("jobTitle",e.target.value),className:"w-full px-4 py-2.5 text-sm border border-gray-200 rounded-lg outline-none focus:border-[#F04E23] focus:ring-2 focus:ring-orange-100 transition-colors",placeholder:"e.g., Manager, HR Director"})]}),S&&O.affidavit&&(0,a.jsxs)("div",{className:"mb-6",children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1.5",children:"Affidavit"}),(0,a.jsx)("div",{className:"w-full px-4 py-2.5 text-sm border border-gray-100 bg-gray-50 rounded-lg text-gray-600 max-h-64 overflow-y-auto",children:O.affidavit})]}),(0,a.jsxs)("div",{className:"flex justify-end gap-3 mt-6",children:[(0,a.jsx)("button",{onClick:ec,disabled:v,className:"px-5 py-2.5 text-sm font-medium text-gray-600 hover:text-gray-800 hover:bg-gray-100 rounded-lg transition-colors",children:"Cancel"}),(0,a.jsx)("button",{onClick:ex,disabled:v,className:"px-5 py-2.5 text-sm font-medium text-white bg-[#F04E23] hover:bg-[#d9441f] rounded-lg transition-colors disabled:opacity-50 inline-flex items-center gap-2",children:v?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[(0,a.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),(0,a.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Saving..."]}):S?"Save Changes":"Add Witness"})]})]})]})}),w&&(0,a.jsx)(ee.Z,{labelledBy:"witness-delete-dialog-title",onClose:v?void 0:eh,children:(0,a.jsxs)("div",{className:"bg-white rounded-xl shadow-2xl p-6 max-w-sm mx-auto text-center",children:[(0,a.jsx)("div",{className:"w-12 h-12 bg-red-100 rounded-full flex items-center justify-center mx-auto mb-4",children:(0,a.jsx)(H.Z,{className:"h-6 w-6 text-red-600"})}),(0,a.jsx)("h3",{id:"witness-delete-dialog-title",className:"text-lg font-semibold text-gray-900 mb-2",children:"Delete Witness"}),(0,a.jsx)("p",{className:"text-gray-600 mb-6",children:"Are you sure you want to delete this witness? This action cannot be undone."}),(0,a.jsxs)("div",{className:"flex justify-center gap-3",children:[(0,a.jsx)("button",{onClick:eh,disabled:v,className:"px-4 py-2 border border-gray-300 text-gray-700 rounded-lg hover:bg-gray-50 font-medium transition-colors",children:"Cancel"}),(0,a.jsx)("button",{onClick:ep,disabled:v,className:"px-4 py-2 bg-red-600 text-white rounded-lg hover:bg-red-700 font-medium transition-colors inline-flex items-center gap-2 disabled:opacity-50",children:v?"Deleting...":"Delete"})]})]})})]})},eh=s(39495);function ep(e){let{caseId:t,userToken:s,onStepChange:o,userData:d,currentStep:c,idUploadNextStep:m=2,useParticipantsWizard:u=!1,pendingUploadFiles:x=[],pendingAdaReviewHref:h="",onPendingUploadFilesConsumed:p,onUserDataUpdate:g}=e;(0,i.E)();let f=(0,l.Z)(),[b,y]=(0,r.useState)({court_state:"",employer_name:""}),[v,j]=(0,r.useState)(!1),N={1:"eeoc",1.75:"w9_form",2:"files",[w.Jn]:"id_upload",[w.C3]:"ssdi_details",2.5:"witness_affidavits",3:"participants"},k=e=>{y(t=>({...t,...e}))},_=()=>{j(!0),o(3)},C=()=>{v&&(j(!1),o(2.5))};return(0,a.jsx)("div",{className:"".concat(f?"w-full absolute left-0 top-0 z-[999] mx-auto min-w-full bg-white p-6":"bg-white py-3"),children:(()=>{switch(N[c]){case"eeoc":default:return(0,a.jsx)(n.default,{userData:d,caseId:t,userToken:s,onStepChange:o,currentStep:c});case"w9_form":return(0,a.jsx)(eh.Z,{caseId:t,userToken:s,userData:d,onStepChange:o,currentStep:c});case"files":return(0,a.jsx)(M,{caseId:t,userToken:s,onStepChange:o,userData:d,currentStep:c,onParticipantsUpdate:k,initialFiles:x,pendingAdaReviewHref:h,onInitialFilesConsumed:p});case"ssdi_details":return(0,a.jsx)(U,{userData:d,userToken:s,onStepChange:o,onUserDataUpdate:g});case"id_upload":var e;return(0,a.jsx)(B.Z,{caseId:t,userToken:s,userData:d,onStepChange:o,onUserDataUpdate:g,nextStep:m,backStep:(null==d?void 0:d.category)!=="employment"||(null==d?void 0:null===(e=d.case)||void 0===e?void 0:e.eeoc_signed_file)?null:1.5,backLabel:"Back to EEOC"});case"witness_affidavits":return(0,a.jsx)(ex,{caseId:t,userToken:s,userData:d,onBack:()=>o(2),onModifyParticipants:_});case"participants":return(0,a.jsx)(ec,{caseId:t,userToken:s,onStepChange:o,userData:d,currentStep:c,useParticipantsWizard:u,extractedData:b,returnToWitnessSection:v,onWizardComplete:C})}})()})}},39495:function(e,t,s){s.d(t,{Z:function(){return m}});var a=s(57437),r=s(2265),l=s(33903),i=s(28142),n=s(19672),o=s(21450),d=s(7409);let c=l.HE;function m(e){let{caseId:t,userToken:s,userData:m,onStepChange:u,currentStep:x,initialW9Document:h=null,settlementOnlyMode:p=!1,onCompleted:g}=e,[f,b]=(0,r.useState)(null),[y,v]=(0,r.useState)(null),[j,w]=(0,r.useState)(!1),[N,k]=(0,r.useState)(null),[_,C]=(0,r.useState)(null),[E,S]=(0,r.useState)(!0),[F,A]=(0,r.useState)(null),Z=(0,r.useRef)(!1);(0,r.useEffect)(()=>{(null==m?void 0:m.email)&&!Z.current&&(Z.current=!0,P())},[null==m?void 0:m.email,h]);let P=async()=>{S(!0),A(null);try{let e=null==m?void 0:m.email,a=(null==m?void 0:m.name)||"".concat((null==m?void 0:m.firstname)||""," ").concat((null==m?void 0:m.lastname)||"").trim(),r
1=h;if(!r){let t=await (0,l.uU)(e,l.sU,s);r=(0,l.dX)(t,l.sU)}if(g&&(r=null),c(r)){let e=(0,l.hR)(r);b("signed"),(null==e?void 0:e.sign_link)&&C(e.sign_link),p||null==u||u(2);return}let i=(0,l.hR)(r);if(null==i?void 0:i.sign_link){v(i.sign_link),k(r.id),b(r.status),w(!0),S(!1);return}let n=(0,l.xp)({caseId:t,clientName:a,userEmail:e}),o=await (0,l.dr)(n,s);if(g&&c(o)){b("verifying"),await g();return}if(null==o?void 0:o.sign_links){let t=o.sign_links[e]||Object.values(o.sign_links)[0];t?(v(t),k(o.sign_document_id),b("sent"),w(!0)):A("Failed to get W9 signing link. Please try again.")}else A("Failed to generate W9 form. Please try again.")}catch(e){console.error("Error initializing W9 form:",e),A("Something went wrong. Please try again.")}finally{S(!1)}};(0,r.useEffect)(()=>{let e=e=>{var t,s;if(e.origin&&"https://app.boldsign.com"!==e.origin)return;let a=null===(t=e.data)||void 0===t?void 0:t.action;("onDocumentSigned"===a||(null===(s=e.data)||void 0===s?void 0:s.type)==="BoldSign"&&"onCompleted"===a)&&j&&R()};return window.addEventListener("message",e),()=>window.removeEventListener("message",e)},[j]),(0,r.useEffect)(()=>{let e;return j&&(null==m?void 0:m.email)&&(e=setInterval(async()=>{try{let e=await (0,l.uU)(m.email,l.sU,s),t=(0,l.dX)(e,l.sU);if(c(t)){let e=(0,l.hR)(t);(null==e?void 0:e.sign_link)&&C(e.sign_link),R()}}catch(e){console.error("Error polling W9 status:",e)}},15e3)),()=>{e&&clearInterval(e)}},[j,null==m?void 0:m.email]);let R=()=>{if(g){g();return}if(S(!0),w(!1),v(null),b("signed"),d.toast.success("W9 form signed successfully!"),!p){null==u||u(2);return}S(!1)};return E?(0,a.jsx)("div",{className:"max-w-2xl mx-auto px-4 py-16",children:(0,a.jsxs)("div",{className:"flex flex-col items-center gap-4",children:[(0,a.jsx)(i.Z,{show:!0,isFullScreen:!1}),(0,a.jsx)("p",{className:"text-sm text-gray-500",children:"Preparing your required W-9 form..."})]})}):F?(0,a.jsxs)("div",{className:"max-w-2xl mx-auto space-y-5 px-4 py-8",children:[(0,a.jsx)("h3",{className:"text-[20px] sm:text-[24px] text-[#F04E23] font-bold text-center",children:"Required W-9 Tax Form"}),(0,a.jsx)("div",{className:"bg-red-50 border border-red-200 rounded-xl p-4 text-center",children:(0,a.jsx)("p",{className:"text-sm text-red-800",children:F})}),(0,a.jsxs)("button",{onClick:()=>{Z.current=!1,P()},className:"w-full py-4 bg-[#F04E23] text-white rounded-xl hover:bg-[#d6390f] font-semibold flex items-center justify-center gap-2 transition-colors shadow-md hover:shadow-lg",children:[(0,a.jsx)(n.Z,{className:"w-5 h-5"}),"Retry"]})]}):"verifying"===f?(0,a.jsx)("p",{role:"status",className:"text-sm text-gray-600",children:"Verifying your completed tax forms…"}):"signed"===f?(0,a.jsxs)("div",{className:"max-w-2xl mx-auto space-y-4 px-4",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold text-center",children:"W9 Form Completed"}),(0,a.jsx)("div",{className:"border-2 border-green-300 bg-green-50 rounded-xl p-6",children:(0,a.jsxs)("div",{className:"flex items-center gap-4",children:[(0,a.jsx)("div",{className:"w-12 h-12 bg-green-100 rounded-full flex items-center justify-center flex-shrink-0",children:(0,a.jsx)(o.Z,{className:"w-8 h-8 text-green-500"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-semibold text-green-800",children:"W-9 Form Signed Successfully"}),(0,a.jsx)("p",{className:"text-sm text-green-600",children:p?"Your required W-9 is now on file. You do not need to upload any other documents from this link, and we will send a separate request if anything else is needed.":"Your required W-9 form has been completed and submitted."}),_&&(0,a.jsxs)("a",{href:_,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 mt-1 text-xs text-green-700 underline hover:text-green-900",children:[(0,a.jsx)(n.Z,{className:"w-3.5 h-3.5"}),"View signed W9 document"]})]})]})}),p?null:(0,a.jsx)("button",{onClick:()=>null==u?void 0:u(2),className:"w-full py-4 bg-[#F04E23] text-white rounded-xl hover:bg-[#d6390f] font-semibold flex items-center justify-center gap-2 transition-colors shadow-md hover:shadow-lg",children:"Continue to Document Upload"})]}
1):j&&y?(0,a.jsxs)("div",{className:"max-w-4xl mx-auto space-y-4 px-4",children:[(0,a.jsx)("h3",{className:"text-[20px] sm:text-[24px] text-[#F04E23] font-bold text-center",children:"Sign Your W-9"}),(0,a.jsx)("p",{className:"text-gray-600 text-center text-sm max-w-2xl mx-auto",children:"Please review and sign the W-9 form below. We keep this required tax document securely on file. Your employer will need it for tax reporting in order to process any settlement payment."}),(0,a.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 overflow-hidden shadow-sm",children:[(0,a.jsx)("div",{className:"p-4 bg-blue-50 border-b border-blue-100 flex justify-between items-center",children:(0,a.jsx)("p",{className:"text-sm text-blue-800",children:"Complete the required W-9 form below. We keep it securely on file for tax reporting."})}),(0,a.jsx)("iframe",{src:y,className:"w-full border-0",style:{height:"700px",minHeight:"500px"},title:"W9 Form Signing",allow:"camera; microphone"})]})]}):null}},71903:function(e,t,s){s.d(t,{E:function(){return r}});var a=s(2265);let r=()=>((0,a.useEffect)(()=>{s.e(9980).then(s.bind(s,27781)).then(e=>{e.GlobalWorkerOptions.workerSrc="https://cdn.jsdelivr.net/npm/[email protected]/build/pdf.worker.mjs"}).catch(e=>{console.error("Failed to load PDF.js:",e)})},[]),null)},41700:function(e,t,s){s.d(t,{N:function(){return o}});var a=s(33287),r=s(73509);let l="gpt-5-nano",i=e=>(e.model.includes("deep-research")&&(e.max_tool_calls=2),e),n=e=>{if("string"!=typeof e)return e;let t=e.trim();return(t=(t=(t=t.replace(/^```json\s*/i,"")).replace(/^```\s*/,"")).replace(/\s*```$/,"")).trim()},o=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1?arguments[1]:void 0,o=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("string"==typeof t&&t.startsWith("data:image/")&&t.includes("base64,")||o){let o={model:l,messages:[{role:"system",content:e},{role:"user",content:[{type:"text",text:"Please analyze this image and extract the information requested."},{type:"image_url",image_url:{url:t}}]}]};i(o);try{let e=await (0,a.ii)(o);if(e&&"string"==typeof e)return n(e)}catch(e){console.error("Error with model ".concat(l,":"),e)}try{let o=await (0,r.T)(t,{maxBytes:r.FY,timeoutMs:r.EQ}),d=await s.e(5525).then(s.t.bind(s,25525,23)),c=(await d.recognize(o,"eng")).data.text,m={model:l,messages:[{role:"system",content:e},{role:"user",content:"Document for context: ".concat(c)}]};i(m);let u=await (0,a.ii)(m),x=n(u);return"string"==typeof x?x:null}catch(e){return console.error("OCR fallback also failed:",e),null}}let d={model:"gpt-5-nano",messages:[{role:"system",content:e},{role:"user",content:"Document for context: ".concat(t)}]};i(d);try{let e=await (0,a.ii)(d),t=n(e);return"string"==typeof t?t:null}catch(e){return console.error("Error during GPT text request:",e),null}}}}]);

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.