function adoptStyleWhenAdoptedStylesheetsNotSupported(
  renderRoot,
  style,
  { teardown = false } = {},
) {
  const adoptRoot = /** @type {ShadowRoot|Document['body']} */ (
    renderRoot === document ? document.body : renderRoot
  );
  // @ts-ignore
  const styleText = style.cssText || serializeConstructableStylesheet(style);

  if (!teardown) {
    const styleEl = document.createElement('style');
    // keep notation, so it's not renamed in minification/build
    // eslint-disable-next-line dot-notation
    const nonce = window['litNonce'];
    if (nonce !== undefined) {
      styleEl.setAttribute('nonce', nonce);
    }
    styleEl.textContent = styleText;
    adoptRoot.appendChild(styleEl);
  } else {
    const foundStyleEls = Array.from(adoptRoot.querySelectorAll('style'));

    for (const foundStyleEl of foundStyleEls) {
      if (foundStyleEl.textContent === styleText) {
        foundStyleEl.remove();
        break;
      }
    }
  }
}
@param {DocumentOrShadowRoot} renderRoot
@param {AdoptableStyle} style
@param {{teardown?: boolean}} opts