PageSourceSearch

https://repsshield.com/assets/PropertyDetailPage-C5mhyUfM.js

js repsshield.com collected 2026-10-02 02:02:01 UTC 61,879 bytes, 16 lines download raw bytes

1import{z as me,j as e,B as E,ae as R,aI as L,Y as he,bj as V,e as Ve,N as Y,a as re,aM as ne,aE as O,de as ve,x as _,y as H,q as W,bW as ge,H as Oe,df as we,r as X,L as ke,ao as Q,dg as He,dh as Se,aH as Ce,C as Ee,d as Re,aC as Pe,cw as Te,aL as Ue,aT as Je,aU as Ge,aV as ye,aW as F,aX as Ke,aY as z,di as pe,bX as Qe,cO as Le,a0 as oe,a1 as de,a2 as ue,a3 as xe,a4 as B,X as Me,f as De,ag as $e,i as Ye,cz as Ae,bo as Ie,aD as Ze,aB as qe,p as We,aN as _e,by as je,dj as Xe,dk as es,cP as ss,G as ts,I as as,J as le,K as ie,b_ as rs,b$ as ns,c0 as ls,c1 as is,c2 as cs,c3 as os,c4 as ds,c5 as us,dl as xs}from"./index-DGo-vssZ.js";import{r as b,b as ms,u as hs}from"./vendor-Qgthw7N1.js";import{m as C,L as gs}from"./mapbox-gl-DJUMvbgb.js";/**
2 * @license lucide-react v0.453.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const ps=me("BedDouble",[["path",{d:"M2 20v-8a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v8",key:"1k78r4"}],["path",{d:"M4 10V6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v4",key:"fb3tl2"}],["path",{d:"M12 4v6",key:"1dcgq2"}],["path",{d:"M2 18h20",key:"ajqnye"}]]);/**
7 * @license lucide-react v0.453.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const Fe=me("Ruler",[["path",{d:"M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0Z",key:"icamh8"}],["path",{d:"m14.5 12.5 2-2",key:"inckbg"}],["path",{d:"m11.5 9.5 2-2",key:"fmmyf7"}],["path",{d:"m8.5 6.5 2-2",key:"vc6u1g"}],["path",{d:"m17.5 15.5 2-2",key:"wo5hmg"}]]);/**
12 * @license lucide-react v0.453.0 - ISC
13 *
14 * This source code is licensed under the ISC license.
15 * See the LICENSE file in the root directory of this source tree.
16 */const ze=me("TreePine",[["path",{d:"m17 14 3 3.3a1 1 0 0 1-.7 1.7H4.7a1 1 0 0 1-.7-1.7L7 14h-.3a1 1 0 0 1-.7-1.7L9 9h-.2A1 1 0 0 1 8 7.3L12 3l4 4.3a1 1 0 0 1-.8 1.7H15l3 3.3a1 1 0 0 1-.7 1.7H17Z",key:"cpyugq"}],["path",{d:"M12 22v-3",key:"kmzjlo"}]]);function fs({nickname:s,fullAddress:a,address:r,city:t,state:n,zipCode:g,sqft:d,latitude:u,longitude:m,geocodingFailed:l=!1,isGeocodePending:p=!1,onRetryGeocode:f}){const i=b.useRef(null),c=b.useRef(null),o=!!(u&&m),y=o?parseFloat(u):0,N=o?parseFloat(m):0;return b.useEffect(()=>{if(!o||!i.current||c.current)return;const k="pk.eyJ1IjoiZWVzdHJhZGEyMzQiLCJhIjoiY21kNmExOWFvMDc5dTJrb20ybGEzejB0MCJ9.hzyNiCdO4hJAgqOfFyJraw";C.accessToken=k;const x=new C.Map({container:i.current,style:"mapbox://styles/mapbox/streets-v12",center:[N,y],zoom:15,scrollZoom:!1});return x.addControl(new C.NavigationControl({showCompass:!1}),"top-right"),new C.Marker({color:"#2563eb"}).setLngLat([N,y]).addTo(x),c.current=x,()=>{x.remove(),c.current=null}},[o,y,N]),e.jsxs("section",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h2",{className:"text-base font-semibold text-gray-900 dark:text-gray-100",children:"Map Location"}),e.jsxs(E,{size:"sm",variant:"outline",onClick:f,disabled:p,className:"gap-1.5 text-xs",children:[p?e.jsx(R,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(L,{className:"h-3.5 w-3.5"}),p?"Geocoding…":"Re-geocode"]})]}),e.jsx("div",{className:"relative rounded-lg overflow-hidden border border-gray-200 dark:border-gray-700 h-72",children:o?e.jsxs(e.Fragment,{children:[e.jsx("div",{ref:i,className:"w-full h-full"}),e.jsxs("div",{className:"absolute top-3 left-3 bg-white dark:bg-gray-900 rounded-lg shadow-md px-3 py-2 max-w-[60%] pointer-events-none",children:[e.jsx("p",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100 leading-tight truncate",children:s}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 leading-tight mt-0.5",children:a||`${r}, ${t}, ${n} ${g}`})]})]}):l?e.jsxs("div",{className:"w-full h-full flex flex-col items-center justify-center gap-2 bg-amber-50 dark:bg-amber-900/10 text-amber-700 dark:text-amber-400 px-6 text-center",children:[e.jsx(he,{className:"h-10 w-10"}),e.jsx("p",{className:"text-sm font-medium",children:"Geocoding failed for this address."}),e.jsx("p",{className:"text-xs opacity-75",children:"Use the Re-geocode button above to try again."})]}):p?e.jsxs("div",{className:"w-full h-full flex flex-col items-center justify-center gap-3 bg-gray-50 dark:bg-gray-800 text-gray-400",children:[e.jsx(R,{className:"h-10 w-10 animate-spin"}),e.jsx("p",{className:"text-sm",children:"Geocoding address…"})]}):e.jsxs("div",{className:"w-full h-full flex flex-col items-center justify-center bg-gray-50 dark:bg-gray-800 text-gray-400",children:[e.jsx(V,{className:"h-10 w-10 mb-2"}),e.jsx("p",{className:"text-sm",children:"Location not yet geocoded"})]})}),e.jsxs("div",{className:"grid grid-cols-2 gap-x-8 gap-y-2 text-sm",children:[e.jsx(U,{label:"Address",value:r||"—"}),e.jsx(U,{label:"Postal code",value:g||"—"}),e.jsx(U,{label:"City",value:t||"—"}
16),e.jsx(U,{label:"Area",value:d?`${d.toLocaleString()} sqft`:"—"}),e.jsx(U,{label:"State/County",value:n||"—"}),e.jsx(U,{label:"Country",value:"USA"})]})]})}function U({label:s,value:a}){return e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 uppercase tracking-wide",children:s}),e.jsx("span",{className:"text-gray-900 dark:text-gray-100 font-medium",children:a})]})}const ys={user:"You",homeharvest:"HomeHarvest",rentcast:"RentCast",calculated:"Calculated"};function be(s,a){if(s==null)return"—";const r=typeof s=="number"&&a!=="$"?s.toLocaleString():typeof s=="number"?`$${s.toLocaleString()}`:String(s);return a&&a!=="$"?`${r} ${a}`:r}function js({icon:s,label:a,field:r,fieldKey:t,unit:n,onSourceChange:g,onUserEdit:d}){const[u,m]=b.useState(!1),[l,p]=b.useState(""),[f,i]=b.useState(!1),c=b.useRef(null),o=b.useRef(null);b.useEffect(()=>{const x=j=>{c.current&&!c.current.contains(j.target)&&i(!1)};return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[]);const y=()=>{p(String(r.active.value??"")),m(!0),setTimeout(()=>{var x;return(x=o.current)==null?void 0:x.focus()},0)},N=()=>{const x=Number(l),j=isNaN(x)?l:x;d(t,j),m(!1)},k=x=>{x.key==="Enter"&&N(),x.key==="Escape"&&m(!1)};return e.jsxs("div",{className:"flex flex-col gap-1 p-3 rounded-lg border border-gray-100 dark:border-gray-800 bg-white dark:bg-gray-900 hover:border-gray-200 dark:hover:border-gray-700 transition-colors",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[e.jsx("span",{className:"text-gray-400 dark:text-gray-500 flex-shrink-0",children:s}),e.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:a})]}),e.jsxs("div",{className:"relative flex-shrink-0",ref:c,children:[e.jsx("button",{type:"button",onClick:()=>i(x=>!x),className:"focus:outline-none",title:"Switch source","aria-label":`${r.options.length} sources available`,children:e.jsx(Ve,{variant:"secondary",className:"text-[10px] px-1.5 py-0.5 cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-700",children:r.options.length})}),f&&e.jsx("div",{className:"absolute right-0 mt-1 w-48 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-50 py-1",children:r.options.map((x,j)=>e.jsxs("button",{type:"button",className:`w-full text-left px-3 py-1.5 text-xs hover:bg-gray-50 dark:hover:bg-gray-700 ${x.source===r.active.source&&x.value===r.active.value?"font-semibold text-blue-600 dark:text-blue-400":"text-gray-700 dark:text-gray-300"}`,onClick:()=>{g(t,x),i(!1)},children:[e.jsx("span",{className:"block text-gray-400 dark:text-gray-500 text-[10px] leading-none mb-0.5",children:ys[x.source]}),be(x.value,n)]},j))})]})]}),u?e.jsx(Y,{ref:o,value:l,onChange:x=>p(x.target.value),onBlur:N,onKeyDown:k,className:"h-7 text-sm px-2 py-1"}):e.jsx("button",{type:"button",onClick:y,className:"text-left text-sm font-medium text-gray-900 dark:text-gray-100 truncate hover:text-blue-600 dark:hover:text-blue-400 transition-colors cursor-text",title:"Click to edit",children:be(r.active.value,n)})]})}const bs=[{key:"purchasePrice",label:"Purchase Price",icon:e.jsx(H,{className:"h-3.5 w-3.5"}),unit:"$"},{key:"landValue",label:"Land Value",icon:e.jsx(ze,{className:"h-3.5 w-3.5"}),unit:"$"},{key:"sqft",label:"Sqft",icon:e.jsx(Fe,{className:"h-3.5 w-3.5"}),unit:"sqft"},{key:"lotSize",label:"Lot Size",icon:e.jsx(gs,{className:"h-3.5 w-3.5"}),unit:"sqft"},{key:"yearBuilt",label:"Year Built",icon:e.jsx(W,{className:"h-3.5 w-3.5"})},{key:"yearPlacedInService",label:"Year Placed In Service",icon:e.jsx(W,{className:"h-3.5 w-3.5"})},{key:"monthPlacedInService",label:"Month Placed In Service",icon:e.jsx(W,{className:"h-3.5 w-3.5"})},{key:"landImprovementValue",label:"Land Improvement Value",icon:e.jsx(ge,{className:"h-3.5 w-3.5"}),unit:"$"},{key:"beds",label:"Beds",icon:e.jsx(ps,{className:"h-3.5 w-3.5"})},{key:"propertyStyle",label:"Property Style",icon:e.jsx(Oe,{className:"h-3.5 w-3.5"})}];function Ns({property:s,geocodingFailed:a,isGeocodePending:r,onRetryGeocode:t}){var c;const{toast:n}=re(),g=ne(),d=s.propertyEnrichment??{},u=Object.keys(d).length>0,m=((c=d.sqft)==null?void 0:c.active.value)??null,l=O({mutationFn:({fieldKey:o,value:y})=>ve(s.id,o,y),onSuccess:()=>{g.invalidateQueries({queryKey:[`/api/properties/${s.id}`]})},onError:()=>{n({title:"Error",description:"Failed to update field",variant:"destructive"})}}),p=(o,y)=>{l.mutate({fieldKey:o,value:y.value})},f=(o,y)=>{l.mutate({fieldKey:o,value:y})}
16,i=s.updatedAt?new Date(s.updatedAt).toLocaleString(void 0,{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"}):null;return e.jsxs("div",{className:"space-y-8",children:[e.jsx(fs,{nickname:s.nickname,fullAddress:s.fullAddress??"",address:s.address,city:s.city,state:s.state,zipCode:s.zipCode,sqft:m,latitude:s.latitude,longitude:s.longitude,geocodingFailed:a,isGeocodePending:r,onRetryGeocode:t}),e.jsxs("section",{className:"space-y-4",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-semibold text-gray-900 dark:text-gray-100",children:"Your Property Details"}),i&&e.jsxs("p",{className:"text-xs text-gray-400 dark:text-gray-500 mt-0.5 whitespace-nowrap",children:["Updated ",i]})]})}),u?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"rounded-lg bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 px-4 py-3 text-xs text-blue-700 dark:text-blue-300",children:"Field values are sourced from the web, your documents, and what you enter. Click any value to override it, or click the numbered badge to choose a different source."}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:bs.map(o=>{const y=d[o.key];return y?e.jsx(js,{icon:o.icon,label:o.label,field:y,fieldKey:o.key,unit:o.unit,onSourceChange:p,onUserEdit:f},o.key):null})})]}):e.jsxs("div",{className:"rounded-lg border border-dashed border-gray-200 dark:border-gray-700 p-8 text-center text-sm text-gray-400 dark:text-gray-500",children:[e.jsx(_,{className:"h-8 w-8 mx-auto mb-2 opacity-40"}),e.jsx("p",{children:"Run a cost segregation estimate to populate property details automatically."})]})]})]})}const vs="No property value found";function ws(s){const a=s.calculationResult;return{estimateId:s.id,addressHash:s.addressHash,sourcedData:s.sourcedData,classification:s.classification??{},calculation:a,stateNote:a.stateNote??"",landShare:a.landShare??0,bonusDepreciationRate:a.bonusDepreciationRate??0,yearPlacedInService:new Date().getFullYear()}}function ks({property:s,isAuthenticated:a=!0}){var y;const{toast:r}=re(),t=ne(),n=b.useRef(!1),[g,d]=b.useState(!1),[u,m]=b.useState(""),l=s.costSegStatus??"none",p=s.costSegEstimateId??null,f=O({mutationFn:N=>we(s.id,N),onSuccess:N=>{d(!1),m(""),t.setQueryData([`/api/properties/${s.id}`],N.property),t.invalidateQueries({queryKey:[`/api/properties/${s.id}`]}),t.invalidateQueries({queryKey:["/api/properties",s.id,"cost-seg-estimate"]})},onError:N=>{N.message.includes(vs)?d(!0):r({title:"Cost segregation failed",description:N.message||"Something went wrong. Please try again.",variant:"destructive"}),t.invalidateQueries({queryKey:[`/api/properties/${s.id}`]})}}),{data:i}=X({queryKey:["/api/properties",s.id,"cost-seg-estimate"],queryFn:()=>Se(s.id),enabled:l==="complete"&&!f.data&&!!p,staleTime:1/0,retry:!1});if(b.useEffect(()=>{n.current||l==="none"&&(n.current=!0,f.mutate(void 0))},[l]),f.isPending||l==="pending")return e.jsxs("div",{className:"flex flex-col items-center justify-center py-20 gap-4 text-gray-500 dark:text-gray-400",children:[e.jsx(R,{className:"h-8 w-8 animate-spin"}),e.jsx("p",{className:"text-sm",children:"Running cost segregation estimate…"}),e.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:"This typically takes 10–20 seconds."})]});if(g||l==="failed"&&g){const N=k=>{k.preventDefault();const x=parseFloat(u.replace(/[^0-9.]/g,""));if(!x||x<=0){r({title:"Invalid price",description:"Please enter a valid purchase price.",variant:"destructive"});return}f.mutate(x)};return e.jsxs("div",{className:"flex flex-col items-center justify-center py-20 gap-5 max-w-sm mx-auto",children:[e.jsx("div",{className:"flex items-center justify-center h-12 w-12 rounded-full bg-amber-100 dark:bg-amber-900/30",children:e.jsx(H,{className:"h-6 w-6 text-amber-600 dark:text-amber-400"})}),e.jsxs("div",{className:"text-center space-y-1.5",children:[e.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:"Purchase price required"}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"We couldn't find a property value for this address. Enter the purchase price to run the cost segregation estimate."})]}),e.jsxs("form",{onSubmit:N,className:"w-full space-y-3",children:[e.jsxs("div",{children:[e.jsx(ke,{htmlFor:"purchasePrice",children:"Purchase Price"}),e.jsxs("div",{className:"relative mt-1",children:[e.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-400 text-sm",children:"$"}),e.jsx(Y,{id:"purchasePrice",type:"text",inputMode:"numeric",value:u,onChange:k=>m(k.target.value),placeholder:"1,500,000",className:"pl-7",required:!0})]})]}),e.jsx(E,{type:"submit",className:"w-full",disabled:f.isPending,children:f.isPending?e.jsxs(e.Fragment,{children:[e.jsx(R,{className:"h-4 w-4 mr-2 animate-spin"}),"Running…"]}):"Run Cost Seg Estimate"})]})]})}if(l==="failed"&&!f.isPending)return e.jsxs("div",{className:"flex flex-col items-center justify-center py-20 gap-4",children:[e.jsx(Q,{className:"h-8 w-8 text-red-400"}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"The cost segregation estimate failed."}),e.jsxs(E,{variant:"outline",size:"sm",onClick:()=>f.mutate(void 0),className:"gap-2",children:[e.jsx(L,{className:"h-4 w-4"}),"Retry"]}),e.jsx("button",{type:"button",className:"text-xs text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 underline",onClick:()=>d(!0),children:"Enter purchase price manually"})]});const o=((y=f.data)==null?void 0:y.costSegResult)??null??(i?ws(i):null);return l==="complete"||o?o?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:["Estimate ready · Estimate #",o.estimateId??p]}),e.jsxs(E,{variant:"ghost",size:"sm",onClick:()=>f.mutate(void 0),disabled:f.isPending,className:"gap-1 text-xs text-gray-400 hover:text-gray-600",children:[e.jsx(L,{className:"h-3.5 w-3.5"}),"Re-run"]})]}
16),e.jsx(He,{input:{result:o,stateNote:o.stateNote,estimateId:o.estimateId??null},isAuthenticated:a,context:"property-tab"})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center py-20 gap-4 text-gray-500 dark:text-gray-400",children:[e.jsx(R,{className:"h-8 w-8 animate-spin"}),e.jsx("p",{className:"text-sm",children:"Loading estimate…"})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center py-20 gap-4 text-gray-500 dark:text-gray-400",children:[e.jsx(R,{className:"h-8 w-8 animate-spin"}),e.jsx("p",{className:"text-sm",children:"Preparing estimate…"})]})}function G(s){return s==null?"—":"$"+s.toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:0})}function Ss(s){return s==null?"—":s.toLocaleString()+" sqft"}function Cs(s){return s==null?"—":s<.1?(s*5280).toFixed(0)+" ft":s.toFixed(1)+" mi"}function Es(s,a){return s==null||a==null||a<=0?"—":"$"+(s/a).toFixed(2)}function Rs({property:s}){const{hasPremiumTierAccess:a,isLoading:r}=Ce(),t=a,{data:n,isLoading:g,isError:d,error:u,refetch:m,isFetching:l}=X({queryKey:["/api/properties",s.id,"rent-estimate"],queryFn:()=>pe(s.id),enabled:!r&&t,staleTime:1/0,retry:2});return!r&&!t?e.jsx(Ps,{}):r?e.jsx("div",{className:"flex items-center justify-center py-20",children:e.jsx(R,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):e.jsx(Ts,{isLoading:g,isError:d,error:u,data:n,property:s,onRetry:()=>m(),isFetching:l})}function Ps(){return e.jsx(Ee,{className:"border-green-100 dark:border-green-900/40",children:e.jsxs(Re,{className:"flex flex-col items-center px-5 py-8 text-center sm:px-8",children:[e.jsx("div",{className:"mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-green-50 dark:bg-green-950/40",children:e.jsx(Pe,{className:"h-6 w-6 text-green-600 dark:text-green-400"})}),e.jsxs("div",{className:"max-w-sm space-y-2",children:[e.jsx("h3",{className:"text-base font-semibold leading-snug text-gray-950 dark:text-gray-100 sm:text-lg",children:"Upgrade to Pro to unlock rent estimates"}),e.jsx("p",{className:"text-sm leading-relaxed text-gray-600 dark:text-gray-400",children:"Compare market rent ranges and nearby rental comps for each property."})]}),e.jsxs(E,{onClick:()=>{window.location.href="/settings?tab=billing"},className:"mt-5 h-10 w-full max-w-[220px] gap-2 rounded-full bg-green-600 text-sm font-semibold hover:bg-green-700",children:[e.jsx(Te,{className:"h-4 w-4"}),"Upgrade to Pro"]})]})})}function Ts({isLoading:s,isError:a,error:r,data:t,property:n,onRetry:g,isFetching:d}){const[u,m]=b.useState(!1);async function l(){m(!0);try{await pe(n.id,!0)}finally{m(!1),await g()}}if(s)return e.jsxs("div",{className:"flex flex-col items-center justify-center py-20 gap-4 text-gray-500 dark:text-gray-400",children:[e.jsx(R,{className:"h-8 w-8 animate-spin"}),e.jsx("p",{className:"text-sm",children:"Fetching rent estimate..."})]});if(a)return e.jsxs("div",{className:"flex flex-col items-center justify-center py-20 gap-4",children:[e.jsx(Q,{className:"h-8 w-8 text-red-400"}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:(r==null?void 0:r.message)||"Failed to fetch rent estimate."}),e.jsxs(E,{variant:"outline",size:"sm",onClick:g,className:"gap-2",children:[e.jsx(L,{className:"h-4 w-4"}),"Retry"]})]});const p=!t||t.comps.length===0,f=t&&t.rent==null&&t.rentRangeLow==null&&t.rentRangeHigh==null;if(p&&f)return e.jsxs("div",{className:"flex flex-col items-center justify-center py-20 gap-3 text-gray-400",children:[e.jsx(V,{className:"h-10 w-10 text-muted-foreground/50"}),e.jsx("p",{className:"text-sm text-gray-500",children:"Not enough data to generate rent estimate."}),e.jsxs(E,{variant:"outline",size:"sm",onClick:g,className:"gap-2 mt-1",children:[e.jsx(L,{className:"h-4 w-4"}),"Retry"]})]});const i=(t==null?void 0:t.comps)??[],c=(t==null?void 0:t.rent)??null,o=(t==null?void 0:t.rentRangeLow)??null,y=(t==null?void 0:t.rentRangeHigh)??null;return e.jsxs("div",{className:"space-y-6",children:[e.jsx(Ee,{children:e.jsxs(Re,{className:"p-4 sm:p-6 relative",children:[e.jsx("button",{onClick:l,disabled:u,title:"Refresh rent estimate from RentC
16ast",className:"absolute top-4 right-4 p-1.5 rounded-md text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors disabled:opacity-50",children:e.jsx(L,{className:Ue("h-4 w-4",u&&"animate-spin")})}),e.jsxs("div",{className:"flex items-start gap-3 sm:gap-4",children:[e.jsx("div",{className:"h-10 w-10 sm:h-12 sm:w-12 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center shrink-0",children:e.jsx(H,{className:"h-5 w-5 sm:h-6 sm:w-6 text-green-600 dark:text-green-400"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 uppercase tracking-wide font-medium mb-1",children:"Estimated Rent Range"}),e.jsx("p",{className:"text-xl sm:text-3xl font-bold text-gray-900 dark:text-gray-100 leading-tight break-words",children:o!=null&&y!=null?G(o)+" - "+G(y)+" / month":c!=null?G(c)+" / month":"Estimate unavailable"}),c!=null&&(o!=null||y!=null)&&e.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:["Median estimate: ",G(c)," / month"]})]})]})]})}),i.length>0&&e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100 mb-3",children:["Comparable Properties (",i.length,")"]}),e.jsx("div",{className:"overflow-x-auto rounded-lg border border-gray-200 dark:border-gray-700",children:e.jsx("div",{className:"max-h-96 overflow-y-auto",children:e.jsxs(Je,{children:[e.jsx(Ge,{children:e.jsxs(ye,{className:"sticky top-0 bg-white dark:bg-gray-800 z-10",children:[e.jsx(F,{children:"Address"}),e.jsx(F,{className:"text-right",children:"Distance"}),e.jsx(F,{className:"text-right",children:"Beds"}),e.jsx(F,{className:"text-right hidden sm:table-cell",children:"Baths"}),e.jsx(F,{className:"text-right hidden sm:table-cell",children:"Sqft"}),e.jsx(F,{className:"text-right",children:"Rent"}),e.jsx(F,{className:"text-right hidden sm:table-cell",children:"$/sqft"})]})}),e.jsx(Ke,{children:i.map((N,k)=>e.jsxs(ye,{children:[e.jsx(z,{className:"max-w-[140px] sm:max-w-[200px] truncate",title:N.formattedAddress,children:N.formattedAddress||"—"}),e.jsx(z,{className:"text-right whitespace-nowrap",children:Cs(N.distance)}),e.jsx(z,{className:"text-right",children:N.bedrooms!=null?N.bedrooms:"—"}),e.jsx(z,{className:"text-right hidden sm:table-cell",children:N.bathrooms!=null?N.bathrooms:"—"}),e.jsx(z,{className:"text-right hidden sm:table-cell",children:Ss(N.squareFootage)}),e.jsx(z,{className:"text-right font-medium whitespace-nowrap",children:G(N.price)}),e.jsx(z,{className:"text-right text-muted-foreground hidden sm:table-cell",children:Es(N.price,N.squareFootage)})]},N.formattedAddress||k))})]})})})]}),i.length>0&&e.jsx(Ls,{propertyLat:n.latitude?parseFloat(n.latitude):null,propertyLng:n.longitude?parseFloat(n.longitude):null,propertyName:n.nickname,comps:i})]})}function Ls({propertyLat:s,propertyLng:a,propertyName:r,comps:t}){const n=b.useRef(null),g=b.useRef(null),d=b.useRef([]),u=s!=null&&a!=null;return b.useEffect(()=>{if(!u||!n.current||g.current)return;const m="pk.eyJ1IjoiZWVzdHJhZGEyMzQiLCJhIjoiY21kNmExOWFvMDc5dTJrb20ybGEzejB0MCJ9.hzyNiCdO4hJAgqOfFyJraw";C.accessToken=m;const l=new C.LngLatBounds;l.extend([a,s]),t.forEach(c=>{c.longitude!=null&&c.latitude!=null&&l.extend([c.longitude,c.latitude])});const p=new C.Map({container:n.current,style:"mapbox://styles/mapbox/streets-v12",bounds:l,fitBoundsOptions:{padding:60,maxZoom:14},scrollZoom:!0});p.addControl(new C.NavigationControl({showCompass:!1}),"top-right");const f=document.createElement("div");f.className="flex items-center justify-center",f.innerHTML='<div style="width:20px;height:20px;border-radius:50%;background:#2563eb;border:3px solid white;box-shadow:0 2px 6px rgba(0,0,0,0.3);cursor:pointer;"></div>';const i=new C.Marker({element:f}).setLngLat([a,s]).setPopup(new C.Popup({offset:25}).setHTML('<p class="font-semibold text-sm">'+r+'</p><p class="text-xs text-gray-500">Subject property</p>')).addTo(p);return d.current.push(i),t.forEach(c=>{if(c.longitude==null||c.latitude==null)return;const o=document.createElement("div");o.className="flex items-center justify-center",o.innerHTML='<div style="width:16px;height:16px;border-radius:50%;background:#16a34a;border:2px solid white;box-shadow:0 1px 4px rgba(0,0,0,0.3);cursor:pointer;"></div>';const y=new C.Marker({element:o}
16).setLngLat([c.longitude,c.latitude]).setPopup(new C.Popup({offset:25}).setHTML('<p class="font-semibold text-sm">'+(c.formattedAddress||"Comp")+'</p><p class="text-xs text-gray-500">Est. rent: '+G(c.price)+"</p>")).addTo(p);d.current.push(y)}),g.current=p,()=>{p.remove(),g.current=null,d.current=[]}},[u,s,a,r,t]),u?e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100 mb-3",children:"Map View"}),e.jsx("div",{className:"rounded-lg overflow-hidden border border-gray-200 dark:border-gray-700 h-60 sm:h-72",children:e.jsx("div",{ref:n,className:"w-full h-full"})})]}):null}function Ms({open:s,editForm:a,isPending:r,onFieldChange:t,onSave:n,onCancel:g}){return e.jsx(Qe,{open:s,onOpenChange:d=>{d||g()},title:"Edit Property",children:e.jsxs("div",{className:"space-y-4 p-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm font-semibold text-gray-700",children:"Nickname"}),e.jsx(Y,{value:(a==null?void 0:a.nickname)??"",onChange:d=>t("nickname",d.target.value),placeholder:"Property nickname",className:"text-base",disabled:r})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm font-semibold text-gray-700",children:"Address"}),e.jsx(Le,{value:(a==null?void 0:a.address)??"",onChange:d=>t("address",d),onSelect:({address:d,city:u,state:m,zipCode:l})=>{t("address",d),t("city",u),t("state",m),t("zipCode",l)}})]}),((a==null?void 0:a.city)||(a==null?void 0:a.state)||(a==null?void 0:a.zipCode))&&e.jsx("p",{className:"-mt-1 text-xs text-gray-500",children:[a.city,a.state,a.zipCode].filter(Boolean).join(", ")}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm font-semibold text-gray-700",children:"Property Type"}),e.jsxs(oe,{value:(a==null?void 0:a.propertyType)??"Long-term Rental",onValueChange:d=>t("propertyType",d),disabled:r,children:[e.jsx(de,{className:"w-full",children:e.jsx(ue,{placeholder:"Property type"})}),e.jsxs(xe,{children:[e.jsx(B,{value:"Long-term Rental",children:"Long-term Rental"}),e.jsx(B,{value:"Short-term Rental",children:"Short-term Rental"})]})]})]}),e.jsxs("div",{className:"flex gap-3 pt-2",children:[e.jsxs(E,{variant:"outline",onClick:g,disabled:r,className:"flex-1 gap-1.5",children:[e.jsx(Me,{className:"h-4 w-4"}),"Cancel"]}),e.jsxs(E,{onClick:n,disabled:r||!a,className:"flex-1 gap-1.5",children:[r?e.jsx(R,{className:"h-4 w-4 animate-spin"}):e.jsx(De,{className:"h-4 w-4"}),r?"Saving…":"Save"]})]})]})})}const Ds="No property value found";function A(s){return s==null?"—":new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(s)}function $s(s){return s==null?"—":`${Math.round(s*100)}%`}function Z(s,a,r){const t=s??0,n=a??0;return`${r(t)} – ${r(n)}`}function As(s){const a=s.calculationResult;return{estimateId:s.id,addressHash:s.addressHash,sourcedData:s.sourcedData,classification:s.classification??{},calculation:a,stateNote:a.stateNote??"",landShare:a.landShare??0,bonusDepreciationRate:a.bonusDepreciationRate??0,yearPlacedInService:new Date().getFullYear()}}function Is({property:s,isAuthenticated:a=!0}){var N,k,x,j,D,$,T,h;const{toast:r}=re(),t=ne(),n=b.useRef(!1),[g,d]=b.useState(!1),[u,m]=b.useState(""),l=s.costSegStatus??"none",p=s.costSegEstimateId??null,f=s.fullAddress??`${s.address}, ${s.city}, ${s.state} ${s.zipCode}`,i=O({mutationFn:v=>we(s.id,v),onSuccess:v=>{d(!1),m(""),t.setQueryData([`/api/properties/${s.id}`],v.property),t.invalidateQueries({queryKey:[`/api/properties/${s.id}`]}),t.invalidateQueries({queryKey:["/api/properties",s.id,"cost-seg-estimate"]})},onError:v=>{v.message.includes(Ds)?d(!0):r({title:"Cost segregation failed",description:v.message||"Something went wrong. Please try again.",variant:"destructive"}),t.invalidateQueries({queryKey:[`/api/properties/${s.id}`]})}}),{data:c}=X({queryKey:["/api/properties",s.id,"cost-seg-estimate"],queryFn:()=>Se(s.id),enabled:l==="complete"&&!i.data&&!!p,staleTime:1/0,retry:!1});if(b.useEffect(()=>{n.current||l==="none"&&(n.current=!0,i.mutate(void 0))},[l]),i.isPending||l==="pending")return e.jsxs("div",{className:"flex flex-col items-center justify-center py-20 gap-4 text-gray-500",children:[e.jsx(R,{className:"h-8 w-8 animate-spin"}),e.jsx("p",{className:"text-sm",children:"Running cost segregation estimate…"}),e.jsx("p",{className:"text-xs text-gray-400",children:"This typically takes 10–20 seconds."})]});if(g||l==="failed"&&g){const v=S=>{S.preventDefault();const M=parseFloat(u.replace(/[^0-9.]/g,""));if(!M||M<=0){r({title:"Invalid price",description:"Please enter a valid purchase price.",variant:"destructive"});return}i.mutate(M)};return e.jsxs("div",{className:"flex flex-col items-center justify-center py-20 gap-5 max-w-sm mx-auto",children:[e.jsx("div",{className:"flex items-center justify-center h-12 w-12 rounded-full bg-amber-100",children:e.jsx(H,{className:"h-6 w-6 text-amber-600"})}),e.jsxs("div",{className:"text-center space-y-1.5",children:[e.jsx("p",{className:"text-sm font-medium text-gray-900",children:"Purchase price required"}),e.jsx("p",{className:"text-xs text-gray-500",children:"We couldn't find a property value for this address. Enter the purchase price to run the cost segregation estimate."})]}),e.jsxs("form",{onSubmit:v,className:"w-full space-y-3",children:[e.jsxs("div",{children:[e.jsx(ke,{htmlFor:"mobileCostSegPurchasePrice",children:"Purchase Price"}),e.jsxs("div",{className:"relative mt-1",children:[e.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-400 text-sm",children:"$"}),e.jsx(Y,{id:"mobileCostSegPurchasePrice",type:"text",inputMode:"numeric",value:u,onChange:S=>m(S.target.value),placeholder:"1,500,000",className:"pl-7",required:!0})]})]}),e.jsx(E,{type:"submit",className:"w-full",disabled:i.isPending,children:i.isPending?e.jsxs(e.Fragment,{children:[e.jsx(R,{className:"h-4 w-4 mr-2 animate-spin"}),"Running…"]}):"Run Cost Seg Estimate"})]})]})}if(l==="failed"&&!i.isPending)return e.jsxs("div",{className:"flex flex-col items-center justify-center py-20 gap-4",children:[e.jsx(Q,{className:"h-8 w-8 text-red-400"}),e.jsx("p",{className:"text-sm text-gray-600",children:"The cost segregation estimate failed."}),e.jsxs(E,{variant:"outline",size:"sm",onClick:()=>i.mutate(void 0),className:"gap-2",children:[e.jsx(L,{className:"h-4 w-4"}),"Retry"]}),e.jsx("button",{type:"button",className:"text-xs text-gray-400 hover:text-gray-600 underline",onClick:()=>d(!0),children:"Enter purchase price manually"})]});const y=((N=i.data)==null?void 0:N.costSegResult)??null??(c?As(c):null);if(l==="complete"||y){if(!y)return e.jsxs("div",{className:"flex flex-col items-center justify-center py-20 gap-4 text-gray-500",children:[e.jsx(R,{className:"h-8 w-8 animate-spin"}),e.jsx("p",{className:"text-sm",children:"Loading estimate…"})]});const{calculation:v,classification:S,sourcedData:M,stateNote:q}=y,ee=M==null?void 0:M.estimatedValue,se=v.conformityStatus!=="conforming",te=y.bonusDepreciationRate>=1?`Bonus Depreciation (${Math.round(y.bonusDepreciationRate*100)}%)`:`Bonus Depreciation (${Math.round(y.bonusDepreciationRate*100)}%)`;return e.jsx("div",{className:"rounded-2xl border border-gray-100 bg-white shadow-sm overflow-hidden",children:e.jsxs("div",{className:"divide-y divide-gray-100",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5",children:[e.jsxs("p",{className:"text-xs text-gray-400",children:["Estimate ready",p?` · Estimate #${p}`:""]}),e.jsxs("button",{type:"button",onClick:()=>i.mutate(void 0),disabled:i.isPending,className:"inline-flex items-center gap-1 text-xs font-medium text-green-600 transition hover:text-green-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-green-500 disabled:opacity-50",children:[i.isPending?e.jsx(R,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(L,{className:"h-3.5 w-3.5"}),i.isPending?"Running…":"Re-run"]})]}),e.jsxs("div",{className:"flex items-center justify-between gap-2 px-4 py-3.5",children:[e.jsx("p",{className:"text-sm font-medium text-gray-900",children:f}),(S==null?void 0:S.label)&&e.jsx("span",{className:"flex-shrink-0 rounded-full bg-green-100 px-2.5 py-0.5 text-[11px] font-semibold text-green-700",children:S.label})]}),e.jsx("div",{className:"px-4 py-4",children:e.jsxs("div",{className:"rounded-xl border border-green-200 bg-white px-4 py-3",children:[e.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wider text-gray-500",children:"TOTAL YEAR-1 TAX SAVINGS"}),e.jsx("p",{className:"mt-1 text-2xl font-bold text-green-600",children:A((k=v.totalSavings)==null?void 0:k.midpoint)}),e.jsx("p",{className:"mt-0.5 text-sm text-gray-500",children:Z((x=v.totalSavings)==null?void 0:x.low,(j=v.totalSavings)==null?void 0:j.high,A)})]})}),e.jsxs("div",{className:"px-4 py-3",children:[e.jsx("h3",{className:"text-base font-bold text-gray-900 mb-3",children:"Calculation Steps"}),e.jsxs("div",{className:"space-y-0 divide-y divide-gray-50",children:[e.jsx(I,{label:"Property Value",value:A(ee??null)}),e.jsx(I,{label:"Land Share",value:$s(y.landShare)}),e.jsx(I,{label:"Depreciable Basis",value:A(v.depreciableBasis)}),e.jsx(I,{label:"Reclassified Basis",value:Z(v.reclassifiedBasisBaseline,v.reclassifiedBasisUpper,A)}),e.jsx(I,{label:"Reclassification %",value:(S==null?void 0:S.baselineReclass)!=null?`${Math.round(S.baselineReclass)}% – ${Math.round(S.upperReclass??S.baselineReclass)}%`:"—"}),e.jsx(I,{label:te,value:Z(v.yr1AcceleratedBaseline,v.yr1AcceleratedUpper,A)}),e.jsx(I,{label:"Federal Savings (24%–37%)",value:Z((D=v.federalSavings)==null?void 0:D.low,($=v.federalSavings)==null?void 0:$.high,A)}),e.jsx(I,{label:"State Savings",value:Z((T=v.stateSavings)==null?void 0:T.low,(h=v.stateSavings)==null?void 0:h.high,A)})]})]}),se&&q&&e.jsx("div",{className:"px-4 py-3",children:e.jsxs("div",{className:"flex items-start gap-2 rounded-xl bg-amber-50 border border-amber-200 px-4 py-3",children:[e.jsx(he,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-amber-600"}),e.jsx("p",{className:"text-xs text-amber-700",children:q})]})}),e.jsx("div",{className:"px-4 py-3",children:e.jsx("button",{type:"button",onClick:()=>window.open("https://rentalpropertyrefund.com/?rfsn=8928736.a5e206","_blank","noopener,noreferrer"),className:"w-full rounded-xl bg-green-600 px-4 py-3 text-sm font-bold text-white transition hover:bg-green-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-green-500",children:"GET A FORMAL COST SEG STUDY"})}),v.disclaimerText&&e.jsx("div",{className:"px-4 py-3",children:e.jsx("p",{className:"text-xs text-gray-400 leading-relaxed",children:v.disclaimerText})})]})})}return e.jsxs("div",{className:"flex flex-col items-center justify-center py-20 gap-4 text-gray-500",children:[e.jsx(R,{className:"h-8 w-8 animate-spin"}),e.jsx("p",{className:"text-sm",children:"Preparing estimate…"})]})}function I({label:s,value:a}){return e.jsxs("div",{className:"flex items-center justify-between py-2.5",children:[e.jsx("span",{className:"text-sm text-gray-500",children:s}),e.jsx("span",{className:"text-sm font-medium text-gray-900 text-right ml-4",children:a})]})}
16function K(s){return s==null?"—":"$"+s.toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:0})}function qs(s){return s==null?"—":s<.1?(s*5280).toFixed(0)+" ft":s.toFixed(1)+" mi"}function Fs({property:s}){const{hasPremiumTierAccess:a,isLoading:r}=Ce(),t=a,{data:n,isLoading:g,isError:d,error:u,refetch:m}=X({queryKey:["/api/properties",s.id,"rent-estimate"],queryFn:()=>pe(s.id),enabled:!r&&t,staleTime:3e5,retry:2});return!r&&!t?e.jsx(zs,{}):r?e.jsx("div",{className:"flex items-center justify-center py-20",children:e.jsx(R,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):e.jsx(Bs,{isLoading:g,isError:d,error:u,data:n,property:s,onRetry:()=>m()})}function zs(){return e.jsxs("div",{className:"rounded-2xl border border-green-100 bg-white px-5 py-6 text-center shadow-sm",children:[e.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-green-50",children:e.jsx(Pe,{className:"h-6 w-6 text-green-600"})}),e.jsxs("div",{className:"mx-auto max-w-[260px] space-y-2",children:[e.jsx("h3",{className:"text-base font-semibold leading-snug text-gray-950",children:"Upgrade to Pro to unlock rent estimates"}),e.jsx("p",{className:"text-sm leading-relaxed text-gray-600",children:"Compare market rent ranges and nearby rental comps for each property."})]}),e.jsxs(E,{onClick:()=>{window.location.href="/settings?tab=billing"},className:"mt-5 h-10 w-full max-w-[220px] gap-2 rounded-full bg-green-600 text-sm font-semibold hover:bg-green-700",children:[e.jsx(Te,{className:"h-4 w-4"}),"Upgrade to Pro"]})]})}function Bs({isLoading:s,isError:a,error:r,data:t,property:n,onRetry:g}){if(s)return e.jsxs("div",{className:"flex flex-col items-center justify-center py-20 gap-4 text-gray-500",children:[e.jsx(R,{className:"h-8 w-8 animate-spin"}),e.jsx("p",{className:"text-sm",children:"Fetching rent estimate…"})]});if(a)return e.jsxs("div",{className:"flex flex-col items-center justify-center py-20 gap-4",children:[e.jsx(Q,{className:"h-8 w-8 text-red-400"}),e.jsx("p",{className:"text-sm text-gray-600",children:(r==null?void 0:r.message)||"Failed to fetch rent estimate."}),e.jsxs(E,{variant:"outline",size:"sm",onClick:g,className:"gap-2",children:[e.jsx(L,{className:"h-4 w-4"}),"Retry"]})]});const d=!t||t.comps.length===0,u=t&&t.rent==null&&t.rentRangeLow==null&&t.rentRangeHigh==null;if(d&&u)return e.jsxs("div",{className:"flex flex-col items-center justify-center py-20 gap-3 text-gray-400",children:[e.jsx(V,{className:"h-10 w-10 text-muted-foreground/50"}),e.jsx("p",{className:"text-sm text-gray-500",children:"Not enough data to generate rent estimate."}),e.jsxs(E,{variant:"outline",size:"sm",onClick:g,className:"gap-2 mt-1",children:[e.jsx(L,{className:"h-4 w-4"}),"Retry"]})]});const m=(t==null?void 0:t.comps)??[],l=(t==null?void 0:t.rent)??null,p=(t==null?void 0:t.rentRangeLow)??null,f=(t==null?void 0:t.rentRangeHigh)??null;return e.jsxs("div",{className:"rounded-2xl border border-gray-100 bg-white shadow-sm overflow-hidden",children:[e.jsxs("div",{className:"flex items-start gap-3 px-4 py-4",children:[e.jsx("div",{className:"flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-full bg-green-100",children:e.jsx(H,{className:"h-5 w-5 text-green-600"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-wider text-gray-400",children:"ESTIMATED RENT RANGE"}),e.jsx("p",{className:"mt-0.5 text-xl font-bold text-gray-900 leading-tight",children:p!=null&&f!=null?`${K(p)} – ${K(f)} / month`:l!=null?`${K(l)} / month`:"Estimate unavailable"}),l!=null&&(p!=null||f!=null)&&e.jsxs("p",{className:"mt-0.5 text-sm text-gray-500",children:["Median estimate: ",K(l)," / month"]})]})]}),m.length>0&&e.jsxs("div",{className:"border-t border-gray-100 px-4 py-3",children:[e.jsxs("h3",{className:"text-sm font-bold text-gray-900 mb-2",children:["Comparable Properties (",m.length,")"]}),e.jsx("div",{className:"max-h-60 overflow-y-auto overflow-x-auto rounded-lg border border-gray-200",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-gray-50 text-left text-gray-500 font-semibold",children:[e.jsx("th",{className:"px-2 py-2",children:"Address"}),e.jsx("th",{className:"px-2 py-2 text-right",children:"Distance"}),e.jsx("th",{className:"px-2 py-2 text-right",children:"Beds"}),e.jsx("th",{className:"px-2 py-2 text-right",children:"Rent"})]})}),e.jsx("tbody",{className:"divide-y divide-gray-100",children:m.map((i,c)=>e.jsxs("tr",{className:"text-gray-900",children:[e.jsx("td",{className:"max-w-[130px] truncate px-2 py-2",title:i.formattedAddress,children:i.formattedAddress||"—"}),e.jsx("td",{className:"whitespace-nowrap px-2 py-2 text-right",children:qs(i.distance)}),e.jsx("td",{className:"px-2 py-2 text-right",children:i.bedrooms!=null?i.bedrooms:"—"}),e.jsx("td",{className:"whitespace-nowrap px-2 py-2 text-right font-medium",children:K(i.price)})]},i.formattedAddress||c))})]})})]}),m.length>0&&e.jsxs("div",{className:"border-t border-gray-100 px-4 py-3",children:[e.jsx("h3",{className:"text-sm font-bold text-gray-900 mb-2",children:"Map View"}),e.jsx(Vs,{propertyLat:n.latitude?parseFloat(n.latitude):null,propertyLng:n.longitude?parseFloat(n.longitude):null,propertyName:n.nickname,comps:m})]})]})}function Vs({propertyLat:s,propertyLng:a,propertyName:r,comps:t}){const n=b.useRef(null),g=b.useRef(null),d=b.useRef([]),u=s!=null&&a!=null;return b.useEffect(()=>{if(!u||!n.current||g.current)return;const m="pk.eyJ1IjoiZWVzdHJhZGEyMzQiLCJhIjoiY21kNmExOWFvMDc5dTJrb20ybGEzejB0MCJ9.hzyNiCdO4hJAgqOfFyJraw";C.accessToken=m;const l=new C.LngLatBounds;l.extend([a,s]),t.forEach(c=>{c.longitude!=null&&c.latitude!=null&&l.extend([c.longitude,c.latitude])});const p=new C.Map({container:n.current,style:"mapbox://styles/mapbox/streets-v12",bounds:l,fitBoundsOptions:{padding:60,maxZoom:14},scrollZoom:!0});p.addControl(new C.NavigationControl({showCompass:!1}),"top-right");const f=document.createElement("div");f.className="flex items-center justify-center",f.innerHTML='<div style="width:20px;height:20px;border-radius:50%;background:#2563eb;border:3px solid white;box-shadow:0 2px 6px rgba(0,0,0,0.3);cursor:pointer;"></div>';const i=new C.Marker({element:f}).setLngLat([a,s]).setPopup(new C.Popup({offset:25}).setHTML('<p class="font-semibold text-sm">'+r+'</p><p class="text-xs text-gray-500">Subject property</p>')).addTo(p);return d.current.push(i),t.forEach(c=>{if(c.longitude==null||c.latitude==null)return;const o=document.createElement("div");o.className="flex items-center justify-center",o.innerHTML='<div style="width:16px;height:16px;border-radius:50%;background:#16a34a;border:2px solid white;box-shadow:0 1px 4px rgba(0,0,0,0.3);cursor:pointer;"></div>';const y=new C.Marker({element:o}
16).setLngLat([c.longitude,c.latitude]).setPopup(new C.Popup({offset:25}).setHTML('<p class="font-semibold text-sm">'+(c.formattedAddress||"Comp")+'</p><p class="text-xs text-gray-500">Est. rent: '+K(c.price)+"</p>")).addTo(p);d.current.push(y)}),g.current=p,()=>{p.remove(),g.current=null,d.current=[]}},[u,s,a,r,t]),u?e.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-200 h-60",children:e.jsx("div",{ref:n,className:"w-full h-full"})}):null}const Os={user:"You",homeharvest:"HomeHarvest",rentcast:"RentCast",calculated:"Calculated"};function Hs({icon:s,label:a,fieldKey:r,field:t,format:n,isUpdating:g,onUpdateField:d,onUpdateSource:u}){var T;const[m,l]=b.useState(!1),[p,f]=b.useState(""),[i,c]=b.useState(!1),o=b.useRef(null),y=b.useRef(null);b.useEffect(()=>{const h=v=>{o.current&&!o.current.contains(v.target)&&c(!1)};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[]);const N=t?n(t.active.value):"—",k=((T=t==null?void 0:t.options)==null?void 0:T.length)??1,x=()=>{f(String((t==null?void 0:t.active.value)??"")),l(!0),setTimeout(()=>{var h;return(h=y.current)==null?void 0:h.focus()},0)},j=()=>{const h=p.trim();if(h!==""){const v=Number(h),S=isNaN(v)?h:v;d(r,S)}l(!1)},D=h=>{h.key==="Enter"&&j(),h.key==="Escape"&&l(!1)},$=h=>{u(r,h),c(!1)};return e.jsxs("div",{className:`flex w-full items-center gap-3 px-4 py-3.5 transition ${g?"opacity-60 pointer-events-none":""}`,children:[e.jsx("div",{className:"flex h-9 w-9 flex-shrink-0 items-center justify-center rounded-xl bg-green-100",children:e.jsx(s,{className:"h-4 w-4 text-green-600"})}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx("p",{className:"text-sm font-medium text-gray-900",children:a})}),m?e.jsx(Y,{ref:y,value:p,onChange:h=>f(h.target.value),onBlur:j,onKeyDown:D,className:"h-8 w-28 text-sm px-2 py-1",disabled:g}):e.jsx("button",{type:"button",onClick:x,disabled:g,className:"text-sm font-medium text-gray-900 hover:text-blue-600 cursor-text whitespace-nowrap transition-colors",children:N}),e.jsxs("div",{className:"relative flex-shrink-0",ref:o,children:[e.jsx("button",{type:"button",onClick:()=>{g||c(h=>!h)},disabled:g,className:"flex h-6 w-6 items-center justify-center rounded-full bg-gray-100 text-[11px] font-bold text-gray-500 hover:bg-gray-200 disabled:opacity-50 transition-colors","aria-label":`${k} sources available`,children:k}),i&&(t==null?void 0:t.options)&&e.jsx("div",{className:"absolute right-0 top-8 z-50 w-48 rounded-xl border border-gray-200 bg-white shadow-lg py-1",children:t.options.map((h,v)=>e.jsxs("button",{type:"button",className:`w-full text-left px-3 py-1.5 text-xs hover:bg-gray-50 transition-colors ${h.source===t.active.source?"font-semibold text-blue-600":"text-gray-700"}`,onClick:()=>$(h),children:[e.jsx("span",{className:"mb-0.5 block text-[10px] leading-none text-gray-400",children:Os[h.source]}),n(h.value)]},v))})]})]})}function Us(s){return s?new Date(s).toLocaleString(void 0,{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0}):""}function ce(s){if(s==null||s==="")return"—";const a=typeof s=="string"?parseFloat(s):s;return isNaN(a)?"—":new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(a)}function Ne(s){return s==null||s===""?"—":String(s)}function Js(s,a,r=600,t=320){return`https://api.mapbox.com/styles/v1/mapbox/streets-v12/static/pin-s+3B82F6(${s},${a})/${s},${a},14,0/${r}x${t}@2x?access_token=pk.eyJ1IjoiZWVzdHJhZGEyMzQiLCJhIjoiY21kNmExOWFvMDc5dTJrb20ybGEzejB0MCJ9.hzyNiCdO4hJAgqOfFyJraw`}const Gs=[{value:"details",label:"Property Details",icon:"info"},{value:"cost-seg",label:"Tax Savings",icon:"chart"},{value:"rent-estimate",label:"Rent Estimate",icon:"dollar"}];function Ks({name:s}){switch(s){case"info":return e.jsx(qe,{className:"h-3.5 w-3.5"});case"chart":return e.jsx(ge,{className:"h-3.5 w-3.5"});case"dollar":return e.jsx(H,{className:"h-3.5 w-3.5"});default:return null}}function J({label:s,value:a,icon:r}){return e.jsxs("div",{className:"flex items-center gap-2 p-3",children:[e.jsx("div",{className:"flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-lg bg-green-100",children:e.jsx(r,{className:"h-4 w-4 text-green-600"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-gray-400",children:s}),e.jsx("p",{className:"truncate text-sm font-medium text-gray-900",children:a??"—"})]})]})}function Qs({property:s,activeTab:a,onBack:r,onEdit:t,onDelete:n,onTabChange:g,onUpdateField:d,onUpdateSource:u,geocodingFailed:m,isGeocodePending:l,isUpdatingEnrichment:p,onRetryGeocode:f,taxSavingsContent:i,rentEstimateContent:c}){var T;const o=s.propertyEnrichment??{},y=Object.keys(o).length>0,N=s.fullAddress??`${s.address}, ${s.city}, ${s.state} ${s.zipCode}`,k=!!(s.latitude&&s.longitude),x=k?parseFloat(String(s.latitude)):0,j=k?parseFloat(String(s.longitude)):0,D=y&&((T=o.sqft)==null?void 0:T.active.value)!=null?`${Number(o.sqft.active.value).toLocaleStr
16ing()} sqft`:"—",$=()=>l?e.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-3 bg-gray-50 text-gray-400",children:[e.jsx(R,{className:"h-10 w-10 animate-spin"}),e.jsx("p",{className:"text-sm",children:"Geocoding address…"})]}):m?e.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2 bg-amber-50 px-6 text-center text-amber-700",children:[e.jsx(he,{className:"h-10 w-10"}),e.jsx("p",{className:"text-sm font-medium",children:"Geocoding failed for this address."}),e.jsx("p",{className:"text-xs opacity-75",children:"Tap Re-geocode to try again."})]}):k?e.jsx("img",{src:Js(j,x,600,320),alt:`Map location for ${s.nickname}`,className:"h-full w-full object-cover",loading:"lazy"}):e.jsx("div",{className:"flex h-full w-full items-center justify-center text-gray-300",children:e.jsx(V,{className:"h-10 w-10"})});return e.jsx("div",{className:"min-h-screen bg-gray-50 pb-24 pt-3",children:e.jsxs("div",{className:"space-y-4 px-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button",onClick:r,"aria-label":"Back to properties",className:"flex h-10 w-10 items-center justify-center rounded-full bg-gray-50 text-gray-600 transition hover:bg-gray-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gray-400",children:e.jsx($e,{className:"h-5 w-5"})}),e.jsx("h1",{className:"text-xl m-0 p-0 font-bold text-gray-900",children:"Properties"})]}),s.updatedAt&&e.jsx("div",{className:"flex justify-center",children:e.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-full border border-amber-200 bg-amber-50 px-4 py-1.5 text-xs font-medium text-amber-700",children:[e.jsx(Ye,{className:"h-3.5 w-3.5"}),"Updated ",Us(s.updatedAt)]})}),e.jsx("div",{className:"rounded-2xl border border-gray-100 bg-white p-4 shadow-sm",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-12 w-12 flex-shrink-0 items-center justify-center rounded-xl bg-blue-100",children:e.jsx(_,{className:"h-6 w-6 text-blue-600"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h2",{className:"text-base font-bold text-gray-900",children:s.nickname}),e.jsx("p",{className:"text-xs text-gray-500",children:N})]}),e.jsxs("div",{className:"flex flex-shrink-0 gap-1",children:[e.jsx("button",{type:"button",onClick:t,"aria-label":"Edit property",className:"flex h-8 w-8 items-center justify-center rounded-full text-gray-400 transition hover:bg-gray-50 hover:text-gray-600 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gray-400",children:e.jsx(Ae,{className:"h-4 w-4"})}),e.jsx("button",{type:"button",onClick:n,"aria-label":"Delete property",className:"flex h-8 w-8 items-center justify-center rounded-full text-red-400 transition hover:bg-red-50 hover:text-red-600 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-red-500",children:e.jsx(Ie,{className:"h-4 w-4"})})]})]})}),e.jsx("div",{className:"rounded-2xl border border-gray-100 bg-white p-1.5 shadow-sm",children:e.jsx("div",{className:"flex gap-1",children:Gs.map(h=>e.jsxs("button",{type:"button",onClick:()=>g(h.value),className:`flex flex-1 items-center justify-center gap-1 rounded-xl py-2 text-[11px] font-semibold whitespace-nowrap transition focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-green-500 ${a===h.value?"bg-green-100 text-green-700":"text-gray-500 hover:text-gray-700"}`,children:[e.jsx(Ks,{name:h.icon}),h.label]},h.value))})}),a==="details"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"overflow-hidden rounded-2xl border border-gray-100 bg-white shadow-sm",children:[e.jsxs("div",{className:"relative h-56 bg-gray-100",children:[$(),e.jsxs("button",{type:"button",onClick:f,disabled:l,className:"absolute right-3 top-3 inline-flex items-center gap-1.5 rounded-lg bg-white/90 px-3 py-1.5 text-xs font-medium text-gray-700 shadow-sm backdrop-blur-sm transition hover:bg-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-green-500 disabled:opacity-50",children:[l?e.jsx(R,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(L,{className:"h-3.5 w-3.5"}),l?"Geocoding…":"Re-geocode"]})]}),e.jsxs("div",{className:"divide-y divide-gray-100",children:[e.jsxs("div",{className:"grid grid-cols-2 divide-x divide-gray-100",children:[e.jsx(J,{label:"ADDRESS",value:s.address||"—",icon:V}),e.jsx(J,{label:"POSTAL CODE",value:s.zipCode||"—",icon:V})]}),e.jsxs("div",{className:"grid grid-cols-2 divide-x divide-gray-100",children:[e.jsx(J,{label:"CITY",value:s.city||"—",icon:_}),e.jsx(J,{label:"AREA",value:D,icon:Fe})]}),e.jsxs("div",{className:"grid grid-cols-2 divide-x divide-gray-100",children:[e.jsx(J,{label:"STATE/COUNTY",value:s.state||"—",icon:V}),e.jsx(J,{label:"COUNTRY",value:"USA",icon:Ze})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-lg font-bold text-gray-900",children:"Your Property Details"}),e.jsxs("div",{className:"flex items-start gap-2 rounded-xl border border-blue-200 bg-blue-50 px-4 py-3",children:[e.jsx(qe,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-blue-500"}),e.jsx("p",{className:"text-xs text-blue-700",children:"Tap a value to edit it, or tap the numbered badge to choose a source."})]}),e.jsx("div",{className:"divide-y divide-gray-100 overflow-hidden rounded-2xl border border-gray-100 bg-white shadow-sm",children:[{key:"purchasePrice",icon:H,label:"Purchase Price",format:ce},{key:"landValue",icon:ze,label:"Land Value",format:ce},{key:"yearPlacedInService",icon:W,label:"Year Placed In Service",format:Ne},{key:"monthPlacedInService",icon:W,label:"Month Placed In Service",format:Ne},{key:"landImprovementValue",icon:ge,label:"Land Improvement Value",format:ce}].map(h=>e.jsx(Hs,{icon:h.icon,label:h.label,fieldKey:h.key,field:o[h.key],format:h.format,isUpdating:p,onUpdateField:d,onUpdateSource:u},h.key))})]})]}),a==="cost-seg"&&i&&e.jsx("div",{className:"overflow-hidden rounded-2xl border border-gray-100 bg-white shadow-sm",children:i}),a==="rent-estimate"&&c&&e.jsx("div",{className:"overflow-hidden rounded-2xl border border-gray-100 bg-white shadow-sm",children:c})]})})}function _s(){const s=ms(),[,a]=hs(),{isAuthenticated:r}=We(),{toast:t}=re(),n=ne(),[g,d]=b.useState(!1),[u,m]=b.useState(null),[l,p]=b.useState(!1),[f,i]=b.useState("details"),[c,o]=b.useState(!1),y=_e(),[N,k]=b.useState(!1);b.useEffect(()=>{k(!0)},[]);const x=s!=null&&s.id?parseInt(s.id,10):NaN,{data:j,isLoading:D,isError:$,error:T}=X({queryKey:[`/api/properties/${x}`],queryFn:()=>xs(x),enabled:!isNaN(x),staleTime:3e4}),h=O({mutationFn:w=>Xe(x,w),onSuccess:()=>{n.invalidateQueries({queryKey:["/api/properties"]}),n.invalidateQueries({queryKey:[`/api/properties/${x}`]}),je.isRunning&&je.refreshGeofences().catch(console.error),t({title:"Property updated"}),d(!1),m(null),o(!1)},onError:w=>{t({title:"Error",description:w.message||"Failed to update property.",variant:"destructive"})}}),v=O({mutationFn:()=>es(x),onSuccess:()=>{n.invalidateQueries({queryKey:[`/api/properties/${x}`]}),t({title:"Geocoding complete",description:"Map location updated."})},onError:w=>{t({title:"Geocoding failed",description:w.message||"Could not geocode this address.",variant:"destructive"})}}),S=O({mutationFn:({fieldKey:w,value:P})=>ve(x,w,P),onSuccess:()=>{n.invalidateQueries({queryKey:[`/api/properties/${x}`]})},onError:()=>{t({title:"Error",description:"Failed to update field",variant:"destructive"})}}),M=(w,P)=>{S.mutate({fieldKey:w,value:P.value})},q=O({mutationFn:()=>ss(x),onSuccess:()=>{n.invalidateQueries({queryKey:["/api/properties"]}),t({title:"Property deleted"}),a("/properties")},onError:w=>{t({title:"Error",description:w.message||"Failed to delete property.",variant:"destructive"})}}),ee=()=>{j&&(m({nickname:j.nickname,address:j.address,city:j.city??"",state:j.state??"",zipCode:j.zipCode??"",propertyType:j.propertyType??"Long-term Rental"}),d(!0))},se=()=>{d(!1),m(null)},te=()=>{u&&h.mutate(u)};return isNaN(x)?e.jsxs("div",{className:"flex flex-col items-center justify-center h-64 gap-3 text-gray-400",children:[e.jsx(Q,{className:"h-8 w-8"}),e.jsx("p",{className:"text-sm",children:"Invalid property ID."})]}):D?e.jsxs("div",{className:"flex flex-col items-center justify-center h-64 gap-3 text-gray-400",children:[e.jsx(R,{className:"h-8 w-8 animate-spin"}),e.jsx("p",{className:"text-sm",children:"Loading property…"})]}):$||!j?e.jsxs("div",{className:"flex flex-col items-center justify-center h-64 gap-3 text-gray-400",children:[e.jsx(Q,{className:"h-8 w-8 text-red-400"}),e.jsx("p",{className:"text-sm",children:(T==null?void 0:T.message)??"Failed to load property."}),e.jsx(E,{variant:"outline",size:"sm",onClick:()=>a("/properties"),children:"Back to Properties"})]}):N&&y?e.jsxs(e.Fragment,{children:[e.jsx(Qs,{property:j,activeTab:f,onBack:()=>a("/properties"),onEdit:()=>{ee(),o(!0)},onDelete:()=>p(!0),onTabChange:i,onUpdateField:(w,P)=>S.mutate({fieldKey:w,value:P}),onUpdateSource:M,geocodingFailed:j.geocodingFailed??!1,isGeocodePending:v.isPending,isUpdatingEnrichment:S.isPending,onRetryGeocode:()=>v.mutate(),taxSavingsContent:e.jsx(Is,{property:j,isAuthenticated:r}),rentEstimateContent:e.jsx(Fs,{property:j})}),e.jsx(Ms,{open:c,editForm:u,isPending:h.isPending,onFieldChange:(w,P)=>{m(ae=>ae&&{...ae,[w]:P})},onSave:()=>te(),onCancel:()=>{se(),o(!1)}})]}):e.jsx(e.Fragment,{children:e.jsxs("div",{className:"container-mobile py-6 space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs(E,{variant:"ghost",size:"sm",onClick:()=>a("/properties"),className:"mt-0.5 -ml-2 gap-1 text-gray-500 hover:text-gray-900 dark:hover:text-gray-100",children:[e.jsx($e,{className:"h-4 w-4"}),"Properties"]}),j.updatedAt&&e.jsxs("span",{className:"inline-flex items-center px-3 py-1 rounded-full bg-amber-400 text-white text-xs font-medium whitespace-nowrap",children:["Updated ",new Date(j.updatedAt).toLocaleStr
16ing(void 0,{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0})]})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-700 shadow-sm p-6 space-y-6",children:[g&&u?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-10 w-10 rounded-lg bg-blue-100 dark:bg-blue-900/30 flex items-center justify-center flex-shrink-0",children:e.jsx(_,{className:"h-5 w-5 text-blue-600 dark:text-blue-400"})}),e.jsx("span",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:"Editing property"})]}),e.jsx(Y,{value:u.nickname,onChange:w=>m(P=>P&&{...P,nickname:w.target.value}),placeholder:"Property nickname",className:"font-semibold text-base"}),e.jsx(Le,{value:u.address,onChange:w=>m(P=>P&&{...P,address:w}),onSelect:({address:w,city:P,state:ae,zipCode:Be})=>m(fe=>fe&&{...fe,address:w,city:P,state:ae,zipCode:Be})}),(u.city||u.state||u.zipCode)&&e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 -mt-1",children:[u.city,u.state,u.zipCode].filter(Boolean).join(", ")}),e.jsxs(oe,{value:u.propertyType,onValueChange:w=>m(P=>P&&{...P,propertyType:w}),children:[e.jsx(de,{className:"w-48",children:e.jsx(ue,{placeholder:"Property type"})}),e.jsxs(xe,{children:[e.jsx(B,{value:"Long-term Rental",children:"Long-term Rental"}),e.jsx(B,{value:"Short-term Rental",children:"Short-term Rental"})]})]}),e.jsxs("div",{className:"flex gap-2 pt-1",children:[e.jsxs(E,{size:"sm",onClick:te,disabled:h.isPending,className:"gap-1.5",children:[e.jsx(De,{className:"h-3.5 w-3.5"}),h.isPending?"Saving…":"Save"]}),e.jsxs(E,{size:"sm",variant:"outline",onClick:se,disabled:h.isPending,className:"gap-1.5",children:[e.jsx(Me,{className:"h-3.5 w-3.5"}),"Cancel"]})]})]}):e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-10 w-10 rounded-lg bg-blue-100 dark:bg-blue-900/30 flex items-center justify-center flex-shrink-0",children:e.jsx(_,{className:"h-5 w-5 text-blue-600 dark:text-blue-400"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h1",{className:"text-base sm:text-xl font-bold text-gray-900 dark:text-gray-100 leading-tight mb-0",children:j.nickname}),e.jsx("p",{className:"text-xs sm:text-sm text-gray-500 dark:text-gray-400 leading-snug",children:j.fullAddress??`${j.address}, ${j.city}, ${j.state} ${j.zipCode}`})]}),e.jsxs(E,{variant:"ghost",onClick:ee,className:"h-8 w-8 p-0 sm:h-auto sm:w-auto sm:px-3 gap-1.5 text-gray-500 hover:text-gray-900 dark:hover:text-gray-100 flex-shrink-0",children:[e.jsx(Ae,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"sr-only sm:not-sr-only",children:"Edit"})]}),e.jsxs(E,{variant:"ghost",onClick:()=>p(!0),className:"h-8 w-8 p-0 sm:h-auto sm:w-auto sm:px-3 gap-1.5 text-red-400 hover:text-red-600 dark:hover:text-red-400 flex-shrink-0",children:[e.jsx(Ie,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"sr-only sm:not-sr-only",children:"Delete"})]})]}),e.jsxs(ts,{value:f,onValueChange:i,children:[e.jsx("div",{className:"sm:hidden",children:e.jsxs(oe,{value:f,onValueChange:i,children:[e.jsx(de,{className:"w-full",children:e.jsx(ue,{})}),e.jsxs(xe,{children:[e.jsx(B,{value:"details",children:"Property Details"}),e.jsx(B,{value:"cost-seg",children:"Tax Savings"}),e.jsx(B,{value:"rent-estimate",children:"Rent Estimate"})]})]})}),e.jsx("div",{className:"hidden sm:block",children:e.jsxs(as,{className:"inline-flex w-full",children:[e.jsx(le,{value:"details",children:"Property Details"}),e.jsx(le,{value:"cost-seg",children:"Tax Savings"}),e.jsx(le,{value:"rent-estimate",children:"Rent Estimate"})]})}),e.jsx(ie,{value:"details",className:"mt-6",children:e.jsx(Ns,{property:j,geocodingFailed:j.geocodingFailed??!1,isGeocodePending:v.isPending,onRetryGeocode:()=>v.mutate()})}),e.jsx(ie,{value:"cost-seg",className:"mt-6",children:e.jsx(ks,{property:j,isAuthenticated:r})}),e.jsx(ie,{value:"rent-estimate",className:"mt-6",children:e.jsx(Rs,{property:j})})]}),e.jsx(rs,{open:l,onOpenChange:p,children:e.jsxs(ns,{children:[e.jsxs(ls,{children:[e.jsx(is,{children:"Delete property?"}),e.jsxs(cs,{children:[e.jsx("strong",{children:j.nickname})," will be permanently deleted. This cannot be undone."]})]}),e.jsxs(os,{children:[e.jsx(ds,{disabled:q.isPending,children:"Cancel"}),e.jsx(us,{onClick:()=>q.mutate(),disabled:q.isPending,className:"bg-red-600 hover:bg-red-700 focus:ring-red-600",children:q.isPending?"Deleting…":"Delete"})]})]})})]})]})})}export{_s 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.