import { r as registerInstance, c as createEvent, h, H as Host } from './index-8dc1a0b7.js';
import './index-2f7827f5.js';
import { r as runState, h as href } from './runStore-08a7baa7.js';

const BaseLink = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
    this.routeChange = createEvent(this, "routeChange", 7);
    this.style = [];
    this.color = "--cj-color-primary";
    this.hoverColor = "--cj-color-secondary";
    this.decoration = "--cj-link-decoration";
    this.hoverDecoration = "--cj-link-hover-decoration";
  }
  async componentWillLoad() {
    await this.computeStyles();
  }
  async computeStyles() {
    const hash = await (await import('./style-2713ffe3.js').then(function (n) { return n.s; })).calculateStyles(this);
    this.hash = hash;
  }
  renderLink() {
    if (runState.router) {
      const defaultProps = href(this.href, runState.router);
      const overwrittenProps = Object.assign(Object.assign({}, defaultProps), { onClick: (ev) => {
          this.routeChange.emit({ type: "routechange", newUrl: this.href });
          if (typeof defaultProps.onClick === "function")
            defaultProps.onClick(ev);
          window.scrollTo({ top: 0 });
        } });
      return (h("a", Object.assign({}, overwrittenProps, { class: this.hash }), h("slot", null)));
    }
    return (h("a", { href: this.href, class: this.hash }, h("slot", null)));
  }
  render() {
    return h(Host, { class: this.hash }, this.renderLink());
  }
};

const CorejamBox = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
    //@todo check if props are valid
    this.display = "block";
    this.droppableElements = ["corejam-box"];
  }
  async componentWillRender() {
    const hash = await (await import('./style-2713ffe3.js').then(function (n) { return n.s; })).calculateStyles(this);
    this.hash = hash;
  }
  render() {
    return (h(Host, { class: this.hash }, h("slot", null)));
  }
};

export { BaseLink as corejam_base_link, CorejamBox as corejam_box };
