import { r as t, c as i, h as e, H as a, a as n } from "./p-9b9ccd0c.js";

import { c as s } from "./p-c5196b3b.js";

import { L as o } from "./p-311eedf3.js";

const r = ":host{display:grid;block-size:100%}.opacity-0{opacity:0}.gxi-hidden{display:none !important}.align-center{display:flex;align-items:center}.align-end{display:flex;align-items:end}.overflow-auto{overflow:auto}:host(.gx-ide-component){height:100% !important;display:flex !important;flex-direction:column !important}.gx-ide-main-wrapper{color:var(--gx-ide-component-text-color);font-weight:var(--font-style-regular);font-size:var(--font-size-body-m);font-family:var(--font-family-body);height:100%;display:flex;flex-direction:column;flex-grow:1;box-sizing:border-box}.buttons-container{display:flex;gap:var(--spacing-gap-m)}.giu-static-pill-icon-and-text,.giu-static-pill{background-color:var(--elevation-background-color, var(--color-accent-surface-elevation-1));padding-inline:var(--spacing-padding-m);color:var(--color-text-neutral-default);font-size:var(--font-size-body-s);line-height:var(--line-height-relaxed);font-weight:var(--font-style-regular);border-radius:4px;min-block-size:25px;display:inline-grid;align-items:center;pointer-events:none;inline-size:max-content}.giu-static-pill-icon-and-text{display:inline-grid;grid-auto-flow:column;grid-auto-columns:max-content;gap:var(--spacing-gap-m)}.tab-full-width-buttons::part(tab-list block-start),.tab-full-width-buttons::part(tab-list block-end){grid-auto-columns:1fr}.tab-full-width-buttons::part(tab block-start){justify-content:center}.tree-view::part(item__header){--icon__system_warning_warning--disabled:var(\n    --icon__system_warning_warning--enabled\n  )}.tabular-grid{--focus-outline-width:1px}.control-wrapper{display:flex;gap:var(--spacing-gap-m);align-items:center}.control-wrapper--vertical{flex-direction:column;align-items:start}.controls-wrapper{display:flex;gap:var(--spacing-gap-m)}.controls-wrapper--vertical{flex-direction:column;align-items:start}.input-text{box-sizing:border-box;background-color:transparent;border:1px solid var(--color-border-neutral-default);border-radius:4px;height:26px;color:var(--color-text-neutral-default);font-size:var(--font-size-body-xs)}.input-text--full-width{align-self:stretch}:host{display:block}.header{display:grid;align-items:center;grid-template-columns:max-content 1fr min-content;gap:var(--spacing-gap-l)}.hidden-input{display:none}";

const l = class {
  constructor(e) {
    t(this, e);
    this.componentDidRenderFirstTime = i(this, "componentDidRenderFirstTime", 7);
    this.renderedFirstTime = false;
    // 7.LISTENERS //
    // 8.PUBLIC METHODS API //
    // 9.LOCAL METHODS //
        this.loadFileHandle = async () => {
      this.fileInput.click();
    };
    this.handleFileInputChange = t => {
      const i = t.target;
      if (i.files && i.files.length > 0) {
        const t = i.files[0];
        this.selectedFile = t;
        this.pathValue = this.selectedFile.name;
      }
      this.fileInput.value = null;
    };
    this.handlePathInputChange = t => {
      this.selectedFile = null;
      const i = t.target;
      const e = i.value;
      this.pathValue = e;
    };
    this.confirmCallbackHandle = async () => {
      if (this.confirmCallback) {
        const t = this.pathValue.replace(/^.*?([^\\\/]*)$/, "$1").toLowerCase().trim();
        if (t === ".gxpm" || !t.endsWith(".gxpm")) {
          return;
        }
        const i = this.selectedFile ? this.selectedFile : new File([ this.pathValue ], t);
        const e = {
          automaticBackup: this.automaticBackupEl.value === "true",
          file: i
        };
        await this.confirmCallback(e);
        this.fileInput.value = null;
        this.selectedFile = null;
        this.pathValue = "";
        this.automaticBackupEl.value = "false";
      }
    };
    this.selectedFile = null;
    this.pathValue = "";
    this.displayTitle = false;
    this.confirmCallback = undefined;
    this.cancelCallback = undefined;
  }
  // 6.COMPONENT LIFECYCLE METHODS //
  async componentWillLoad() {
    this._componentLocale = await o.getComponentStrings(this.el);
  }
  componentDidRender() {
    if (!this.renderedFirstTime) {
      this.componentDidRenderFirstTime.emit(this._componentLocale.componentName);
      this.renderedFirstTime = true;
    }
  }
  // 10.RENDER() FUNCTION //
  render() {
    return e(a, {
      class: "gx-ide-component"
    }, e("div", {
      class: "gx-ide-main-wrapper"
    }, e("gx-ide-container", {
      slimmerFooter: s.gxIdeContainer.slimmerFooter
    }, e("div", {
      class: "header"
    }, e("label", {
      htmlFor: "project-path"
    }, this._componentLocale.main.projectPathInputLabel), e("input", {
      type: "text",
      class: "input-text",
      id: "project-path",
      value: this.pathValue,
      onChange: this.handlePathInputChange
    }), e("input", {
      type: "file",
      id: "input_file",
      accept: ".gxpm",
      ref: t => this.fileInput = t,
      onChange: this.handleFileInputChange,
      class: "hidden-input"
    }), e("button", {
      onClick: this.loadFileHandle
    }, this._componentLocale.main.addFilesButton)), e("div", {
      class: "control-wrapper"
    }, e("label", {
      htmlFor: "automatic-backup"
    }, this._componentLocale.main.automaticBackupCheckboxLabel), e("ch-checkbox", {
      id: "automatic-backup",
      accessibleName: "automatic-backup",
      checkedValue: "true",
      unCheckedValue: "false",
      value: "checked",
      ref: t => this.automaticBackupEl = t
    })), e("button", {
      slot: "footer-end",
      onClick: this.cancelCallback
    }, this._componentLocale.footer.cancelButton), e("button", {
      slot: "footer-end",
      onClick: this.confirmCallbackHandle
    }, this._componentLocale.footer.confirmButton))));
  }
  static get assetsDirs() {
    return [ "gx-ide-assets/bpm-import-gxpm" ];
  }
  get el() {
    return n(this);
  }
};

l.style = r;

export { l as gx_ide_bpm_import_gxpm };
//# sourceMappingURL=p-dbf9a97d.entry.js.map