1import{r as h,j as e}from"./vendor-BwygqmH8.js";import{s as w,i as Re}from"./index-BqHqKq3I.js";import{u as Ae,c as De}from"./LeadWatchPage-BKmR39dn.js";import{S as Te,P as Be}from"./SmartDocIntake-B6SVaPUf.js";import{c as Fe,a as Ne,d as Pe}from"./tcLmChecklists-Bhwr8ola.js";import{l as $e,N as Ee}from"./NextMoveBar-quBUEjpG.js";import{S as Je,a as qe,b as He,L as Ge}from"./SeatAgentSettings-Kg0YAngj.js";import{Y as P,C as q,ay as ve,aa as se,G as ie,H as ne,a4 as xe,au as me,bf as ae,ab as ue,bl as Oe,F as Ue,d7 as Ve,X as Ye,e3 as U,M as Ke,aN as he,T as Qe,aM as Xe,b6 as ye,ba as Ze,k as er,a_ as rr}from"./icons-B7bQwT6M.js";import"./monitoring-DqjV4dpj.js";import"./deps-D_AQaZss.js";import"./supabase-BM56svY1.js";import"./App-CwTlHduM.js";import"./Field-DQ05uNMW.js";import"./leadImportFields-_LlMDVd_.js";import"./seatActions-BAUuu1BG.js";function tr(f){return/\d/.test(String(f||""))}function ar(f){return(f||[]).filter(v=>(v.lmChecklist||[]).filter(y=>y.phase==="paperwork").some(y=>!y.done)).length}function nr(f){return(f||[]).filter(v=>(v.lmChecklist||[]).some(s=>s.id==="photos_delivered"&&!s.done)).length}function sr(f){return(f||[]).filter(v=>(v.lmChecklist||[]).some(s=>s.id==="mls_entered"&&!s.done)).length}function ir(f){return(f||[]).filter(v=>v.status==="active").length}function or(f){const v=new Map;for(const s of f||[])s.agentId&&!v.has(s.agentId)&&v.set(s.agentId,s.agentName||"Agent");const l=Array.from(v,([s,y])=>({id:s,name:y})).sort((s,y)=>s.name.localeCompare(y.name));return{agentMap:v,agents:l}}function lr(f,v,l){const s=l!=="all"&&!v.has(l)?"all":l,y=s==="all"?f||[]:(f||[]).filter(W=>W.agentId===s);return{safeAgentFilter:s,filtered:y}}function dr(f,v=new Date){const l=f||[],{done:s,total:y,overdue:W}=Fe(l,v),k=y>0?Math.round(s/y*100):0,I=l.filter(z=>z.phase==="paperwork"&&z.done).length,g=l.filter(z=>z.phase==="paperwork").length;return{done:s,total:y,pct:k,overdue:W,paperworkDone:I,paperworkTotal:g}}function cr({listings:f,onOpenListing:v}){const l=h.useMemo(()=>{if(!Array.isArray(f)||f.length===0)return[];const g=new Date;g.setHours(0,0,0,0);const z=864e5,A=[];for(const M of f){const _=Array.isArray(M.lmChecklist)?M.lmChecklist:[];for(const C of _){if(!C||C.done||!C.dueDate)continue;const H=new Date(String(C.dueDate).slice(0,10)+"T00:00:00");if(!Number.isFinite(H.getTime()))continue;const T=Math.round((H.getTime()-g.getTime())/z);T>7||A.push({listingId:M.id,address:M.address||"Unnamed listing",agentName:M.agentName||"Agent",itemId:C.id,itemLabel:C.label||C.id,phase:C.phase||"paperwork",dueDate:String(C.dueDate).slice(0,10),daysLeft:T})}}return A.sort((M,_)=>M.daysLeft-_.daysLeft),A.slice(0,12)},[f]);if(l.length===0)return null;const s=l.filter(g=>g.daysLeft<0),y=l.filter(g=>g.daysLeft===0),W=l.filter(g=>g.daysLeft>0&&g.daysLeft<=7),k=g=>g<0?`${Math.abs(g)}d overdue`:g===0?"Today":g===1?"Tomorrow":`in ${g}d`,I=g=>e.jsxs("button",{onClick:()=>v==null?void 0:v(g.listingId),style:{display:"grid",gridTemplateColumns:"1fr auto",gap:12,alignItems:"center",padding:"10px 14px",borderRadius:10,border:"1px solid rgba(var(--brand-rgb), .18)",background:"rgba(var(--brand-rgb), .05)",cursor:"pointer",textAlign:"left",color:"var(--text)"},onMouseEnter:z=>{z.currentTarget.style.background="rgba(var(--brand-rgb), .10)"},onMouseLeave:z=>{z.currentTarget.style.background="rgba(var(--brand-rgb), .05)"},children:[e.jsxs("div",{style:{minWidth:0},children:[e.jsx("div",{style:{fontSize:13,fontWeight:600,color:"var(--text)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:g.itemLabel}),e.jsxs("div",{style:{fontSize:11,color:"var(--muted)",marginTop:2,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:[g.address," · ",g.agentName]})]}),e.jsxs("div",{style:{textAlign:"right",flexShrink:0},children:[e.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:5,padding:"3px 10px",borderRadius:999,fontSize:10,fontWeight:800,letterSpacing:.3,background:g.daysLeft<0?"rgba(239,68,68,.12)":g.daysLeft===0?"rgba(var(--brand-rgb), .18)":"rgba(var(--brand-rgb), .08)",color:g.daysLeft<0?"#f87171":"var(--brand-secondary, var(--brand))",border:g.daysLeft<0?"1px solid rgba(239,68,68,.4)":"1px solid rgba(var(--brand-rgb), .3)",fontFamily:"'JetBrains Mono', monospace"},children:[g.daysLeft<0&&e.jsx(P,{size:10,strokeWidth:2.5}),k(g.daysLeft)]}
1),e.jsx("div",{style:{fontSize:10,color:"var(--muted)",marginTop:3,fontFamily:"'JetBrains Mono', monospace"},children:g.dueDate})]})]},`${g.listingId}-${g.itemId}`);return e.jsxs("div",{style:{padding:"18px 20px",borderRadius:14,background:"var(--surface)",border:"1px solid var(--b1)",boxShadow:"0 1px 0 rgba(255,255,255,.02) inset"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:14,flexWrap:"wrap"},children:[e.jsx("div",{style:{width:30,height:30,borderRadius:9,background:"rgba(var(--brand-rgb), .12)",border:"1px solid rgba(var(--brand-rgb), .3)",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx(P,{size:14,strokeWidth:2.2,style:{color:"var(--brand-secondary, var(--brand))"}})}),e.jsx("span",{className:"serif",style:{fontSize:18,fontWeight:600,color:"var(--text)"},children:"Imminent Deadlines"}),e.jsx("span",{style:{padding:"2px 9px",borderRadius:999,background:"rgba(var(--brand-rgb), .12)",border:"1px solid rgba(var(--brand-rgb), .3)",color:"var(--brand-secondary, var(--brand))",fontSize:10,fontWeight:800,letterSpacing:.4,fontFamily:"'JetBrains Mono', monospace"},children:l.length}),e.jsx("span",{style:{marginLeft:"auto",fontSize:11,color:"var(--muted)"},children:"across all listings · next 7 days"})]}),s.length>0&&e.jsxs("div",{style:{marginBottom:14},children:[e.jsxs("div",{style:{fontSize:10,fontWeight:800,letterSpacing:1.2,color:"#f87171",textTransform:"uppercase",marginBottom:6,fontFamily:"'JetBrains Mono', monospace"},children:["Overdue · ",s.length]}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:s.map(I)})]}),y.length>0&&e.jsxs("div",{style:{marginBottom:14},children:[e.jsxs("div",{style:{fontSize:10,fontWeight:800,letterSpacing:1.2,color:"var(--brand-secondary, var(--brand))",textTransform:"uppercase",marginBottom:6,fontFamily:"'JetBrains Mono', monospace"},children:["Today · ",y.length]}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:y.map(I)})]}),W.length>0&&e.jsxs("div",{children:[e.jsxs("div",{style:{fontSize:10,fontWeight:800,letterSpacing:1.2,color:"var(--muted)",textTransform:"uppercase",marginBottom:6,fontFamily:"'JetBrains Mono', monospace"},children:["Next 7 Days · ",W.length]}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:W.map(I)})]})]})}const fe=[{key:"paperwork",label:"Paperwork & Disclosures",shortLabel:"Paperwork",Icon:ve},{key:"property_prep",label:"Property Prep",shortLabel:"Prep",Icon:Ze},{key:"media",label:"Marketing & Media",shortLabel:"Media",Icon:se},{key:"mls",label:"MLS & Activation",shortLabel:"MLS",Icon:ie},{key:"launch",label:"Launch & Monitor",shortLabel:"Launch",Icon:ye}],D=[{key:"intake",label:"Intake",color:"#f59e0b",Icon:q,icon:""},{key:"disclosures",label:"Disclosures",color:"#ef4444",Icon:Ue,icon:""},{key:"property_prep",label:"Property Prep",color:"var(--brand-secondary, var(--brand))",Icon:Ve,icon:""},{key:"media",label:"Media",color:"var(--brand-secondary, var(--brand))",Icon:se,icon:""},{key:"mls_entry",label:"MLS Entry",color:"var(--brand)",Icon:ie,icon:""},{key:"active",label:"Active",color:"var(--brand)",Icon:ne,icon:""},{key:"monitoring",label:"Monitoring",color:"var(--brand-secondary, var(--brand))",Icon:me,icon:""}];function zr({onOpenListing:f,onMessageAgent:v}){var be;const{profile:l,user:s}=Ae(),[y,W]=h.useState(!0),[k,I]=h.useState([]),[g,z]=h.useState("all"),[A,M]=h.useState("board"),[_,C]=h.useState("board"),[H,T]=h.useState(null),[L,$]=h.useState(null),[B,V]=h.useState("intake"),[b,Y]=h.useState(null),[oe,le]=h.useState(!1),[de,K]=h.useState(""),[Q,ce]=h.useState(!1),[X,Z]=h.useState([]),[E,ee]=h.useState(""),[ke,ge]=h.useState(!1),{width:je,isResizing:pe,onMouseDown:Se}=De({storageKey:"rg_lm_panel_width",defaultWidth:520,min:420,max:1200});h.useEffect(()=>{if(!L){V("intake"),Y(null),K(""),Z([]),ee("");return}let t=!1;return w.from("listing_messages").select("id, sender_id, sender_role, body, kind, attachments, created_at").eq("listing_id",L).order("created_at",{ascending:!0}).limit(200).then(({data:o})=>{t||Z(o||[])}),()=>{t=!0}},[L]);const we=h.useCallback(async()=>
1{if(!L||!E.trim())return;const t=l==null?void 0:l.team_id;if(t){ge(!0);try{const{data:o,error:x}=await w.from("listing_messages").insert({listing_id:L,team_id:t,sender_id:s.id,sender_role:"lm",body:E.trim(),kind:"message"}).select("id, sender_id, sender_role, body, kind, attachments, created_at").single();if(x){alert(`Send failed: ${x.message}`);return}Z(a=>[...a,o]),ee("");const d=k.find(a=>a.id===L);d!=null&&d.user_id&&w.from("notifications").insert({user_id:d.user_id,type:"listing_message",title:"New message from your Listing Manager",body:E.trim().slice(0,120)}).then(()=>{})}finally{ge(!1)}}},[L,E,l==null?void 0:l.team_id,s==null?void 0:s.id,k]),re=h.useCallback(async t=>{le(!0),K(""),Y(null);try{const o=await Re("lm-intake-validator",{listing_id:t});Y(o)}catch(o){K((o==null?void 0:o.message)||"Intake check failed")}finally{le(!1)}},[]),G=h.useCallback(async(t,o)=>{var a;if(!(t!=null&&t.id)||(((a=t.milestones)==null?void 0:a.stage)||"intake")===o)return;const x={...t.milestones||{},stage:o};I(c=>c.map(r=>r.id===t.id?{...r,milestones:x}:r));const{error:d}=await w.from("listings").update({lm_milestones:x}).eq("id",t.id);d&&(I(c=>c.map(r=>r.id===t.id?{...r,milestones:t.milestones}:r)),alert(`Couldn't move listing: ${d.message}`))},[]),Ie=h.useCallback(async t=>{if(t!=null&&t.id&&window.confirm(`Move "${t.address||"this listing"}" to ACTIVE? 2 3This will trigger MLS entry and marketing assignment.`)){ce(!0);try{const{error:o}=await w.from("listings").update({status:"active"}).eq("id",t.id);if(o)throw o;I(x=>x.map(d=>d.id===t.id?{...d,status:"active"}:d)),G(t,"active"),$(null)}catch(o){alert(`Failed to go active: ${(o==null?void 0:o.message)||o}`)}finally{ce(!1)}}},[G]),ze=h.useCallback(async(t,o)=>{let x=null;if(I(d=>d.map(a=>{if(a.id!==t)return a;const c=(a.lmChecklist||[]).map(r=>r.id===o?{...r,done:!r.done}:r);return x=c,{...a,lmChecklist:c}})),x){const{error:d}=await w.from("listings").update({lm_checklist:x}).eq("id",t);d&&alert(`Save failed: ${d.message}`)}},[]),Ce=h.useCallback(async(t,o,x)=>{let d=null;I(a=>a.map(c=>{if(c.id!==t)return c;const r=(c.lmChecklist||[]).map(i=>i.id===o?{...i,dueDate:x}:i);return d=r,{...c,lmChecklist:r}})),d&&await w.from("listings").update({lm_checklist:d}).eq("id",t)},[]),We=h.useCallback(async(t,o,x)=>{let d=null;I(a=>a.map(c=>{if(c.id!==t)return c;const r=(c.lmChecklist||[]).map(i=>i.id===o?{...i,notes:x}:i);return d=r,{...c,lmChecklist:r}})),d&&await w.from("listings").update({lm_checklist:d}).eq("id",t)},[]),te=h.useCallback(async()=>{if(!(s!=null&&s.id)){W(!1);return}W(!0);try{let t=(l==null?void 0:l.team_id)||null,o=null;if(t){const{data:n}=await w.from("teams").select("created_by").eq("id",t).maybeSingle();o=(n==null?void 0:n.created_by)||null}else{const{data:n}=await w.from("teams").select("id, created_by").eq("created_by",s.id).order("created_at",{ascending:!0}).limit(1).maybeSingle();t=(n==null?void 0:n.id)||null,o=(n==null?void 0:n.created_by)||null}let x=[s.id];if(o&&x.push(o),t){const{data:n}=await w.from("profiles").select("id").eq("team_id",t);n!=null&&n.length&&(x=[...new Set([...x,...n.map(S=>S.id)])])}x=[...new Set(x)];const d="id, user_id, address, price, type, status, lead_id, team_id, lm_checklist, lm_milestones, cover_photo, created_at",a=["coming_soon","active","pending"],[c,r]=await Promise.all([t?w.from("listings").select(d).eq("team_id",t).in("status",a).order("created_at",{ascending:!1}).limit(200):Promise.resolve({data:[]}),x.length>0?w.from("listings").select(d).in("user_id",x).in("status",a).order("created_at",{ascending:!1}).limit(200):Promise.resolve({data:[]})]),i=new Map;for(const n of[...(c==null?void 0:c.data)||[],...(r==null?void 0:r.data)||[]])n!=null&&n.id&&i.set(n.id,n);const m=Array.from(i.values()).filter(n=>String(n.type||"").toLowerCase()!=="buyer").filter(n=>tr(n.address)).sort((n,S)=>String(S.created_at||"").localeCompare(String(n.created_at||""))),u=[...new Set(m.map(n=>n.user_id).filter(Boolean))];let p={};if(u.length>0){const{data:n}=await w.from("profiles").select("id, full_name, email").in("id",u);for(const S of n||[])p[S.id]={name:S.full_name||S.email||"Agent",email:S.email}}const j=m.map(n=>{var R;let S=Array.isArray(n.lm_checklist)?n.lm_checklist:null;return Ne(S)||(S=Pe(),w.from("listings").update({lm_checklist:S}).eq("id",n.id).then(()=>{},()=>{})),{id:n.id,address:n.address||"",price:n.price||"",status:n.status,coverPhoto:n.cover_photo||null,agentName:((R=p[n.user_id])==null?void 0:R.name)||"Agent",agentId:n.user_id,lmChecklist:S,milestones:n.lm_milestones||{}}});I(j)}catch(t){console.warn("[lm center] load failed:",t==null?void 0:t.message)}W(!1)},[s==null?void 0:s.id,l==null?void 0:l.team_id]);if(h.useEffect(()=>{te()},[te]),y)return e.jsx("div",{style:{padding:40,textAlign:"center",color:"var(--muted)"},children:"Loading Listing Manager Command Centerâ¦"});const F=ar(k),N=nr(k),O=sr(k),_e=ir(k),J=F+N,Me=((be=l==null?void 0:l.full_name)==null?void 0:be.split(" ")[0])||"Manager",Le=[{key:"pipeline",label:"In Pipeline",value:k.length,Icon:q,sub:"all listing stages"},{key:"disclosures",label:"Disclosures Pending",value:F,Icon:ve,sub:"SPDS, lead paint, agency",urgent:F>0},{key:"photos",label:"Photos Needed",value:N,Icon:se,sub:"awaiting delivery",urgent:N>0},{key:"mls",label:"MLS Entries Due",value:O,Icon:ie,sub:"not yet entered"},{key:"active",label:"Active & Live",value:_e,Icon:ne,sub:"on market now"}];return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:22},children:[e.jsx(Te,{deals:k,teamId:l==null?void 0:l.team_id,seat:"lm"}),e.jsx("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[{v:"board",label:"Board",Icon:q},{v:"queue",label:"Agent Queue",Icon:xe},{v:"activity",label:"Activity",Icon:me},{v:"settings",label:"Agent Settings",Icon:ae}].map(t=>e.jsxs("button",{onClick:()=>C(t.v),style:{display:"inline-flex",alignItems:"center",gap:6,padding:"8px 14px",borderRadius:10,border:_===t.v?"1px solid rgba(var(--brand-rgb), .4)":"1px solid var(--b1)",background:_===t.v?"rgba(var(--brand-rgb), .12)":"var(--surface)",color:_===t.v?"var(--brand-secondary, var(--brand))":"var(--muted)",fontSize:12,fontWeight:700,cursor:"pointer"},children:[e.jsx(t.Icon,{size:13,strokeWidth:2.2})," ",t.label]},t.v))}),_==="queue"&&e.jsx(Je,{seat:"lm",onOpenListing:t=>{C("board"),$(t)}}),_==="activity"&&e.jsx(qe,{seat:"lm"}),_==="settings"&&e.jsx(He,{seat:"lm"}),_==="board"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{position:"relative",padding:"28px 30px 24px",borderRadius:20,overflow:"hidden",background:"linear-gradient(135deg, rgba(var(--brand-rgb), .18), rgba(var(--brand-rgb),.08) 55%, var(--surface))",border:"1px solid rgba(var(--brand-rgb), .22)",boxShadow:"0 1px 0 rgba(255,255,255,.04) inset, 0 20px 60px -30px rgba(var(--brand-rgb), .45)"},children:[e.jsx("div",{"aria-hidden":!0,style:{position:"absolute",inset:0,pointerEvents:"none",backgroundImage:"linear-gradient(rgba(var(--brand-rgb), .05) 1px, transparent 1px), linear-gradient(90deg, rgba(var(--brand-rgb), .05) 1px, transparent 1px)",backgroundSize:"32px 32px",maskImage:"radial-gradient(ellipse 60% 80% at 85% 0%, rgba(0,0,0,.6), transparent 70%)"}}),e.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"flex-end",gap:14,marginBottom:22,flexWrap:"wrap"},children:[e.jsxs("div",{children:[e.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:8,marginBottom:10,padding:"5px 12px",borderRadius:999,background:"rgba(var(--brand-rgb), .12)",border:"1px solid rgba(var(--brand-rgb), .3)",fontSize:10,fontWeight:800,letterSpacing:2,color:"var(--brand-secondary, var(--brand))",fontFamily:"'JetBrains Mono',monospace"},children:[e.jsx(q,{size:11,strokeWidth:2.5})," LISTING MANAGER COMMAND CENTER"]}),e.jsxs("div",{className:"serif",style:{fontSize:36,fontWeight:700,color:"var(--text)",letterSpacing:"-.02em",lineHeight:1.05,marginBottom:6},children:["Welcome back, ",Me,e.jsx("span",{style:{color:"var(--brand-secondary, var(--brand))"},children:"."})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,fontSize:12,color:"var(--muted)",flexWrap:"wrap"},children:[e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5},children:[e.jsx(ue,{size:12,strokeWidth:2}),new Date().toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric"})]}),J>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{color:"var(--b2)"},children:"·"}),e.jsxs("span",{style:{color:"var(--brand-secondary, var(--brand))",fontWeight:700,display:"inline-flex",alignItems:"center",gap:5},children:[e.jsx(P,{size:12,strokeWidth:2.5}),J," item",J===1?"":"s"," need",J===1?"s":""," attention"]})]})]})]}),e.jsx("span",{style:{flex:1}}),e.jsxs("button",{onClick:te,style:{padding:"9px 16px",borderRadius:10,border:"1px solid rgba(var(--brand-rgb), .35)",background:"rgba(var(--brand-rgb), .1)",color:"var(--brand-secondary, var(--brand))",fontSize:12,fontWeight:700,cursor:"pointer",display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(Oe,{size:12,strokeWidth:2.5})," Refresh"]})]}),e.jsx("div",{style:{position:"relative",display:"grid",gridTemplateColumns:"repeat(auto-fit,minmax(180px,1fr))",gap:10},children:Le.map(t=>e.jsxs("div",{style:{position:"relative",padding:"14px 16px",borderRadius:12,background:"rgba(15,23,42,.25)",border:t.urgent?"1px solid rgba(var(--brand-rgb), .4)":"1px solid rgba(var(--brand-rgb), .15)",backdropFilter:"blur(6px)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:6},children:[e.jsx(t.Icon,{size:12,strokeWidth:2.2,style:{color:t.urgent?"var(--brand-secondary, var(--brand))":"var(--muted)"}}),e.jsx("span",{style:{fontSize:10,fontWeight:700,letterSpacing:.8,color:"var(--muted)",textTransform:"uppercase"},children:t.label}),t.urgent&&e.jsx("span",{style:{marginLeft:"auto",width:6,height:6,borderRadius:999,background:"var(--brand-secondary, var(--brand))",boxShadow:"0 0 0 4px rgba(var(--brand-rgb), .2)"}})]}),e.jsx("div",{style:{fontFamily:"'JetBrains Mono',monospace",fontSize:28,fontWeight:800,color:t.urgent?"var(--brand-secondary, var(--brand))":"var(--text)",lineHeight:1,marginBottom:4},children:t.value}
3),e.jsx("div",{style:{fontSize:10,color:"var(--muted)",lineHeight:1.3},children:t.sub})]},t.key))}),J>0&&e.jsxs("div",{style:{position:"relative",marginTop:14,padding:"11px 14px",borderRadius:10,background:"rgba(var(--brand-rgb), .08)",border:"1px solid rgba(var(--brand-rgb), .25)",display:"flex",alignItems:"center",gap:10,flexWrap:"wrap",fontSize:12},children:[e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,color:"var(--brand-secondary, var(--brand))",fontWeight:800,letterSpacing:.3},children:[e.jsx(xe,{size:13,strokeWidth:2.5})," TODAY'S PRIORITIES"]}),F>0&&e.jsxs("span",{style:{color:"var(--text)"},children:[e.jsx("strong",{children:F})," listing",F===1?"":"s"," with incomplete disclosures"]}),N>0&&e.jsxs("span",{style:{color:"var(--text)"},children:[e.jsx("strong",{children:N})," listing",N===1?"":"s"," awaiting photography"]}),O>0&&e.jsxs("span",{style:{color:"var(--text)"},children:[e.jsx("strong",{children:O})," listing",O===1?"":"s"," need MLS entry"]})]})]}),e.jsx(cr,{listings:k,onOpenListing:f}),k.length>0&&(()=>{const{agentMap:t,agents:o}=or(k),{safeAgentFilter:x,filtered:d}=lr(k,t,g);return e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:14,flexWrap:"wrap"},children:[e.jsx("div",{style:{width:34,height:34,borderRadius:10,background:"rgba(var(--brand-rgb), .12)",border:"1px solid rgba(var(--brand-rgb), .3)",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx(ne,{size:16,strokeWidth:2.2,style:{color:"var(--brand-secondary, var(--brand))"}})}),e.jsx("span",{className:"serif",style:{fontSize:20,color:"var(--text)",fontWeight:600},children:"Listing Pipeline"}),e.jsx("span",{style:{padding:"3px 10px",borderRadius:999,background:"rgba(var(--brand-rgb), .12)",border:"1px solid rgba(var(--brand-rgb), .3)",color:"var(--brand-secondary, var(--brand))",fontSize:11,fontWeight:700,letterSpacing:.4},children:d.length}),e.jsx("span",{style:{flex:1}}),o.length>0&&e.jsxs("select",{value:x,onChange:a=>z(a.target.value),title:"Filter by agent",style:{padding:"7px 12px",borderRadius:10,background:"var(--bg)",border:"1px solid var(--b1)",color:"var(--text)",fontSize:12,fontWeight:600,letterSpacing:.2,fontFamily:"Poppins,sans-serif",cursor:"pointer"},children:[e.jsxs("option",{value:"all",children:["All Agents (",k.length,")"]}),o.map(a=>e.jsxs("option",{value:a.id,children:[a.name," (",k.filter(c=>c.agentId===a.id).length,")"]},a.id))]}),e.jsx("div",{style:{display:"inline-flex",padding:3,borderRadius:10,background:"var(--bg)",border:"1px solid var(--b1)",gap:2},children:[{v:"board",l:"⦠Board"},{v:"list",l:"ⰠList"}].map(a=>e.jsx("button",{onClick:()=>M(a.v),style:{padding:"7px 12px",borderRadius:8,border:"none",cursor:"pointer",fontSize:12,fontWeight:700,letterSpacing:.2,background:A===a.v?"linear-gradient(135deg,var(--brand-secondary, var(--brand)),var(--brand-secondary, var(--brand)))":"transparent",color:A===a.v?"#fff":"var(--muted)",boxShadow:A===a.v?"0 2px 8px -2px rgba(var(--brand-rgb), .4)":"none",transition:"all .15s",fontFamily:"Poppins,sans-serif"},children:a.l},a.v))})]}),d.length===0?e.jsx("div",{style:{padding:30,textAlign:"center",background:"var(--bg)",borderRadius:12,border:"1px dashed var(--b1)",color:"var(--muted)",fontSize:13},children:"No listings in the pipeline right now."}):A==="board"?e.jsx("div",{style:{display:"grid",gridTemplateColumns:`repeat(${D.length}, minmax(220px, 1fr))`,gap:10,overflowX:"auto",paddingBottom:8},children:D.map(a=>{const c=d.filter(r=>{var i;return(((i=r.milestones)==null?void 0:i.stage)||"intake")===a.key});return e.jsxs("div",{onDragOver:r=>{r.preventDefault(),r.dataTransfer.dropEffect="move"},onDrop:r=>{r.preventDefault();const i=r.dataTransfer.getData("text/plain")||H,m=d.find(u=>u.id===i);m&&G(m,a.key),T(null)},style:{background:"var(--bg)",border:"1px solid var(--b1)",borderRadius:10,borderTop:`2.5px solid ${a.color}`,display:"flex",flexDirection:"column",minHeight:260},children:[e.jsxs("div",{style:{padding:"10px 12px",borderBottom:"1px solid var(--b1)",display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{style:{display:"inline-flex",color:a.color},children:a.Icon?e.jsx(a.Icon,{size:13,strokeWidth:2.2}):e.jsx("span",{style:{fontSize:13},children:a.icon})}),e.jsx("span",{style:{fontSize:11,fontWeight:700,color:"var(--text)",letterSpacing:.3,flex:1},children:a.label}),e.jsx("span",{style:{fontSize:10,fontFamily:"'JetBrains Mono',monospace",fontWeight:700,color:a.color,padding:"2px 7px",borderRadius:999,background:`${a.color}1a`,border:`1px solid ${a.color}40`},children:c.length})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,padding:10,flex:1}
3,children:[c.length===0&&e.jsx("div",{style:{fontSize:10,color:"var(--dim)",textAlign:"center",padding:"18px 6px",fontStyle:"italic"},children:"Drop here"}),c.map(r=>{const i=r.lmChecklist||[],{done:m,total:u,pct:p,overdue:j,paperworkDone:n,paperworkTotal:S}=dr(i);return e.jsxs("div",{draggable:!0,onDragStart:R=>{T(r.id),R.dataTransfer.setData("text/plain",r.id),R.dataTransfer.effectAllowed="move"},onDragEnd:()=>T(null),onClick:()=>$(r.id),style:{padding:"10px 12px",borderRadius:8,background:"var(--surface)",border:j>0?"1px solid rgba(239,68,68,.3)":"1px solid var(--b2)",cursor:"grab",transition:"transform .1s, border-color .15s"},onMouseEnter:R=>{R.currentTarget.style.transform="translateY(-1px)"},onMouseLeave:R=>{R.currentTarget.style.transform="translateY(0)"},children:[r.coverPhoto&&e.jsx("div",{style:{width:"100%",height:80,borderRadius:6,marginBottom:8,backgroundImage:`url(${r.coverPhoto})`,backgroundSize:"cover",backgroundPosition:"center",border:"1px solid var(--b1)"}}),e.jsx("div",{style:{fontSize:12,fontWeight:600,color:"var(--text)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginBottom:3},children:r.address||"Untitled listing"}),e.jsxs("div",{style:{fontSize:10,color:"var(--muted)",marginBottom:7,display:"flex",alignItems:"center",gap:5,flexWrap:"wrap"},children:[e.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"60%"},children:r.agentName}),r.price&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{color:"var(--b2)"},children:"·"}),e.jsxs("span",{style:{fontFamily:"'JetBrains Mono',monospace",color:"var(--text)",fontWeight:600},children:["$",Number(String(r.price).replace(/[^0-9.]/g,"")).toLocaleString()]})]})]}),e.jsx("div",{style:{height:4,background:"var(--b1)",borderRadius:999,overflow:"hidden",marginBottom:6},children:e.jsx("div",{style:{height:"100%",width:`${p}%`,background:a.color,transition:"width .3s"}})}),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",fontSize:9,color:"var(--muted)",fontFamily:"'JetBrains Mono',monospace"},children:[e.jsxs("span",{children:[m,"/",u," · ",p,"%"]}),e.jsx("span",{style:{color:n<S?"#f59e0b":"var(--brand)",fontWeight:700},children:n<S?`${S-n} disclosures`:"docs complete"}),j>0&&e.jsxs("span",{style:{color:"#ef4444",fontWeight:700},children:[j," overdue"]})]})]},r.id)})]})]},a.key)})}):e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:d.map(a=>{const c=a.lmChecklist||[],r=c.filter(p=>p.done).length,i=c.length,m=i>0?Math.round(r/i*100):0,u=D.find(p=>{var j;return p.key===(((j=a.milestones)==null?void 0:j.stage)||"intake")})||D[0];return e.jsxs("button",{onClick:()=>$(a.id),style:{display:"grid",gridTemplateColumns:"auto 1fr auto auto",gap:14,alignItems:"center",padding:"12px 16px",borderRadius:10,background:"var(--surface)",border:"1px solid var(--b1)",cursor:"pointer",textAlign:"left",color:"var(--text)"},onMouseEnter:p=>{p.currentTarget.style.borderColor="rgba(var(--brand-rgb), .4)"},onMouseLeave:p=>{p.currentTarget.style.borderColor="var(--b1)"},children:[e.jsxs("div",{style:{padding:"4px 10px",borderRadius:999,fontSize:9,fontWeight:800,background:`${u.color}1a`,color:u.color,border:`1px solid ${u.color}40`,whiteSpace:"nowrap",display:"inline-flex",alignItems:"center",gap:5},children:[u.Icon?e.jsx(u.Icon,{size:10,strokeWidth:2.4}):null,u.label]}),e.jsxs("div",{style:{minWidth:0},children:[e.jsx("div",{style:{fontSize:13,fontWeight:600,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:a.address||"Untitled listing"}),e.jsxs("div",{style:{fontSize:11,color:"var(--muted)",marginTop:1},children:[a.agentName," ",a.price?`· $${Number(String(a.price).replace(/[^0-9.]/g,"")).toLocaleString()}`:""]})]}),e.jsxs("div",{style:{width:80},children:[e.jsx("div",{style:{height:4,background:"var(--b1)",borderRadius:999,overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",width:`${m}%`,background:u.color}})}),e.jsxs("div",{style:{fontSize:9,color:"var(--muted)",textAlign:"center",marginTop:3,fontFamily:"'JetBrains Mono',monospace"},children:[m,"%"]})]}
3),e.jsxs("div",{style:{fontSize:10,color:"var(--muted)"},children:[r,"/",i]})]},a.id)})})]})})(),k.length===0&&!y&&e.jsx("div",{style:{padding:40,textAlign:"center",color:"var(--muted)",fontSize:13},children:"No listings assigned yet. Team owners can assign listings from the Deals view."}),L&&(()=>{const t=k.find(r=>r.id===L);if(!t)return null;const o=t.lmChecklist||[],x=o.filter(r=>r.done).length,d=o.length,a=d>0?Math.round(x/d*100):0,c=D.find(r=>{var i;return r.key===(((i=t.milestones)==null?void 0:i.stage)||"intake")})||D[0];return e.jsxs("div",{style:{position:"fixed",top:0,right:0,width:`min(${je}px, 100vw)`,height:"100vh",background:"var(--bg)",borderLeft:"1px solid var(--b1)",boxShadow:"-8px 0 40px rgba(0,0,0,.3)",zIndex:1e3,display:"flex",flexDirection:"column",animation:pe?"none":"slideInRight .2s ease-out"},children:[e.jsx(Be,{isResizing:pe,onMouseDown:Se,accent:"var(--gold)"}),e.jsxs("div",{style:{padding:"16px 20px",borderBottom:"1px solid var(--b1)",background:"linear-gradient(135deg, rgba(var(--brand-rgb), .08), var(--surface))"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:10},children:[e.jsx("button",{onClick:()=>$(null),style:{width:30,height:30,borderRadius:8,border:"1px solid var(--b1)",background:"var(--bg)",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text)"},children:e.jsx(Ye,{size:14,strokeWidth:2.5})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontSize:15,fontWeight:700,color:"var(--text)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t.address||"Untitled listing"}),e.jsxs("div",{style:{fontSize:11,color:"var(--muted)",marginTop:2},children:[t.agentName," ",t.price?`· $${Number(String(t.price).replace(/[^0-9.]/g,"")).toLocaleString()}`:""]})]}),e.jsxs("div",{style:{padding:"4px 10px",borderRadius:999,fontSize:9,fontWeight:800,background:`${c.color}1a`,color:c.color,border:`1px solid ${c.color}40`,display:"inline-flex",alignItems:"center",gap:5},children:[c.Icon?e.jsx(c.Icon,{size:10,strokeWidth:2.4}):null,c.label]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsx("div",{style:{flex:1,height:6,background:"var(--b1)",borderRadius:999,overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",width:`${a}%`,background:"var(--brand-secondary, var(--brand))",transition:"width .3s",borderRadius:999}})}),e.jsxs("span",{style:{fontSize:11,fontWeight:800,fontFamily:"'JetBrains Mono',monospace",color:"var(--brand-secondary, var(--brand))",minWidth:40,textAlign:"right"},children:[a,"%"]})]}),e.jsx("div",{style:{display:"flex",gap:4,marginTop:10,flexWrap:"wrap"},children:D.map(r=>{var i,m;return e.jsxs("button",{onClick:()=>G(t,r.key),style:{padding:"4px 10px",borderRadius:999,border:"none",cursor:"pointer",fontSize:9,fontWeight:700,background:(((i=t.milestones)==null?void 0:i.stage)||"intake")===r.key?r.color:"var(--bg)",color:(((m=t.milestones)==null?void 0:m.stage)||"intake")===r.key?"#fff":"var(--muted)",transition:"all .15s",display:"inline-flex",alignItems:"center",gap:4},children:[r.Icon?e.jsx(r.Icon,{size:10,strokeWidth:2.4}):null,r.label]},r.key)})})]}),(()=>{const r=$e(t,{onSwitchTab:V});return e.jsx(Ee,{accent:"var(--brand-secondary, var(--brand))",...r,onAction:r.action})})(),e.jsx("div",{style:{display:"flex",borderBottom:"1px solid var(--b1)",padding:"0 20px"},children:[{key:"intake",label:"Intake",Icon:ae},{key:"checklist",label:"Checklist",Icon:U},{key:"deadlines",label:"Deadlines",Icon:ue},{key:"messages",label:`Messages${X.length?` (${X.length})`:""}`,Icon:Ke}].map(r=>e.jsxs("button",{onClick:()=>V(r.key),style:{padding:"10px 16px",border:"none",cursor:"pointer",fontSize:12,fontWeight:700,background:"transparent",color:B===r.key?"var(--brand-secondary, var(--brand))":"var(--muted)",borderBottom:B===r.key?"2px solid var(--brand-secondary, var(--brand))":"2px solid transparent",display:"flex",alignItems:"center",gap:6},children:[e.jsx(r.Icon,{size:13,strokeWidth:2}),r.label]},r.key))}),e.jsxs("div",{style:{flex:1,overflow:"auto",padding:"16px 20px"},children:[B==="intake"&&e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[!b&&!oe&&e.jsxs("button",{onClick:()=>re(t.id),style:{width:"100%",padding:"14px 20px",borderRadius:10,border:"1px solid rgba(var(--brand-rgb), .3)",cursor:"pointer",background:"linear-gradient(135deg, rgba(var(--brand-rgb), .1), rgba(var(--brand-rgb), .05))",color:"var(--brand-secondary, var(--brand))",fontWeight:700,fontSize:13,display:"flex",alignItems:"center",justifyContent:"center",gap:8,transition:"all .15s"},onMouseEnter:r=>{r.currentTarget.style.background="linear-gradient(135deg, rgba(var(--brand-rgb), .18), rgba(var(--brand-rgb), .1))"},onMouseLeave:r=>{r.currentTarget.style.background="linear-gradient(135deg, rgba(var(--brand-rgb), .1), rgba(var(--brand-rgb), .05))"},children:[e.jsx(ae,{size:16,strokeWidth:2.2}),"Run Intake Check"]}),oe&&e.jsxs("div",{style:{padding:"40px 20px",textAlign:"center",color:"var(--muted)",fontSize:13,display:"flex",flexDirection:"column",alignItems:"center",gap:12},children:[e.jsx(he,{size:24,strokeWidth:2,className:"mmp-spin",style:{color:"var(--brand-secondary, var(--brand))"}}),"Validating listing readiness..."]}),de&&e.jsxs("div",{style:{padding:"14px",borderRadius:10,background:"rgba(239,68,68,.08)",border:"1px solid rgba(239,68,68,.2)",color:"#ef4444",fontSize:12,display:"flex",alignItems:"center",gap:8},children:[e.jsx(P,{size:14,strokeWidth:2.2}),de,e.jsx("button",{onClick:()=>re(t.id),style:{marginLeft:"auto",background:"none",border:"none",color:"#ef4444",cursor:"pointer",fontSize:11,fontWeight:700,textDecoration:"underline"},children:"Retry"})]}),b&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{padding:"16px",borderRadius:12,background:b.overall==="pass"?"rgba(var(--brand-rgb),.08)":b.overall==="warn"?"rgba(245,158,11,.08)":"rgba(239,68,68,.08)",border:`1px solid ${b.overall==="pass"?"rgba(var(--brand-rgb),.25)":b.overall==="warn"?"rgba(245,158,11,.25)":"rgba(239,68,68,.25)"}`,display:"flex",alignItems:"center",gap:14},children:[e.jsxs("div",{style:{width:48,height:48,borderRadius:12,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:900,fontSize:18,fontFamily:"'JetBrains Mono',monospace",background:b.overall==="pass"?"rgba(var(--brand-rgb),.15)":b.overall==="warn"?"rgba(245,158,11,.15)":"rgba(239,68,68,.15)",color:b.overall==="pass"?"var(--brand)":b.overall==="warn"?"#f59e0b":"#ef4444"},children:[b.score,"%"]}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:14,fontWeight:700,color:b.overall==="pass"?"var(--brand)":b.overall==="warn"?"#f59e0b":"#ef4444"},children:b.overall==="pass"?"Ready to Go Active":b.overall==="warn"?"Almost Ready â Minor Issues":"Not Ready â Action Required"}),e.jsxs("div",{style:{fontSize:11,color:"var(--muted)",marginTop:2},children:[b.checks.filter(r=>r.status==="pass").length," passed",b.checks.filter(r=>r.status==="warn").length>0&&` · ${b.checks.filter(r=>r.status==="warn").length} warnings`,b.checks.filter(r=>r.status==="fail").length>0&&` · ${b.checks.filter(r=>r.status==="fail").length} failed`]})]})]}),e.jsxs("div",{style:{padding:"12px 14px",borderRadius:10,background:"var(--surface)",border:"1px solid var(--b1)",display:"flex",alignItems:"center",gap:10},children:[e.jsx(q,{size:14,strokeWidth:2.2,style:{color:"var(--brand-secondary, var(--brand))"}}),e.jsx("span",{style:{fontSize:12,color:"var(--text)",flex:1},children:"LM Checklist"}),e.jsx("div",{style:{width:60,height:5,background:"var(--b1)",borderRadius:999,overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",width:`${b.checklist_progress.pct}%`,background:"var(--brand-secondary, var(--brand))",borderRadius:999,transition:"width .3s"}})}),e.jsxs("span",{style:{fontSize:10,fontWeight:800,fontFamily:"'JetBrains Mono',monospace",color:"var(--brand-secondary, var(--brand))",minWidth:36,textAlign:"right"},children:[b.checklist_progress.done,"/",b.checklist_progress.total]})]}),e.jsx("div",{style:{borderRadius:12,border:"1px solid var(--b1)",background:"var(--surface)",overflow:"hidden"},children:b.checks.map((r,i)=>e.jsxs("div",{style:{padding:"12px 14px",display:"flex",alignItems:"flex-start",ga
3p:10,borderBottom:i<b.checks.length-1?"1px solid var(--b1)":"none",background:r.status==="fail"?"rgba(239,68,68,.03)":"transparent"},children:[e.jsxs("div",{style:{marginTop:1,flexShrink:0},children:[r.status==="pass"&&e.jsx(U,{size:15,strokeWidth:2.2,style:{color:"var(--brand)"}}),r.status==="warn"&&e.jsx(Qe,{size:15,strokeWidth:2.2,style:{color:"#f59e0b"}}),r.status==="fail"&&e.jsx(P,{size:15,strokeWidth:2.2,style:{color:"#ef4444"}})]}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontSize:12,fontWeight:600,color:"var(--text)"},children:r.label}),e.jsx("div",{style:{fontSize:11,color:"var(--muted)",marginTop:2,lineHeight:1.4},children:r.detail})]})]},r.id))}),e.jsxs("div",{style:{display:"flex",gap:8,marginTop:4},children:[e.jsxs("button",{onClick:()=>re(t.id),style:{flex:1,padding:"10px 16px",borderRadius:8,border:"1px solid var(--b1)",background:"var(--surface)",color:"var(--text)",fontSize:12,fontWeight:600,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",gap:6},children:[e.jsx(Xe,{size:13,strokeWidth:2.2}),"Re-run Check"]}),e.jsx("button",{onClick:()=>Ie(t),disabled:!b.ready_to_go_active||Q,style:{flex:2,padding:"10px 16px",borderRadius:8,border:"none",background:b.ready_to_go_active?"linear-gradient(135deg, var(--brand), var(--brand-secondary, var(--brand)))":"var(--b1)",color:b.ready_to_go_active?"#fff":"var(--muted)",fontSize:12,fontWeight:700,cursor:b.ready_to_go_active?"pointer":"not-allowed",display:"flex",alignItems:"center",justifyContent:"center",gap:6,opacity:Q?.6:1},children:Q?e.jsxs(e.Fragment,{children:[e.jsx(he,{size:13,strokeWidth:2.2,className:"mmp-spin"})," Going Active..."]}):e.jsxs(e.Fragment,{children:[e.jsx(ye,{size:13,strokeWidth:2.2})," Approve & Go Active"]})})]}),!b.ready_to_go_active&&e.jsxs("div",{style:{padding:"10px 14px",borderRadius:8,background:"rgba(239,68,68,.06)",border:"1px solid rgba(239,68,68,.15)",fontSize:11,color:"#ef4444",display:"flex",alignItems:"center",gap:8},children:[e.jsx(P,{size:13,strokeWidth:2.2}),"Fix all failed checks before going active"]})]})]}),B==="checklist"&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:16},children:fe.map(r=>{const i=o.filter(p=>p.phase===r.key);if(i.length===0)return null;const m=i.filter(p=>p.done).length,u=Math.round(m/i.length*100);return e.jsxs("div",{style:{borderRadius:12,border:"1px solid var(--b1)",background:"var(--surface)",overflow:"hidden"},children:[e.jsxs("div",{style:{padding:"10px 14px",borderBottom:"1px solid var(--b1)",display:"flex",alignItems:"center",gap:8,background:u===100?"rgba(var(--brand-rgb),.06)":"transparent"},children:[e.jsx(r.Icon,{size:14,strokeWidth:2.2,style:{color:u===100?"var(--brand)":"var(--brand-secondary, var(--brand))"}}),e.jsx("span",{style:{fontSize:12,fontWeight:700,color:"var(--text)",flex:1},children:r.label}),e.jsxs("span",{style:{fontSize:10,fontWeight:800,fontFamily:"'JetBrains Mono',monospace",color:u===100?"var(--brand)":"var(--brand-secondary, var(--brand))"},children:[m,"/",i.length]}),u===100&&e.jsx(U,{size:14,strokeWidth:2.5,style:{color:"var(--brand)"}})]}),e.jsx("div",{style:{padding:"6px 8px"},children:i.map(p=>e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:8,padding:"8px 6px",borderRadius:6,opacity:p.done?.6:1},onMouseEnter:j=>{j.currentTarget.style.background="rgba(var(--brand-rgb), .04)"},onMouseLeave:j=>{j.currentTarget.style.background="transparent"},children:[e.jsx("button",{onClick:()=>ze(t.id,p.id),style:{width:18,height:18,borderRadius:4,flexShrink:0,border:p.done?"1.5px solid var(--brand)":"1.5px solid var(--b2)",background:p.done?"rgba(var(--brand-rgb),.15)":"transparent",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",marginTop:1},children:p.done&&e.jsx(er,{size:11,strokeWidth:3,style:{color:"var(--brand)"}})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontSize:12,color:"var(--text)",lineHeight:1.4,textDecoration:p.done?"line-through":"none"},children:p.label}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginTop:4},children:[e.jsx("input",{type:"date",value:p.dueDate||"",onChange:j=>
3Ce(t.id,p.id,j.target.value),style:{fontSize:10,padding:"2px 6px",borderRadius:4,border:"1px solid var(--b1)",background:"var(--bg)",color:"var(--muted)",fontFamily:"'JetBrains Mono',monospace"}}),e.jsx("input",{type:"text",placeholder:"Notes...",value:p.notes||"",onChange:j=>We(t.id,p.id,j.target.value),style:{fontSize:10,padding:"3px 6px",borderRadius:4,flex:1,border:"1px solid var(--b1)",background:"var(--bg)",color:"var(--text)",minWidth:0}})]})]})]},p.id))})]},r.key)})}),B==="deadlines"&&e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[e.jsx("div",{style:{fontSize:12,fontWeight:700,color:"var(--text)",marginBottom:4},children:"Key Dates"}),[{key:"go_live_date",label:"Go-Live / Active Date",icon:""},{key:"photo_deadline",label:"Photography Deadline",icon:""},{key:"disclosure_due",label:"Disclosures Due",icon:""},{key:"open_house_date",label:"First Open House",icon:""}].map(r=>{var i;return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"10px 14px",borderRadius:8,background:"var(--surface)",border:"1px solid var(--b1)"},children:[e.jsx("span",{style:{fontSize:16},children:r.icon}),e.jsx("div",{style:{flex:1},children:e.jsx("div",{style:{fontSize:12,fontWeight:600,color:"var(--text)"},children:r.label})}),e.jsx("input",{type:"date",value:((i=t.milestones)==null?void 0:i[r.key])||"",onChange:async m=>{const u={...t.milestones||{},[r.key]:m.target.value};I(p=>p.map(j=>j.id===t.id?{...j,milestones:u}:j)),await w.from("listings").update({lm_milestones:u}).eq("id",t.id)},style:{fontSize:11,padding:"5px 8px",borderRadius:6,border:"1px solid var(--b1)",background:"var(--bg)",color:"var(--text)",fontFamily:"'JetBrains Mono',monospace"}})]},r.key)}),e.jsxs("div",{style:{marginTop:16,padding:"14px",borderRadius:10,background:"rgba(var(--brand-rgb), .06)",border:"1px solid rgba(var(--brand-rgb), .2)"},children:[e.jsx("div",{style:{fontSize:11,fontWeight:700,color:"var(--brand-secondary, var(--brand))",marginBottom:8,letterSpacing:.5},children:"LISTING STATUS"}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},children:fe.map(r=>{const i=o.filter(u=>u.phase===r.key),m=i.filter(u=>u.done).length;return e.jsxs("div",{style:{fontSize:11,color:"var(--text)",display:"flex",alignItems:"center",gap:6},children:[m===i.length?e.jsx(U,{size:12,style:{color:"var(--brand)"}}):e.jsx(rr,{size:12,style:{color:"var(--muted)"}}),e.jsxs("span",{children:[r.shortLabel,": ",m,"/",i.length]})]},r.key)})})]})]}),B==="messages"&&e.jsx(Ge,{messages:X,draft:E,onDraftChange:ee,sending:ke,onSend:we,userId:s==null?void 0:s.id,accentColor:"var(--brand-secondary, var(--brand))",seatLabel:"LM",listing:t})]})]})})()]})]})}export{zr as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.