${title}
${desc}
${link?`Read original source ↗`:''}/* Website shell derived from the signed CapGain iOS release, 12 October 2026. */
const esc = value => String(value ?? '').replace(/[&<>"']/g, c => ({'&':'&','<':'<','>':'>','"':'"',"'":'''}[c]));
const asset = name => `native-assets/CapGainHero${name}.webp`;
const photos = {cg:'CapitalGains',stamp:'StampDuty',ownership:'DealCost',gst:'GST',emi:'EMI',finance:'LoanEligibility',pmay:'PMAY',rent:'Home',nridesk:'NRI',circle:'CircleRate',land:'LandUnits',builders:'Diligence'};
const svcPhotos = {'cg-review':'AdvisoryCapitalGains',tds:'AdvisoryTDS',docs:'AdvisoryDocuments',verify:'AdvisoryVerify',rera:'AdvisoryRERA',diligence:'AdvisoryDiligence',nri:'AdvisoryNRI',valuation:'AdvisoryValuation',rental:'AdvisoryRental',succession:'AdvisorySuccession',structuring:'AdvisoryStructuring'};
const tabNames = {home:'Home',calculators:'Calculators',advisory:'Advisory',news:'News',knowledge:'Knowledge'};
const calcOrder = ['cg','stamp','ownership','gst','emi','finance','pmay','rent','nridesk','circle','land'];
const journeyPhotos = {sell:'JourneySell',buy:'JourneyBuy',nri:'JourneyNRI',inherit:'JourneyInherit'};
let tab = 'home';
let term = '';
const root = document.createElement('div');
root.id = 'cg-native-app';
root.setAttribute('aria-label','CAPGAIN website');
document.body.prepend(root);
document.documentElement.classList.add('cg-native-parity');
const accountDialog=document.createElement('dialog');
accountDialog.id='cg-native-account-dialog';
accountDialog.className='cg-native-account-dialog';
document.body.append(accountDialog);
function cg() { return window.CG; }
function button(text, action, cls = '') { return ``; }
function hero(image, eyebrow, title, subtitle) { return ` ${esc(subtitle)}${esc(title)}
${esc(title)}${esc(sub)}›`, action, 'cg-native-row'); }
function section(title, body, action, actionText='See all') { return `
${esc(title)}
${action ? button(esc(actionText)+' ',action,'cg-native-link') : ''}
No matching calculator.
')}`; } function advisory() { const services=(cg().catalog.services||[]).filter(s=>(s.title+' '+(s.what||'')).toLowerCase().includes(term.toLowerCase())); return `${hero('Transactions','ADVISORY','Expert help for your transaction','Choose the right professional for tax, legal review and property decisions.')} ${section('Services',services.length?services.map(s=>row(s.title,s.what||'',`service:${s.key}`,svcPhotos[s.key]||'AdvisoryTransaction')).join(''):'No matching service.
')} ${section('Your requests',row('My requests','View or continue an advisory request','route:account:requests','AdvisoryTransaction'))}`; } function newsList(limit=12) { let items=[]; try { items=cg().feed.items({limit}); } catch {} return items.length?items.map(item=>{ const link=typeof item.link==='string'&&/^https:\/\//i.test(item.link)?item.link:null; const title=esc(item.title); const desc=esc(item.desc||''); return `${desc}
${link?`Read original source ↗`:''}Headlines are unavailable right now.
'; } function news() { return `${hero('News','NEWS','Real Estate Transactions Tax News','Capital gains · Income tax · TDS · GST. Read each update at its original source.')}${section('Latest updates',newsList())}`; } function knowledge() { const topics = [ ['Capital gains','Income tax on a property sale','knowledge:topic:capital-gains','CapitalGains'],['RERA','Projects, registration and buyer remedies','knowledge:topic:rera','RERA'],['GST on property','Construction, rent and reverse charge','knowledge:topic:gst','GST'],['NRI property rules','Tax, TDS and repatriation','knowledge:topic:nri','NRI'] ]; const matched=topics.filter(t=>(t[0]+' '+t[1]).toLowerCase().includes(term.toLowerCase())); return `${hero('Knowledge','KNOWLEDGE','Property law and tax, in plain words','RERA, land records, capital gains, GST and NRI rules, with tools to act on them.')} ${row('Ask the 2026 capital gains book','Answers grounded in cited reader pages','book','Knowledge')} ${section('Explore the library',matched.length?matched.map(t=>row(t[0],t[1],`route:${t[2]}`,t[3])).join(''):'No matching topic.
')} ${section('Market and property data',row('Circle rates','Government values by city and zone','route:circle','CircleRate')+row('Builder grade','Developer records and ratings','route:builders','Diligence'))}`; } function render() { const content={home,calculators,advisory,news,knowledge}[tab](); root.innerHTML=`${esc(user.emailMasked||'Signed in')}
Signed in with ${esc(user.provider||user.method||'CAPGAIN')}