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

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

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

const o = ':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;grid-template-columns:1fr min-content min-content;grid-template-areas:"label label label" "input cancel export";grid-gap:var(--spacing-gap-l)}.header .label{grid-area:label}.header .input{grid-area:input}.header .cancel{grid-area:cancel}.header .export{grid-area:export}';

const l = class {
  constructor(i) {
    t(this, i);
    this.componentDidRenderFirstTime = e(this, "componentDidRenderFirstTime", 7);
    this.renderedFirstTime = false;
    // 7.LISTENERS //
    // 8.PUBLIC METHODS API //
    // 9.LOCAL METHODS //
        this.exportHandler = () => {
      var t;
      if (this.exportCallback) {
        this.notExporting = false;
        const e = {
          directoryName: this.exportInputEl.value,
          Objects: (t = this.bpmObjectSelectorEl.selection) !== null && t !== void 0 ? t : {
            includeAll: false,
            objectIds: []
          }
        };
        this.exportCallback(e).then((() => {
          this.notExporting = true;
        })).catch((() => {
          // error handling
          this.notExporting = true;
        }));
      }
    };
    this.inputHandle = async () => {
      var t;
      this.emptyInput = !((t = this.exportInputEl.value) === null || t === void 0 ? void 0 : t.length);
    };
    this.handleSelectionChanged = () => {
      this.emptyObjects = !this.bpmObjectSelectorEl.selection.objectIds.length;
    };
    this.emptyInput = true;
    this.emptyObjects = true;
    this.notExporting = true;
    this.displayTitle = false;
    this.exportCallback = undefined;
    this.cancelCallback = undefined;
    this.addCallback = undefined;
    this.referencesCallback = undefined;
  }
  // 6.COMPONENT LIFECYCLE METHODS //
  async componentWillLoad() {
    this._componentLocale = await s.getComponentStrings(this.el);
  }
  componentDidRender() {
    if (!this.renderedFirstTime) {
      this.componentDidRenderFirstTime.emit(this._componentLocale.componentName);
      this.renderedFirstTime = true;
    }
  }
  // 10.RENDER() FUNCTION //
  render() {
    return i(a, {
      class: "gx-ide-component"
    }, i("div", {
      class: "gx-ide-main-wrapper"
    }, i("gx-ide-container", {
      slimmerFooter: n.gxIdeContainer.slimmerFooter
    }, i("div", {
      class: "header"
    }, i("label", {
      htmlFor: "export-directory",
      class: "label"
    }, this._componentLocale.main.exportInputLabel), i("input", {
      type: "text",
      id: "export-directory",
      class: "input-text input",
      onInput: this.inputHandle,
      ref: t => this.exportInputEl = t
    }), i("button", {
      class: "export",
      disabled: this.emptyInput || this.emptyObjects,
      onClick: this.exportHandler
    }, this._componentLocale.main.exportButton), i("button", {
      class: "cancel",
      disabled: this.notExporting,
      onClick: this.cancelCallback
    }, this._componentLocale.main.cancelButton)), i("gx-ide-bpm-objects-selector", {
      id: "gx-ide-bpm-objects-selector",
      addCallback: this.addCallback,
      referencesCallback: this.referencesCallback,
      ref: t => this.bpmObjectSelectorEl = t,
      onSelectionChanged: this.handleSelectionChanged
    }))));
  }
  static get assetsDirs() {
    return [ "gx-ide-assets/bpm-export-xpdl" ];
  }
  get el() {
    return r(this);
  }
};

l.style = o;

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