import { r as registerInstance, h, H as Host } from './index-acdc1ac0.js';
import './data-model-bb5789f5.js';
import './User-e14f1ece.js';
import { P as Product } from './product-eb03beb4.js';

const DevingenProductPage = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
    this.fetchProduct = async () => {
      const { id } = this.match.params;
      const productResponse = await this.apiDevingen.getProduct(id).catch((e) => this.error = e);
      if (!productResponse)
        return;
      this.product = Product.decode(productResponse);
    };
  }
  componentWillLoad() {
    this.fetchProduct();
  }
  render() {
    const { apiData, apiDevingen, product, products, workspaceOwnerships } = this;
    if (!product) {
      return (h("div", { class: "d-flex justify-content-center pt-3" }, h("dvn-progress", { indefinite: true })));
    }
    const Tag = `devingen-product-root-${product.type}`;
    return (h(Host, null, h(Tag, { apiData: apiData, apiDevingen: apiDevingen, product: product, products: products, workspaceOwnerships: workspaceOwnerships })));
  }
};

export { DevingenProductPage as devingen_product_page };
