import { defineComponent as k, ref as S, watch as G, createBlock as g, openBlock as m, unref as e, withCtx as l, createVNode as t, createTextVNode as z, toDisplayString as v, createElementVNode as V, computed as ee, mergeProps as H, createSlots as ue, mergeModels as de, useModel as te, createElementBlock as x, Fragment as U, renderList as W, onBeforeMount as me, createCommentVNode as pe, resolveDynamicComponent as fe } from "vue";
import { useI18n as O } from "vue-i18n";
import { o as I, ay as be, az as he, f as ae, g as F, a as M, j as ve, c as ge, aA as le, aB as q, aC as ye, a7 as w, V as Se, W as _e, a9 as Ae, a3 as Ce, K as we, ah as ze, am as Me, E as B, R as Te, J as D, af as J, ag as X, i as Ee, _ as Ve, b as Ie, h as Pe, I as Be, X as ke, Y as Le, $ as De, Z as $e, a0 as xe, a1 as Ue, aD as Oe } from "./start-BYfL32Oe.mjs";
import "pinia";
import "vue-router";
import "./header-Droxy2Kd.mjs";
import "./moment-h96o7c8I.mjs";
import { B as Ne } from "./base-CD_Q6J1k.mjs";
import "./IsActiveStatusCell-DlvB6_E-.mjs";
import "@vuelidate/validators";
import "./MultiLangScopeEditorsList.vue_vue_type_script_setup_true_lang-CWQeDnSm.mjs";
import "./DatahubDataTypeCompletenessRenderer.vue_vue_type_script_setup_true_lang-Btvu_WeF.mjs";
import "./topBarRoutes-0VuQ_i6D.mjs";
import "./VariantToVariantExtension-WcLvPNqG.mjs";
import "./DatahubDataTypeVariantValueEditor-f1gR3QCx.mjs";
import { B as Re } from "./base-CZBAM3Up.mjs";
const R = `${Re}ETL.`, We = {
  /** Change the cron-line of the cronjob spawning the ETL-job */
  async changeEtlSpawnCronLine(n) {
    return I.post(`${R}changeEtlSpawnCronLine`, {
      cronLine: n
    });
  },
  /** Spawn ETL job */
  async spawnJob() {
    return I.post(`${R}spawnJob`);
  },
  /** Return possible change tracking modes */
  async getChangeTrackingModes() {
    return I.post(`${R}getChangeTrackingModes`);
  }
}, Fe = be, ne = `${Fe}PimChannelsConnection.`, qe = `${ne}Mapping.`, Ye = {
  /** getAttributeSetMappingsForProducts */
  async getAttributeSetMappingsForProducts(n) {
    return I.post(
      `${qe}getAttributeSetMappingsForProducts`,
      n
    );
  }
};
var T = /* @__PURE__ */ ((n) => (n.ALL = "all", n.CUSTOM = "custom", n.FILTER = "filter", n))(T || {}), P = /* @__PURE__ */ ((n) => (n.ACTIVE = "active", n.INACTIVE = "inactive", n.NOT_AVAILABLE = "not_available", n))(P || {});
const Ge = `${ne}Offers.`, je = {
  /** getAttributeSetMappingsForProducts */
  async deferBulkCreateOffersFromPim(n) {
    return I.post(
      `${Ge}deferBulkCreateOffersFromPim`,
      n
    );
  }
}, ie = /* @__PURE__ */ k({
  __name: "StepSelectConnection",
  props: {
    value: {}
  },
  emits: ["validated"],
  setup(n, { emit: c }) {
    const p = c, { t: s } = O(), i = S({
      connection: void 0,
      noDuplicates: !0,
      productSelection: T.CUSTOM
    }), _ = {
      connection: ye,
      noDuplicates: {},
      productSelection: {}
    }, { v$: b } = he({ rules: _, form: i });
    return G(
      [() => {
        var f;
        return (f = b.value) == null ? void 0 : f.$invalid;
      }, i],
      ([f]) => p(
        "validated",
        f ? void 0 : {
          connectionId: i.value.connection.id,
          noDuplicates: i.value.noDuplicates,
          productSelection: i.value.productSelection
        }
      ),
      { immediate: !0, deep: !0 }
    ), (f, a) => (m(), g(e(ae), { fluid: "" }, {
      default: l(() => [
        t(e(F), null, {
          default: l(() => [
            t(e(M), {
              cols: "12",
              sm: "10",
              md: "8",
              lg: "6",
              xl: "4"
            }, {
              default: l(() => [
                t(e(M), null, {
                  default: l(() => [
                    z(v(e(s)(
                      "pim-channels-plugin.channels-from-pim-wizard.connectionDescription"
                    )), 1)
                  ]),
                  _: 1
                }),
                t(e(M), null, {
                  default: l(() => {
                    var r;
                    return [
                      t(e(ve), {
                        data: "Actindo.Modules.Actindo.Channels.Connections.listConnections?listOnlyActiveSynced=true",
                        label: e(s)("pim-channels-plugin.channels-from-pim-wizard.connection"),
                        "custom-query": { listOnlyActiveSynced: !0 },
                        "item-title": "name",
                        "item-value": "id",
                        text: ((r = i.value.connection) == null ? void 0 : r.name) ?? e(s)("pim-channels-plugin.channels-from-pim-wizard.selectConnection"),
                        "page-size": "",
                        select: "",
                        search: "",
                        block: "",
                        onChange: a[0] || (a[0] = (y) => e(b).connection.$model = y)
                      }, null, 8, ["label", "text"])
                    ];
                  }),
                  _: 1
                }),
                t(e(M), null, {
                  default: l(() => [
                    t(e(ge), {
                      modelValue: e(b).noDuplicates.$model,
                      "onUpdate:modelValue": a[1] || (a[1] = (r) => e(b).noDuplicates.$model = r),
                      label: e(s)(
                        "pim-channels-plugin.channels-from-pim-wizard.confirmDuplicates"
                      )
                    }, null, 8, ["modelValue", "label"])
                  ]),
                  _: 1
                }),
                t(e(M), null, {
                  default: l(() => [
                    V("p", null, v(e(s)(
                      "pim-channels-plugin.channels-from-pim-wizard.selectProductsTitle"
                    )), 1),
                    t(e(le), {
                      modelValue: e(b).productSelection.$model,
                      "onUpdate:modelValue": a[2] || (a[2] = (r) => e(b).productSelection.$model = r)
                    }, {
                      default: l(() => [
                        t(e(q), {
                          label: e(s)("pim-channels-plugin.channels-from-pim-wizard.allProducts"),
                          value: e(T).ALL
                        }, null, 8, ["label", "value"]),
                        t(e(q), {
                          label: e(s)("pim-channels-plugin.channels-from-pim-wizard.customProduct"),
                          value: e(T).CUSTOM
                        }, null, 8, ["label", "value"])
                      ]),
                      _: 1
                    }, 8, ["modelValue"])
                  ]),
                  _: 1
                })
              ]),
              _: 1
            })
          ]),
          _: 1
        })
      ]),
      _: 1
    }));
  }
});
function E(n) {
  const c = n;
  c.__i18n = c.__i18n || [], c.__i18n.push({
    locale: "",
    resource: {
      "en-US": {
        "pim-channels-plugin": {
          "channels-from-pim-wizard": {
            noSetMap: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Attribute set not defined" } },
            etlMode: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "ETL mode" } },
            initialOfferStatus: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Initial offer status" } },
            statistic: {
              matched: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Matched" } },
              notMatched: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Not matched (unclear)" } },
              impossible: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Not matched (not possible)" } },
              duplicateNo: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Already have offers on this connection and would create duplicates" } },
              duplicateYes: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Already have offers on this connection and will create duplicates" } }
            },
            table: {
              mapAttributeSets: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Map attribute sets" } },
              sourceAttributeSet: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Source attribute set" } },
              destinationAttributeSet: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Destination attribute set" } },
              selectAll: { t: 0, b: { t: 2, i: [{ t: 3, v: "Select all " }, { t: 4, k: "count" }, { t: 3, v: " products" }] } },
              sku: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "SKU" } },
              modified: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Modified on" } },
              modifiedByUsername: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Modified by" } },
              createdByUsername: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Created by" } },
              frozenByName: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Frozen by (name)" } },
              variantStatus: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Variant status" } },
              frozenDate: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Frozen date" } },
              frozenByMe: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Frozen by me" } },
              productType: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Product Type" } },
              lifecycleStatus: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Life cycle status" } },
              lifecycleStatusChangedAt: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Life cycle status changed at" } },
              lifecycleStatusChangedByUsername: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Life cycle status changed by (name)" } }
            },
            statuses: {
              offer: {
                active: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Active" } },
                inactive: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Inactive" } },
                notAvailable: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Offline" } }
              },
              variant: {
                MASTER: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Master" } },
                CHILD: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Child" } },
                SINGLE: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Single" } }
              },
              lifecycle: {
                active: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Active" } },
                archive: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Archive" } },
                recycleBin: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Recycle bin" } }
              }
            },
            createOffer: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Create offers" } },
            allProducts: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "All products" } },
            customProduct: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Product selection" } },
            selectProductsTitle: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Please select products which you want to create offers from:" } },
            connection: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Connection" } },
            connectionDescription: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Please select a connection which you want to create offers for. " } },
            confirmDuplicates: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Create only offers for products which do not have an offer on the selected connection yet. This prevents the creation of duplicate offers." } },
            selectConnection: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Select connection" } },
            selectProducts: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Select products" } },
            selectETLMode: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Select ETL mode and status" } },
            Summary: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Summary" } }
          }
        }
      },
      "de-DE": {
        "pim-channels-plugin": {
          "channels-from-pim-wizard": {}
        }
      }
    }
  });
}
typeof E == "function" && E(ie);
const K = `${Ne}PIM.`, Q = {
  /** Get a list of pim Products that are not in archive and not in recycle bin */
  async listProducts(n) {
    return I.post(`${K}listProducts`, n);
  },
  /** Get column definitions of Entity by entity type class name */
  async getColumnDefinitions(n) {
    return I.post(`${K}getColumnDefinitions`, n);
  }
}, $ = [
  "pim-channels-plugin.channels-from-pim-wizard.selectConnection",
  "pim-channels-plugin.channels-from-pim-wizard.selectProducts",
  "pim-channels-plugin.channels-from-pim-wizard.selectETLMode",
  "pim-channels-plugin.channels-from-pim-wizard.Summary"
], se = {
  active: {
    icon: "check_circle",
    label: "pim-channels-plugin.channels-from-pim-wizard.statuses.lifecycle.active",
    color: "positive_gradient_1"
  },
  in_archive: {
    icon: "pause",
    label: "pim-channels-plugin.channels-from-pim-wizard.statuses.lifecycle.archive",
    color: "on_light_64"
  },
  in_recycle_bin: {
    icon: "cancel",
    label: "pim-channels-plugin.channels-from-pim-wizard.statuses.lifecycle.recycleBin",
    color: "on_light"
  }
}, oe = {
  master: "pim-channels-plugin.channels-from-pim-wizard.statuses.variant.MASTER",
  child: "pim-channels-plugin.channels-from-pim-wizard.statuses.variant.CHILD",
  single: "pim-channels-plugin.channels-from-pim-wizard.statuses.variant.SINGLE"
}, He = {
  data: Q.listProducts,
  gridId: "pim-products-list",
  dynamicColumnsEndpoint: Q.getColumnDefinitions,
  entityTypeClassName: "Actindo\\Modules\\Actindo\\PIM\\Models\\PIMProduct",
  rowSelection: _e.MULTI,
  hideGlobalSearch: !1,
  hideFilters: !1,
  lockedProperty: "frozenByName",
  hideColumnCustomization: !1,
  hidePagination: !1,
  sortType: Se.NONE,
  channels: !0,
  languages: !0,
  columns: [
    {
      id: "id",
      header: "common.id",
      minWidth: 200,
      isVisible: !1,
      filterable: w.NUMERIC,
      sortable: !0,
      properties: { hidden: !0 }
    },
    {
      id: "sku",
      header: "pim-channels-plugin.channels-from-pim-wizard.table.sku",
      minWidth: 200,
      filterable: w.STRING,
      sortable: !0
    },
    {
      id: "lifecycleStatus",
      header: "pim-channels-plugin.channels-from-pim-wizard.table.lifecycleStatus",
      minWidth: 200,
      width: 200,
      filterable: w.LIST,
      filterListValues: Object.entries(se).map(
        ([n, { label: c }]) => ({ value: n, title: c })
      ),
      sortable: !0
    },
    {
      id: "lifecycleStatusChangedByUsername",
      header: "pim-channels-plugin.channels-from-pim-wizard.table.lifecycleStatusChangedByUsername",
      minWidth: 200,
      isVisible: !1,
      filterable: !1,
      sortable: !1
    },
    {
      id: "lifecycleStatusChangedAt",
      header: "pim-channels-plugin.channels-from-pim-wizard.table.lifecycleStatusChangedAt",
      minWidth: 200,
      isVisible: !1,
      filterable: w.DATE,
      sortable: !0
    },
    {
      id: "attributeSetName",
      header: "pim-channels-plugin.channels-from-pim-wizard.table.productType",
      minWidth: 200,
      filterable: w.STRING,
      sortable: !0
    },
    {
      id: "frozenByName",
      header: "pim-channels-plugin.channels-from-pim-wizard.table.frozenByName",
      minWidth: 200,
      filterable: !1,
      sortable: !1
    },
    {
      id: "frozenDate",
      header: "pim-channels-plugin.channels-from-pim-wizard.table.frozenDate",
      minWidth: 200,
      isVisible: !1,
      filterable: w.DATE,
      sortable: !0
    },
    {
      id: "isFrozenByMe",
      header: "pim-channels-plugin.channels-from-pim-wizard.table.frozenDate",
      renderer: "CheckboxCell",
      minWidth: 200,
      isVisible: !1,
      filterable: w.BOOLEAN,
      sortable: !0
    },
    {
      id: "variantStatus",
      header: "pim-channels-plugin.channels-from-pim-wizard.table.variantStatus",
      minWidth: 200,
      isVisible: !1,
      filterable: w.LIST,
      filterListValues: Object.entries(oe).map(
        ([n, c]) => ({ value: n, title: c })
      ),
      sortable: !0
    },
    {
      id: "created",
      header: "common.created",
      minWidth: 200,
      isVisible: !1,
      filterable: w.DATE,
      sortable: !0
    },
    {
      id: "createdByUsername",
      header: "pim-channels-plugin.channels-from-pim-wizard.table.createdByUsername",
      minWidth: 200,
      isVisible: !1,
      filterable: !1,
      sortable: !1
    },
    {
      id: "modified",
      header: "pim-channels-plugin.channels-from-pim-wizard.table.modified",
      minWidth: 200,
      isVisible: !1,
      filterable: w.DATE,
      sortable: !0
    },
    {
      id: "modifiedByUsername",
      header: "pim-channels-plugin.channels-from-pim-wizard.table.modifiedByUsername",
      minWidth: 200,
      isVisible: !1,
      filterable: !1,
      sortable: !1
    }
  ]
}, Je = [
  {
    id: "sourceSet.name",
    header: "pim-channels-plugin.channels-from-pim-wizard.table.sourceAttributeSet"
  },
  {
    id: "destination",
    header: "pim-channels-plugin.channels-from-pim-wizard.table.destinationAttributeSet"
  }
], re = /* @__PURE__ */ k({
  __name: "StepSelectProducts",
  props: {
    value: {}
  },
  emits: ["next", "validated"],
  setup(n, { emit: c }) {
    const p = c, { t: s } = O({ useScope: "parent" }), i = S(), _ = S({
      filter: [
        {
          property: "variantStatus",
          operator: "!=",
          value: "child",
          active: 1
        }
      ],
      sort: [{ field: "id", order: "DESC" }],
      serializeOptionals: ["_pim_art_name", "_pim_variants", "_pim_images"]
    }), b = ee(() => {
      var a;
      return ((a = i.value) == null ? void 0 : a.table.rowCount.value) || 0;
    });
    function f() {
      var a;
      p("validated", {
        productIds: [],
        productSelection: T.FILTER,
        listProductsRequest: (a = i.value) == null ? void 0 : a.prepareDataRequestPayload()
      }), p("next");
    }
    return G(
      () => {
        var a;
        return (a = i.value) == null ? void 0 : a.table.selectedRows.value;
      },
      (a) => {
        var r;
        p(
          "validated",
          a != null && a.length ? {
            productIds: Ae(a),
            productSelection: T.CUSTOM,
            listProductsRequest: (r = i.value) == null ? void 0 : r.prepareDataRequestPayload()
          } : void 0
        );
      },
      { immediate: !0, deep: !0 }
    ), (a, r) => (m(), g(e(Ce), H({
      ref_key: "table",
      ref: i,
      "custom-query": _.value,
      "page-sizes": [5, 10, 25],
      "page-size": 5
    }, e(He)), ue({
      "cell-lifecycleStatus": l(({ cellValue: y }) => [
        t(e(Me), {
          options: e(se)[y]
        }, null, 8, ["options"])
      ]),
      "cell-variantStatus": l(({ cellValue: y }) => [
        z(v(e(s)(e(oe)[y])), 1)
      ]),
      rowDisabled: l(() => [
        t(e(we), {
          text: e(s)("pim-tables.productIsLocked")
        }, {
          activator: l(({ props: y }) => [
            t(e(ze), H({
              icon: "lock",
              class: "ml-3"
            }, y), null, 16)
          ]),
          _: 1
        }, 8, ["text"])
      ]),
      _: 2
    }, [
      b.value ? {
        name: "actionButtons",
        fn: l(() => [
          t(e(B), {
            variant: "elevated",
            text: e(s)("pim-channels-plugin.channels-from-pim-wizard.table.selectAll", {
              count: b.value
            }),
            onClick: f
          }, null, 8, ["text"])
        ]),
        key: "0"
      } : void 0
    ]), 1040, ["custom-query"]));
  }
});
typeof E == "function" && E(re);
const Z = /* @__PURE__ */ k({
  __name: "RadioButtons",
  props: /* @__PURE__ */ de({
    options: {},
    loading: { type: Boolean },
    readonly: { type: Boolean }
  }, {
    modelValue: {},
    modelModifiers: {}
  }),
  emits: ["update:modelValue"],
  setup(n) {
    const c = te(n, "modelValue");
    return (p, s) => (m(), g(e(le), {
      modelValue: c.value,
      "onUpdate:modelValue": s[0] || (s[0] = (i) => c.value = i)
    }, {
      default: l(() => [
        p.loading ? (m(), g(e(Te), {
          key: 0,
          type: "list-item-avatar@3"
        })) : (m(!0), x(U, { key: 1 }, W(p.options, ({ id: i, name: _ }) => (m(), g(e(q), {
          key: i,
          label: _,
          value: i,
          readonly: p.readonly
        }, null, 8, ["label", "value", "readonly"]))), 128))
      ]),
      _: 1
    }, 8, ["modelValue"]));
  }
}), Y = /* @__PURE__ */ k({
  __name: "StepEtlMode",
  props: {
    value: {},
    readonly: { type: Boolean }
  },
  emits: ["validated"],
  setup(n, { emit: c }) {
    const p = n, s = c, { t: i } = O(), _ = S(!1), b = S([]), f = S(!0), a = S({
      attributeSetMap: [],
      clear: 0,
      ambiguous: 0,
      impossible: 0,
      existingOffer: 0
    }), r = S({
      changeTracking: 2,
      initialStatus: P.ACTIVE,
      attributeSetMapping: []
    }), y = ee(() => [
      {
        id: P.ACTIVE,
        name: i(
          "pim-channels-plugin.channels-from-pim-wizard.statuses.offer.active"
        )
      },
      {
        id: P.INACTIVE,
        name: i(
          "pim-channels-plugin.channels-from-pim-wizard.statuses.offer.inactive"
        )
      },
      {
        id: P.NOT_AVAILABLE,
        name: i(
          "pim-channels-plugin.channels-from-pim-wizard.statuses.offer.notAvailable"
        )
      }
    ]);
    function N(o, u) {
      const d = o.targetSets.length, A = u.targetSets.length;
      return d >= 2 && A < 2 ? -1 : A >= 2 && d < 2 ? 1 : d === 0 && A !== 0 ? -1 : A === 0 && d > 0 ? 1 : o.productCount > u.productCount ? -1 : 1;
    }
    async function C() {
      try {
        f.value = !0;
        const o = {
          ...p.value,
          attributeSetMapping: r.value.attributeSetMapping
        };
        a.value = await Ye.getAttributeSetMappingsForProducts(o), a.value.attributeSetMap.sort(N);
      } finally {
        f.value = !1;
      }
    }
    function h(o, u, d) {
      r.value.attributeSetMapping[d] = { sourceSetId: o, targetSetId: u }, C();
    }
    return me(async () => {
      C();
      try {
        _.value = !0;
        const { data: o } = await We.getChangeTrackingModes();
        b.value = o;
      } finally {
        _.value = !1;
      }
    }), G(
      [f, r],
      ([o]) => {
        const u = a.value.attributeSetMap.some(
          ({ targetSets: A }, L) => (A == null ? void 0 : A.length) > 1 && !r.value.attributeSetMapping[L]
        ), d = o || u || a.value.clear < 1;
        s("validated", d ? void 0 : r.value);
      },
      { immediate: !0, deep: !0 }
    ), (o, u) => (m(), g(e(ae), {
      fluid: "",
      class: "h-100 d-flex flex-column overflow-y-hidden"
    }, {
      default: l(() => [
        t(e(F), { class: "flex-grow-0" }, {
          default: l(() => [
            t(e(M), {
              cols: "12",
              sm: "4",
              class: "d-flex flex-column justify-space-between ga-2"
            }, {
              default: l(() => [
                t(e(D), {
                  type: "success",
                  variant: "tonal",
                  density: "comfortable"
                }, {
                  default: l(() => [
                    V("b", null, v(a.value.clear), 1),
                    z(" - " + v(e(i)("pim-channels-plugin.channels-from-pim-wizard.statistic.matched")), 1)
                  ]),
                  _: 1
                }),
                t(e(D), {
                  type: "warning",
                  variant: "tonal",
                  density: "comfortable"
                }, {
                  default: l(() => [
                    V("b", null, v(a.value.ambiguous), 1),
                    z(" - " + v(e(i)(
                      "pim-channels-plugin.channels-from-pim-wizard.statistic.notMatched"
                    )), 1)
                  ]),
                  _: 1
                }),
                t(e(D), {
                  type: "error",
                  variant: "tonal",
                  density: "comfortable"
                }, {
                  default: l(() => [
                    V("b", null, v(a.value.impossible), 1),
                    z(" - " + v(e(i)(
                      "pim-channels-plugin.channels-from-pim-wizard.statistic.impossible"
                    )), 1)
                  ]),
                  _: 1
                }),
                t(e(D), {
                  type: "info",
                  variant: "tonal",
                  density: "comfortable"
                }, {
                  default: l(() => [
                    V("b", null, v(a.value.existingOffer), 1),
                    z(" - " + v(e(i)(
                      o.value.noDuplicates ? "pim-channels-plugin.channels-from-pim-wizard.statistic.duplicateNo" : "pim-channels-plugin.channels-from-pim-wizard.statistic.duplicateYes"
                    )), 1)
                  ]),
                  _: 1
                })
              ]),
              _: 1
            }),
            t(e(M), {
              cols: "12",
              sm: "4"
            }, {
              default: l(() => [
                t(e(J), {
                  plain: "",
                  color: "transparent",
                  variant: "flat"
                }, {
                  default: l(() => [
                    t(e(X), { class: "form-title text-body-2" }, {
                      default: l(() => [
                        z(v(e(i)("pim-channels-plugin.channels-from-pim-wizard.etlMode")), 1)
                      ]),
                      _: 1
                    }),
                    t(Z, {
                      modelValue: r.value.changeTracking,
                      "onUpdate:modelValue": u[0] || (u[0] = (d) => r.value.changeTracking = d),
                      loading: _.value,
                      options: b.value,
                      readonly: o.readonly
                    }, null, 8, ["modelValue", "loading", "options", "readonly"])
                  ]),
                  _: 1
                })
              ]),
              _: 1
            }),
            t(e(M), {
              cols: "12",
              sm: "4"
            }, {
              default: l(() => [
                t(e(J), {
                  plain: "",
                  color: "transparent",
                  variant: "flat"
                }, {
                  default: l(() => [
                    t(e(X), { class: "form-title text-body-2" }, {
                      default: l(() => [
                        z(v(e(i)(
                          "pim-channels-plugin.channels-from-pim-wizard.initialOfferStatus"
                        )), 1)
                      ]),
                      _: 1
                    }),
                    t(Z, {
                      modelValue: r.value.initialStatus,
                      "onUpdate:modelValue": u[1] || (u[1] = (d) => r.value.initialStatus = d),
                      options: y.value,
                      readonly: o.readonly
                    }, null, 8, ["modelValue", "options", "readonly"])
                  ]),
                  _: 1
                })
              ]),
              _: 1
            })
          ]),
          _: 1
        }),
        t(e(F), { class: "flex-grow-1 overflow-y-hidden my-2" }, {
          default: l(() => [
            t(e(Ee), {
              data: a.value.attributeSetMap,
              columns: e(Je),
              "table-name": e(i)(
                "pim-channels-plugin.channels-from-pim-wizard.table.mapAttributeSets"
              ),
              "is-loading": f.value,
              readonly: o.readonly,
              "hide-remove": "",
              "hide-global-search": ""
            }, {
              "cell-destination": l(({
                row: d,
                rowIndex: A
              }) => {
                var L, j;
                return [
                  (L = d.targetSets) != null && L.length ? d.targetSets.length === 1 ? (m(), g(e(Ie), {
                    key: 1,
                    "model-value": d.targetSets[0].name,
                    readonly: ""
                  }, null, 8, ["model-value"])) : (m(), g(e(Pe), {
                    key: 2,
                    "model-value": (j = r.value.attributeSetMapping[A]) == null ? void 0 : j.targetSetId,
                    items: d.targetSets,
                    "item-title": "name",
                    "item-value": "id",
                    "onUpdate:modelValue": (ce) => h(d.sourceSet.id, ce, A)
                  }, null, 8, ["model-value", "items", "onUpdate:modelValue"])) : (m(), g(e(Ve), {
                    key: 0,
                    icon: "error",
                    color: "alert"
                  }, {
                    default: l(() => [
                      z(v(e(i)("pim-channels-plugin.channels-from-pim-wizard.noSetMap")), 1)
                    ]),
                    _: 1
                  }))
                ];
              }),
              _: 1
            }, 8, ["data", "columns", "table-name", "is-loading", "readonly"])
          ]),
          _: 1
        })
      ]),
      _: 1
    }));
  }
});
typeof E == "function" && E(Y);
const Xe = { class: "flex-grow-1 overflow-auto ma-6" }, Ke = { class: "d-flex bg-gradient_2 pa-4" }, Qe = /* @__PURE__ */ k({
  __name: "PIMChannelsFromPIMWizard",
  props: {
    modelValue: { type: Boolean },
    modelModifiers: {}
  },
  emits: ["update:modelValue"],
  setup(n) {
    const c = te(n, "modelValue"), { t: p } = O(), s = S(1), i = S({}), _ = [ie, re, Y, Y], b = S(Array($.length - 1).fill(!1)), f = S(!1), a = S({
      connectionId: 0,
      productSelection: T.CUSTOM,
      noDuplicates: !0,
      productIds: [],
      listProductsRequest: {},
      attributeSetMapping: [],
      changeTracking: 2,
      initialStatus: P.ACTIVE
    });
    function r(C) {
      b.value[s.value - 1] = !!C, C && (a.value = { ...a.value, ...C }, i.value[2] = a.value.productSelection === T.ALL);
    }
    function y(C) {
      for (s.value += C; i.value[s.value]; )
        s.value += C;
    }
    async function N() {
      try {
        f.value = !0, await je.deferBulkCreateOffersFromPim(a.value), c.value = !1;
      } finally {
        f.value = !1;
      }
    }
    return (C, h) => (m(), g(e(Be), {
      modelValue: c.value,
      "onUpdate:modelValue": h[5] || (h[5] = (o) => c.value = o),
      height: "90%",
      "padding-bottom": "",
      "padding-x": "",
      "cancel-caption": "",
      "content-padding-y": "",
      persistent: ""
    }, {
      default: l(() => [
        t(e(ke), {
          modelValue: s.value,
          "onUpdate:modelValue": h[4] || (h[4] = (o) => s.value = o),
          class: "h-100 overflow-hidden d-flex flex-column"
        }, {
          default: l(() => [
            t(e(Le), { class: "bg-gradient_2 flex-shrink-0" }, {
              default: l(() => [
                (m(!0), x(U, null, W(e($), (o, u) => (m(), x(U, { key: u }, [
                  t(e(De), {
                    value: u + 1,
                    complete: s.value > u + 1,
                    title: e(p)(o)
                  }, null, 8, ["value", "complete", "title"]),
                  u < e($).length - 1 ? (m(), g(e($e), { key: 0 })) : pe("", !0)
                ], 64))), 128))
              ]),
              _: 1
            }),
            V("div", Xe, [
              t(e(xe), null, {
                default: l(() => [
                  (m(), x(U, null, W(_, (o, u) => t(e(Ue), {
                    key: u,
                    value: u + 1
                  }, {
                    default: l(() => [
                      (m(), g(fe(o), {
                        value: a.value,
                        readonly: s.value === 4,
                        onValidated: r,
                        onNext: h[0] || (h[0] = (d) => y(1))
                      }, null, 40, ["value", "readonly"]))
                    ]),
                    _: 2
                  }, 1032, ["value"])), 64))
                ]),
                _: 1
              })
            ]),
            V("div", Ke, [
              t(e(B), {
                variant: "outlined",
                color: "background",
                disabled: s.value <= 1,
                text: e(p)("common.back"),
                onClick: h[1] || (h[1] = (o) => y(-1))
              }, null, 8, ["disabled", "text"]),
              t(e(Oe)),
              t(e(B), {
                variant: "text",
                color: "background",
                text: e(p)("common.cancel"),
                onClick: h[2] || (h[2] = (o) => c.value = !1)
              }, null, 8, ["text"]),
              s.value < e($).length ? (m(), g(e(B), {
                key: 0,
                variant: "elevated",
                loading: f.value,
                disabled: !b.value[s.value - 1],
                text: e(p)("common.continue"),
                onClick: h[3] || (h[3] = (o) => y(1))
              }, null, 8, ["loading", "disabled", "text"])) : (m(), g(e(B), {
                key: 1,
                variant: "elevated",
                loading: f.value,
                disabled: !b.value[s.value - 1],
                text: e(p)("pim-channels-plugin.channels-from-pim-wizard.createOffer"),
                onClick: N
              }, null, 8, ["loading", "disabled", "text"]))
            ])
          ]),
          _: 1
        }, 8, ["modelValue"])
      ]),
      _: 1
    }, 8, ["modelValue"]));
  }
});
typeof E == "function" && E(Qe);
export {
  Qe as default
};
