javascript:(()=>{const clean=t=>String(t||"").replace(/\s+/g," ").trim();const visible=e=>!!(e&&e.offsetParent!==null&&getComputedStyle(e).visibility!=="hidden");const hasTime=t=>/\b\d{1,2}:\d{2}\b|(?:\d+(?:,\d+|\.\d+)?\s*(?:h|hora|horas))|(?:\d+\s*(?:m|min|mins|minuto|minutos))\b/i.test(t);const hasDate=t=>/\b\d{1,2}[\/.-]\d{1,2}(?:[\/.-]\d{2,4})?\b|\b20\d{2}-\d{1,2}-\d{1,2}\b/i.test(t);const parseMinutes=t=>{t=String(t||"").toLowerCase().replace(",",".");let c=t.match(/\b(\d{1,2}):(\d{2})(?::\d{2})?\b/);if(c)return Number(c[1])*60+Number(c[2]);let h=t.match(/(\d+(?:\.\d+)?)\s*(?:h|hora|horas)\b/);let m=t.match(/(\d+)\s*(?:m|min|mins|minuto|minutos)\b/);return Math.round((h?Number(h[1])*60:0)+(m?Number(m[1]):0));};const parseDate=t=>{t=String(t||"");let iso=t.match(/\b(20\d{2})-(\d{1,2})-(\d{1,2})\b/);if(iso)return `${iso[1]}-${String(iso[2]).padStart(2,"0")}-${String(iso[3]).padStart(2,"0")}`;let br=t.match(/\b(\d{1,2})[\/.-](\d{1,2})(?:[\/.-](\d{2,4}))?\b/);if(br){let y=br[3]?Number(br[3].length===2?`20${br[3]}`:br[3]):new Date().getFullYear();return `${y}-${String(br[2]).padStart(2,"0")}-${String(br[1]).padStart(2,"0")}`;}return "";};const candidates=[...document.querySelectorAll("table tbody tr,[role=row],li,.timeline-item,.timeline-row,.card,.item,[class*=timeline],[class*=Linha],[class*=linha],[class*=Historico],[class*=historico]")].filter(visible);const rows=[];const seen=new Set();for(const el of candidates){const cells=[...el.querySelectorAll("td,th,[role=cell],span,div,p,strong")].map(x=>clean(x.innerText||x.textContent)).filter(Boolean);let useful=cells.filter(x=>x.length>1&&x.length<240);let text=clean((useful.length?useful.join(" | "):el.innerText||el.textContent));if(text.length<8||text.length>1200)continue;if(!hasTime(text)&&!hasDate(text))continue;if(seen.has(text))continue;seen.add(text);let dateCell=useful.find(hasDate)||text;let timeCell=useful.find(hasTime)||text;let subjectCell=useful.find(x=>!hasDate(x)&&!hasTime(x)&&x.length>2&&x.length<90)||"";let topicCell=useful.find(x=>x!==subjectCell&&!hasDate(x)&&!hasTime(x)&&x.length>2&&x.length<160)||"";rows.push({id:String(rows.length+1),date:parseDate(dateCell),minutes:parseMinutes(timeCell),subject:subjectCell||"Aprovado",topic:topicCell,rawText:text});}if(!rows.length){const lines=clean(document.body.innerText).split(/(?=\b\d{1,2}[\/.-]\d{1,2})|(?=\b\d{1,2}:\d{2}\b)/).map(clean).filter(x=>x.length>8&&(hasTime(x)||hasDate(x)));lines.forEach((line,i)=>rows.push({id:String(i+1),date:parseDate(line),minutes:parseMinutes(line),subject:"Aprovado",topic:"",rawText:line}));}const payload={schema:"estudos-track-external-study-v1",source:"Aprovado",url:location.href,exportedAt:new Date().toISOString(),items:rows};const blob=new Blob([JSON.stringify(payload,null,2)],{type:"application/json;charset=utf-8"});const a=document.createElement("a");a.href=URL.createObjectURL(blob);a.download=`aprovado-estudos-${new Date().toISOString().slice(0,10)}.json`;a.click();setTimeout(()=>URL.revokeObjectURL(a.href),1000);alert(`${rows.length} registros visiveis exportados. Importe o JSON no Estudos Track.`);})();