import { ref as u } from "vue";
import { defineStore as S } from "pinia";
import { s as n, Z as r, l as h } from "./start-CE9SawgU.js";
import "vue-i18n";
import "./header-Bn1EKnBE.js";
import { B as g } from "./base-B7u32Mej.js";
import { t as k } from "./TreeNodeValueController-Cy6eyeVx.js";
const d = `${g}Dimensions.`, O = {
  /** List etl processes */
  async getList(e) {
    return n.post(`${d}get`, e);
  },
  /** create entity */
  async getOne(e) {
    return n.post(`${d}getOne`, { id: e });
  }
}, t = `${g}Languages.`, _ = {
  /** List etl processes */
  async getList(e) {
    return n.post(`${t}getList`, e);
  },
  /** get scope */
  async get(e, a) {
    return n.post(`${t}get`, { id: e, freeze: a });
  },
  /** save scope */
  async save(e) {
    return n.post(`${t}save`, e);
  },
  /** create scope */
  async create(e) {
    return n.post(`${t}create`, e);
  },
  /** delete scope */
  async delete(e) {
    return n.post(`${t}delete`, { ids: e });
  },
  /** getListOfLanguagesScopesAndFields */
  async getListOfLanguagesScopesAndFields() {
    return n.post(
      `${t}getListOfLanguagesScopesAndFields`
    );
  }
}, F = `${g}ETL.`, B = {
  /** Return possible change tracking modes */
  async getChangeTrackingModes() {
    return n.post(`${F}getChangeTrackingModes`);
  }
}, K = S("DataHub-dataTypes", () => {
  const e = u({}), a = u({}), {
    data: p,
    isLoading: l,
    api: L
  } = r({
    apiFn: O.getList
  }), {
    data: f,
    isLoading: $,
    api: y
  } = r({
    apiFn: h.listCurrencies
  }), {
    data: m,
    isLoading: A,
    api: C
  } = r({
    apiFn: _.getList
  }), {
    data: T,
    isLoading: v,
    api: E
  } = r({
    apiFn: B.getChangeTrackingModes
  }), c = ({
    attributeId: i,
    scopeId: o,
    languageId: s,
    entityId: D
  }) => `${i}-${o}-${s}-${D}`;
  async function M(i, o) {
    const s = c(i);
    try {
      return a.value[s] = !0, e.value[s] || (e.value[s] = o.configuration?.alternativeConfiguration ? n.post(
        o.configuration.alternativeConfiguration.url,
        {
          ...i,
          ...o.configuration.alternativeConfiguration.params
        }
      ) : k.getTree(i)), await e.value[s];
    } finally {
      a.value[s] = !1;
    }
  }
  return {
    currencies: f,
    isCurrenciesLoading: $,
    dimensions: p,
    isDimensionsLoading: l,
    languages: m,
    isLanguagesLoading: A,
    treeNodes: e,
    isTreeNodesLoading: a,
    changeTrackingModes: T,
    isChangeTrackingModesLoading: v,
    ensureDimensions: L,
    ensureCurrencies: y,
    ensureLanguages: C,
    ensureChangeTrackingModes: E,
    fetchTreeNodes: M,
    getTreeNodeKey: c
  };
});
export {
  O as d,
  _ as l,
  K as u
};
