1/**
2 * Copyright © 2023 650 Industries.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7import { ctx as rootContext } from '../../_ctx-html';
8
9export function getRootComponent() {
10  const keys = rootContext.keys();
11  if (!keys.length) {
12    return (require('./html') as typeof import('./html')).Html;
13  }
14  if (keys.length > 1) {
15    throw new Error(`Multiple components match the root HTML element: ${keys.join(', ')}`);
16  }
17  const exp = rootContext(keys[0]);
18
19  if (!exp.default) {
20    throw new Error(`The root HTML element "${keys[0]}" is missing the required default export.`);
21  }
22
23  return exp.default;
24}
25