'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index = require('./index-cba1c3ae.js');
const store = require('./store-49e3b933.js');
require('./getHandlebarsHelpers-7b2b1728.js');
require('./_commonjsHelpers-a5111d61.js');
require('./logic-d8c34975.js');
require('./index-1f381af8.js');
require('./localforage-af1b8c0e.js');

const TemplateBlock = class {
  constructor(hostRef) {
    index.registerInstance(this, hostRef);
    this.zoom = 1;
    this.resize = false;
    this.allowFullscreen = false;
    this.disablePositioning = false;
  }
  componentDidLoad() {
    try {
      this.templateEl.shadowRoot.querySelector(".contract-header").remove();
      this.templateEl.shadowRoot.querySelector(".contract-footer").remove();
    }
    catch (e) {
      console.log(e);
    }
    if (!this.disablePositioning)
      return;
    const renderWrapperEl = this.templateEl.shadowRoot.querySelector(".render-wrapper");
    if (renderWrapperEl)
      renderWrapperEl.style.position = "relative";
  }
  render() {
    var _a, _b;
    const template = this.template ||
      ((_b = (_a = store.state.templates) === null || _a === void 0 ? void 0 : _a.find) === null || _b === void 0 ? void 0 : _b.call(_a, (template) => (template === null || template === void 0 ? void 0 : template.id) === this.templateId));
    const helpers = this.helpers || (store.state === null || store.state === void 0 ? void 0 : store.state.helpers) || {};
    const partials = (this.partials || store.state.templates || [])
      .filter((template) => !!(template === null || template === void 0 ? void 0 : template.partial))
      .map((partial) => ({
      html: (partial === null || partial === void 0 ? void 0 : partial.html) || "",
      id: (partial === null || partial === void 0 ? void 0 : partial.id) || null,
    }));
    return (index.h("fireenjin-render-template", { ref: (el) => (this.templateEl = el), disableFrame: true, template: template, templateId: this.templateId, data: this.data, helpers: helpers, partials: partials, zoom: this.zoom, allowFullscreen: this.allowFullscreen, resize: this.resize, rawHtml: this.rawHtml }));
  }
};

exports.floodteam_template = TemplateBlock;
