<!-- SOLID CITY · part 78 -->
/i.test(n)) try { c.setAttribute(n, el.attributes[a].value); } catch (e) {} }
  copyStyle(cs, c);
  job.bg(cs, c);
  if (el.tagName === 'IMG') { c.removeAttribute('srcset'); job.img(el.currentSrc || el.src, c); }
  if (el.tagName === 'INPUT') { if (/checkbox|radio/.test(el.type)) { if (el.checked) c.setAttribute('checked', 'checked'); } else c.setAttribute('value', el.value); }
  if (el.tagName === 'TEXTAREA') c.textContent = el.value;
  if (el.tagName === 'SELECT') { var o = el.options[el.selectedIndex]; c = document.createElement('div'); copyStyle(cs, c, 'overflow:hidden;white-space:nowrap;'); c.textContent = o ? o.text : ''; return c; }
  if (el.tagName === 'DETAILS' && el.open) c.setAttribute('open', '');
  var b = pseudo(el, '::before', job); if (b) c.appendChild(b);
  var kids = el.childNodes, st = el.scrollTop, sl = el.scrollLeft;
  for (var k = 0; k < kids.length; k++) {
    var ch = kids[k]; if (ch.nodeType === 1) { var ccs = getComputedStyle(ch); if (ccs.display === 'none') continue; }
    var cc = cloneTree(ch, job, depth + 1); if (!cc) continue;
    if ((st || sl) && cc.nodeType === 1) cc.setAttribute('style', (cc.getAttribute('style') || '') + 'translate:' + (-sl) + 'px ' + (-st) + 'px;');   // keep the scroll position
    c.appendChild(cc);
  }
  var af = pseudo(el, '::after', job); if (af) c.appendChild(af);
  if (mqFreeze) el.classList.remove('done');
  if (cs.backdropFilter && cs.backdropFilter !== 'none' || cs.webkitBackdropFilter && cs.webkitBackdropFilter !== 'none') {
    var m = /blur\(([\d.]+)px\)/.exec(cs.backdropFilter || cs.webkitBackdropFilter); if (m && +m[1] > 0) { var rr = el.getBoundingClientRect(); job.glass.push({ x: rr.left, y: rr.top, w: rr.width, h: rr.height, r: parseFloat(cs.borderTopLeftRadius) || 0, blur: +m[1] }); }
  }
  return c;
}
var fontFaces = null;
function fontRules() {
  if (fontFaces) return fontFaces; fontFaces = [];
  for (var i = 0; i < document.styleSheets.length; i++) { var rules; try { rules = document.styleSheets[i].cssRules; } catch (e) { continue; }
    for (var j = 0; rules && j < rules.length; j++) { var r = rules[j]; if (r.type !== 5) continue; var fam = (r.style.getPropertyValue('font-family') || '').replace(/["']/g, '').trim(), src = r.style.getPropertyValue('src'), m = /url\(["']?([^"')]+)["']?\)/.exec(src || '');
      if (fam && m) fontFaces.push({ fam: fam, url: new URL(m[1], document.styleSheets[i].href || location.href).href, weight: r.style.getPropertyValue('font-weight') || 'normal', style: r.style.getPropertyValue('font-style') || 'normal' }); } }
  return fontFaces;
}
function layerSvg(el, scale, job) {
  var r = el.getBoundingClientRect(), pad = 28, u = { l: r.left, t: r.top, r: r.right, b: r.bottom }, all = el.getElementsByTagName('*');
  for (var i = 0; i < all.length && i < 4000; i++) { var q = all[i].getBoundingClientRect(); if (q.width && q.height) { if (q.left < u.l) u.l = q.left; if (q.top < u.t) u.t = q.top; if (q.right > u.r) u.r = q.right; if (q.bottom > u.b) u.b = q.bottom; } }
  var x0 = Math.max(0, u.l - pad), y0 = Math.max(0, u.t - pad), x1 = Math.min(innerWidth, u.r + pad), y1 = Math.min(innerHeight, u.b + pad);
  var clone = cloneTree(el, job, 0); if (!clone) return null;
  var cs = clone.getAttribute('style') || '';
  clone.setAttribute('style', cs.replace(/(^|;)(position|left|top|right|bottom|margin-[a-z]+|transform|translate):[^;]*/g, '$1') + 'position:absolute;left:' + (r.left - x0) + 'px;top:' + (r.top - y0) + 'px;right:auto;bottom:auto;margin:0;width:' + r.width + 'px;height:' + r.height + 'px;transform:none;');
  return { clone: clone, x: x0, y: y0, w: x1 - x0, h: y1 - y0 };
}
function fontsCss(html) {
  var used = fontRules().filter(function (f) { return html.indexOf(f.fam) >= 0; });
  return Promise.all(used.map(function (f) { return toDataURL(f.url).then(function (d) { return d ? '@font-face{font-family:"' + f.fam + '";src:url(' + d + ');font-weight:' + f.weight + ';font-style:' + f.style + ';}' : ''; }); })).then(function (a) { return a.join(''); });
}
function drawSvg(ctx, L, scale, ox, oy, fonts) {
  var root = document.createElement('div'); root.setAttribute('xmlns', XHTML);
  root.setAttribute('style', 'position:relative;width:' + L.w + 'px;height:' + L.h + 'px;transform:scale(' + scale + ');transform-origin:0 0;overflow:hidden;margin:0;padding:0;font-family:system-ui,-apple-system,sans-serif;');
  root.appendChild(L.clone);
  var xml = new XMLSerializer().serializeToString(root);
  var W = Math.ceil(L.w * scale), H = Math.ceil(L.h * scale);
  var svg = '<svg xmlns="' + SVGNS + '" width="' + W + '" height="' + H + '" viewBox="0 0 ' + W + ' ' + H + '"><foreignObject x="0" y="0" width="' + W + '" height="' + H + '">' + (fonts ? '<style xmlns="' + XHTML + '">' + fonts + '</style>' : '') + xml + '</foreignObject></svg>';
  return new Promise(function (res, rej) {
    var img = new Image(); img.decoding = 'sync';
    img.onload = function () { try { ctx.drawImage(img, ox + L