+ const vis = row => row.split(/\n/)[3].trim().replaceAll(/<.*?>/g,'').replaceAll(/\.\.+/g,'..')
+ list.sort((a,b) => vis(a)>vis(b) ? 1 : -1)
+ const q = (id,delta) => Object.entries(req.query)
+ .map(([k,v]) => k == id ? `${k}=${+v+delta}` : `${k}=${v}`)
+ .join('&')
+ const p = id => `<a href=/usage?${q(id,+1)} style="background-color:#ddd;"> + </a>`
+ const m = id => `<a href=/usage?${q(id,-1)} style="background-color:#ddd;"> − </a>`
+ const d = id => `<span title=${req.query[id]}>${id} ${p(id)} ${m(id)}</span>`
+ res.send(style('usage',key)+`
+ <p><table>${files.tally().map(([k,v]) => `<tr><td>${v}<td>${k}`).join("\n")}</table>
+ <p><section>— ${d('width')} ${d('depth')} —</section>
+ <p><table>${list.join("\n")}</table>`)
+})
+
+app.get('/nesting', (req,res) => {
+ const {file,type,start,end} = req.query
+ const result = []
+ const doit = (branch,stack) => {
+ if(stack.at(-1)==file && branch.type==type && branch.start==start && branch.end==end) {
+ const file = stack.at(-1)
+ const path = stack.slice(0,-1).map((n,i) => `
+ <tr>
+ <td><a title=${file} href=/similar?pos=${`${file}-${start}-${end}`}&depth=${i}>${n.type}</a>:
+ <td>${sxpr(n,3,null,stack[i-1])}`).reverse()
+ const hit = stack[1]
+ result.push(`
+ <p><table>${path.join("")}</table><br>
+ <p><pre>${escape(JSON.stringify(hit,omit,2))}</pre>`)
+ }
+ }
+ visitor.wander(mods,doit)
+ res.send(style('nesting')+`${result.join("<hr>")}`)