(function() {
  if (typeof window !== "undefined") {
    window.__VC_SHELL_MODULE_VERSION_INFO__ = window.__VC_SHELL_MODULE_VERSION_INFO__ || {};
    window.__VC_SHELL_MODULE_VERSION_INFO__["import-app"] = { "version": "1.1.3", "compatibleWith": { "framework": "^1.1.0", "modules": {} } };
  }
})();
(function(global, factory) {
  typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory(require("vue"), require("@vc-shell/framework"), require("vue-router"), require("lodash-es"), require("vee-validate"), require("vue-i18n"), require("moment")) : typeof define === "function" && define.amd ? define(["vue", "@vc-shell/framework", "vue-router", "lodash-es", "vee-validate", "vue-i18n", "moment"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, global.VcShellModule_import_app = factory(global.Vue, global.VcShellFramework, global.VueRouter, global._, global.VeeValidate, global.VueI18n, global.moment));
})(this, function(vue, framework, vueRouter, _, veeValidate, vueI18n, moment) {
  "use strict";var __defProp = Object.defineProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);

  function _interopNamespaceDefault(e) {
    const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
    if (e) {
      for (const k in e) {
        if (k !== "default") {
          const d = Object.getOwnPropertyDescriptor(e, k);
          Object.defineProperty(n, k, d.get ? d : {
            enumerable: true,
            get: () => e[k]
          });
        }
      }
    }
    n.default = e;
    return Object.freeze(n);
  }
  const ___namespace = /* @__PURE__ */ _interopNamespaceDefault(_);
  class AuthApiBase {
    constructor() {
      __publicField(this, "authToken", "");
    }
    // Enforce always return empty string as baseUrl
    getBaseUrl(defaultUrl, baseUrl) {
      return "";
    }
    setAuthToken(token) {
      this.authToken = token;
    }
    transformOptions(options) {
      if (this.authToken) {
        options.headers["authorization"] = `Bearer ${this.authToken}`;
      }
      return Promise.resolve(options);
    }
  }
  class ImportClient extends AuthApiBase {
    constructor(baseUrl, http) {
      super();
      __publicField(this, "http");
      __publicField(this, "baseUrl");
      __publicField(this, "jsonParseReviver");
      this.http = http ? http : window;
      this.baseUrl = this.getBaseUrl("", baseUrl);
    }
    /**
     * @param body (optional) 
     * @return Success
     */
    runImport(body) {
      let url_ = this.baseUrl + "/api/import/run";
      url_ = url_.replace(/[?&]$/, "");
      const content_ = JSON.stringify(body);
      let options_ = {
        body: content_,
        method: "POST",
        headers: {
          "Content-Type": "application/json-patch+json",
          "Accept": "text/plain"
        }
      };
      return this.transformOptions(options_).then((transformedOptions_) => {
        return this.http.fetch(url_, transformedOptions_);
      }).then((_response) => {
        return this.processRunImport(_response);
      });
    }
    processRunImport(response) {
      const status = response.status;
      let _headers = {};
      if (response.headers && response.headers.forEach) {
        response.headers.forEach((v, k) => _headers[k] = v);
      }
      if (status === 200) {
        return response.text().then((_responseText) => {
          let result200 = null;
          let resultData200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
          result200 = ImportPushNotification.fromJS(resultData200);
          return result200;
        });
      } else if (status !== 200 && status !== 204) {
        return response.text().then((_responseText) => {
          return throwException("An unexpected server error occurred.", status, _responseText, _headers);
        });
      }
      return Promise.resolve(null);
    }
    /**
     * @param body (optional) 
     * @return Success
     */
    cancelJob(body) {
      let url_ = this.baseUrl + "/api/import/task/cancel";
      url_ = url_.replace(/[?&]$/, "");
      const content_ = JSON.stringify(body);
      let options_ = {
        body: content_,
        method: "POST",
        headers: {
          "Content-Type": "application/json-patch+json"
        }
      };
      return this.transformOptions(options_).then((transformedOptions_) => {
        return this.http.fetch(url_, transformedOptions_);
      }).then((_response) => {
        return this.processCancelJob(_response);
      });
    }
    processCancelJob(response) {
      const status = response.status;
      let _headers = {};
      if (response.headers && response.headers.forEach) {
        response.headers.forEach((v, k) => _headers[k] = v);
      }
      if (status === 200) {
        return response.text().then((_responseText) => {
          return;
        });
      } else if (status === 401) {
        return response.text().then((_responseText) => {
          return throwException("Unauthorized", status, _responseText, _headers);
        });
      } else if (status === 403) {
        return response.text().then((_responseText) => {
          return throwException("Forbidden", status, _responseText, _headers);
        });
      } else if (status !== 200 && status !== 204) {
        return response.text().then((_responseText) => {
          return throwException("An unexpected server error occurred.", status, _responseText, _headers);
        });
      }
      return Promise.resolve(null);
    }
    /**
     * @param body (optional) 
     * @return Success
     */
    preview(body) {
      let url_ = this.baseUrl + "/api/import/preview";
      url_ = url_.replace(/[?&]$/, "");
      const content_ = JSON.stringify(body);
      let options_ = {
        body: content_,
        method: "POST",
        headers: {
          "Content-Type": "application/json-patch+json",
          "Accept": "text/plain"
        }
      };
      return this.transformOptions(options_).then((transformedOptions_) => {
        return this.http.fetch(url_, transformedOptions_);
      }).then((_response) => {
        return this.processPreview(_response);
      });
    }
    processPreview(response) {
      const status = response.status;
      let _headers = {};
      if (response.headers && response.headers.forEach) {
        response.headers.forEach((v, k) => _headers[k] = v);
      }
      if (status === 200) {
        return response.text().then((_responseText) => {
          let result200 = null;
          let resultData200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
          result200 = ImportDataPreview.fromJS(resultData200);
          return result200;
        });
      } else if (status === 401) {
        return response.text().then((_responseText) => {
          return throwException("Unauthorized", status, _responseText, _headers);
        });
      } else if (status === 403) {
        return response.text().then((_responseText) => {
          return throwException("Forbidden", status, _responseText, _headers);
        });
      } else if (status !== 200 && status !== 204) {
        return response.text().then((_responseText) => {
          return throwException("An unexpected server error occurred.", status, _responseText, _headers);
        });
      }
      return Promise.resolve(null);
    }
    /**
     * @param body (optional) 
     * @return Success
     */
    validate(body) {
      let url_ = this.baseUrl + "/api/import/validate";
      url_ = url_.replace(/[?&]$/, "");
      const content_ = JSON.stringify(body);
      let options_ = {
        body: content_,
        method: "POST",
        headers: {
          "Content-Type": "application/json-patch+json",
          "Accept": "text/plain"
        }
      };
      return this.transformOptions(options_).then((transformedOptions_) => {
        return this.http.fetch(url_, transformedOptions_);
      }).then((_response) => {
        return this.processValidate(_response);
      });
    }
    processValidate(response) {
      const status = response.status;
      let _headers = {};
      if (response.headers && response.headers.forEach) {
        response.headers.forEach((v, k) => _headers[k] = v);
      }
      if (status === 200) {
        return response.text().then((_responseText) => {
          let result200 = null;
          let resultData200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
          result200 = ValidationResult.fromJS(resultData200);
          return result200;
        });
      } else if (status === 401) {
        return response.text().then((_responseText) => {
          return throwException("Unauthorized", status, _responseText, _headers);
        });
      } else if (status === 403) {
        return response.text().then((_responseText) => {
          return throwException("Forbidden", status, _responseText, _headers);
        });
      } else if (status !== 200 && status !== 204) {
        return response.text().then((_responseText) => {
          return throwException("An unexpected server error occurred.", status, _responseText, _headers);
        });
      }
      return Promise.resolve(null);
    }
    /**
     * @return Success
     */
    getImporters() {
      let url_ = this.baseUrl + "/api/import/importers";
      url_ = url_.replace(/[?&]$/, "");
      let options_ = {
        method: "GET",
        headers: {
          "Accept": "text/plain"
        }
      };
      return this.transformOptions(options_).then((transformedOptions_) => {
        return this.http.fetch(url_, transformedOptions_);
      }).then((_response) => {
        return this.processGetImporters(_response);
      });
    }
    processGetImporters(response) {
      const status = response.status;
      let _headers = {};
      if (response.headers && response.headers.forEach) {
        response.headers.forEach((v, k) => _headers[k] = v);
      }
      if (status === 200) {
        return response.text().then((_responseText) => {
          let result200 = null;
          let resultData200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
          if (Array.isArray(resultData200)) {
            result200 = [];
            for (let item of resultData200)
              result200.push(IDataImporter.fromJS(item));
          } else {
            result200 = null;
          }
          return result200;
        });
      } else if (status === 401) {
        return response.text().then((_responseText) => {
          return throwException("Unauthorized", status, _responseText, _headers);
        });
      } else if (status === 403) {
        return response.text().then((_responseText) => {
          return throwException("Forbidden", status, _responseText, _headers);
        });
      } else if (status !== 200 && status !== 204) {
        return response.text().then((_responseText) => {
          return throwException("An unexpected server error occurred.", status, _responseText, _headers);
        });
      }
      return Promise.resolve(null);
    }
    /**
     * @return Success
     */
    getImportProfileById(profileId) {
      let url_ = this.baseUrl + "/api/import/profiles/{profileId}";
      if (profileId === void 0 || profileId === null)
        throw new Error("The parameter 'profileId' must be defined.");
      url_ = url_.replace("{profileId}", encodeURIComponent("" + profileId));
      url_ = url_.replace(/[?&]$/, "");
      let options_ = {
        method: "GET",
        headers: {
          "Accept": "text/plain"
        }
      };
      return this.transformOptions(options_).then((transformedOptions_) => {
        return this.http.fetch(url_, transformedOptions_);
      }).then((_response) => {
        return this.processGetImportProfileById(_response);
      });
    }
    processGetImportProfileById(response) {
      const status = response.status;
      let _headers = {};
      if (response.headers && response.headers.forEach) {
        response.headers.forEach((v, k) => _headers[k] = v);
      }
      if (status === 200) {
        return response.text().then((_responseText) => {
          let result200 = null;
          let resultData200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
          result200 = ImportProfile.fromJS(resultData200);
          return result200;
        });
      } else if (status === 401) {
        return response.text().then((_responseText) => {
          return throwException("Unauthorized", status, _responseText, _headers);
        });
      } else if (status === 403) {
        return response.text().then((_responseText) => {
          return throwException("Forbidden", status, _responseText, _headers);
        });
      } else if (status !== 200 && status !== 204) {
        return response.text().then((_responseText) => {
          return throwException("An unexpected server error occurred.", status, _responseText, _headers);
        });
      }
      return Promise.resolve(null);
    }
    /**
     * @param body (optional) 
     * @return Success
     */
    createImportProfile(body) {
      let url_ = this.baseUrl + "/api/import/profiles";
      url_ = url_.replace(/[?&]$/, "");
      const content_ = JSON.stringify(body);
      let options_ = {
        body: content_,
        method: "POST",
        headers: {
          "Content-Type": "application/json-patch+json",
          "Accept": "text/plain"
        }
      };
      return this.transformOptions(options_).then((transformedOptions_) => {
        return this.http.fetch(url_, transformedOptions_);
      }).then((_response) => {
        return this.processCreateImportProfile(_response);
      });
    }
    processCreateImportProfile(response) {
      const status = response.status;
      let _headers = {};
      if (response.headers && response.headers.forEach) {
        response.headers.forEach((v, k) => _headers[k] = v);
      }
      if (status === 200) {
        return response.text().then((_responseText) => {
          let result200 = null;
          let resultData200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
          result200 = ImportProfile.fromJS(resultData200);
          return result200;
        });
      } else if (status === 401) {
        return response.text().then((_responseText) => {
          return throwException("Unauthorized", status, _responseText, _headers);
        });
      } else if (status === 403) {
        return response.text().then((_responseText) => {
          return throwException("Forbidden", status, _responseText, _headers);
        });
      } else if (status !== 200 && status !== 204) {
        return response.text().then((_responseText) => {
          return throwException("An unexpected server error occurred.", status, _responseText, _headers);
        });
      }
      return Promise.resolve(null);
    }
    /**
     * @param body (optional) 
     * @return Success
     */
    updateImportProfile(body) {
      let url_ = this.baseUrl + "/api/import/profiles";
      url_ = url_.replace(/[?&]$/, "");
      const content_ = JSON.stringify(body);
      let options_ = {
        body: content_,
        method: "PUT",
        headers: {
          "Content-Type": "application/json-patch+json",
          "Accept": "text/plain"
        }
      };
      return this.transformOptions(options_).then((transformedOptions_) => {
        return this.http.fetch(url_, transformedOptions_);
      }).then((_response) => {
        return this.processUpdateImportProfile(_response);
      });
    }
    processUpdateImportProfile(response) {
      const status = response.status;
      let _headers = {};
      if (response.headers && response.headers.forEach) {
        response.headers.forEach((v, k) => _headers[k] = v);
      }
      if (status === 200) {
        return response.text().then((_responseText) => {
          let result200 = null;
          let resultData200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
          result200 = ImportProfile.fromJS(resultData200);
          return result200;
        });
      } else if (status === 401) {
        return response.text().then((_responseText) => {
          return throwException("Unauthorized", status, _responseText, _headers);
        });
      } else if (status === 403) {
        return response.text().then((_responseText) => {
          return throwException("Forbidden", status, _responseText, _headers);
        });
      } else if (status !== 200 && status !== 204) {
        return response.text().then((_responseText) => {
          return throwException("An unexpected server error occurred.", status, _responseText, _headers);
        });
      }
      return Promise.resolve(null);
    }
    /**
     * @param profileId (optional) 
     * @return Success
     */
    deleteProfile(profileId) {
      let url_ = this.baseUrl + "/api/import/profiles?";
      if (profileId === null)
        throw new Error("The parameter 'profileId' cannot be null.");
      else if (profileId !== void 0)
        url_ += "profileId=" + encodeURIComponent("" + profileId) + "&";
      url_ = url_.replace(/[?&]$/, "");
      let options_ = {
        method: "DELETE",
        headers: {}
      };
      return this.transformOptions(options_).then((transformedOptions_) => {
        return this.http.fetch(url_, transformedOptions_);
      }).then((_response) => {
        return this.processDeleteProfile(_response);
      });
    }
    processDeleteProfile(response) {
      const status = response.status;
      let _headers = {};
      if (response.headers && response.headers.forEach) {
        response.headers.forEach((v, k) => _headers[k] = v);
      }
      if (status === 200) {
        return response.text().then((_responseText) => {
          return;
        });
      } else if (status === 401) {
        return response.text().then((_responseText) => {
          return throwException("Unauthorized", status, _responseText, _headers);
        });
      } else if (status === 403) {
        return response.text().then((_responseText) => {
          return throwException("Forbidden", status, _responseText, _headers);
        });
      } else if (status !== 200 && status !== 204) {
        return response.text().then((_responseText) => {
          return throwException("An unexpected server error occurred.", status, _responseText, _headers);
        });
      }
      return Promise.resolve(null);
    }
    /**
     * @param body (optional) 
     * @return Success
     */
    searchImportProfiles(body) {
      let url_ = this.baseUrl + "/api/import/profiles/search";
      url_ = url_.replace(/[?&]$/, "");
      const content_ = JSON.stringify(body);
      let options_ = {
        body: content_,
        method: "POST",
        headers: {
          "Content-Type": "application/json-patch+json",
          "Accept": "text/plain"
        }
      };
      return this.transformOptions(options_).then((transformedOptions_) => {
        return this.http.fetch(url_, transformedOptions_);
      }).then((_response) => {
        return this.processSearchImportProfiles(_response);
      });
    }
    processSearchImportProfiles(response) {
      const status = response.status;
      let _headers = {};
      if (response.headers && response.headers.forEach) {
        response.headers.forEach((v, k) => _headers[k] = v);
      }
      if (status === 200) {
        return response.text().then((_responseText) => {
          let result200 = null;
          let resultData200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
          result200 = SearchImportProfilesResult.fromJS(resultData200);
          return result200;
        });
      } else if (status !== 200 && status !== 204) {
        return response.text().then((_responseText) => {
          return throwException("An unexpected server error occurred.", status, _responseText, _headers);
        });
      }
      return Promise.resolve(null);
    }
    /**
     * @param body (optional) 
     * @return Success
     */
    searchImportRunHistory(body) {
      let url_ = this.baseUrl + "/api/import/profiles/execution/history/search";
      url_ = url_.replace(/[?&]$/, "");
      const content_ = JSON.stringify(body);
      let options_ = {
        body: content_,
        method: "POST",
        headers: {
          "Content-Type": "application/json-patch+json",
          "Accept": "text/plain"
        }
      };
      return this.transformOptions(options_).then((transformedOptions_) => {
        return this.http.fetch(url_, transformedOptions_);
      }).then((_response) => {
        return this.processSearchImportRunHistory(_response);
      });
    }
    processSearchImportRunHistory(response) {
      const status = response.status;
      let _headers = {};
      if (response.headers && response.headers.forEach) {
        response.headers.forEach((v, k) => _headers[k] = v);
      }
      if (status === 200) {
        return response.text().then((_responseText) => {
          let result200 = null;
          let resultData200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
          result200 = SearchImportRunHistoryResult.fromJS(resultData200);
          return result200;
        });
      } else if (status !== 200 && status !== 204) {
        return response.text().then((_responseText) => {
          return throwException("An unexpected server error occurred.", status, _responseText, _headers);
        });
      }
      return Promise.resolve(null);
    }
  }
  class OrganizationClient extends AuthApiBase {
    constructor(baseUrl, http) {
      super();
      __publicField(this, "http");
      __publicField(this, "baseUrl");
      __publicField(this, "jsonParseReviver");
      this.http = http ? http : window;
      this.baseUrl = this.getBaseUrl("", baseUrl);
    }
    /**
     * @param organizationId (optional) 
     * @return Success
     */
    getOrganizationInfo(organizationId) {
      let url_ = this.baseUrl + "/api/import/organization?";
      if (organizationId === null)
        throw new Error("The parameter 'organizationId' cannot be null.");
      else if (organizationId !== void 0)
        url_ += "organizationId=" + encodeURIComponent("" + organizationId) + "&";
      url_ = url_.replace(/[?&]$/, "");
      let options_ = {
        method: "GET",
        headers: {
          "Accept": "text/plain"
        }
      };
      return this.transformOptions(options_).then((transformedOptions_) => {
        return this.http.fetch(url_, transformedOptions_);
      }).then((_response) => {
        return this.processGetOrganizationInfo(_response);
      });
    }
    processGetOrganizationInfo(response) {
      const status = response.status;
      let _headers = {};
      if (response.headers && response.headers.forEach) {
        response.headers.forEach((v, k) => _headers[k] = v);
      }
      if (status === 200) {
        return response.text().then((_responseText) => {
          let result200 = null;
          let resultData200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
          result200 = OrganizationInfo.fromJS(resultData200);
          return result200;
        });
      } else if (status !== 200 && status !== 204) {
        return response.text().then((_responseText) => {
          return throwException("An unexpected server error occurred.", status, _responseText, _headers);
        });
      }
      return Promise.resolve(null);
    }
  }
  class IAuthorizationRequirement {
    constructor(data) {
      if (data) {
        for (var property in data) {
          if (data.hasOwnProperty(property))
            this[property] = data[property];
        }
      }
    }
    init(_data) {
    }
    static fromJS(data) {
      data = typeof data === "object" ? data : {};
      let result = new IAuthorizationRequirement();
      result.init(data);
      return result;
    }
    toJSON(data) {
      data = typeof data === "object" ? data : {};
      return data;
    }
  }
  class IDataImporter {
    constructor(data) {
      __publicField(this, "typeName");
      __publicField(this, "metadata");
      __publicField(this, "availSettings");
      __publicField(this, "authorizationRequirement");
      if (data) {
        for (var property in data) {
          if (data.hasOwnProperty(property))
            this[property] = data[property];
        }
      }
    }
    init(_data) {
      if (_data) {
        this.typeName = _data["typeName"];
        if (_data["metadata"]) {
          this.metadata = {};
          for (let key in _data["metadata"]) {
            if (_data["metadata"].hasOwnProperty(key))
              this.metadata[key] = _data["metadata"][key];
          }
        }
        if (Array.isArray(_data["availSettings"])) {
          this.availSettings = [];
          for (let item of _data["availSettings"])
            this.availSettings.push(SettingDescriptor.fromJS(item));
        }
        this.authorizationRequirement = _data["authorizationRequirement"] ? IAuthorizationRequirement.fromJS(_data["authorizationRequirement"]) : void 0;
      }
    }
    static fromJS(data) {
      data = typeof data === "object" ? data : {};
      let result = new IDataImporter();
      result.init(data);
      return result;
    }
    toJSON(data) {
      data = typeof data === "object" ? data : {};
      data["typeName"] = this.typeName;
      if (this.metadata) {
        data["metadata"] = {};
        for (let key in this.metadata) {
          if (this.metadata.hasOwnProperty(key))
            data["metadata"][key] = this.metadata[key];
        }
      }
      if (Array.isArray(this.availSettings)) {
        data["availSettings"] = [];
        for (let item of this.availSettings)
          data["availSettings"].push(item.toJSON());
      }
      data["authorizationRequirement"] = this.authorizationRequirement ? this.authorizationRequirement.toJSON() : void 0;
      return data;
    }
  }
  class ImportCancellationRequest {
    constructor(data) {
      __publicField(this, "jobId");
      if (data) {
        for (var property in data) {
          if (data.hasOwnProperty(property))
            this[property] = data[property];
        }
      }
    }
    init(_data) {
      if (_data) {
        this.jobId = _data["jobId"];
      }
    }
    static fromJS(data) {
      data = typeof data === "object" ? data : {};
      let result = new ImportCancellationRequest();
      result.init(data);
      return result;
    }
    toJSON(data) {
      data = typeof data === "object" ? data : {};
      data["jobId"] = this.jobId;
      return data;
    }
  }
  class ImportDataPreview {
    constructor(data) {
      __publicField(this, "totalCount");
      __publicField(this, "fileName");
      __publicField(this, "records");
      __publicField(this, "errors");
      if (data) {
        for (var property in data) {
          if (data.hasOwnProperty(property))
            this[property] = data[property];
        }
      }
    }
    init(_data) {
      if (_data) {
        this.totalCount = _data["totalCount"];
        this.fileName = _data["fileName"];
        if (Array.isArray(_data["records"])) {
          this.records = [];
          for (let item of _data["records"])
            this.records.push(item);
        }
        if (Array.isArray(_data["errors"])) {
          this.errors = [];
          for (let item of _data["errors"])
            this.errors.push(item);
        }
      }
    }
    static fromJS(data) {
      data = typeof data === "object" ? data : {};
      let result = new ImportDataPreview();
      result.init(data);
      return result;
    }
    toJSON(data) {
      data = typeof data === "object" ? data : {};
      data["totalCount"] = this.totalCount;
      data["fileName"] = this.fileName;
      if (Array.isArray(this.records)) {
        data["records"] = [];
        for (let item of this.records)
          data["records"].push(item);
      }
      if (Array.isArray(this.errors)) {
        data["errors"] = [];
        for (let item of this.errors)
          data["errors"].push(item);
      }
      return data;
    }
  }
  class ImportProfile {
    constructor(data) {
      __publicField(this, "name");
      __publicField(this, "dataImporterType");
      __publicField(this, "userId");
      __publicField(this, "userName");
      __publicField(this, "settings");
      __publicField(this, "typeName");
      __publicField(this, "profileType");
      __publicField(this, "importFileUrl");
      __publicField(this, "importReportUrl");
      __publicField(this, "importReporterType");
      __publicField(this, "previewObjectCount");
      __publicField(this, "createdDate");
      __publicField(this, "modifiedDate");
      __publicField(this, "createdBy");
      __publicField(this, "modifiedBy");
      __publicField(this, "id");
      if (data) {
        for (var property in data) {
          if (data.hasOwnProperty(property))
            this[property] = data[property];
        }
      }
    }
    init(_data) {
      if (_data) {
        this.name = _data["name"];
        this.dataImporterType = _data["dataImporterType"];
        this.userId = _data["userId"];
        this.userName = _data["userName"];
        if (Array.isArray(_data["settings"])) {
          this.settings = [];
          for (let item of _data["settings"])
            this.settings.push(ObjectSettingEntry.fromJS(item));
        }
        this.typeName = _data["typeName"];
        this.profileType = _data["profileType"];
        this.importFileUrl = _data["importFileUrl"];
        this.importReportUrl = _data["importReportUrl"];
        this.importReporterType = _data["importReporterType"];
        this.previewObjectCount = _data["previewObjectCount"];
        this.createdDate = _data["createdDate"] ? new Date(_data["createdDate"].toString()) : void 0;
        this.modifiedDate = _data["modifiedDate"] ? new Date(_data["modifiedDate"].toString()) : void 0;
        this.createdBy = _data["createdBy"];
        this.modifiedBy = _data["modifiedBy"];
        this.id = _data["id"];
      }
    }
    static fromJS(data) {
      data = typeof data === "object" ? data : {};
      let result = new ImportProfile();
      result.init(data);
      return result;
    }
    toJSON(data) {
      data = typeof data === "object" ? data : {};
      data["name"] = this.name;
      data["dataImporterType"] = this.dataImporterType;
      data["userId"] = this.userId;
      data["userName"] = this.userName;
      if (Array.isArray(this.settings)) {
        data["settings"] = [];
        for (let item of this.settings)
          data["settings"].push(item.toJSON());
      }
      data["typeName"] = this.typeName;
      data["profileType"] = this.profileType;
      data["importFileUrl"] = this.importFileUrl;
      data["importReportUrl"] = this.importReportUrl;
      data["importReporterType"] = this.importReporterType;
      data["previewObjectCount"] = this.previewObjectCount;
      data["createdDate"] = this.createdDate ? this.createdDate.toISOString() : void 0;
      data["modifiedDate"] = this.modifiedDate ? this.modifiedDate.toISOString() : void 0;
      data["createdBy"] = this.createdBy;
      data["modifiedBy"] = this.modifiedBy;
      data["id"] = this.id;
      return data;
    }
  }
  class ImportPushNotification {
    constructor(data) {
      __publicField(this, "profileId");
      __publicField(this, "profileName");
      __publicField(this, "jobId");
      __publicField(this, "estimatingRemaining");
      __publicField(this, "estimatedRemaining");
      __publicField(this, "finished");
      __publicField(this, "totalCount");
      __publicField(this, "processedCount");
      __publicField(this, "errorCount");
      __publicField(this, "errors");
      __publicField(this, "reportUrl");
      __publicField(this, "serverId");
      __publicField(this, "creator");
      __publicField(this, "created");
      __publicField(this, "isNew");
      __publicField(this, "notifyType");
      __publicField(this, "description");
      __publicField(this, "title");
      __publicField(this, "repeatCount");
      __publicField(this, "id");
      if (data) {
        for (var property in data) {
          if (data.hasOwnProperty(property))
            this[property] = data[property];
        }
      }
    }
    init(_data) {
      if (_data) {
        this.profileId = _data["profileId"];
        this.profileName = _data["profileName"];
        this.jobId = _data["jobId"];
        this.estimatingRemaining = _data["estimatingRemaining"];
        this.estimatedRemaining = _data["estimatedRemaining"];
        this.finished = _data["finished"] ? new Date(_data["finished"].toString()) : void 0;
        this.totalCount = _data["totalCount"];
        this.processedCount = _data["processedCount"];
        this.errorCount = _data["errorCount"];
        if (Array.isArray(_data["errors"])) {
          this.errors = [];
          for (let item of _data["errors"])
            this.errors.push(item);
        }
        this.reportUrl = _data["reportUrl"];
        this.serverId = _data["serverId"];
        this.creator = _data["creator"];
        this.created = _data["created"] ? new Date(_data["created"].toString()) : void 0;
        this.isNew = _data["isNew"];
        this.notifyType = _data["notifyType"];
        this.description = _data["description"];
        this.title = _data["title"];
        this.repeatCount = _data["repeatCount"];
        this.id = _data["id"];
      }
    }
    static fromJS(data) {
      data = typeof data === "object" ? data : {};
      let result = new ImportPushNotification();
      result.init(data);
      return result;
    }
    toJSON(data) {
      data = typeof data === "object" ? data : {};
      data["profileId"] = this.profileId;
      data["profileName"] = this.profileName;
      data["jobId"] = this.jobId;
      data["estimatingRemaining"] = this.estimatingRemaining;
      data["estimatedRemaining"] = this.estimatedRemaining;
      data["finished"] = this.finished ? this.finished.toISOString() : void 0;
      data["totalCount"] = this.totalCount;
      data["processedCount"] = this.processedCount;
      data["errorCount"] = this.errorCount;
      if (Array.isArray(this.errors)) {
        data["errors"] = [];
        for (let item of this.errors)
          data["errors"].push(item);
      }
      data["reportUrl"] = this.reportUrl;
      data["serverId"] = this.serverId;
      data["creator"] = this.creator;
      data["created"] = this.created ? this.created.toISOString() : void 0;
      data["isNew"] = this.isNew;
      data["notifyType"] = this.notifyType;
      data["description"] = this.description;
      data["title"] = this.title;
      data["repeatCount"] = this.repeatCount;
      data["id"] = this.id;
      return data;
    }
  }
  class ImportRunHistory {
    constructor(data) {
      __publicField(this, "userId");
      __publicField(this, "userName");
      __publicField(this, "jobId");
      __publicField(this, "profileId");
      __publicField(this, "profileName");
      __publicField(this, "executed");
      __publicField(this, "finished");
      __publicField(this, "totalCount");
      __publicField(this, "processedCount");
      __publicField(this, "errorsCount");
      __publicField(this, "errors");
      __publicField(this, "fileUrl");
      __publicField(this, "reportUrl");
      __publicField(this, "typeName");
      __publicField(this, "settings");
      __publicField(this, "createdDate");
      __publicField(this, "modifiedDate");
      __publicField(this, "createdBy");
      __publicField(this, "modifiedBy");
      __publicField(this, "id");
      if (data) {
        for (var property in data) {
          if (data.hasOwnProperty(property))
            this[property] = data[property];
        }
      }
    }
    init(_data) {
      if (_data) {
        this.userId = _data["userId"];
        this.userName = _data["userName"];
        this.jobId = _data["jobId"];
        this.profileId = _data["profileId"];
        this.profileName = _data["profileName"];
        this.executed = _data["executed"] ? new Date(_data["executed"].toString()) : void 0;
        this.finished = _data["finished"] ? new Date(_data["finished"].toString()) : void 0;
        this.totalCount = _data["totalCount"];
        this.processedCount = _data["processedCount"];
        this.errorsCount = _data["errorsCount"];
        if (Array.isArray(_data["errors"])) {
          this.errors = [];
          for (let item of _data["errors"])
            this.errors.push(item);
        }
        this.fileUrl = _data["fileUrl"];
        this.reportUrl = _data["reportUrl"];
        this.typeName = _data["typeName"];
        if (Array.isArray(_data["settings"])) {
          this.settings = [];
          for (let item of _data["settings"])
            this.settings.push(ObjectSettingEntry.fromJS(item));
        }
        this.createdDate = _data["createdDate"] ? new Date(_data["createdDate"].toString()) : void 0;
        this.modifiedDate = _data["modifiedDate"] ? new Date(_data["modifiedDate"].toString()) : void 0;
        this.createdBy = _data["createdBy"];
        this.modifiedBy = _data["modifiedBy"];
        this.id = _data["id"];
      }
    }
    static fromJS(data) {
      data = typeof data === "object" ? data : {};
      let result = new ImportRunHistory();
      result.init(data);
      return result;
    }
    toJSON(data) {
      data = typeof data === "object" ? data : {};
      data["userId"] = this.userId;
      data["userName"] = this.userName;
      data["jobId"] = this.jobId;
      data["profileId"] = this.profileId;
      data["profileName"] = this.profileName;
      data["executed"] = this.executed ? this.executed.toISOString() : void 0;
      data["finished"] = this.finished ? this.finished.toISOString() : void 0;
      data["totalCount"] = this.totalCount;
      data["processedCount"] = this.processedCount;
      data["errorsCount"] = this.errorsCount;
      if (Array.isArray(this.errors)) {
        data["errors"] = [];
        for (let item of this.errors)
          data["errors"].push(item);
      }
      data["fileUrl"] = this.fileUrl;
      data["reportUrl"] = this.reportUrl;
      data["typeName"] = this.typeName;
      if (Array.isArray(this.settings)) {
        data["settings"] = [];
        for (let item of this.settings)
          data["settings"].push(item.toJSON());
      }
      data["createdDate"] = this.createdDate ? this.createdDate.toISOString() : void 0;
      data["modifiedDate"] = this.modifiedDate ? this.modifiedDate.toISOString() : void 0;
      data["createdBy"] = this.createdBy;
      data["modifiedBy"] = this.modifiedBy;
      data["id"] = this.id;
      return data;
    }
  }
  class ObjectSettingEntry {
    constructor(data) {
      __publicField(this, "itHasValues");
      __publicField(this, "objectId");
      __publicField(this, "objectType");
      __publicField(this, "isReadOnly");
      __publicField(this, "value");
      __publicField(this, "id");
      __publicField(this, "restartRequired");
      __publicField(this, "moduleId");
      __publicField(this, "groupName");
      __publicField(this, "name");
      __publicField(this, "displayName");
      __publicField(this, "isRequired");
      __publicField(this, "isHidden");
      __publicField(this, "valueType");
      __publicField(this, "allowedValues");
      __publicField(this, "defaultValue");
      __publicField(this, "isDictionary");
      __publicField(this, "isLocalizable");
      if (data) {
        for (var property in data) {
          if (data.hasOwnProperty(property))
            this[property] = data[property];
        }
      }
    }
    init(_data) {
      if (_data) {
        this.itHasValues = _data["itHasValues"];
        this.objectId = _data["objectId"];
        this.objectType = _data["objectType"];
        this.isReadOnly = _data["isReadOnly"];
        this.value = _data["value"];
        this.id = _data["id"];
        this.restartRequired = _data["restartRequired"];
        this.moduleId = _data["moduleId"];
        this.groupName = _data["groupName"];
        this.name = _data["name"];
        this.displayName = _data["displayName"];
        this.isRequired = _data["isRequired"];
        this.isHidden = _data["isHidden"];
        this.valueType = _data["valueType"];
        if (Array.isArray(_data["allowedValues"])) {
          this.allowedValues = [];
          for (let item of _data["allowedValues"])
            this.allowedValues.push(item);
        }
        this.defaultValue = _data["defaultValue"];
        this.isDictionary = _data["isDictionary"];
        this.isLocalizable = _data["isLocalizable"];
      }
    }
    static fromJS(data) {
      data = typeof data === "object" ? data : {};
      let result = new ObjectSettingEntry();
      result.init(data);
      return result;
    }
    toJSON(data) {
      data = typeof data === "object" ? data : {};
      data["itHasValues"] = this.itHasValues;
      data["objectId"] = this.objectId;
      data["objectType"] = this.objectType;
      data["isReadOnly"] = this.isReadOnly;
      data["value"] = this.value;
      data["id"] = this.id;
      data["restartRequired"] = this.restartRequired;
      data["moduleId"] = this.moduleId;
      data["groupName"] = this.groupName;
      data["name"] = this.name;
      data["displayName"] = this.displayName;
      data["isRequired"] = this.isRequired;
      data["isHidden"] = this.isHidden;
      data["valueType"] = this.valueType;
      if (Array.isArray(this.allowedValues)) {
        data["allowedValues"] = [];
        for (let item of this.allowedValues)
          data["allowedValues"].push(item);
      }
      data["defaultValue"] = this.defaultValue;
      data["isDictionary"] = this.isDictionary;
      data["isLocalizable"] = this.isLocalizable;
      return data;
    }
  }
  class OrganizationInfo {
    constructor(data) {
      __publicField(this, "organizationId");
      __publicField(this, "organizationName");
      __publicField(this, "organizationLogoUrl");
      if (data) {
        for (var property in data) {
          if (data.hasOwnProperty(property))
            this[property] = data[property];
        }
      }
    }
    init(_data) {
      if (_data) {
        this.organizationId = _data["organizationId"];
        this.organizationName = _data["organizationName"];
        this.organizationLogoUrl = _data["organizationLogoUrl"];
      }
    }
    static fromJS(data) {
      data = typeof data === "object" ? data : {};
      let result = new OrganizationInfo();
      result.init(data);
      return result;
    }
    toJSON(data) {
      data = typeof data === "object" ? data : {};
      data["organizationId"] = this.organizationId;
      data["organizationName"] = this.organizationName;
      data["organizationLogoUrl"] = this.organizationLogoUrl;
      return data;
    }
  }
  class SearchImportProfilesCriteria {
    constructor(data) {
      __publicField(this, "userId");
      __publicField(this, "userName");
      __publicField(this, "name");
      __publicField(this, "responseGroup");
      __publicField(this, "objectType");
      __publicField(this, "objectTypes");
      __publicField(this, "objectIds");
      __publicField(this, "keyword");
      __publicField(this, "searchPhrase");
      __publicField(this, "languageCode");
      __publicField(this, "sort");
      __publicField(this, "sortInfos");
      __publicField(this, "skip");
      __publicField(this, "take");
      if (data) {
        for (var property in data) {
          if (data.hasOwnProperty(property))
            this[property] = data[property];
        }
      }
    }
    init(_data) {
      if (_data) {
        this.userId = _data["userId"];
        this.userName = _data["userName"];
        this.name = _data["name"];
        this.responseGroup = _data["responseGroup"];
        this.objectType = _data["objectType"];
        if (Array.isArray(_data["objectTypes"])) {
          this.objectTypes = [];
          for (let item of _data["objectTypes"])
            this.objectTypes.push(item);
        }
        if (Array.isArray(_data["objectIds"])) {
          this.objectIds = [];
          for (let item of _data["objectIds"])
            this.objectIds.push(item);
        }
        this.keyword = _data["keyword"];
        this.searchPhrase = _data["searchPhrase"];
        this.languageCode = _data["languageCode"];
        this.sort = _data["sort"];
        if (Array.isArray(_data["sortInfos"])) {
          this.sortInfos = [];
          for (let item of _data["sortInfos"])
            this.sortInfos.push(SortInfo.fromJS(item));
        }
        this.skip = _data["skip"];
        this.take = _data["take"];
      }
    }
    static fromJS(data) {
      data = typeof data === "object" ? data : {};
      let result = new SearchImportProfilesCriteria();
      result.init(data);
      return result;
    }
    toJSON(data) {
      data = typeof data === "object" ? data : {};
      data["userId"] = this.userId;
      data["userName"] = this.userName;
      data["name"] = this.name;
      data["responseGroup"] = this.responseGroup;
      data["objectType"] = this.objectType;
      if (Array.isArray(this.objectTypes)) {
        data["objectTypes"] = [];
        for (let item of this.objectTypes)
          data["objectTypes"].push(item);
      }
      if (Array.isArray(this.objectIds)) {
        data["objectIds"] = [];
        for (let item of this.objectIds)
          data["objectIds"].push(item);
      }
      data["keyword"] = this.keyword;
      data["searchPhrase"] = this.searchPhrase;
      data["languageCode"] = this.languageCode;
      data["sort"] = this.sort;
      if (Array.isArray(this.sortInfos)) {
        data["sortInfos"] = [];
        for (let item of this.sortInfos)
          data["sortInfos"].push(item.toJSON());
      }
      data["skip"] = this.skip;
      data["take"] = this.take;
      return data;
    }
  }
  class SearchImportProfilesResult {
    constructor(data) {
      __publicField(this, "totalCount");
      __publicField(this, "results");
      if (data) {
        for (var property in data) {
          if (data.hasOwnProperty(property))
            this[property] = data[property];
        }
      }
    }
    init(_data) {
      if (_data) {
        this.totalCount = _data["totalCount"];
        if (Array.isArray(_data["results"])) {
          this.results = [];
          for (let item of _data["results"])
            this.results.push(ImportProfile.fromJS(item));
        }
      }
    }
    static fromJS(data) {
      data = typeof data === "object" ? data : {};
      let result = new SearchImportProfilesResult();
      result.init(data);
      return result;
    }
    toJSON(data) {
      data = typeof data === "object" ? data : {};
      data["totalCount"] = this.totalCount;
      if (Array.isArray(this.results)) {
        data["results"] = [];
        for (let item of this.results)
          data["results"].push(item.toJSON());
      }
      return data;
    }
  }
  class SearchImportRunHistoryCriteria {
    constructor(data) {
      __publicField(this, "userId");
      __publicField(this, "userName");
      __publicField(this, "profileId");
      __publicField(this, "jobId");
      __publicField(this, "responseGroup");
      __publicField(this, "objectType");
      __publicField(this, "objectTypes");
      __publicField(this, "objectIds");
      __publicField(this, "keyword");
      __publicField(this, "searchPhrase");
      __publicField(this, "languageCode");
      __publicField(this, "sort");
      __publicField(this, "sortInfos");
      __publicField(this, "skip");
      __publicField(this, "take");
      if (data) {
        for (var property in data) {
          if (data.hasOwnProperty(property))
            this[property] = data[property];
        }
      }
    }
    init(_data) {
      if (_data) {
        this.userId = _data["userId"];
        this.userName = _data["userName"];
        this.profileId = _data["profileId"];
        this.jobId = _data["jobId"];
        this.responseGroup = _data["responseGroup"];
        this.objectType = _data["objectType"];
        if (Array.isArray(_data["objectTypes"])) {
          this.objectTypes = [];
          for (let item of _data["objectTypes"])
            this.objectTypes.push(item);
        }
        if (Array.isArray(_data["objectIds"])) {
          this.objectIds = [];
          for (let item of _data["objectIds"])
            this.objectIds.push(item);
        }
        this.keyword = _data["keyword"];
        this.searchPhrase = _data["searchPhrase"];
        this.languageCode = _data["languageCode"];
        this.sort = _data["sort"];
        if (Array.isArray(_data["sortInfos"])) {
          this.sortInfos = [];
          for (let item of _data["sortInfos"])
            this.sortInfos.push(SortInfo.fromJS(item));
        }
        this.skip = _data["skip"];
        this.take = _data["take"];
      }
    }
    static fromJS(data) {
      data = typeof data === "object" ? data : {};
      let result = new SearchImportRunHistoryCriteria();
      result.init(data);
      return result;
    }
    toJSON(data) {
      data = typeof data === "object" ? data : {};
      data["userId"] = this.userId;
      data["userName"] = this.userName;
      data["profileId"] = this.profileId;
      data["jobId"] = this.jobId;
      data["responseGroup"] = this.responseGroup;
      data["objectType"] = this.objectType;
      if (Array.isArray(this.objectTypes)) {
        data["objectTypes"] = [];
        for (let item of this.objectTypes)
          data["objectTypes"].push(item);
      }
      if (Array.isArray(this.objectIds)) {
        data["objectIds"] = [];
        for (let item of this.objectIds)
          data["objectIds"].push(item);
      }
      data["keyword"] = this.keyword;
      data["searchPhrase"] = this.searchPhrase;
      data["languageCode"] = this.languageCode;
      data["sort"] = this.sort;
      if (Array.isArray(this.sortInfos)) {
        data["sortInfos"] = [];
        for (let item of this.sortInfos)
          data["sortInfos"].push(item.toJSON());
      }
      data["skip"] = this.skip;
      data["take"] = this.take;
      return data;
    }
  }
  class SearchImportRunHistoryResult {
    constructor(data) {
      __publicField(this, "totalCount");
      __publicField(this, "results");
      if (data) {
        for (var property in data) {
          if (data.hasOwnProperty(property))
            this[property] = data[property];
        }
      }
    }
    init(_data) {
      if (_data) {
        this.totalCount = _data["totalCount"];
        if (Array.isArray(_data["results"])) {
          this.results = [];
          for (let item of _data["results"])
            this.results.push(ImportRunHistory.fromJS(item));
        }
      }
    }
    static fromJS(data) {
      data = typeof data === "object" ? data : {};
      let result = new SearchImportRunHistoryResult();
      result.init(data);
      return result;
    }
    toJSON(data) {
      data = typeof data === "object" ? data : {};
      data["totalCount"] = this.totalCount;
      if (Array.isArray(this.results)) {
        data["results"] = [];
        for (let item of this.results)
          data["results"].push(item.toJSON());
      }
      return data;
    }
  }
  class SettingDescriptor {
    constructor(data) {
      __publicField(this, "id");
      __publicField(this, "restartRequired");
      __publicField(this, "moduleId");
      __publicField(this, "groupName");
      __publicField(this, "name");
      __publicField(this, "displayName");
      __publicField(this, "isRequired");
      __publicField(this, "isHidden");
      __publicField(this, "valueType");
      __publicField(this, "allowedValues");
      __publicField(this, "defaultValue");
      __publicField(this, "isDictionary");
      __publicField(this, "isLocalizable");
      if (data) {
        for (var property in data) {
          if (data.hasOwnProperty(property))
            this[property] = data[property];
        }
      }
    }
    init(_data) {
      if (_data) {
        this.id = _data["id"];
        this.restartRequired = _data["restartRequired"];
        this.moduleId = _data["moduleId"];
        this.groupName = _data["groupName"];
        this.name = _data["name"];
        this.displayName = _data["displayName"];
        this.isRequired = _data["isRequired"];
        this.isHidden = _data["isHidden"];
        this.valueType = _data["valueType"];
        if (Array.isArray(_data["allowedValues"])) {
          this.allowedValues = [];
          for (let item of _data["allowedValues"])
            this.allowedValues.push(item);
        }
        this.defaultValue = _data["defaultValue"];
        this.isDictionary = _data["isDictionary"];
        this.isLocalizable = _data["isLocalizable"];
      }
    }
    static fromJS(data) {
      data = typeof data === "object" ? data : {};
      let result = new SettingDescriptor();
      result.init(data);
      return result;
    }
    toJSON(data) {
      data = typeof data === "object" ? data : {};
      data["id"] = this.id;
      data["restartRequired"] = this.restartRequired;
      data["moduleId"] = this.moduleId;
      data["groupName"] = this.groupName;
      data["name"] = this.name;
      data["displayName"] = this.displayName;
      data["isRequired"] = this.isRequired;
      data["isHidden"] = this.isHidden;
      data["valueType"] = this.valueType;
      if (Array.isArray(this.allowedValues)) {
        data["allowedValues"] = [];
        for (let item of this.allowedValues)
          data["allowedValues"].push(item);
      }
      data["defaultValue"] = this.defaultValue;
      data["isDictionary"] = this.isDictionary;
      data["isLocalizable"] = this.isLocalizable;
      return data;
    }
  }
  class SortInfo {
    constructor(data) {
      __publicField(this, "sortColumn");
      __publicField(this, "sortDirection");
      if (data) {
        for (var property in data) {
          if (data.hasOwnProperty(property))
            this[property] = data[property];
        }
      }
    }
    init(_data) {
      if (_data) {
        this.sortColumn = _data["sortColumn"];
        this.sortDirection = _data["sortDirection"];
      }
    }
    static fromJS(data) {
      data = typeof data === "object" ? data : {};
      let result = new SortInfo();
      result.init(data);
      return result;
    }
    toJSON(data) {
      data = typeof data === "object" ? data : {};
      data["sortColumn"] = this.sortColumn;
      data["sortDirection"] = this.sortDirection;
      return data;
    }
  }
  class ValidationResult {
    constructor(data) {
      __publicField(this, "errors");
      __publicField(this, "errorsCount");
      if (data) {
        for (var property in data) {
          if (data.hasOwnProperty(property))
            this[property] = data[property];
        }
      }
    }
    init(_data) {
      if (_data) {
        if (Array.isArray(_data["errors"])) {
          this.errors = [];
          for (let item of _data["errors"])
            this.errors.push(item);
        }
        this.errorsCount = _data["errorsCount"];
      }
    }
    static fromJS(data) {
      data = typeof data === "object" ? data : {};
      let result = new ValidationResult();
      result.init(data);
      return result;
    }
    toJSON(data) {
      data = typeof data === "object" ? data : {};
      if (Array.isArray(this.errors)) {
        data["errors"] = [];
        for (let item of this.errors)
          data["errors"].push(item);
      }
      data["errorsCount"] = this.errorsCount;
      return data;
    }
  }
  class ApiException extends Error {
    constructor(message, status, response, headers, result) {
      super();
      __publicField(this, "message");
      __publicField(this, "status");
      __publicField(this, "response");
      __publicField(this, "headers");
      __publicField(this, "result");
      __publicField(this, "isApiException", true);
      this.message = message;
      this.status = status;
      this.response = response;
      this.headers = headers;
      this.result = result;
    }
    static isApiException(obj) {
      return obj.isApiException === true;
    }
  }
  function throwException(message, status, response, headers, result) {
    throw new ApiException(message, status, response, headers, null);
  }
  const { getApiClient: getOrgApiClient } = framework.useApiClient(OrganizationClient);
  const useHelpers = () => {
    const route = vueRouter.useRoute();
    const { action: getCurrentOrganization } = framework.useAsync(async () => {
      const client = await getOrgApiClient();
      return client.getOrganizationInfo();
    });
    async function GetSellerId() {
      var _a, _b;
      let result = (_a = route == null ? void 0 : route.params) == null ? void 0 : _a.sellerId;
      if (!result || result === "") {
        result = (_b = await getCurrentOrganization()) == null ? void 0 : _b.organizationId;
      }
      return result;
    }
    return {
      GetSellerId
    };
  };
  const { getApiClient: getApiClient$3 } = framework.useApiClient(ImportClient);
  function useImportProfiles() {
    const { user } = framework.useUser();
    const { GetSellerId } = useHelpers();
    const profile = vue.ref(new ImportProfile());
    const profileSearchResult = vue.ref();
    const profileDetails = vue.ref(new ImportProfile({ settings: [new framework.ObjectSettingEntry()] }));
    let profileDetailsCopy;
    const dataImporters = vue.ref([]);
    const modified = vue.ref(false);
    const importProfiles = vue.ref([]);
    const { loading: dataImportersLoading, action: fetchDataImporters } = framework.useAsync(async () => {
      const client = await getApiClient$3();
      dataImporters.value = await client.getImporters();
      return dataImporters.value;
    });
    const { loading: profilesLoading, action: fetchImportProfiles } = framework.useAsync(
      async (args) => {
        var _a;
        const client = await getApiClient$3();
        const importUserId = await GetSellerId();
        const profileQuery = new SearchImportProfilesCriteria({ userId: importUserId, ...args });
        profileSearchResult.value = await client.searchImportProfiles(profileQuery);
        importProfiles.value = ((_a = profileSearchResult.value) == null ? void 0 : _a.results) || [];
      }
    );
    const { loading: profileLoading, action: loadImportProfile } = framework.useAsync(async (args) => {
      if (!(args == null ? void 0 : args.id)) {
        return;
      }
      const client = await getApiClient$3();
      profile.value = await client.getImportProfileById(args.id);
      profile.value.importer = dataImporters.value.find((x) => x.typeName === profile.value.dataImporterType);
      Object.assign(profileDetails.value, profile.value);
      profileDetailsCopy = ___namespace.cloneDeep(profileDetails.value);
    });
    const { action: createImportProfile } = framework.useAsync(async (newProfile) => {
      var _a, _b, _c, _d;
      if (!newProfile) {
        return;
      }
      const importUserId = await GetSellerId();
      const client = await getApiClient$3();
      newProfile.userName = (_a = user.value) == null ? void 0 : _a.userName;
      newProfile.userId = importUserId && importUserId != "" ? importUserId : (_b = user.value) == null ? void 0 : _b.id;
      const command = new ImportProfile({
        ...newProfile,
        userId: importUserId && importUserId != "" ? importUserId : (_c = user.value) == null ? void 0 : _c.id,
        settings: (_d = newProfile.settings) == null ? void 0 : _d.map((setting) => new framework.ObjectSettingEntry(setting))
      });
      const newProfileWithId = await client.createImportProfile(command);
      await loadImportProfile({ id: newProfileWithId.id });
    });
    const { loading: updateImportProfileLoading, action: updateImportProfile } = framework.useAsync(
      async (updatedProfile) => {
        var _a;
        if (!updatedProfile) {
          return;
        }
        const importUserId = await GetSellerId();
        const client = await getApiClient$3();
        const command = new ImportProfile({
          ...updatedProfile,
          userId: importUserId && importUserId != "" ? importUserId : (_a = user.value) == null ? void 0 : _a.id
        });
        await client.updateImportProfile(command);
        await loadImportProfile({ id: updatedProfile.id });
      }
    );
    const { action: deleteImportProfile } = framework.useAsync(async (args) => {
      if (!(args == null ? void 0 : args.id)) {
        return;
      }
      const client = await getApiClient$3();
      await client.deleteProfile(args.id);
    });
    function setImporter(typeName) {
      var _a;
      if (typeName) {
        const importer = dataImporters.value.find((item) => item.typeName === typeName);
        if (importer) {
          profileDetails.value.settings = [
            ...((_a = importer == null ? void 0 : importer.availSettings) == null ? void 0 : _a.map((x) => {
              const entry = new framework.ObjectSettingEntry(x);
              if (entry.defaultValue) {
                entry.value = entry.defaultValue;
              }
              return entry;
            })) || []
          ];
        }
      }
    }
    function setProfiles(extProfiles) {
      importProfiles.value = extProfiles;
    }
    function setProfile(extProfile) {
      profile.value = extProfile;
    }
    vue.watch(
      () => profileDetails,
      (state) => {
        modified.value = !___namespace.isEqual(profileDetailsCopy, state.value);
      },
      { deep: true }
    );
    return {
      loading: framework.useLoading(profilesLoading, profileLoading),
      importProfiles: vue.computed(() => importProfiles.value),
      dataImporters: vue.computed(() => dataImporters.value),
      dataImportersLoading,
      modified: vue.computed(() => modified.value),
      updateImportProfileLoading: vue.computed(() => updateImportProfileLoading.value),
      profile,
      profileDetails,
      fetchDataImporters,
      fetchImportProfiles,
      loadImportProfile,
      createImportProfile,
      updateImportProfile,
      deleteImportProfile,
      setImporter,
      setProfiles,
      setProfile
    };
  }
  const { getApiClient: getApiClient$2 } = framework.useApiClient(ImportClient);
  function useImportStatus({
    setProfiles,
    setFile,
    importProfiles,
    profile
  }) {
    const { notifications } = framework.useNotifications();
    const importStatus = vue.ref({ inProgress: false });
    const importStarted = vue.ref(false);
    function updateStatus(notification) {
      var _a;
      const pushNotification = notification;
      importStatus.value = {
        notification: { ...notification, errorCount: pushNotification.errorsCount ?? pushNotification.errorCount },
        jobId: notification.jobId,
        inProgress: !notification.finished,
        progress: notification.processedCount / notification.totalCount * 100 || 0,
        estimatingRemaining: pushNotification.estimatingRemaining,
        estimatedRemaining: pushNotification.estimatedRemaining,
        fileName: "fileUrl" in pushNotification && typeof pushNotification.fileUrl === "string" && ((_a = pushNotification.fileUrl) == null ? void 0 : _a.split("/").pop()) || void 0
      };
    }
    vue.watch(
      [() => notifications, () => importStarted],
      ([newNotifications, isStarted]) => {
        var _a;
        if (isStarted.value && importStatus.value) {
          const notification = newNotifications.value.find(
            (x) => {
              var _a2, _b;
              return x.id === ((_b = (_a2 = importStatus.value) == null ? void 0 : _a2.notification) == null ? void 0 : _b.id);
            }
          );
          if (notification) {
            updateStatus(notification);
          }
        }
        if (importProfiles.value && ((_a = importProfiles.value) == null ? void 0 : _a.length)) {
          const mappedProfiles = importProfiles.value.map((item) => {
            const notification = newNotifications.value.find(
              (x) => x.profileId === item.id
            );
            if (notification) {
              item.inProgress = !notification.finished;
              item.jobId = notification.jobId;
            }
            return item;
          });
          setProfiles(mappedProfiles);
        }
      },
      { deep: true, immediate: true }
    );
    const { loading, action: startImport } = framework.useAsync(async (extProfile) => {
      const client = await getApiClient$2();
      const importProfile = new ImportProfile(
        extProfile && Object.keys(extProfile).length > 0 ? extProfile : profile.value
      );
      const notification = await client.runImport(importProfile);
      importStarted.value = true;
      updateStatus(notification);
    });
    const { action: cancelImport } = framework.useAsync(async () => {
      var _a, _b;
      const client = await getApiClient$2();
      if ((_a = importStatus.value) == null ? void 0 : _a.inProgress) {
        await client.cancelJob(new ImportCancellationRequest({ jobId: (_b = importStatus.value) == null ? void 0 : _b.jobId }));
      }
    });
    function clearImport() {
      setFile({
        url: void 0,
        name: void 0,
        size: 0
      });
      importStatus.value = void 0;
    }
    function setImportStarted(value) {
      importStarted.value = value;
    }
    return {
      loading,
      importStatus: vue.computed(() => importStatus.value),
      importStarted: vue.computed(() => importStarted.value),
      setImportStarted,
      startImport,
      cancelImport,
      clearImport,
      updateStatus
    };
  }
  function useUploadedFile({
    profile,
    setProfile
  }) {
    const uploadedFile = vue.ref();
    function setFile(file) {
      setProfile(
        vue.reactive(
          new ImportProfile({
            ...profile.value,
            importFileUrl: file.url
          })
        )
      );
      uploadedFile.value = file;
    }
    return {
      uploadedFile: vue.computed(() => uploadedFile.value),
      setFile
    };
  }
  const { getApiClient: getApiClient$1 } = framework.useApiClient(ImportClient);
  function useImportHistory() {
    const { GetSellerId } = useHelpers();
    const historySearchResult = vue.ref();
    const currentPage = vue.ref(1);
    const { loading, action: fetchImportHistory } = framework.useAsync(
      async (query) => {
        const client = await getApiClient$1();
        const importUserId = await GetSellerId();
        const historyQuery = new SearchImportRunHistoryCriteria({
          ...query || {},
          take: 15,
          userId: importUserId
        });
        historySearchResult.value = await client.searchImportRunHistory(historyQuery);
        currentPage.value = ((historyQuery == null ? void 0 : historyQuery.skip) || 0) / Math.max(1, (historyQuery == null ? void 0 : historyQuery.take) || 15) + 1;
      }
    );
    return {
      loading: vue.computed(() => loading.value),
      importHistory: vue.computed(() => {
        var _a;
        return (_a = historySearchResult.value) == null ? void 0 : _a.results;
      }),
      totalHistoryCount: vue.computed(() => {
        var _a;
        return (_a = historySearchResult.value) == null ? void 0 : _a.totalCount;
      }),
      historyPages: vue.computed(() => {
        var _a;
        return Math.ceil((((_a = historySearchResult.value) == null ? void 0 : _a.totalCount) ?? 1) / 15);
      }),
      currentPage: vue.computed(() => currentPage.value),
      fetchImportHistory
    };
  }
  const { getApiClient } = framework.useApiClient(ImportClient);
  const useImport = () => {
    const { notifications } = framework.useNotifications();
    const { GetSellerId } = useHelpers();
    const {
      profile,
      profileDetails,
      dataImporters,
      importProfiles,
      dataImportersLoading,
      modified,
      updateImportProfileLoading,
      loadImportProfile,
      createImportProfile,
      updateImportProfile,
      deleteImportProfile,
      fetchDataImporters,
      setImporter,
      fetchImportProfiles,
      setProfiles,
      setProfile,
      loading: profilesLoading
    } = useImportProfiles();
    const {
      importHistory,
      totalHistoryCount,
      historyPages,
      currentPage,
      fetchImportHistory,
      loading: importHistoryLoading
    } = useImportHistory();
    const { uploadedFile, setFile } = useUploadedFile({
      setProfile,
      profile
    });
    const { importStatus, updateStatus, setImportStarted, startImport, clearImport } = useImportStatus({
      importProfiles,
      profile,
      setProfiles,
      setFile
    });
    const errorMessage = vue.ref("");
    const { loading: previewDataLoading, action: previewData } = framework.useAsync(async () => {
      const importUserId = await GetSellerId();
      const client = await getApiClient();
      try {
        const previewDataQuery = new ImportProfile({
          ...profile.value,
          userId: importUserId
        });
        return client.preview(previewDataQuery);
      } catch (e) {
        console.error(e);
        throw e;
      }
    });
    const { action: cancelImport } = framework.useAsync(async () => {
      var _a, _b;
      const client = await getApiClient();
      try {
        if ((_a = importStatus.value) == null ? void 0 : _a.inProgress) {
          await client.cancelJob(new ImportCancellationRequest({ jobId: (_b = importStatus.value) == null ? void 0 : _b.jobId }));
        }
      } catch (e) {
        console.error(e);
        throw e;
      }
    });
    function getLongRunning(args) {
      const job = notifications.value.find((x) => {
        return x.profileId === (args == null ? void 0 : args.id);
      });
      if (job && !job.finished) {
        updateStatus(job);
        setImportStarted(true);
      }
    }
    function clearErrorMessage() {
      errorMessage.value = "";
    }
    function setErrorMessage(message) {
      errorMessage.value = message;
    }
    async function init(args) {
      if (args.profileId) {
        await fetchDataImporters();
        await loadImportProfile({ id: args.profileId });
        await fetchImportHistory({
          profileId: args.profileId,
          jobId: args.importJobId
        });
      }
      getTasks(args);
    }
    function getTasks(args) {
      if (args.profileId && args.importJobId) {
        const historyItem = importHistory.value && importHistory.value.find((x) => x.jobId === args.importJobId);
        getLongRunning({ id: args.profileId });
        if (!(importStatus.value && importStatus.value.jobId) && historyItem) {
          updateStatus(historyItem);
        }
      }
    }
    return {
      loading: framework.useLoading(profilesLoading),
      importHistoryLoading: framework.useLoading(importHistoryLoading),
      dataImportersLoading: framework.useLoading(dataImportersLoading),
      previewDataLoading: framework.useLoading(previewDataLoading),
      profilesLoading: vue.computed(() => profilesLoading.value),
      uploadedFile: vue.computed(() => uploadedFile.value),
      importStatus: vue.computed(() => importStatus.value),
      isValid: vue.computed(() => !!(profile.value.importer && uploadedFile.value)),
      importHistory,
      importProfiles,
      dataImporters: vue.computed(() => dataImporters.value),
      modified: vue.computed(() => modified.value),
      profile: vue.computed(() => profile.value),
      totalHistoryCount,
      historyPages,
      currentPage,
      profileDetails,
      errorMessage: vue.computed(() => errorMessage.value),
      updateImportProfileLoading,
      setFile,
      fetchDataImporters,
      previewData,
      startImport,
      cancelImport,
      clearImport,
      loadImportProfile,
      fetchImportHistory,
      fetchImportProfiles,
      createImportProfile,
      updateImportProfile,
      deleteImportProfile,
      setImporter,
      updateStatus,
      getLongRunning,
      setErrorMessage,
      clearErrorMessage,
      init,
      getTasks
    };
  };
  const _hoisted_1$8 = { class: "tw-p-4" };
  const _hoisted_2$6 = ["href"];
  const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
    ...{
      url: "/import-profile-details",
      name: "ImportProfileDetails",
      routable: false
    },
    __name: "import-profile-details",
    props: {
      expanded: { type: Boolean, default: true },
      closable: { type: Boolean, default: true },
      param: { default: void 0 },
      options: { default: void 0 }
    },
    emits: ["close:blade", "collapse:blade", "expand:blade", "parent:call"],
    setup(__props, { expose: __expose, emit: __emit }) {
      const props = __props;
      const emit = __emit;
      const { showConfirmation } = framework.usePopup();
      const { t } = vueI18n.useI18n({ useScope: "global" });
      const {
        dataImporters,
        profileDetails,
        loading,
        profile,
        modified,
        updateImportProfileLoading,
        dataImportersLoading,
        createImportProfile,
        loadImportProfile,
        deleteImportProfile,
        updateImportProfile,
        fetchDataImporters,
        setImporter
      } = useImport();
      veeValidate.useForm({ validateOnMount: false });
      const isValid = veeValidate.useIsFormValid();
      const isDirty = veeValidate.useIsFormDirty();
      const { onBeforeClose } = framework.useBladeNavigation();
      framework.useBeforeUnload(vue.computed(() => !isDisabled.value || modified.value));
      const bladeLoading = vue.computed(() => loading.value || updateImportProfileLoading.value || dataImportersLoading.value);
      const isDisabled = vue.computed(() => {
        return !isDirty.value || !isValid.value;
      });
      const bladeToolbar = vue.ref([
        {
          id: "save",
          title: vue.computed(() => t("IMPORT.PAGES.PROFILE_DETAILS.TOOLBAR.SAVE")),
          icon: "material-save",
          async clickHandler() {
            if (isValid.value) {
              if (props.param) {
                await updateImportProfile(profileDetails.value);
                emit("parent:call", {
                  method: "reloadParent"
                });
              } else {
                await createImportProfile(profileDetails.value);
                emit("parent:call", {
                  method: "reload"
                });
              }
              emit("close:blade");
            }
          },
          disabled: vue.computed(() => {
            return isDisabled.value || !modified.value;
          })
        },
        {
          id: "cancel",
          title: vue.computed(() => t("IMPORT.PAGES.PROFILE_DETAILS.TOOLBAR.CANCEL")),
          icon: "material-cancel",
          clickHandler() {
            emit("close:blade");
          },
          isVisible: vue.computed(() => !props.param)
        },
        {
          id: "delete",
          title: vue.computed(() => t("IMPORT.PAGES.PROFILE_DETAILS.TOOLBAR.DELETE")),
          icon: "material-delete",
          isVisible: vue.computed(() => !!props.param),
          async clickHandler() {
            if (await showConfirmation(
              vue.computed(() => t("IMPORT.PAGES.PROFILE_DETAILS.CONFIRM_POPUP.DELETE_IMPORTER.DESCRIPTION"))
            )) {
              deleteProfile();
            }
          }
        }
      ]);
      const sampleTemplateUrl = vue.computed(() => {
        const importer = dataImporters.value.find((x) => x.typeName === profileDetails.value.dataImporterType);
        let url;
        if (profile.value.importer) {
          url = profile.value.importer.metadata && profile.value.importer.metadata.sampleCsvUrl;
        } else if (importer) {
          url = importer.metadata && importer.metadata.sampleCsvUrl;
        } else {
          url = "#";
        }
        return url;
      });
      const title = vue.computed(
        () => {
          var _a, _b;
          return ((_a = props.options) == null ? void 0 : _a.importer) ? (_b = props.options) == null ? void 0 : _b.importer.typeName : t("IMPORT.PAGES.PROFILE_DETAILS.TITLE");
        }
      );
      vue.onMounted(async () => {
        await fetchDataImporters();
        if (props.param) {
          await loadImportProfile({ id: props.param });
        }
      });
      function setSettingsValue(data) {
        var _a;
        const { property, value } = data;
        const mutatedSetting = new ObjectSettingEntry({ ...property, value });
        (_a = profileDetails.value.settings) == null ? void 0 : _a.forEach((x) => {
          if (x.id && property.id && x.id === property.id || x.name === property.name) {
            Object.assign(x, mutatedSetting);
          }
        });
      }
      function loadDictionaries(settingId) {
        var _a;
        const setting = (_a = profileDetails.value.settings) == null ? void 0 : _a.find((x) => x.id === settingId);
        if ((setting == null ? void 0 : setting.allowedValues) && (setting == null ? void 0 : setting.allowedValues.length)) {
          return setting.allowedValues.map((val) => ({
            id: val,
            alias: val
          }));
        }
      }
      async function deleteProfile() {
        if (props.param) {
          await deleteImportProfile({ id: props.param });
          emit("parent:call", {
            method: "reloadParent"
          });
          emit("close:blade");
        }
      }
      onBeforeClose(async () => {
        if (modified.value) {
          return await showConfirmation(vue.unref(vue.computed(() => t("IMPORT.PAGES.PROFILE_DETAILS.ALERTS.CLOSE_CONFIRMATION"))));
        }
      });
      __expose({
        title
      });
      return (_ctx, _cache) => {
        const _component_VcCard = vue.resolveComponent("VcCard");
        const _directive_loading = vue.resolveDirective("loading");
        return vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(framework.VcBlade), {
          title: _ctx.param && vue.unref(profileDetails) ? vue.unref(profileDetails).name : _ctx.$t("IMPORT.PAGES.PROFILE_DETAILS.TITLE"),
          width: "50%",
          "toolbar-items": bladeToolbar.value,
          closable: _ctx.closable,
          expanded: _ctx.expanded,
          modified: vue.unref(modified),
          onClose: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("close:blade")),
          onExpand: _cache[3] || (_cache[3] = ($event) => _ctx.$emit("expand:blade")),
          onCollapse: _cache[4] || (_cache[4] = ($event) => _ctx.$emit("collapse:blade"))
        }, {
          default: vue.withCtx(() => [
            vue.createVNode(vue.unref(framework.VcContainer), null, {
              default: vue.withCtx(() => [
                vue.createVNode(vue.unref(framework.VcRow), null, {
                  default: vue.withCtx(() => [
                    vue.createVNode(vue.unref(framework.VcCol), null, {
                      default: vue.withCtx(() => [
                        vue.createVNode(vue.unref(veeValidate.Field), {
                          label: _ctx.$t("IMPORT.PAGES.PROFILE_DETAILS.IMPORT_INPUTS.PROFILE_NAME.TITLE"),
                          rules: "required",
                          name: "profile_name",
                          "model-value": vue.unref(profileDetails).name
                        }, {
                          default: vue.withCtx(({ field, errorMessage, handleChange, errors }) => [
                            vue.createVNode(vue.unref(framework.VcInput), vue.mergeProps(field, {
                              modelValue: vue.unref(profileDetails).name,
                              "onUpdate:modelValue": [
                                _cache[0] || (_cache[0] = ($event) => vue.unref(profileDetails).name = $event),
                                handleChange
                              ],
                              class: "tw-p-3",
                              label: _ctx.$t("IMPORT.PAGES.PROFILE_DETAILS.IMPORT_INPUTS.PROFILE_NAME.TITLE"),
                              placeholder: _ctx.$t("IMPORT.PAGES.PROFILE_DETAILS.IMPORT_INPUTS.PROFILE_NAME.PLACEHOLDER"),
                              clearable: true,
                              tooltip: _ctx.$t("IMPORT.PAGES.PROFILE_DETAILS.IMPORT_INPUTS.PROFILE_NAME.TOOLTIP"),
                              error: !!errors.length,
                              "error-message": errorMessage,
                              required: ""
                            }), null, 16, ["modelValue", "label", "placeholder", "tooltip", "error", "error-message", "onUpdate:modelValue"])
                          ]),
                          _: 1
                        }, 8, ["label", "model-value"]),
                        vue.createVNode(vue.unref(veeValidate.Field), {
                          label: _ctx.$t("IMPORT.PAGES.PROFILE_DETAILS.IMPORT_INPUTS.IMPORTER.TITLE"),
                          rules: "required",
                          name: "importer",
                          "model-value": vue.unref(profileDetails).dataImporterType
                        }, {
                          default: vue.withCtx(({ field, handleChange }) => [
                            vue.createVNode(vue.unref(framework.VcSelect), vue.mergeProps(field, {
                              modelValue: vue.unref(profileDetails).dataImporterType,
                              "onUpdate:modelValue": [
                                _cache[1] || (_cache[1] = ($event) => vue.unref(profileDetails).dataImporterType = $event),
                                (e) => {
                                  handleChange(e);
                                  vue.unref(setImporter)(e);
                                }
                              ],
                              class: "tw-p-3",
                              label: _ctx.$t("IMPORT.PAGES.PROFILE_DETAILS.IMPORT_INPUTS.IMPORTER.TITLE"),
                              tooltip: _ctx.$t("IMPORT.PAGES.PROFILE_DETAILS.IMPORT_INPUTS.IMPORTER.TOOLTIP"),
                              options: vue.unref(dataImporters),
                              "option-value": "typeName",
                              "option-label": "typeName",
                              required: "",
                              searchable: "",
                              clearable: false
                            }), null, 16, ["modelValue", "label", "tooltip", "options", "onUpdate:modelValue"])
                          ]),
                          _: 1
                        }, 8, ["label", "model-value"])
                      ]),
                      _: 1
                    })
                  ]),
                  _: 1
                }),
                vue.unref(profileDetails).dataImporterType ? (vue.openBlock(), vue.createBlock(vue.unref(framework.VcRow), {
                  key: 0,
                  class: "tw-p-3"
                }, {
                  default: vue.withCtx(() => [
                    vue.createVNode(_component_VcCard, {
                      header: _ctx.$t("IMPORT.PAGES.PROFILE_DETAILS.PROFILE_SETTINGS.TITLE")
                    }, {
                      default: vue.withCtx(() => [
                        vue.createVNode(vue.unref(framework.VcRow), null, {
                          default: vue.withCtx(() => [
                            vue.createVNode(vue.unref(framework.VcCol), null, {
                              default: vue.withCtx(() => [
                                vue.createElementVNode("div", _hoisted_1$8, [
                                  vue.createElementVNode("a", {
                                    class: "vc-link",
                                    href: sampleTemplateUrl.value
                                  }, vue.toDisplayString(_ctx.$t("IMPORT.PAGES.TEMPLATE.DOWNLOAD_TEMPLATE")), 9, _hoisted_2$6),
                                  vue.createTextVNode(" " + vue.toDisplayString(_ctx.$t("IMPORT.PAGES.TEMPLATE.FOR_REFERENCE")), 1)
                                ]),
                                (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(profileDetails).settings, (setting, i) => {
                                  return vue.openBlock(), vue.createBlock(vue.unref(framework.VcDynamicProperty), {
                                    key: `${setting.name}_${i}`,
                                    class: "tw-px-4 tw-pb-4",
                                    property: setting,
                                    dictionary: setting.isDictionary,
                                    disabled: setting.isReadOnly,
                                    name: setting.name ?? "",
                                    "options-getter": loadDictionaries,
                                    "model-value": setting.value,
                                    required: setting.isRequired ?? false,
                                    "value-type": setting.valueType ?? "",
                                    placeholder: setting.defaultValue,
                                    "onUpdate:modelValue": (args) => setSettingsValue({ property: setting, ...args })
                                  }, null, 8, ["property", "dictionary", "disabled", "name", "model-value", "required", "value-type", "placeholder", "onUpdate:modelValue"]);
                                }), 128))
                              ]),
                              _: 1
                            })
                          ]),
                          _: 1
                        })
                      ]),
                      _: 1
                    }, 8, ["header"])
                  ]),
                  _: 1
                })) : vue.createCommentVNode("", true)
              ]),
              _: 1
            })
          ]),
          _: 1
        }, 8, ["title", "toolbar-items", "closable", "expanded", "modified"])), [
          [_directive_loading, bladeLoading.value, "1000"]
        ]);
      };
    }
  });
  var UserPermissions = /* @__PURE__ */ ((UserPermissions2) => {
    UserPermissions2["SellerImportProfilesEdit"] = "seller:import_profiles:edit";
    return UserPermissions2;
  })(UserPermissions || {});
  const _hoisted_1$7 = { class: "tw-flex tw-flex-col" };
  const _hoisted_2$5 = { class: "tw-flex tw-flex-row tw-justify-between" };
  const _hoisted_3$4 = { class: "tw-p-5 tw-flex tw-items-center" };
  const _hoisted_4$3 = { class: "tw-m-0 tw-text-[color:var(--import-popup-description-color)] tw-leading-lg" };
  const _hoisted_5$1 = { class: "tw-p-5 tw-flex tw-items-center tw-border-l tw-border-solid tw-border-l-[var(--import-popup-border-color)]" };
  const _hoisted_6 = { class: "tw-text-lg tw-leading-xl tw-text-[color:var(--import-popup-description-color)] tw-m-0" };
  const _hoisted_7 = { class: "tw-text-[color:var(--import-popup-preview-text-color)]" };
  const _hoisted_8 = { class: "tw-text-[color:var(--import-popup-preview-text-color)]" };
  const _hoisted_9 = { class: "tw-p-5 tw-flex tw-flex-auto tw-justify-between" };
  const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
    __name: "ImportPopup",
    props: {
      columns: { default: () => [] },
      items: { default: () => [] },
      total: { default: 0 },
      disabled: { type: Boolean, default: false }
    },
    emits: ["close", "startImport"],
    setup(__props) {
      return (_ctx, _cache) => {
        return vue.openBlock(), vue.createBlock(vue.unref(framework.VcPopup), {
          title: _ctx.$t("IMPORT.PAGES.IMPORTING.POPUP.TITLE"),
          "is-fullscreen": "",
          "is-mobile-fullscreen": "",
          "modal-width": "tw-w-screen",
          class: "import-popup",
          onClose: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("close"))
        }, {
          content: vue.withCtx(() => [
            vue.createElementVNode("div", _hoisted_1$7, [
              vue.createElementVNode("div", _hoisted_2$5, [
                vue.createElementVNode("div", _hoisted_3$4, [
                  vue.createElementVNode("p", _hoisted_4$3, vue.toDisplayString(_ctx.$t("IMPORT.PAGES.IMPORTING.POPUP.DESCRIPTION")), 1)
                ]),
                vue.createElementVNode("div", _hoisted_5$1, [
                  vue.createElementVNode("p", _hoisted_6, [
                    vue.createTextVNode(vue.toDisplayString(_ctx.$t("IMPORT.PAGES.IMPORTING.POPUP.PREVIEW_COUNT")) + ": ", 1),
                    vue.createElementVNode("span", _hoisted_7, vue.toDisplayString(_ctx.items.length), 1),
                    vue.createTextVNode(" " + vue.toDisplayString(_ctx.$t("IMPORT.PAGES.IMPORTING.POPUP.PREVIEW_OF")) + " ", 1),
                    vue.createElementVNode("span", _hoisted_8, vue.toDisplayString(_ctx.total), 1)
                  ])
                ])
              ]),
              vue.createVNode(vue.unref(framework.VcTable), {
                class: "tw-flex-auto",
                columns: _ctx.columns,
                items: _ctx.items,
                header: false,
                footer: false,
                "state-key": "import_popup"
              }, null, 8, ["columns", "items"])
            ])
          ]),
          footer: vue.withCtx(({ close }) => [
            vue.createElementVNode("div", _hoisted_9, [
              vue.createVNode(vue.unref(framework.VcButton), {
                outline: true,
                onClick: close
              }, {
                default: vue.withCtx(() => [
                  vue.createTextVNode(vue.toDisplayString(_ctx.$t("IMPORT.PAGES.IMPORTING.POPUP.CANCEL")), 1)
                ]),
                _: 2
              }, 1032, ["onClick"]),
              vue.createVNode(vue.unref(framework.VcButton), {
                disabled: _ctx.disabled,
                onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("startImport"))
              }, {
                default: vue.withCtx(() => [
                  vue.createTextVNode(vue.toDisplayString(_ctx.$t("IMPORT.PAGES.IMPORTING.POPUP.IMPORT")), 1)
                ]),
                _: 1
              }, 8, ["disabled"])
            ])
          ]),
          _: 1
        }, 8, ["title"]);
      };
    }
  });
  const _hoisted_1$6 = { class: "tw-flex tw-flex-row tw-items-center" };
  const _hoisted_2$4 = {
    key: 0,
    class: "tw-w-[30px] tw-h-[41px] tw-bg-center tw-bg-no-repeat tw-bg-[image:var(--file-upload-success-img)]"
  };
  const _hoisted_3$3 = {
    key: 1,
    class: "tw-w-[30px] tw-h-[41px] tw-bg-center tw-bg-no-repeat tw-bg-[image:var(--file-upload-error-img)]"
  };
  const _hoisted_4$2 = { class: "tw-flex tw-flex-col tw-grow tw-basis-0 tw-ml-3" };
  const _hoisted_5 = { class: "tw-font-normal tw-text-lg" };
  const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
    __name: "ImportUploadedFile",
    props: {
      uploadedFile: { default: () => ({}) },
      isUploaded: { type: Boolean, default: false }
    },
    setup(__props) {
      return (_ctx, _cache) => {
        const _component_VcHint = vue.resolveComponent("VcHint");
        return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$6, [
          _ctx.isUploaded ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$4)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$3)),
          vue.createElementVNode("div", _hoisted_4$2, [
            vue.createElementVNode("div", _hoisted_5, vue.toDisplayString(_ctx.uploadedFile.name), 1),
            typeof _ctx.uploadedFile.size === "number" ? (vue.openBlock(), vue.createBlock(_component_VcHint, { key: 0 }, {
              default: vue.withCtx(() => [
                vue.createTextVNode(vue.toDisplayString(_ctx.uploadedFile.size) + " Mb ", 1)
              ]),
              _: 1
            })) : vue.createCommentVNode("", true)
          ])
        ]);
      };
    }
  });
  const _hoisted_1$5 = { class: "tw-flex tw-flex-col tw-grow tw-basis-0" };
  const _hoisted_2$3 = {
    key: 0,
    class: "tw-flex tw-flex-row tw-justify-between tw-mt-5"
  };
  const _hoisted_3$2 = { class: "tw-ml-auto" };
  const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
    __name: "ImportUploadStatus",
    props: {
      uploadActions: { default: () => [] },
      uploadedFile: {},
      isUploaded: { type: Boolean },
      isStarted: { type: Boolean }
    },
    setup(__props) {
      const props = __props;
      const filteredActions = vue.computed(() => props.uploadActions.filter((action) => action.isVisible));
      return (_ctx, _cache) => {
        const _component_VcButton = vue.resolveComponent("VcButton");
        return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$5, [
          vue.createVNode(_sfc_main$8, {
            "uploaded-file": _ctx.uploadedFile,
            "is-uploaded": _ctx.isUploaded
          }, null, 8, ["uploaded-file", "is-uploaded"]),
          filteredActions.value && filteredActions.value.length ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$3, [
            vue.createElementVNode("div", null, [
              (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(filteredActions.value.slice(0, 1), (action, i) => {
                return vue.openBlock(), vue.createBlock(_component_VcButton, {
                  key: i,
                  variant: action.variant,
                  outline: action.outline,
                  small: true,
                  disabled: action.disabled,
                  onClick: action.clickHandler
                }, {
                  default: vue.withCtx(() => [
                    vue.createTextVNode(vue.toDisplayString(action.name), 1)
                  ]),
                  _: 2
                }, 1032, ["variant", "outline", "disabled", "onClick"]);
              }), 128))
            ]),
            vue.createElementVNode("div", _hoisted_3$2, [
              (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(filteredActions.value.slice(1, 3), (action, i) => {
                return vue.openBlock(), vue.createBlock(_component_VcButton, {
                  key: i,
                  variant: action.variant,
                  outline: action.outline,
                  small: true,
                  disabled: action.disabled,
                  class: "tw-ml-3",
                  onClick: action.clickHandler
                }, {
                  default: vue.withCtx(() => [
                    vue.createTextVNode(vue.toDisplayString(action.name), 1)
                  ]),
                  _: 2
                }, 1032, ["variant", "outline", "disabled", "onClick"]);
              }), 128))
            ])
          ])) : vue.createCommentVNode("", true)
        ]);
      };
    }
  });
  const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
    __name: "ImportStatus",
    props: {
      item: { default: void 0 }
    },
    setup(__props) {
      const props = __props;
      const statusStyles = vue.computed(
        () => {
          if (props.item.finished) {
            if (props.item.errorsCount && props.item.processedCount && props.item.errorsCount >= props.item.processedCount) {
              return {
                outline: false,
                variant: "danger"
              };
            } else if (props.item.errorsCount && props.item.processedCount && props.item.errorsCount < props.item.processedCount && props.item.errorsCount > 0) {
              return {
                outline: false,
                variant: "warning"
              };
            } else if (props.item.errorsCount === 0) {
              return {
                outline: false,
                variant: "success"
              };
            }
          }
          return {
            outline: true,
            variant: "warning"
          };
        }
      );
      const statusText = vue.computed(() => {
        if (props.item.finished) {
          if (props.item.errorsCount && props.item.processedCount && props.item.errorsCount >= props.item.processedCount) {
            return "Failed";
          } else if (props.item.errorsCount && props.item.processedCount && props.item.errorsCount < props.item.processedCount && props.item.errorsCount > 0) {
            return "CompletedWithErrors";
          } else if (props.item.errorsCount === 0) {
            return "Completed";
          }
        }
        return "Cancelled";
      });
      return (_ctx, _cache) => {
        const _component_VcStatus = vue.resolveComponent("VcStatus");
        return vue.openBlock(), vue.createBlock(_component_VcStatus, vue.normalizeProps(vue.guardReactiveProps(statusStyles.value)), {
          default: vue.withCtx(() => [
            vue.createTextVNode(vue.toDisplayString(_ctx.$t(`IMPORT.PAGES.LIST.TABLE.STATUSES.${vue.unref(framework.camelToSnake)(statusText.value).toUpperCase()}`)), 1)
          ]),
          _: 1
        }, 16);
      };
    }
  });
  const _hoisted_1$4 = { class: "tw-ml-3" };
  const _hoisted_2$2 = { class: "tw-font-medium" };
  const _hoisted_3$1 = { key: 1 };
  const _hoisted_4$1 = ["href"];
  const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
    __name: "ImportStat",
    props: {
      importStatus: {}
    },
    setup(__props) {
      const { errorMessage } = useImport();
      const { t } = vueI18n.useI18n({ useScope: "global" });
      const props = __props;
      const importStatus = vue.computed(() => props.importStatus);
      const locale = window.navigator.language;
      const progressbarVariant = vue.computed(() => inProgress.value ? "striped" : "default");
      const importStarted = vue.computed(() => !!(importStatus.value && importStatus.value.jobId));
      const estimatedRemaining = vue.computed(() => {
        return importStatus.value && importStatus.value.estimatedRemaining ? moment.duration(importStatus.value.estimatedRemaining).locale(locale).humanize(false, "precise") : null;
      });
      const reportUrl = vue.computed(() => {
        var _a, _b;
        return (_b = (_a = importStatus.value) == null ? void 0 : _a.notification) == null ? void 0 : _b.reportUrl;
      });
      const inProgress = vue.computed(() => importStatus.value && importStatus.value.inProgress || false);
      const importBadges = vue.computed(() => {
        var _a, _b, _c, _d;
        const clockTitleTime = (() => {
          var _a2, _b2, _c2, _d2;
          if ((_b2 = (_a2 = importStatus.value) == null ? void 0 : _a2.notification) == null ? void 0 : _b2.created) {
            return moment(importStatus.value.notification.created).locale(locale).format("LTS");
          } else if ((_d2 = (_c2 = importStatus.value) == null ? void 0 : _c2.notification) == null ? void 0 : _d2.createdDate) {
            return moment(importStatus.value.notification.createdDate).locale(locale).format("LTS");
          }
          return null;
        })();
        const linesImported = (() => {
          var _a2, _b2, _c2, _d2;
          if (typeof ((_b2 = (_a2 = importStatus.value) == null ? void 0 : _a2.notification) == null ? void 0 : _b2.processedCount) !== "undefined" && typeof ((_d2 = (_c2 = importStatus.value) == null ? void 0 : _c2.notification) == null ? void 0 : _d2.errorCount) !== "undefined") {
            const value = importStatus.value.notification.processedCount - importStatus.value.notification.errorCount;
            return value >= 0 ? value : 0;
          }
          return 0;
        })();
        const clockDescription = (() => {
          var _a2, _b2, _c2, _d2;
          if ((_b2 = (_a2 = importStatus.value) == null ? void 0 : _a2.notification) == null ? void 0 : _b2.created) {
            return moment(importStatus.value.notification.created).locale(locale).fromNow();
          } else if ((_d2 = (_c2 = importStatus.value) == null ? void 0 : _c2.notification) == null ? void 0 : _d2.createdDate) {
            return moment(importStatus.value.notification.createdDate).locale(locale).fromNow();
          }
          return void 0;
        })();
        return [
          {
            id: "clock",
            icon: "lucide-clock",
            color: "var(--import-new-badge-color-info)",
            title: t("IMPORT.PAGES.PRODUCT_IMPORTER.UPLOAD_STATUS.STARTED_AT") + " " + clockTitleTime,
            description: clockDescription
          },
          {
            id: "linesRead",
            icon: "material-check_circle",
            color: "var(--import-new-badge-color-success)",
            title: (_b = (_a = importStatus.value) == null ? void 0 : _a.notification) == null ? void 0 : _b.totalCount,
            description: t("IMPORT.PAGES.PRODUCT_IMPORTER.UPLOAD_STATUS.LINES_READ")
          },
          {
            id: "linesImported",
            icon: "material-check_circle",
            color: "var(--import-new-badge-color-success)",
            title: linesImported,
            description: t("IMPORT.PAGES.PRODUCT_IMPORTER.UPLOAD_STATUS.IMPORTED")
          },
          {
            id: "skipped",
            icon: "material-error",
            color: "var(--import-new-badge-color-warning)",
            title: typeof ((_d = (_c = importStatus.value) == null ? void 0 : _c.notification) == null ? void 0 : _d.errorCount) !== "undefined" ? importStatus.value.notification.errorCount : 0,
            description: t("IMPORT.PAGES.PRODUCT_IMPORTER.UPLOAD_STATUS.SKIPPED")
          }
        ];
      });
      return (_ctx, _cache) => {
        const _component_VcProgress = vue.resolveComponent("VcProgress");
        const _component_VcHint = vue.resolveComponent("VcHint");
        const _component_VcCol = vue.resolveComponent("VcCol");
        const _component_VcRow = vue.resolveComponent("VcRow");
        const _component_VcIcon = vue.resolveComponent("VcIcon");
        return importStarted.value ? (vue.openBlock(), vue.createBlock(_component_VcCol, { key: 0 }, {
          default: vue.withCtx(() => [
            inProgress.value ? (vue.openBlock(), vue.createBlock(_component_VcRow, {
              key: 0,
              class: "tw-relative tw-p-5 before:tw-content-[''] before:[background:linear-gradient(180deg,var(--import-new-border-color)_0%,rgba(236,242,246,0)_100%)] before:tw-left-0 before:tw-right-0 before:tw-absolute before:h-[21px] before:tw-top-0"
            }, {
              default: vue.withCtx(() => [
                vue.createVNode(_component_VcCol, { class: "tw-text-[var(--import-new-preview-text-color)]" }, {
                  default: vue.withCtx(() => {
                    var _a, _b, _c, _d;
                    return [
                      vue.createTextVNode(vue.toDisplayString(_ctx.$t("IMPORT.PAGES.PRODUCT_IMPORTER.UPLOAD_STATUS.IN_PROGRESS")) + " ", 1),
                      (vue.openBlock(), vue.createBlock(_component_VcProgress, {
                        key: (_a = importStatus.value) == null ? void 0 : _a.progress,
                        class: "tw-mt-3",
                        value: (_b = importStatus.value) == null ? void 0 : _b.progress,
                        variant: progressbarVariant.value
                      }, null, 8, ["value", "variant"])),
                      ((_c = importStatus.value) == null ? void 0 : _c.estimatingRemaining) || ((_d = importStatus.value) == null ? void 0 : _d.estimatedRemaining) ? (vue.openBlock(), vue.createBlock(_component_VcHint, {
                        key: 0,
                        class: "tw-py-3"
                      }, {
                        default: vue.withCtx(() => {
                          var _a2;
                          return [
                            ((_a2 = importStatus.value) == null ? void 0 : _a2.estimatingRemaining) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
                              vue.createTextVNode(vue.toDisplayString(_ctx.$t("IMPORT.PAGES.PRODUCT_IMPORTER.UPLOAD_STATUS.ESTIMATING")), 1)
                            ], 64)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
                              vue.createTextVNode(vue.toDisplayString(_ctx.$t("IMPORT.PAGES.PRODUCT_IMPORTER.UPLOAD_STATUS.ESTIMATED")) + " " + vue.toDisplayString(estimatedRemaining.value), 1)
                            ], 64))
                          ];
                        }),
                        _: 1
                      })) : vue.createCommentVNode("", true)
                    ];
                  }),
                  _: 1
                })
              ]),
              _: 1
            })) : vue.createCommentVNode("", true),
            vue.createVNode(_component_VcRow, { class: "tw-border-t tw-border-solid tw-border-t-[var(--import-new-border-top-color)]" }, {
              default: vue.withCtx(() => [
                (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(importBadges.value, (badge, i) => {
                  return vue.openBlock(), vue.createBlock(_component_VcCol, {
                    key: i,
                    class: "tw-flex !tw-flex-row tw-items-center tw-p-5"
                  }, {
                    default: vue.withCtx(() => [
                      vue.createVNode(_component_VcIcon, {
                        icon: `${badge.icon}`,
                        size: "xxl",
                        style: vue.normalizeStyle({ color: badge.color })
                      }, null, 8, ["icon", "style"]),
                      vue.createElementVNode("div", _hoisted_1$4, [
                        vue.createElementVNode("div", _hoisted_2$2, vue.toDisplayString(badge.title), 1),
                        vue.createVNode(_component_VcHint, null, {
                          default: vue.withCtx(() => [
                            vue.createTextVNode(vue.toDisplayString(badge.description), 1)
                          ]),
                          _: 2
                        }, 1024)
                      ])
                    ]),
                    _: 2
                  }, 1024);
                }), 128))
              ]),
              _: 1
            }),
            vue.createVNode(_component_VcRow, null, {
              default: vue.withCtx(() => [
                vue.unref(errorMessage) ? (vue.openBlock(), vue.createBlock(_component_VcHint, {
                  key: 0,
                  class: "tw-p-3 import-new__error"
                }, {
                  default: vue.withCtx(() => [
                    vue.createTextVNode(vue.toDisplayString(vue.unref(errorMessage)), 1)
                  ]),
                  _: 1
                })) : vue.createCommentVNode("", true),
                reportUrl.value && reportUrl.value != "DefaultDataReporter" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$1, [
                  vue.createVNode(_component_VcHint, { class: "tw-p-3 import-new__history" }, {
                    default: vue.withCtx(() => [
                      vue.createTextVNode(vue.toDisplayString(_ctx.$t("IMPORT.PAGES.LIST.REPORT.DOWNLOAD")) + " ", 1),
                      vue.createElementVNode("a", {
                        class: "vc-link",
                        href: reportUrl.value
                      }, vue.toDisplayString(reportUrl.value), 9, _hoisted_4$1)
                    ]),
                    _: 1
                  })
                ])) : vue.createCommentVNode("", true)
              ]),
              _: 1
            })
          ]),
          _: 1
        })) : vue.createCommentVNode("", true);
      };
    }
  });
  const _hoisted_1$3 = { class: "tw-flex tw-flex-col" };
  const _hoisted_2$1 = { class: "tw-truncate" };
  const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
    __name: "ImportErrorsCard",
    props: {
      importStatus: {}
    },
    setup(__props) {
      const props = __props;
      const { t } = vueI18n.useI18n({ useScope: "global" });
      const importStatus = vue.computed(() => props.importStatus);
      const importStarted = vue.computed(() => !!(importStatus.value && importStatus.value.jobId));
      const reversedErrors = vue.computed(() => {
        var _a, _b;
        const errors = ___namespace.cloneDeep((_b = (_a = importStatus.value) == null ? void 0 : _a.notification) == null ? void 0 : _b.errors);
        return errors == null ? void 0 : errors.reverse();
      });
      const skippedColorVariant = vue.computed(() => {
        return !(importStatus.value && importStatus.value.notification && importStatus.value.notification.errors && importStatus.value.notification.errors.length) ? "success" : "danger";
      });
      const skippedColumns = vue.ref([
        {
          id: "errors",
          title: vue.computed(() => t("IMPORT.PAGES.PRODUCT_IMPORTER.UPLOAD_STATUS.TABLE.ERROR_DESC"))
        }
      ]);
      return (_ctx, _cache) => {
        var _a;
        const _component_VcTable = vue.resolveComponent("VcTable");
        const _component_VcCard = vue.resolveComponent("VcCard");
        const _component_VcCol = vue.resolveComponent("VcCol");
        return importStarted.value && ((_a = reversedErrors.value) == null ? void 0 : _a.length) ? (vue.openBlock(), vue.createBlock(_component_VcCol, {
          key: 0,
          class: "tw-p-3"
        }, {
          default: vue.withCtx(() => [
            vue.createVNode(_component_VcCard, {
              class: "import-new__skipped",
              fill: true,
              variant: skippedColorVariant.value,
              header: _ctx.$t("IMPORT.PAGES.PRODUCT_IMPORTER.UPLOAD_STATUS.TABLE.SKIPPED_DETAILS")
            }, {
              default: vue.withCtx(() => [
                vue.createVNode(_component_VcTable, {
                  columns: skippedColumns.value,
                  header: false,
                  footer: false,
                  items: reversedErrors.value ?? [],
                  "state-key": "import_errors"
                }, {
                  item_errors: vue.withCtx((itemData) => [
                    vue.createElementVNode("div", _hoisted_1$3, [
                      vue.createElementVNode("div", _hoisted_2$1, vue.toDisplayString(itemData.item), 1)
                    ])
                  ]),
                  _: 1
                }, 8, ["columns", "items"])
              ]),
              _: 1
            }, 8, ["variant", "header"])
          ]),
          _: 1
        })) : vue.createCommentVNode("", true);
      };
    }
  });
  const _hoisted_1$2 = { class: "tw-p-3" };
  const _hoisted_2 = ["href"];
  const _hoisted_3 = { class: "tw-flex tw-flex-col" };
  const _hoisted_4 = { class: "tw-truncate" };
  const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
    ...{
      // url: "/importer",
      name: "ImportNew"
    },
    __name: "import-new",
    props: {
      expanded: { type: Boolean, default: true },
      closable: { type: Boolean, default: true },
      param: {},
      options: {}
    },
    emits: ["close:blade", "collapse:blade", "expand:blade", "parent:call"],
    setup(__props, { expose: __expose, emit: __emit }) {
      const props = __props;
      const emit = __emit;
      const { openBlade, resolveBladeByName } = framework.useBladeNavigation();
      const { t } = vueI18n.useI18n({ useScope: "global" });
      const { hasAccess } = framework.usePermissions();
      const {
        loading: importLoading,
        importHistory,
        uploadedFile,
        importStatus,
        isValid,
        profile,
        historyPages,
        totalHistoryCount,
        currentPage,
        importHistoryLoading,
        dataImportersLoading,
        previewDataLoading,
        profilesLoading,
        cancelImport,
        clearImport,
        previewData,
        setFile,
        startImport,
        fetchImportHistory,
        setErrorMessage,
        clearErrorMessage,
        init,
        getTasks
      } = useImport();
      const { moduleNotifications, markAsRead } = framework.useNotifications("ImportPushNotification");
      const fileLoading = vue.ref(false);
      const preview = vue.ref();
      const importPreview = vue.ref(false);
      const popupColumns = vue.ref([]);
      const popupItems = vue.ref([]);
      const title = vue.computed(
        () => {
          var _a;
          return props.param && profileDetails.value.name ? profileDetails.value.name : (_a = props.options) == null ? void 0 : _a.title;
        }
      );
      const cancelled = vue.ref(false);
      const notificationId = vue.ref();
      const previewLoading = vue.ref(false);
      const selectedItemId = vue.ref();
      const bladeWidth = vue.ref(70);
      vue.watch(
        moduleNotifications,
        (newVal) => {
          newVal.forEach((message) => {
            const messageContent = message.profileName ? `${message.profileName}: ${message.title}` : message.title;
            if (!importStarted.value && message.profileId === props.param) {
              getTasks({
                profileId: message.profileId,
                importJobId: message.jobId
              });
            }
            if (!message.finished) {
              if (!notificationId.value && messageContent) {
                notificationId.value = framework.notification(messageContent, {
                  timeout: false
                });
              } else {
                framework.notification.update(notificationId.value, {
                  content: messageContent
                });
              }
            } else {
              if (message.title === "Import failed") {
                framework.notification.update(notificationId.value, {
                  timeout: 5e3,
                  content: messageContent,
                  type: "error",
                  onClose() {
                    markAsRead(message);
                    notificationId.value = void 0;
                  }
                });
              } else {
                framework.notification.update(notificationId.value, {
                  timeout: 5e3,
                  content: messageContent,
                  type: "success",
                  onClose() {
                    markAsRead(message);
                    notificationId.value = void 0;
                  }
                });
              }
            }
          });
        },
        { deep: true }
      );
      const bladeToolbar = vue.ref([
        {
          id: "edit",
          title: vue.computed(() => t("IMPORT.PAGES.PRODUCT_IMPORTER.TOOLBAR.EDIT")),
          icon: "material-edit",
          clickHandler() {
            openBlade({
              blade: resolveBladeByName("ImportProfileDetails"),
              options: {
                importer: profileDetails.value.importer
              },
              param: profile.value.id
            });
          },
          isVisible: vue.computed(() => !!(hasAccess(UserPermissions.SellerImportProfilesEdit) && profile.value)),
          disabled: vue.computed(() => importLoading.value || !profile.value.name || importStarted.value)
        },
        {
          id: "cancel",
          title: vue.computed(() => t("IMPORT.PAGES.PRODUCT_IMPORTER.TOOLBAR.CANCEL")),
          icon: "material-cancel",
          async clickHandler() {
            var _a;
            if ((_a = importStatus.value) == null ? void 0 : _a.inProgress) {
              try {
                await cancelImport();
                cancelled.value = true;
              } catch (e) {
                cancelled.value = false;
                throw e;
              }
            }
          },
          disabled: vue.computed(() => {
            var _a;
            return !((_a = importStatus.value) == null ? void 0 : _a.inProgress) || cancelled.value;
          }),
          isVisible: vue.computed(() => !!props.param)
        },
        {
          id: "newRun",
          title: vue.computed(() => t("IMPORT.PAGES.PRODUCT_IMPORTER.TOOLBAR.NEW_RUN")),
          icon: "material-add",
          clickHandler() {
            emit("parent:call", {
              method: "openImporter",
              args: props.param
            });
          },
          disabled: vue.computed(() => {
            var _a;
            return (_a = importStatus.value) == null ? void 0 : _a.inProgress;
          }),
          isVisible: vue.computed(() => !!(importStatus.value && profile.value.name))
        }
      ]);
      async function reRunImport(importJobId) {
        var _a;
        const jobId = ((_a = props.options) == null ? void 0 : _a.importJobId) || importJobId;
        const historyItem = importHistory.value && importHistory.value.find((x) => x.jobId === jobId);
        if (historyItem == null ? void 0 : historyItem.fileUrl) {
          const correctedProfile = profile == null ? void 0 : profile.value;
          correctedProfile.importFileUrl = historyItem.fileUrl;
          correctedProfile.inProgress = false;
          correctedProfile.jobId = void 0;
          await start(correctedProfile);
        }
      }
      const columns = vue.ref([
        {
          id: "profileName",
          // temp
          title: vue.computed(() => t("IMPORT.PAGES.LIST.TABLE.HEADER.PROFILE_NAME")),
          alwaysVisible: true
        },
        {
          id: "createdBy",
          title: vue.computed(() => t("IMPORT.PAGES.LIST.TABLE.HEADER.CREATED_BY")),
          width: 147
        },
        {
          id: "finished",
          title: vue.computed(() => t("IMPORT.PAGES.LIST.TABLE.HEADER.STATUS")),
          width: 147
        },
        {
          id: "createdDate",
          title: vue.computed(() => t("IMPORT.PAGES.LIST.TABLE.HEADER.STARTED_AT")),
          width: 147,
          type: "date",
          format: "L LT"
        },
        {
          id: "errorsCount",
          title: vue.computed(() => t("IMPORT.PAGES.LIST.TABLE.HEADER.ERROR_COUNT")),
          width: 118,
          sortable: true
        }
      ]);
      const uploadActions = vue.ref([
        {
          name: vue.computed(() => t("IMPORT.PAGES.ACTIONS.UPLOADER.ACTIONS.USE_ANOTHER_ONE")),
          clickHandler() {
            clearImport();
            clearErrorMessage();
          },
          outline: true,
          variant: "secondary",
          isVisible: vue.computed(() => !inProgress.value)
        },
        {
          name: vue.computed(() => t("IMPORT.PAGES.ACTIONS.UPLOADER.ACTIONS.PREVIEW")),
          async clickHandler() {
            try {
              previewLoading.value = true;
              preview.value = await previewData();
              popupItems.value = [];
              popupColumns.value = [];
              if (preview.value && preview.value.records && preview.value.records.length) {
                for (const recordKey in preview.value.records[0]) {
                  popupColumns.value.push({
                    id: recordKey,
                    title: recordKey,
                    width: 130
                  });
                }
                preview.value.records.forEach((record) => {
                  popupItems.value.push(record);
                });
                importPreview.value = true;
              }
            } catch (e) {
              setErrorMessage(e.message);
              throw e;
            } finally {
              previewLoading.value = false;
            }
          },
          outline: true,
          isVisible: vue.computed(() => isValid.value && !importStarted.value),
          disabled: vue.computed(() => previewLoading.value)
        },
        {
          name: vue.computed(() => t("IMPORT.PAGES.ACTIONS.UPLOADER.ACTIONS.START_IMPORT")),
          async clickHandler() {
            await start();
          },
          outline: false,
          isVisible: vue.computed(() => isValid.value && !importStarted.value),
          disabled: vue.computed(() => importStatus.value && importStatus.value.inProgress || importLoading.value)
        }
      ]);
      const inProgress = vue.computed(() => importStatus.value && importStatus.value.inProgress || false);
      const bladeLoading = vue.computed(
        () => importLoading.value || dataImportersLoading.value || profilesLoading.value || previewDataLoading.value || importHistoryLoading.value
      );
      const profileDetails = vue.computed(() => profile.value);
      const importStarted = vue.computed(() => !!(importStatus.value && importStatus.value.jobId));
      const previewTotalNum = vue.computed(() => {
        var _a;
        return (_a = preview.value) == null ? void 0 : _a.totalCount;
      });
      async function onItemClick(item) {
        if ((item == null ? void 0 : item.jobId) && item.profileId) {
          openBlade({
            blade: resolveBladeByName("ImportProcess"),
            options: {
              importJobId: item == null ? void 0 : item.jobId,
              title: item == null ? void 0 : item.profileName
            },
            param: item == null ? void 0 : item.profileId,
            onOpen() {
              selectedItemId.value = item == null ? void 0 : item.id;
            },
            onClose() {
              selectedItemId.value = void 0;
            }
          });
          bladeWidth.value = 50;
        }
      }
      vue.onMounted(async () => {
        var _a;
        clearImport();
        await init({ profileId: props.param, importJobId: (_a = props.options) == null ? void 0 : _a.importJobId });
      });
      async function uploadCsv(files) {
        if (files && files.length) {
          try {
            fileLoading.value = true;
            const formData = new FormData();
            formData.append("file", files[0]);
            const result = await fetch(`/api/assets?folderUrl=/tmp`, {
              method: "POST",
              body: formData
            });
            const response = await result.json();
            if (response == null ? void 0 : response.length) {
              setFile(response[0]);
            }
            files = null;
          } catch (e) {
            setErrorMessage(e.message);
            if (files)
              setFile({
                name: files[0].name,
                size: files[0].size / (1024 * 1024)
              });
            throw e;
          } finally {
            fileLoading.value = false;
          }
        }
      }
      async function saveExternalUrl() {
        var _a;
        setFile({
          name: (_a = profile.value.importFileUrl) == null ? void 0 : _a.substring(profile.value.importFileUrl.lastIndexOf("/") + 1),
          url: profile.value.importFileUrl,
          size: Number(0)
        });
      }
      async function start(importProfile) {
        try {
          clearErrorMessage();
          await startImport(importProfile);
        } catch (e) {
          setErrorMessage(e.message);
          throw e;
        }
      }
      function initializeImporting() {
        importPreview.value = false;
        start();
      }
      function reloadParent() {
        emit("parent:call", {
          method: "reload"
        });
        emit("close:blade");
      }
      const sampleTemplateUrl = vue.computed(() => {
        return profile.value && profile.value.importer && profile.value.importer.metadata ? profile.value.importer.metadata.sampleCsvUrl : "#";
      });
      async function onPaginationClick(page) {
        await fetchImportHistory({
          skip: (page - 1) * 15,
          profileId: props.param
        });
      }
      __expose({
        reloadParent,
        reRunImport,
        title
      });
      return (_ctx, _cache) => {
        const _component_VcInput = vue.resolveComponent("VcInput");
        const _directive_loading = vue.resolveDirective("loading");
        return vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(framework.VcBlade), {
          title: title.value,
          width: "50%",
          "toolbar-items": bladeToolbar.value,
          closable: _ctx.closable,
          expanded: _ctx.expanded,
          onClose: _cache[3] || (_cache[3] = ($event) => _ctx.$emit("close:blade")),
          onExpand: _cache[4] || (_cache[4] = ($event) => _ctx.$emit("expand:blade")),
          onCollapse: _cache[5] || (_cache[5] = ($event) => _ctx.$emit("collapse:blade"))
        }, {
          default: vue.withCtx(() => [
            vue.createVNode(vue.unref(framework.VcContainer), { class: "import-new" }, {
              default: vue.withCtx(() => [
                vue.createVNode(vue.unref(framework.VcCol), null, {
                  default: vue.withCtx(() => [
                    vue.createElementVNode("div", _hoisted_1$2, [
                      vue.createVNode(vue.unref(framework.VcRow), null, {
                        default: vue.withCtx(() => [
                          vue.createVNode(vue.unref(framework.VcCard), {
                            header: importStarted.value ? _ctx.$t("IMPORT.PAGES.PRODUCT_IMPORTER.FILE_UPLOAD.IMPORT_RESULTS") : vue.unref(uploadedFile) && vue.unref(uploadedFile).url ? _ctx.$t("IMPORT.PAGES.PRODUCT_IMPORTER.FILE_UPLOAD.TITLE_UPLOADED") : _ctx.$t("IMPORT.PAGES.PRODUCT_IMPORTER.FILE_UPLOAD.TITLE")
                          }, {
                            default: vue.withCtx(() => [
                              !importStarted.value && !(vue.unref(uploadedFile) && vue.unref(uploadedFile).url) ? (vue.openBlock(), vue.createBlock(vue.unref(framework.VcCol), {
                                key: 0,
                                class: "tw-p-5"
                              }, {
                                default: vue.withCtx(() => [
                                  vue.createVNode(vue.unref(framework.VcRow), { class: "tw-mb-4" }, {
                                    default: vue.withCtx(() => [
                                      vue.createElementVNode("a", {
                                        class: "vc-link",
                                        href: sampleTemplateUrl.value
                                      }, vue.toDisplayString(_ctx.$t("IMPORT.PAGES.TEMPLATE.DOWNLOAD_TEMPLATE")), 9, _hoisted_2),
                                      vue.createTextVNode("  " + vue.toDisplayString(_ctx.$t("IMPORT.PAGES.TEMPLATE.FOR_REFERENCE")), 1)
                                    ]),
                                    _: 1
                                  }),
                                  vue.createVNode(vue.unref(framework.VcRow), null, {
                                    default: vue.withCtx(() => [
                                      vue.createVNode(vue.unref(framework.VcCol), null, {
                                        default: vue.withCtx(() => [
                                          vue.createVNode(vue.unref(framework.VcRow), { class: "tw-mb-4" }, {
                                            default: vue.withCtx(() => [
                                              vue.createVNode(vue.unref(framework.VcFileUpload), {
                                                variant: "file-upload",
                                                notification: true,
                                                accept: "*.*",
                                                loading: fileLoading.value,
                                                onUpload: uploadCsv
                                              }, null, 8, ["loading"])
                                            ]),
                                            _: 1
                                          }),
                                          vue.createVNode(vue.unref(framework.VcRow), null, {
                                            default: vue.withCtx(() => [
                                              vue.createVNode(vue.unref(veeValidate.Field), {
                                                "model-value": vue.unref(profile).importFileUrl,
                                                label: _ctx.$t("IMPORT.PAGES.PRODUCT_IMPORTER.EXTERNAL_URL.TITLE"),
                                                rules: "url",
                                                name: "externalUrl"
                                              }, {
                                                default: vue.withCtx(({ field, errorMessage, handleChange, errors }) => [
                                                  vue.createVNode(_component_VcInput, vue.mergeProps(field, {
                                                    modelValue: vue.unref(profile).importFileUrl,
                                                    "onUpdate:modelValue": [
                                                      _cache[1] || (_cache[1] = ($event) => vue.unref(profile).importFileUrl = $event),
                                                      handleChange
                                                    ],
                                                    class: "tw-grow tw-basis-0",
                                                    placeholder: _ctx.$t("IMPORT.PAGES.PRODUCT_IMPORTER.EXTERNAL_URL.PLACEHOLDER"),
                                                    required: "",
                                                    clearable: "",
                                                    error: !!errors.length,
                                                    "error-message": errorMessage
                                                  }), {
                                                    append: vue.withCtx(() => [
                                                      vue.renderSlot(_ctx.$slots, "button", {}, () => [
                                                        vue.createVNode(vue.unref(framework.VcButton), {
                                                          outline: true,
                                                          onClick: _cache[0] || (_cache[0] = ($event) => saveExternalUrl())
                                                        }, {
                                                          default: vue.withCtx(() => [
                                                            vue.createTextVNode(vue.toDisplayString(_ctx.$t("IMPORT.PAGES.PRODUCT_IMPORTER.EXTERNAL_URL.SAVE")), 1)
                                                          ]),
                                                          _: 1
                                                        })
                                                      ])
                                                    ]),
                                                    _: 2
                                                  }, 1040, ["modelValue", "placeholder", "error", "error-message", "onUpdate:modelValue"])
                                                ]),
                                                _: 3
                                              }, 8, ["model-value", "label"])
                                            ]),
                                            _: 3
                                          })
                                        ]),
                                        _: 3
                                      })
                                    ]),
                                    _: 3
                                  })
                                ]),
                                _: 3
                              })) : (vue.openBlock(), vue.createBlock(vue.unref(framework.VcCol), { key: 1 }, {
                                default: vue.withCtx(() => [
                                  vue.unref(uploadedFile) && vue.unref(uploadedFile).url ? (vue.openBlock(), vue.createBlock(vue.unref(framework.VcRow), { key: 0 }, {
                                    default: vue.withCtx(() => [
                                      vue.createVNode(_sfc_main$7, {
                                        "upload-actions": uploadActions.value,
                                        "uploaded-file": vue.unref(uploadedFile),
                                        "is-uploaded": vue.unref(isValid),
                                        "is-started": importStarted.value,
                                        class: "tw-p-5"
                                      }, null, 8, ["upload-actions", "uploaded-file", "is-uploaded", "is-started"])
                                    ]),
                                    _: 1
                                  })) : vue.createCommentVNode("", true)
                                ]),
                                _: 1
                              })),
                              vue.createVNode(vue.unref(_sfc_main$5), { "import-status": vue.unref(importStatus) }, null, 8, ["import-status"])
                            ]),
                            _: 3
                          }, 8, ["header"])
                        ]),
                        _: 3
                      })
                    ]),
                    vue.createVNode(vue.unref(_sfc_main$4), { "import-status": vue.unref(importStatus) }, null, 8, ["import-status"]),
                    !importStarted.value ? (vue.openBlock(), vue.createBlock(vue.unref(framework.VcCol), {
                      key: 0,
                      class: "tw-p-3"
                    }, {
                      default: vue.withCtx(() => [
                        vue.createVNode(vue.unref(framework.VcCard), {
                          header: _ctx.$t("IMPORT.PAGES.LAST_EXECUTIONS"),
                          fill: true,
                          class: "import-new__history"
                        }, {
                          default: vue.withCtx(() => [
                            vue.createVNode(vue.unref(framework.VcTable), {
                              columns: columns.value,
                              loading: vue.unref(importHistoryLoading),
                              items: vue.unref(importHistory) ?? [],
                              header: false,
                              "total-count": vue.unref(totalHistoryCount),
                              pages: vue.unref(historyPages),
                              "selected-item-id": selectedItemId.value,
                              "current-page": vue.unref(currentPage),
                              "state-key": "import_history",
                              onItemClick,
                              onPaginationClick
                            }, {
                              item_profileName: vue.withCtx((itemData) => [
                                vue.createElementVNode("div", _hoisted_3, [
                                  vue.createElementVNode("div", _hoisted_4, vue.toDisplayString(itemData.item.profileName), 1)
                                ])
                              ]),
                              item_finished: vue.withCtx((itemData) => [
                                vue.createVNode(_sfc_main$6, {
                                  item: itemData.item
                                }, null, 8, ["item"])
                              ]),
                              _: 1
                            }, 8, ["columns", "loading", "items", "total-count", "pages", "selected-item-id", "current-page"])
                          ]),
                          _: 1
                        }, 8, ["header"])
                      ]),
                      _: 1
                    })) : vue.createCommentVNode("", true)
                  ]),
                  _: 3
                })
              ]),
              _: 3
            }),
            importPreview.value ? (vue.openBlock(), vue.createBlock(_sfc_main$9, {
              key: 0,
              columns: popupColumns.value,
              items: popupItems.value,
              total: previewTotalNum.value ?? 0,
              disabled: !!(vue.unref(importStatus) && vue.unref(importStatus).jobId),
              onClose: _cache[2] || (_cache[2] = ($event) => importPreview.value = false),
              onStartImport: initializeImporting
            }, null, 8, ["columns", "items", "total", "disabled"])) : vue.createCommentVNode("", true)
          ]),
          _: 3
        }, 8, ["title", "toolbar-items", "closable", "expanded"])), [
          [_directive_loading, bladeLoading.value, "1001"]
        ]);
      };
    }
  });
  const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
    ...{
      url: "/import",
      name: "ImportProfileSelector",
      isWorkspace: true,
      menuItem: {
        title: "IMPORT.MENU.TITLE",
        icon: "lucide-file-input",
        priority: 4
      }
    },
    __name: "import-profiles",
    props: {
      expanded: { type: Boolean },
      closable: { type: Boolean },
      param: {},
      options: {}
    },
    emits: ["collapse:blade", "expand:blade"],
    setup(__props, { expose: __expose }) {
      const props = __props;
      const { t } = vueI18n.useI18n({ useScope: "global" });
      const { hasAccess } = framework.usePermissions();
      const { openBlade, resolveBladeByName } = framework.useBladeNavigation();
      const { debounce } = framework.useFunctions();
      const { importProfiles, profilesLoading, fetchImportProfiles } = useImport();
      const bladeWidth = vue.ref(50);
      const selectedProfileId = vue.ref();
      const title = vue.computed(() => t("IMPORT.PAGES.IMPORT_PROFILES.TITLE"));
      const searchValue = vue.ref();
      const selectedItemId = vue.ref();
      vue.watch(
        () => props.param,
        async (newParam) => {
          selectedItemId.value = newParam;
        },
        { immediate: true }
      );
      const bladeToolbar = vue.computed(() => {
        return [
          {
            id: "refresh",
            title: vue.computed(() => t("IMPORT.PAGES.IMPORT_PROFILES.TOOLBAR.REFRESH")),
            icon: "material-refresh",
            async clickHandler() {
              await reload();
            }
          },
          {
            id: "add",
            title: vue.computed(() => t("IMPORT.PAGES.IMPORT_PROFILES.TOOLBAR.ADD_PROFILE")),
            icon: "material-add",
            async clickHandler() {
              await newProfile();
            },
            isVisible: vue.computed(() => hasAccess(UserPermissions.SellerImportProfilesEdit))
          }
        ];
      });
      const columns = vue.ref([
        {
          id: "name",
          title: vue.computed(() => t("IMPORT.PAGES.IMPORT_PROFILES.TABLE.HEADER.PROFILE_NAME")),
          alwaysVisible: true
        },
        {
          id: "dataImporterType",
          title: vue.computed(() => t("IMPORT.PAGES.IMPORT_PROFILES.TABLE.HEADER.IMPORTER"))
        },
        {
          id: "longRunningStatus",
          title: vue.computed(() => t("IMPORT.PAGES.IMPORT_PROFILES.TABLE.HEADER.LONG_RUNNING_STATUS"))
        }
        // {
        //   id: "lastRun",
        //   title: computed(() => t("IMPORT.PAGES.IMPORT_PROFILES.TABLE.HEADER.LAST_RUN")),
        //   type: "date-time",
        // },
      ]);
      const onItemClick = (item) => {
        openBlade({
          blade: resolveBladeByName("ImportNew"),
          param: item.id,
          options: {
            importJobId: item && item.inProgress ? item.jobId : void 0
          },
          onOpen() {
            selectedItemId.value = item.id;
          },
          onClose() {
            selectedItemId.value = void 0;
          }
        });
      };
      async function newProfile() {
        await openBlade({
          blade: resolveBladeByName("ImportProfileDetails")
        });
        bladeWidth.value = 70;
      }
      async function reload() {
        await fetchImportProfiles();
      }
      const onSearchList = debounce(async (keyword) => {
        searchValue.value = keyword;
        await fetchImportProfiles({
          keyword
        });
      }, 1e3);
      async function openImporter(profileId) {
        var _a;
        const profile = (_a = importProfiles.value) == null ? void 0 : _a.find((importProfile) => importProfile.id === profileId);
        await openBlade({
          blade: resolveBladeByName("ImportNew"),
          param: profileId,
          options: {
            importJobId: profile && profile.inProgress ? profile.jobId : void 0
          },
          onOpen() {
            selectedProfileId.value = profileId;
          },
          onClose() {
            selectedProfileId.value = void 0;
          }
        });
        bladeWidth.value = 50;
      }
      vue.onMounted(async () => {
        await reload();
      });
      __expose({
        openImporter,
        reload,
        title
      });
      return (_ctx, _cache) => {
        const _component_VcStatus = vue.resolveComponent("VcStatus");
        const _component_VcTable = vue.resolveComponent("VcTable");
        const _component_VcBlade = vue.resolveComponent("VcBlade");
        return vue.openBlock(), vue.createBlock(_component_VcBlade, {
          title: _ctx.$t("IMPORT.PAGES.IMPORT_PROFILES.TITLE"),
          width: "50%",
          "toolbar-items": bladeToolbar.value,
          closable: _ctx.closable,
          expanded: _ctx.expanded,
          onExpand: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("expand:blade")),
          onCollapse: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("collapse:blade"))
        }, {
          default: vue.withCtx(() => [
            vue.createVNode(_component_VcTable, {
              loading: vue.unref(profilesLoading),
              columns: columns.value,
              items: vue.unref(importProfiles) ?? [],
              footer: false,
              "selected-item-id": vue.unref(selectedItemId.value),
              "state-key": "importProfiles",
              "onSearch:change": vue.unref(onSearchList),
              onItemClick
            }, {
              item_longRunningStatus: vue.withCtx(({ item }) => [
                item.inProgress ? (vue.openBlock(), vue.createBlock(_component_VcStatus, {
                  key: 0,
                  variant: "success"
                }, {
                  default: vue.withCtx(() => [
                    vue.createTextVNode(vue.toDisplayString(_ctx.$t(`IMPORT.PAGES.IMPORT_PROFILES.TABLE.CELLS.LONG_RUNNING_STATUS.RUNNING`)), 1)
                  ]),
                  _: 1
                })) : vue.createCommentVNode("", true)
              ]),
              _: 1
            }, 8, ["loading", "columns", "items", "selected-item-id", "onSearch:change"])
          ]),
          _: 1
        }, 8, ["title", "toolbar-items", "closable", "expanded"]);
      };
    }
  });
  const _hoisted_1$1 = { class: "tw-p-3" };
  const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
    ...{
      name: "ImportProcess"
    },
    __name: "import-process",
    props: {
      expanded: { type: Boolean, default: true },
      closable: { type: Boolean, default: true },
      param: {},
      options: {}
    },
    emits: ["close:blade", "collapse:blade", "expand:blade", "parent:call"],
    setup(__props, { expose: __expose, emit: __emit }) {
      const props = __props;
      const emit = __emit;
      const { t } = vueI18n.useI18n({ useScope: "global" });
      const {
        loading: importLoading,
        importHistory,
        importStatus,
        profile,
        dataImportersLoading,
        profilesLoading,
        importHistoryLoading,
        uploadedFile,
        init,
        getTasks
      } = useImport();
      const { moduleNotifications, markAsRead } = framework.useNotifications("ImportPushNotification");
      const notificationId = vue.ref();
      const importStarted = vue.computed(() => !!(importStatus.value && importStatus.value.jobId));
      vue.watch(
        moduleNotifications,
        (newVal) => {
          newVal.forEach((message) => {
            const messageContent = message.profileName ? `${message.profileName} ${message.title}` : message.title;
            if (!importStarted.value && message.profileId === props.param) {
              getTasks({
                profileId: message.profileId,
                importJobId: message.jobId
              });
            }
            if (!message.finished) {
              if (!notificationId.value && messageContent) {
                notificationId.value = framework.notification(messageContent, {
                  timeout: false
                });
              } else {
                framework.notification.update(notificationId.value, {
                  content: messageContent
                });
              }
            } else {
              if (message.title === "Import failed") {
                framework.notification.update(notificationId.value, {
                  timeout: 5e3,
                  content: messageContent,
                  type: "error",
                  onClose() {
                    markAsRead(message);
                    notificationId.value = void 0;
                  }
                });
              } else {
                framework.notification.update(notificationId.value, {
                  timeout: 5e3,
                  content: messageContent,
                  type: "success",
                  onClose() {
                    markAsRead(message);
                    notificationId.value = void 0;
                  }
                });
              }
            }
          });
        },
        { deep: true }
      );
      const title = vue.computed(
        () => {
          var _a;
          return props.param && profileDetails.value.name ? profileDetails.value.name + t("IMPORT.PAGES.IMPORT_PROCESS.TITLE_SUFFIX") : ((_a = props.options) == null ? void 0 : _a.title) + t("IMPORT.PAGES.IMPORT_PROCESS.TITLE_SUFFIX");
        }
      );
      const bladeToolbar = vue.ref([
        {
          id: "reRun",
          title: vue.computed(() => t("IMPORT.PAGES.PRODUCT_IMPORTER.TOOLBAR.RE_RUN")),
          icon: "material-refresh",
          async clickHandler() {
            var _a;
            emit("parent:call", { method: "reRunImport", args: (_a = props.options) == null ? void 0 : _a.importJobId });
            emit("close:blade");
          },
          disabled: vue.computed(() => {
            const historyItem = importHistory.value && importHistory.value.find((x) => {
              var _a;
              return x.jobId === ((_a = props.options) == null ? void 0 : _a.importJobId);
            });
            return !((historyItem == null ? void 0 : historyItem.finished) && historyItem.fileUrl != null);
          }),
          isVisible: vue.computed(() => !!(importStatus.value && profile.value.name))
        }
      ]);
      const bladeLoading = vue.computed(
        () => importLoading.value || dataImportersLoading.value || profilesLoading.value || importHistoryLoading.value
      );
      const profileDetails = vue.computed(() => profile.value);
      vue.onMounted(async () => {
        var _a;
        await init({ profileId: props.param, importJobId: (_a = props.options) == null ? void 0 : _a.importJobId });
      });
      __expose({
        title
      });
      return (_ctx, _cache) => {
        const _directive_loading = vue.resolveDirective("loading");
        return vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(framework.VcBlade), {
          title: title.value,
          width: "50%",
          "toolbar-items": bladeToolbar.value,
          closable: _ctx.closable,
          expanded: _ctx.expanded,
          onClose: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("close:blade")),
          onExpand: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("expand:blade")),
          onCollapse: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("collapse:blade"))
        }, {
          default: vue.withCtx(() => [
            vue.createVNode(vue.unref(framework.VcContainer), { class: "import-process" }, {
              default: vue.withCtx(() => [
                !bladeLoading.value ? (vue.openBlock(), vue.createBlock(vue.unref(framework.VcCol), { key: 0 }, {
                  default: vue.withCtx(() => [
                    vue.createElementVNode("div", _hoisted_1$1, [
                      vue.createVNode(vue.unref(framework.VcCard), {
                        header: _ctx.$t("IMPORT.PAGES.PRODUCT_IMPORTER.FILE_UPLOAD.IMPORT_RESULTS")
                      }, {
                        default: vue.withCtx(() => {
                          var _a, _b;
                          return [
                            !((_a = vue.unref(importStatus)) == null ? void 0 : _a.inProgress) ? (vue.openBlock(), vue.createBlock(vue.unref(_sfc_main$8), {
                              key: 0,
                              class: "tw-m-5",
                              "uploaded-file": {
                                ...vue.unref(uploadedFile),
                                name: (_b = vue.unref(importStatus)) == null ? void 0 : _b.fileName
                              },
                              "is-uploaded": ""
                            }, null, 8, ["uploaded-file"])) : vue.createCommentVNode("", true),
                            vue.createVNode(vue.unref(_sfc_main$5), { "import-status": vue.unref(importStatus) }, null, 8, ["import-status"])
                          ];
                        }),
                        _: 1
                      }, 8, ["header"])
                    ]),
                    vue.createVNode(vue.unref(_sfc_main$4), { "import-status": vue.unref(importStatus) }, null, 8, ["import-status"])
                  ]),
                  _: 1
                })) : vue.createCommentVNode("", true)
              ]),
              _: 1
            })
          ]),
          _: 1
        }, 8, ["title", "toolbar-items", "closable", "expanded"])), [
          [_directive_loading, bladeLoading.value, "1000"]
        ]);
      };
    }
  });
  const ImportProfileDetails = _sfc_main$a;
  const ImportNew = _sfc_main$3;
  const ImportProfiles = _sfc_main$2;
  const ImportProcess = _sfc_main$1;
  const pages = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
    __proto__: null,
    ImportNew,
    ImportProcess,
    ImportProfileDetails,
    ImportProfiles
  }, Symbol.toStringTag, { value: "Module" }));
  const IMPORT = { "MENU": { "TITLE": "Import" }, "PAGES": { "TITLE": "Import", "TOOLBAR": { "REFRESH": "Refresh", "NEW_IMPORT": "New import", "EDIT": "Edit", "DELETE": "Delete" }, "WIDGETS": { "IN_PROGRESS": "In progress" }, "TEMPLATE": { "DOWNLOAD_TEMPLATE": "Download template", "FOR_REFERENCE": "for a reference" }, "LAST_EXECUTIONS": "Last executions", "IMPORT_PROFILES": { "TITLE": "Import profiles", "TOOLBAR": { "ADD_PROFILE": "Add profile", "REFRESH": "Refresh" }, "TABLE": { "HEADER": { "PROFILE_NAME": "Profile name", "IMPORTER": "Importer", "LAST_RUN": "Last run date", "LONG_RUNNING_STATUS": "Status" }, "CELLS": { "LONG_RUNNING_STATUS": { "RUNNING": "In progress" } } }, "EMPTY": { "NO_ITEMS": "List is empty" } }, "PROFILE_SELECTOR": { "TITLE": "Import profiles", "TOOLBAR": { "ADD_PROFILE": "Add profile", "REFRESH": "Refresh" }, "TABLE": { "HEADER": { "PROFILE_NAME": "Profile name", "IMPORTER": "Importer", "CREATED_DATE": "Created date" } }, "EMPTY": { "NO_ITEMS": "List is empty" } }, "PROFILE_DETAILS": { "TITLE": "New import profile", "TOOLBAR": { "SAVE": "Save", "CANCEL": "Cancel", "DELETE": "Delete" }, "IMPORT_INPUTS": { "PROFILE_NAME": { "TITLE": "Profile name", "PLACEHOLDER": "Enter your profile name", "TOOLTIP": "Initialize profile name" }, "IMPORTER": { "TITLE": "Importer", "TOOLTIP": "Select importer type" } }, "PROFILE_SETTINGS": { "TITLE": "Profile settings" }, "CONFIRM_POPUP": { "DELETE_IMPORTER": { "TITLE": "Delete confirmation", "DESCRIPTION": "Are you sure you want to delete the import profile?" } }, "ALERTS": { "CLOSE_CONFIRMATION": "You have unsaved changes\nClose anyway?" } }, "PRODUCT_IMPORTER": { "TITLE": "Product CSV importer", "TOOLBAR": { "EDIT": "Edit", "CANCEL": "Cancel", "NEW_RUN": "New run", "RE_RUN": "Re-run" }, "EXTERNAL_URL": { "TITLE": "External URL", "PLACEHOLDER": "or enter external URL", "SAVE": "Save" }, "FILE_UPLOAD": { "TITLE": "File upload", "TITLE_UPLOADED": "Uploaded", "IMPORT_RESULTS": "Import results" }, "UPLOAD_STATUS": { "TITLE": "Upload status", "LINES_FOUND": "lines found", "NO_ERRORS": "No errors", "IN_PROGRESS": "Import in progress", "ESTIMATING": "Calculating remaining time...", "ESTIMATED": "Estimated remaining time is ", "STARTED_AT": "Started at", "LINES_READ": "lines read", "IMPORTED": "items imported", "SKIPPED": "items skipped", "CANCEL": "Cancel", "Started at": "Started at", "TABLE": { "SKIPPED_DETAILS": "Skipped lines details", "LINE": "Line", "ERROR_DESC": "Error description", "NO_ERRORS": "No errors found" } } }, "IMPORT_PROCESS": { "TITLE_SUFFIX": " statistics" }, "ACTIONS": { "UPLOADER": { "TITLE": "Uploaded", "ACTIONS": { "USE_ANOTHER_ONE": "Use another one", "PREVIEW": "Preview", "START_IMPORT": "Start import", "CANCEL_IMPORT": "Cancel" } } }, "LIST": { "TABLE": { "HEADER": { "PROFILE_NAME": "Profile name", "STARTED_AT": "Started at", "CREATED_BY": "Created by", "STATUS": "Status", "LINES_UPDATED": "Lines updated", "ERROR_COUNT": "Errors count", "DATE": "Date", "REPORT_URL": "Errors report download Url" }, "STATUSES": { "COMPLETED": "Completed", "COMPLETED_WITH_ERRORS": "Completed with errors", "FAILED": "Failed", "CANCELLED": "Cancelled" } }, "REPORT": { "DOWNLOAD": "URL to download error report" } }, "IMPORTING": { "POPUP": { "TITLE": "Preview import lines (up to 10 lines)", "DESCRIPTION": "Please use horizontal scroll to see all columns from the import preview", "PREVIEW_COUNT": "Preview count", "PREVIEW_OF": "of", "CANCEL": "Cancel", "IMPORT": "Import" }, "CONFIRMATION_POPUP": { "CONFIRMATION": "Are you sure you want to proceed?", "YES": "Yes", "NO": "No" } } }, "CSV": { "DELIMITER": "Delimiter" }, "PUSH": { "PROFILE": "Profile:", "ERRORS": "Errors" } };
  const VCMP = { "IMPORT": { "CSV": { "CREATEDICTIONARYVALUES": "Create dictionary values" } } };
  const en = {
    IMPORT,
    VCMP
  };
  const en$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
    __proto__: null,
    IMPORT,
    VCMP,
    default: en
  }, Symbol.toStringTag, { value: "Module" }));
  const locales = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
    __proto__: null,
    en: en$1
  }, Symbol.toStringTag, { value: "Module" }));
  const _hoisted_1 = { key: 1 };
  const _sfc_main = /* @__PURE__ */ vue.defineComponent({
    ...{
      inheritAttrs: false,
      notifyType: "ImportPushNotification"
    },
    __name: "ImportPushNotification",
    props: {
      notification: {}
    },
    emits: ["notificationClick"],
    setup(__props, { emit: __emit }) {
      const props = __props;
      const emit = __emit;
      const { openBlade, resolveBladeByName } = framework.useBladeNavigation();
      const notificationStyle = vue.computed(() => {
        const notification = props.notification;
        if (notification.finished && !(notification.errors && notification.errors.length)) {
          return {
            color: "var(--import-notification-success-color)",
            icon: "material-check_circle"
          };
        } else if (!(notification.errors && notification.errors.length) && !notification.finished) {
          return {
            color: "var(--import-notification-info-color)",
            icon: "material-info"
          };
        } else {
          return {
            color: "var(--import-notification-error-color)",
            icon: "material-error"
          };
        }
      });
      async function onClick() {
        if (props.notification.notifyType === "ImportPushNotification") {
          emit("notificationClick");
          await openBlade(
            {
              blade: resolveBladeByName("ImportProfileSelector"),
              param: props.notification.profileId
            },
            true
          );
          await openBlade({
            blade: resolveBladeByName("ImportProcess"),
            param: props.notification.profileId,
            options: {
              importJobId: props.notification.jobId
            }
          });
        }
      }
      return (_ctx, _cache) => {
        const _component_VcHint = vue.resolveComponent("VcHint");
        return vue.openBlock(), vue.createBlock(vue.unref(framework.NotificationTemplate), {
          color: notificationStyle.value.color,
          title: _ctx.notification.title ?? "",
          icon: notificationStyle.value.icon,
          notification: _ctx.notification,
          onClick
        }, {
          default: vue.withCtx(() => [
            _ctx.notification.profileName ? (vue.openBlock(), vue.createBlock(_component_VcHint, {
              key: 0,
              class: "tw-mb-1"
            }, {
              default: vue.withCtx(() => [
                vue.createTextVNode(vue.toDisplayString(_ctx.$t("IMPORT.PUSH.PROFILE")) + " ", 1),
                vue.createElementVNode("b", null, vue.toDisplayString(_ctx.notification.profileName), 1)
              ]),
              _: 1
            })) : vue.createCommentVNode("", true),
            _ctx.notification.errors && _ctx.notification.errors.length ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
              vue.createVNode(_component_VcHint, null, {
                default: vue.withCtx(() => [
                  vue.createTextVNode(vue.toDisplayString(_ctx.$t("IMPORT.PUSH.ERRORS")) + ": " + vue.toDisplayString(_ctx.notification.errors && _ctx.notification.errors.length), 1)
                ]),
                _: 1
              })
            ])) : vue.createCommentVNode("", true)
          ]),
          _: 1
        }, 8, ["color", "title", "icon", "notification"]);
      };
    }
  });
  const notificationTemplates = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
    __proto__: null,
    ImportPushNotification: _sfc_main
  }, Symbol.toStringTag, { value: "Module" }));
  const index$1 = framework.createAppModule(pages, locales, notificationTemplates);
  const Import = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
    __proto__: null,
    ImportErrorsCard: _sfc_main$4,
    ImportNew,
    ImportPopup: _sfc_main$9,
    ImportProcess,
    ImportProfileDetails,
    ImportProfiles,
    ImportStat: _sfc_main$5,
    ImportStatus: _sfc_main$6,
    ImportUploadStatus: _sfc_main$7,
    ImportUploadedFile: _sfc_main$8,
    default: index$1,
    useHelpers,
    useImport,
    useImportHistory,
    useImportProfiles,
    useImportStatus,
    useUploadFile: useUploadedFile
  }, Symbol.toStringTag, { value: "Module" }));
  const index = {
    Import
  };
  return index;
});
(function() {
  if (typeof window !== "undefined" && typeof VcShellModule_import_app !== "undefined") {
    if (!window.VcShellDynamicModules) {
      window.VcShellDynamicModules = {};
    }
    window.VcShellDynamicModules["import-app"] = VcShellModule_import_app;
    console.log("Registered module: import-app");
    if (typeof CustomEvent !== "undefined") {
      window.dispatchEvent(new CustomEvent("vc-shell-module-registered", {
        detail: { moduleName: "import-app", moduleObject: VcShellModule_import_app }
      }));
    }
    console.log("Current VcShellDynamicModules:", Object.keys(window.VcShellDynamicModules));
  }
})();
//# sourceMappingURL=index.js.map
