var BASE="https://mbnakfrkfwxinhxlisyq.supabase.co/rest/v1";
function H(x){return Object.assign({"Content-Type":"application/json"},window.PureAuth&&PureAuth.authedHeaders?PureAuth.authedHeaders(x||{}):{});}
function esc(s){return String(s==null?"":s).replace(/[<>&]/g,function(c){return{"<":"<",">":">","&":"&"}[c];});}
var q=new URLSearchParams(location.search),tok=q.get('t'),aid=q.get('a')||'LB-000147';
// resolve by track token (notice) or asset id; demo-friendly fallback to the seeded asset trail
function loadByAsset(id){
fetch(BASE+"/pure_assets?id=eq."+id+"&select=*&limit=1",{headers:H()}).then(function(r){return r.ok?r.json():[];}).then(function(a){
var as=a&&a[0]||{label:"8146 County Road 860",listing_id:"PURE-8146",location:"McKinney TX"};
document.getElementById("title").textContent=as.listing_id||"Your home journey";
document.getElementById("addr").textContent=(as.location||"")+(as.label?" \u00b7 "+as.label:"");
fetch(BASE+"/pure_asset_events?asset_id=eq."+id+"&select=*&order=created_at.asc&limit=30",{headers:H()}).then(function(r){return r.ok?r.json():[];}).then(function(evs){
var future=["Final walkthrough","Closing & funding"];
var html=evs.map(function(e,i){var last=i===evs.length-1;return '