import { proxyCustomElement, HTMLElement, createEvent } from '@stencil/core/internal/client';

const ScConsumer$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.mountEmitter = createEvent(this, "mountConsumer", 7);
    this.setContext = async (context) => {
      this.context = context;
      return this.promise;
    };
    this.promise = new Promise(resolve => {
      this.resolvePromise = resolve;
    });
  }
  componentWillLoad() {
    this.mountEmitter.emit(this.setContext);
  }
  disconnectedCallback() {
    this.resolvePromise();
  }
  render() {
    if (!this.context) {
      return null;
    }
    return this.renderer(this.context);
  }
}, [0, "sc-consumer", {
    "renderer": [8],
    "context": [32],
    "promise": [32],
    "resolvePromise": [32]
  }]);
function defineCustomElement$1() {
  if (typeof customElements === "undefined") {
    return;
  }
  const components = ["sc-consumer"];
  components.forEach(tagName => { switch (tagName) {
    case "sc-consumer":
      if (!customElements.get(tagName)) {
        customElements.define(tagName, ScConsumer$1);
      }
      break;
  } });
}
defineCustomElement$1();

const ScConsumer = ScConsumer$1;
const defineCustomElement = defineCustomElement$1;

export { ScConsumer, defineCustomElement };
