es(k,json);entries.forEach(e=>{const str=JSON.stringify(e).toLowerCase();if(str.includes(ql))hits.push({k,e,f:LIB_FILES[k]})})});document.getElementById('statSearch').textContent=hits.length;bar.className='search-results-bar show';bar.textContent=`Found ${hits.length} results across ${[...new Set(hits.map(h=>h.k))].length} datasets for "${q}"`;if(hits.length>0){this.active='_search';document.querySelectorAll('.lib-cat-card').forEach(c=>c.classList.remove('active'));document.getElementById('panelTitle').textContent='🔍 Search: "'+q+'"';document.getElementById('panelMeta').textContent=hits.length+' results';document.getElementById('panelInfo').textContent='Searching across all loaded datasets';document.getElementById('panelDriveLink').href='#';document.getElementById('panelEntries').innerHTML=hits.slice(0,100).map(({k,e,f})=>`
${this.esc(e.name||e.symbol||e.Z||'—')}${f.icon} ${f.label}
${this.esc(String(e.value||e.v||e.A_std||e.mass_kg||'—'))}
${this.esc(e.unit||e.u||e.category||'')}
`).join('');document.getElementById('libPanel').classList.add('open')}},filterByCat(k){if(!k)return;this.openCat(k)},closePanel(){document.getElementById('libPanel').classList.remove('open');document.querySelectorAll('.lib-cat-card').forEach(c=>c.classList.remove('active'));this.active=null},esc(s){return String(s).replace(/&/g,'&').replace(//g,'>').replace(/"/g,'"')}};LIB.init();return;const entries=this.extractEntrObject.entries(this.data).forEach(([k,json])=>{if(!json||json._errorCase();let hits=[]yId('statSearch').textContent='—';return}const ql=q.toLowent.getElementsName='search-results-bar';docum=>k2!=='meta').map(([k2,v])=>typeof v==='object'?{name:k2,...v}:{name:k2,value:v})},search(q){const bar=document.getElementById('searchBar');if(!q){bar.clas(json).filter(([k2]Object.entri json[keys[0]];return(json[keys[0]]))retur(x=>x!=='meta');if(keys.length===1&&Array.isArrarn json.data;if(Array.isArray(json))return json;const keys=Object.keys(json).filtejson.entries;if(json.data)retts;if(json.bodies)return json.bodies;if(json.entries)returnurn json.constarn json.elements;if(json.constants)re){if(json.elements)retntries found
'},extractEntries(k,jso''}
`).join(''):'
No otes||e.description||'').substring(0,120))}
`on?`
${this.esc((e.{json?._msg||'Unknown error'}

Open in Google Drive
`;document.getElementById('panelInfo').textContent='Error loading dataset';return}const meta=json.meta||{};document.getElementById('panelInfo').textContent=JSON.stringify({title:meta.title||k,version:meta.version||'—',units:meta.units||'—',scope:meta.scope||'—',entries:this.countEntries(k,json)});const entries=this.extractEntries(k,json);document.getElementById('panelEntries').innerHTML=entries.length?entries.map(e=>`
${this.esc(e.name||e.n||e.symbol||e.Z||'—')}${this.esc(e.symbol||e.s||e.Z||'')}
${this.esc(String(e.value||e.v||e.A_std||e.mass_kg||e.mu_km3s2||'—'))}
${this.esc(e.unit||e.u||e.category||e.block||'')}
${e.notes||e.descripton
e.google.com/file/d/'+f.id+'/view';document.getElementById('libPanel').classList.add('open');if(this.data[k])this.renderPanel(k);else{document.getElementById('panelEntries').innerHTML='
⟳ Loading dataset from Drive...
'}document.getElementById('libPanel').scrollIntoView({behavior:'smooth',block:'start'})},renderPanel(k){const f=LIB_FILES[k];const json=this.data[k];if(!json||json._error){document.getElementById('panelEntries').innerHTML=`
⚠ Could not load ${k}.j}})+'%';if(this.active===k)this.renderPanel(k)}).catch(e=>{this.data[k]={_error:true,_msg:e.message};document.getElementById('badge-'+k).textContent='⚠ error';document.getElementById('badge-'+k).className='lib-cat-badge error'})})},countEntries(k,json){if(Array.isArray(json))return json.length;if(json.elements)return json.elements.length;if(json.constants)return json.constants.length;if(json.bodies)return json.bodies.length;if(json.entries)return json.entries.length;if(json.data)return json.data.length;const keys=Object.keys(json).filter(k=>k!=='meta'&&k!=='version'&&k!=='units');if(keys.length===1&&Array.isArray(json[keys[0]]))return json[keys[0]].length;return Object.keys(json).length},openCat(k){this.active=k;const f=LIB_FILES[k];document.querySelectorAll('.lib-cat-card').forEach(c=>c.classList.remove('active'));document.getElementById('card-'+k).classList.add('active');document.getElementById('panelTitle').textContent=f.icon+' '+f.label+' Dataset';document.getElementById('panelMeta').textContent=f.desc+' · '+k+'.json';document.getElementById('panelDriveLink').href='https://dri'">
● LIVE
Drive Status
Loading dataset metadata...