{"size": 35847, "ext": "js", "max_stars_repo_path": "install/js/germes/multibasket/stores/cart/dist/script.bundle.js", "max_stars_repo_name": "AndreyChursin/germes.multibasket", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "install/js/germes/multibasket/stores/cart/dist/script.bundle.js", "max_issues_repo_name": "AndreyChursin/germes.multibasket", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "install/js/germes/multibasket/stores/cart/dist/script.bundle.js", "max_forks_repo_name": "AndreyChursin/germes.multibasket", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 53.9052631579, "max_line_length": 557, "alphanum_fraction": 0.5842050939}
(function (exports,main_core,currency_currencyCore,ui_vue,germes_multibasket_stores_user,germes_analytics,germes_multibasket_entity_cart,germes_multibasket_entity_product) {
    'use strict';

    if (!germes_multibasket_stores_user.userStore.hasModule('basket')) {
      germes_multibasket_stores_user.userStore.registerModule('basket', {
        namespaced: true,
        state: {
          BASKETS: {},
          // нужно всё перенести в корзины... даже текущую!
          CURRENT_CART_ID: null,
          // текущая корзина (куда добавляются товары из каталога)
          basketPriceDiscountError: null,
          // params
          error: {
            payment: {},
            delivery: {},
            user_rops: {}
          },
          initHandler: false,
          submited: false,
          status: false,
          // static props!
          basketPageURL: '/personal/order/',
          basketUrlRozn: '/catalog/?action=ADD2BASKET&id=#ID#',
          // DEPRECATED
          basketUrlOpt: '/local/tools/ajax_multibasket.php?action=ADD2BASKET&id=#ID#',
          basketUrl: '/local/tools/ajax_multibasket.php?action=ADD2BASKET&id=#ID#'
        },
        mutations: {
          setCurrentCartId: function setCurrentCartId(state, cartId) {
            var cart = this.getters['basket/getCartList'][cartId],
                event = {
              cart: cart,
              result: true
            };
            main_core.onCustomEvent("OnBeforeSetCurrentCartId", event);

            if (event.result && cart != undefined) {
              state.CURRENT_CART_ID = cartId;
              main_core.onCustomEvent("OnAfterSetCurrentCartId", event);
            } else {
              this.dispatch('showNotificate', {
                message: 'Корзина не сменилась!'
              });
            }
          },
          setBasket: function setBasket(state, cartObject) {
            // console.warn("// DEPRECATED setBasket use cart.setCurrentCart(Object: cartObject)");
            this.commit('basket/setCurrentCart', cartObject);
          },
          setCurrentCart: function setCurrentCart(state, cartObject) {
            if (!!((cartObject === null || cartObject === void 0 ? void 0 : cartObject.ID) == undefined) || (cartObject === null || cartObject === void 0 ? void 0 : cartObject.ID) == '') {
              this.dispatch('showNotificate', {
                message: 'Не смогли загрузить пустую корзину!'
              });
            } else {
              var event = {
                basket: cartObject,
                result: true
              };
              main_core.onCustomEvent("OnBeforeCartSet", event);

              if (event.result === true) {
                this.commit('basket/updateBasket', cartObject);
                this.commit('basket/setCurrentCartId', cartObject.ID);
                main_core.onCustomEvent("OnAfterCartSet", event);
              }
            }
          },
          updateBasket: function updateBasket(state, cartObject) {
            if (!!((cartObject === null || cartObject === void 0 ? void 0 : cartObject.ID) == undefined) || (cartObject === null || cartObject === void 0 ? void 0 : cartObject.ID) == '') {
              console.error("No basket to updateBasket");
            } else {
              var _this$getters$basket;

              var oldCart = (_this$getters$basket = this.getters['basket/getCartList']) === null || _this$getters$basket === void 0 ? void 0 : _this$getters$basket[cartObject.ID];

              if (oldCart != undefined) {
                var event = {
                  cart: oldCart,
                  result: true
                };
                main_core.onCustomEvent("OnBeforeCartUpdate", event);

                if (event.result == true) {
                  oldCart.update(cartObject);
                  main_core.onCustomEvent("OnAfterCartUpdate", event);
                }
              } else {
                this.commit('basket/addBasket', cartObject);
              }
            }
          },
          addBasket: function addBasket(state, cartObject) {
            var _cartObject, _cartObject2;

            if (!!(((_cartObject = cartObject) === null || _cartObject === void 0 ? void 0 : _cartObject.ID) == undefined) || ((_cartObject2 = cartObject) === null || _cartObject2 === void 0 ? void 0 : _cartObject2.ID) == '') {
              console.error("No basket to addBasket");
            } else {
              var _this$getters$basket2;

              var oldCart = (_this$getters$basket2 = this.getters['basket/getCartList']) === null || _this$getters$basket2 === void 0 ? void 0 : _this$getters$basket2[cartObject.ID];

              if (oldCart == undefined) {
                if (!(cartObject instanceof germes_multibasket_entity_cart.Cart)) cartObject = new germes_multibasket_entity_cart.Cart(cartObject);
                var event = {
                  cart: cartObject,
                  result: true
                };
                main_core.onCustomEvent("OnBeforeCartAdd", event);

                if (event.result == true) {
                  ui_vue.BitrixVue.set(this.getters['basket/getCartList'], cartObject.ID, cartObject);
                  main_core.onCustomEvent("OnAfterCartAdd", event);
                }
              } else {
                this.commit('basket/updateBasket', cartObject);
              }
            }
          },
          deleteBasket: function deleteBasket(state, cartObject) {
            if (!!((cartObject === null || cartObject === void 0 ? void 0 : cartObject.ID) == undefined) || (cartObject === null || cartObject === void 0 ? void 0 : cartObject.ID) == '') {
              console.error("No basket to deleteBasket");
            } else {
              var _this$getters$basket3;

              var oldCart = (_this$getters$basket3 = this.getters['basket/getCartList']) === null || _this$getters$basket3 === void 0 ? void 0 : _this$getters$basket3[cartObject.ID];

              if (oldCart == undefined) {
                var event = {
                  basket: oldCart,
                  result: true
                };
                main_core.onCustomEvent("OnBeforeCartDelete", event);

                if (event.result == true) {
                  ui_vue.BitrixVue["delete"](this.getters['basket/getCartList'], oldCart.ID);
                  main_core.onCustomEvent("OnAfterCartDelete", event);
                }
              }
            }
          }
        },
        actions: {
          send2Server: function send2Server(store, data) {
            return new Promise(function (resolve, reject) {
              try {
                if (babelHelpers["typeof"](data) != 'object') throw "No data to send";
                if (data.ID && (!data.PRODUCT_ID || data.PRODUCT_ID == undefined)) data.PRODUCT_ID = data.ID; // TODO убрать костыль!

                var postData = store.getters.getPostData(data);
                store.state.status = 'loading'; // TODO заменить на BX.ajax.runComponentAction(component, action[, config])

                BX.ajax({
                  url: postData.url,
                  data: postData,
                  method: 'POST',
                  dataType: 'json',
                  timeout: 60,
                  async: true,
                  cache: false,
                  onsuccess: BX.proxy(function (result) {
                    if (result != null && result.STATUS == "ERROR") {
                      store.dispatch('errorSend2Server', {
                        item: data,
                        type: result
                      });
                      reject(false);
                    } else {
                      resolve(result);
                    }

                    store.state.status = null;
                  }, store),
                  onfailure: BX.proxy(function (error) {
                    store.dispatch('errorSend2Server', {
                      item: data,
                      type: error
                    });
                    reject(false);
                    store.state.status = null;
                  }, store)
                });
              } catch (error) {
                store.dispatch('errorSend2Server', {
                  item: data,
                  type: error
                });
                reject(false);
              }
            });
          },
          initEventHandler: function initEventHandler(store) {
            if (!store.state.initHandler) {
              main_core.addCustomEvent("OnAfterContragentChange", BX.proxy(function (event) {
                var _this = this;

                try {
                  var _Object$keys;

                  // TODO нужно знать в какой корзине обновлен контрагент! и там и запрашивать новые цены!
                  main_core.onCustomEvent('OnBeforeBasketUpdatePrice');
                  var data = {
                    action: 'getPrice',
                    items_id: this.getters['basket/getItemsXML_ID']
                  };

                  if (data.items_id != undefined && (_Object$keys = Object.keys(data.items_id)) !== null && _Object$keys !== void 0 && _Object$keys.length) {
                    this.dispatch('submit', data).then(function (response) {
                      _this.commit('basket/updateItemsPrice', response.data);

                      _this.dispatch('showNotificate', {
                        message: _this.getters['basket/localize']('UPDATE_PRICE_Y'),
                        category: 'OnCatalogUpdatePrice'
                      });

                      main_core.onCustomEvent('OnAfterBasketUpdatePrice');
                    }, function (error) {
                      _this.dispatch('showNotificate', {
                        message: _this.getters['basket/localize']('UPDATE_PRICE_N'),
                        category: 'OnCatalogUpdatePrice'
                      });

                      throw error;
                    });
                  }
                } catch (error) {
                  console.debug(error);
                }
              }, this)); // addCustomEvent("OnAfterBasketUpdatePrice", BX.delegate(function () {
              //     if (!this?.getters['isLoading']) {
              //         onCustomEvent('OnBasketChange');
              //     }
              // }, this));
              // addCustomEvent("OnAfterBasketElementUpdate", BX.delegate(function () {
              //     if (!this?.getters['isLoading']) {
              //         onCustomEvent('OnBasketChange');
              //     }
              // }, this));
              // TODO add analitycs for action event
              // addCustomEvent("OnAfterBasketAddProduct", BX.delegate(function () {
              //     if (!this?.getters['isLoading']) {
              //         onCustomEvent('OnBasketChange');
              //     }
              //     // this.setAnalyticsDataLayer('addToCart')
              // }, this));
              // addCustomEvent("OnAfterBasketDeleteProduct", BX.delegate(function () {
              //     if (!this?.getters['isLoading']) {
              //         onCustomEvent('OnBasketChange');
              //     }
              //     // this.setAnalyticsDataLayer('removeFromCart')
              // }, this));
              // addCustomEvent("OnAfterBasketUpdateProduct", BX.delegate(function() {
              //     this.setAnalyticsDataLayer('addToCart')
              // }, this));showNotificate

              BX.ready(BX.proxy(function () {
                main_core.onCustomEvent("OnAfterBasketStoreInit");
              }, this));
              store.state.initHandler = true;
            }
          },
          checkUserCartPossibility: function checkUserCartPossibility(store) {
            // TODO изменить на проверку группы доступа (будем работать для розницы)!
            return new Promise(function (resolve, reject) {
              var _store$rootGetters$ge;

              if (!((_store$rootGetters$ge = store.rootGetters.getCurrentUser) !== null && _store$rootGetters$ge !== void 0 && _store$rootGetters$ge.LOGIN)) reject(BX.message("NOTIFICATE_NEED_AUTH"));
              resolve(true);
            });
          },
          updateBasketInList: function updateBasketInList(store, cartData) {
            if ((cartData === null || cartData === void 0 ? void 0 : cartData.ID) != undefined) {
              var _store$getters$getCar, _store$getters$getCar2;

              if ((_store$getters$getCar = store.getters.getCartList) !== null && _store$getters$getCar !== void 0 && (_store$getters$getCar2 = _store$getters$getCar[cartData.ID]) !== null && _store$getters$getCar2 !== void 0 && _store$getters$getCar2.ID) {
                store.commit('updateBasket', cartData);
              } else {
                store.commit('addBasket', cartData);
              }

              return store.getters.getCart(cartData.ID);
            }
          },
          removeBasketInList: function removeBasketInList(store, cartObject) {
            if ((cartObject === null || cartObject === void 0 ? void 0 : cartObject.ID) != undefined) {
              ui_vue.BitrixVue["delete"](store.getters.getCartList, cartObject.ID, cartObject);
            }
          },
          updateBasketList: function updateBasketList(store, basketList) {
            var _Object$keys2;

            if (basketList !== undefined && basketList !== null && ((_Object$keys2 = Object.keys(basketList)) === null || _Object$keys2 === void 0 ? void 0 : _Object$keys2.length) !== 0) {
              var event = {
                data: basketList,
                result: true
              };
              main_core.onCustomEvent("OnBeforeUpdateBasketList", event);

              if (event.result) {
                for (var id in basketList) {
                  var _basketList$id;

                  if (Object.hasOwnProperty.call(basketList, id) && (_basketList$id = basketList[id]) !== null && _basketList$id !== void 0 && _basketList$id.ID) {
                    store.dispatch('updateBasketInList', basketList[id]);
                  }
                }

                main_core.onCustomEvent("OnAfterUpdateBasketList", event);
              }
            } else {
              ui_vue.BitrixVue.set(store.state, 'ITEMS', {}); // this.dispatch('showNotificate', { message: 'Товары в корзине не обновлены!' });
            }
          },
          getList: function getList(store, params) {
            var _params;

            (_params = params) !== null && _params !== void 0 ? _params : params = {
              limit: 10
            };

            if (params.limit <= store.getters['basket/getCount']) {
              var cartList = store.getters['basket/getCartList'],
                  cartListLimited = {};

              for (var id in cartList) {
                if (Object.hasOwnProperty.call(cartList, id)) {
                  cartListLimited[id] = cartList[id];
                }
              }

              return cartListLimited;
            }

            if (!this.getters.isLoading) {
              return this.dispatch('submit', {
                action: 'getbasketlist',
                params: params
              }).then(function (result) {
                store.dispatch('updateBasketList', result.data);
                return result.data;
              }, function (reject) {
                throw reject;
              })["catch"](function (error) {
                throw error;
              });
            }
          }
        },
        getters: {
          localize: function localize(state) {
            return function (CODE) {
              return ui_vue.BitrixVue.getFilteredPhrases('')[CODE];
            };
          },
          getCount: function getCount(state, getters, rootState, rootGetters) {
            return getters.getCartList ? Object.keys(getters.getCartList).length : 0;
          },
          getCurrentCart: function getCurrentCart(state, getters, rootState, rootGetters) {
            var _getters$getCartList;

            return (_getters$getCartList = getters.getCartList) === null || _getters$getCartList === void 0 ? void 0 : _getters$getCartList[state.CURRENT_CART_ID];
          },
          getCurrentCartId: function getCurrentCartId(state, getters, rootState, rootGetters) {
            var _state$CURRENT_CART_I;

            return parseInt((_state$CURRENT_CART_I = state.CURRENT_CART_ID) !== null && _state$CURRENT_CART_I !== void 0 ? _state$CURRENT_CART_I : 0);
          },
          getCartList: function getCartList(state, getters, rootState, rootGetters) {
            return state.BASKETS;
          },
          getBasketList: function getBasketList(state, getters, rootState, rootGetters) {
            console.warn("// DEPRECATED getBasketList use getCartList insted");
            return state.BASKETS;
          },
          getPostData: function getPostData(state, getters, rootState, rootGetters) {
            return function (postedData) {
              if (babelHelpers["typeof"](postedData) == 'object' && postedData !== undefined && postedData.PRODUCT_ID !== undefined) {
                if (getters.getContragentId) {
                  // TODO поправить разделение обработчиков, т.к. это плохой тон!
                  postedData.url = state.basketUrlOpt;
                } else {
                  postedData.url = state.basketUrlRozn;
                }

                postedData.url = state.basketUrl;
                postedData.user_id = rootGetters.getUserId;
                if (postedData.ANALOG === 'Y') postedData.PLACEMENT = "analog";else if (window.location.pathname.indexOf('catalog/')) postedData.PLACEMENT = "catalog";else if (window.location.pathname.indexOf('actions/')) postedData.PLACEMENT = "actions";else if (window.location.pathname.indexOf('order/') && window.location.hash == '#import-basket-tab') postedData.PLACEMENT = "import";
                return postedData;
              } else {
                throw "Error! Empty postedData";
              }
            };
          },
          // TODO optimyze me
          findItem: function findItem(state, getters) {
            return function (find_product_str) {
              var _product;

              var product = getters.getItems[find_product_str] || {};

              if (!((_product = product) !== null && _product !== void 0 && _product.ID) && find_product_str != undefined && getters.getItems != undefined) {
                for (var i in getters.getItems) {
                  if (Object.hasOwnProperty.call(getters.getItems, i) && (getters.getItems[i].PRODUCT_ID == find_product_str || getters.getItems[i].XML_ID == find_product_str || getters.getItems[i].PRODUCT_XML_ID == find_product_str)) {
                    product = getters.getItems[i];
                    break;
                  }
                }
              } // if (product.PRODUCT_XML_ID) product.PRODUCT_XML_ID = product.PRODUCT_XML_ID?.replace(/(.)*#/i, '');


              return product;
            };
          },
          findItemIndex: function findItemIndex(state, getters) {
            return function (find_product_str) {
              var productIndex = null;

              if (!!getters.getItems && find_product_str != undefined) {
                for (var i in getters.getItems) {
                  if (Object.hasOwnProperty.call(getters.getItems, i) && (getters.getItems[i].PRODUCT_ID == find_product_str || getters.getItems[i].XML_ID == find_product_str || getters.getItems[i].PRODUCT_XML_ID == find_product_str)) {
                    productIndex = i;
                    break;
                  }
                }
              }

              return productIndex;
            };
          },
          getItemQuantity: function getItemQuantity(state, getters) {
            return function (find_product_str) {
              console.error("// DEPRECATED getItemQuantity use getQuantity to object insted");
              return getters.getCurrentCart.QUANTITY;
            };
          },
          getItemPrice: function getItemPrice(state, getters) {
            return function (find_product_str) {
              console.error("// DEPRECATED getItemPrice use getPrice to object insted");
              return getters.getCurrentCart.PRICE;
            };
          },
          getQuantity: function getQuantity(state, getters, rootState, rootGetters) {
            console.error("// DEPRECATED getQuantity use getItemsQuantity to object insted");
            return getters.getCurrentCart.QUANTITY;
          },
          getItems: function getItems(state, getters, rootState, rootGetters) {
            var _getters$getCurrentCa;

            console.error("// DEPRECATED getItems use getItemsList to object insted");
            return (_getters$getCurrentCa = getters.getCurrentCart) === null || _getters$getCurrentCa === void 0 ? void 0 : _getters$getCurrentCa.ITEMS;
          },
          getItemsQuantity: function getItemsQuantity(state, getters, rootState, rootGetters) {
            var quantity = 0;
            if (getters.getItems !== null && babelHelpers["typeof"](getters.getItems) == 'object' && Object.keys(getters.getItems).length) for (var i in getters.getItems) {
              if (Object.hasOwnProperty.call(getters.getItems, i) && getters.getItems[i]) quantity += parseFloat(getters.getItems[i].QUANTITY);
            }
            return quantity;
          },
          getItemsXML_ID: function getItemsXML_ID(state, getters, rootState, rootGetters) {
            console.error("// DEPRECATED getItemsXML_ID use cart.ITEMS_XML_ID to object insted");
            var result = {},
                itemList = getters.getItems;
            if (itemList !== null && babelHelpers["typeof"](itemList) == 'object' && Object.keys(itemList).length) for (var i in itemList) {
              if (Object.hasOwnProperty.call(itemList, i) && itemList[i]) result[i] = itemList[i].PRODUCT_XML_ID;
            }
            return result;
          },
          getItemsCount: function getItemsCount(state, getters, rootState, rootGetters) {
            var _getters$getCurrentCa2;

            console.error("// DEPRECATED getItemsCount use cart.COUNT to object insted");
            return (_getters$getCurrentCa2 = getters.getCurrentCart) === null || _getters$getCurrentCa2 === void 0 ? void 0 : _getters$getCurrentCa2.COUNT;
          },
          getCurrency: function getCurrency(state, getters, rootState, rootGetters) {
            var _getters$getCurrentCa3;

            return (_getters$getCurrentCa3 = getters.getCurrentCart) === null || _getters$getCurrentCa3 === void 0 ? void 0 : _getters$getCurrentCa3.CURRENCY;
          },
          //
          getBasketDescription: function getBasketDescription(state) {
            var _getters$getCurrentCa4;

            return (_getters$getCurrentCa4 = getters.getCurrentCart) === null || _getters$getCurrentCa4 === void 0 ? void 0 : _getters$getCurrentCa4.DESCRIPTION;
          },
          basketStatus: function basketStatus(state, getters, rootState, rootGetters) {
            return state.status;
          },
          //
          basketPrice: function basketPrice(state, getters, rootState, rootGetters) {
            console.warn("// DEPRECATED basketPrice use getBasketPrice insted");
            return getters.getBasketPrice;
          },
          getBasketPrice: function getBasketPrice(state, getters, rootState, rootGetters) {
            var _getters$getCurrentCa5;

            return (_getters$getCurrentCa5 = getters.getCurrentCart) === null || _getters$getCurrentCa5 === void 0 ? void 0 : _getters$getCurrentCa5.PRICE;
          },
          getBasketPriceCurrency: function getBasketPriceCurrency(state, getters, rootState, rootGetters) {
            var _BX$Currency$Currency, _BX$Currency, _BX$Currency$Currency2, _BX$Currency$Currency3;

            (_BX$Currency$Currency = (_BX$Currency = BX.Currency) === null || _BX$Currency === void 0 ? void 0 : (_BX$Currency$Currency2 = _BX$Currency.CurrencyCore) === null || _BX$Currency$Currency2 === void 0 ? void 0 : (_BX$Currency$Currency3 = _BX$Currency$Currency2.currencyFormat(getters.basketPrice, getters.getCurrency, true)) === null || _BX$Currency$Currency3 === void 0 ? void 0 : _BX$Currency$Currency3.replace(/&nbsp;/gi, ' ')) !== null && _BX$Currency$Currency !== void 0 ? _BX$Currency$Currency : "";
          },
          basketBasePrice: function basketBasePrice(state, getters, rootState, rootGetters) {
            console.warn("// DEPRECATED basketBasePrice use getBasketBasePrice insted");
            return getters.getBasketBasePrice;
          },
          getBasketBasePrice: function getBasketBasePrice(state, getters, rootState, rootGetters) {
            var _getters$getCurrentCa6;

            return (_getters$getCurrentCa6 = getters.getCurrentCart) === null || _getters$getCurrentCa6 === void 0 ? void 0 : _getters$getCurrentCa6.BASE_PRICE;
          },
          getBasketBasePriceCurrency: function getBasketBasePriceCurrency(state, getters, rootState, rootGetters) {
            var _BX$Currency$Currency4, _BX$Currency2, _BX$Currency2$Currenc, _BX$Currency2$Currenc2;

            return (_BX$Currency$Currency4 = (_BX$Currency2 = BX.Currency) === null || _BX$Currency2 === void 0 ? void 0 : (_BX$Currency2$Currenc = _BX$Currency2.CurrencyCore) === null || _BX$Currency2$Currenc === void 0 ? void 0 : (_BX$Currency2$Currenc2 = _BX$Currency2$Currenc.currencyFormat(getters.getBasketBasePrice, getters.getCurrency, true)) === null || _BX$Currency2$Currenc2 === void 0 ? void 0 : _BX$Currency2$Currenc2.replace(/&nbsp;/gi, ' ')) !== null && _BX$Currency$Currency4 !== void 0 ? _BX$Currency$Currency4 : getters.getBasketBasePrice;
          },
          basketPriceDiscount: function basketPriceDiscount(state, getters, rootState, rootGetters) {
            console.warn("// DEPRECATED basketPriceDiscount use getBasketPriceDiscount insted");
            return getters.getBasketPriceDiscount;
          },
          getBasketPriceDiscount: function getBasketPriceDiscount(state, getters, rootState, rootGetters) {
            var _getters$getCurrentCa7;

            return (_getters$getCurrentCa7 = getters.getCurrentCart) === null || _getters$getCurrentCa7 === void 0 ? void 0 : _getters$getCurrentCa7.DISCOUNT_PRICE;
          },
          getBasketPriceDiscountError: function getBasketPriceDiscountError(state, getters, rootState, rootGetters) {
            var _getters$getCurrentCa8;

            return (_getters$getCurrentCa8 = getters.getCurrentCart) === null || _getters$getCurrentCa8 === void 0 ? void 0 : _getters$getCurrentCa8.ERROR;
          },
          getBasketPriceDiscountCurrency: function getBasketPriceDiscountCurrency(state, getters, rootState, rootGetters) {
            var _BX, _BX$Currency3, _BX$Currency3$currenc;

            return ((_BX = BX) === null || _BX === void 0 ? void 0 : (_BX$Currency3 = _BX.Currency) === null || _BX$Currency3 === void 0 ? void 0 : (_BX$Currency3$currenc = _BX$Currency3.currencyFormat(getters.getBasketPriceDiscount, getters.getCurrency, true)) === null || _BX$Currency3$currenc === void 0 ? void 0 : _BX$Currency3$currenc.replace(/&nbsp;/gi, ' ')) || getters.getBasketPriceDiscount;
          },
          basketPriceAvailable: function basketPriceAvailable(state, getters, rootState, rootGetters) {
            console.warn("// DEPRECATED basketPriceAvailable use getBasketPriceAvailable insted");
            return getters.getBasketPriceAvailable;
          },
          getBasketPriceAvailable: function getBasketPriceAvailable(state, getters, rootState, rootGetters) {
            var _getters$getCurrentCa9;

            return (_getters$getCurrentCa9 = getters.getCurrentCart) === null || _getters$getCurrentCa9 === void 0 ? void 0 : _getters$getCurrentCa9.AVAILABLE_PRICE;
          },
          getBasketPriceAvailableCurrency: function getBasketPriceAvailableCurrency(state, getters, rootState, rootGetters) {
            var _BX2, _BX2$Currency, _BX2$Currency$currenc;

            return ((_BX2 = BX) === null || _BX2 === void 0 ? void 0 : (_BX2$Currency = _BX2.Currency) === null || _BX2$Currency === void 0 ? void 0 : (_BX2$Currency$currenc = _BX2$Currency.currencyFormat(getters.getBasketPriceAvailable, getters.getCurrency, true)) === null || _BX2$Currency$currenc === void 0 ? void 0 : _BX2$Currency$currenc.replace(/&nbsp;/gi, ' ')) || getters.getBasketPriceAvailable;
          },
          getBasketWeight: function getBasketWeight(state, getters, rootState, rootGetters) {
            var _getters$getCurrentCa10;

            return (_getters$getCurrentCa10 = getters.getCurrentCart) === null || _getters$getCurrentCa10 === void 0 ? void 0 : _getters$getCurrentCa10.WEIGHT;
          },
          basketNumber: function basketNumber(state, getters, rootState, rootGetters) {
            console.warn("// DEPRECATED basketNumber use getBasketNumber insted");
            return getters.getBasketNumber;
          },
          getBasketNumber: function getBasketNumber(state, getters, rootState, rootGetters) {
            var _getters$getCurrentCa11;

            return (_getters$getCurrentCa11 = getters.getCurrentCart) === null || _getters$getCurrentCa11 === void 0 ? void 0 : _getters$getCurrentCa11.ACCOUNT_NUMBER;
          },
          basketQuantity: function basketQuantity(state, getters, rootState, rootGetters) {
            return getters.getItems ? getters.getItems.length : 0;
          },
          contragent_id: function contragent_id(state, getters, rootState, rootGetters) {
            console.warn("// DEPRECATED contragent_id use getContragentId insted");
            return getters.getContragentId;
          },
          getContragentId: function getContragentId(state, getters, rootState, rootGetters) {
            var _getters$getCurrentCa12, _getters$getCurrentCa13;

            return parseInt((_getters$getCurrentCa12 = (_getters$getCurrentCa13 = getters.getCurrentCart) === null || _getters$getCurrentCa13 === void 0 ? void 0 : _getters$getCurrentCa13.CONTRAGENT_ID) !== null && _getters$getCurrentCa12 !== void 0 ? _getters$getCurrentCa12 : 0);
          },
          getContragent: function getContragent(state, getters, rootState, rootGetters) {
            return rootGetters['contragent/getContragentList'][getters.getContragentId];
          },
          getContragentSource: function getContragentSource(state, getters, rootState, rootGetters) {
            var _getters$getContragen, _getters$getContragen2;

            return (_getters$getContragen = getters.getContragent) === null || _getters$getContragen === void 0 ? void 0 : (_getters$getContragen2 = _getters$getContragen.UF_ISTOCHNIK) === null || _getters$getContragen2 === void 0 ? void 0 : _getters$getContragen2.toUpperCase();
          },
          getOwner: function getOwner(state, getters, rootState, rootGetters) {
            var _getters$getCurrentCa14, _getters$getCurrentCa15;

            return (_getters$getCurrentCa14 = getters.getCurrentCart) === null || _getters$getCurrentCa14 === void 0 ? void 0 : (_getters$getCurrentCa15 = _getters$getCurrentCa14.USER) === null || _getters$getCurrentCa15 === void 0 ? void 0 : _getters$getCurrentCa15.LOGIN;
          },
          address_id: function address_id(state, getters, rootState, rootGetters) {
            console.warn("// DEPRECATED address_id use getAddressId insted");
            return getters.getAddressId;
          },
          getAddressId: function getAddressId(state, getters, rootState, rootGetters) {
            var _getters$getCurrentCa16, _getters$getContragen3, _getters$getContragen4, _getters$getContragen5;

            var address_id = (_getters$getCurrentCa16 = getters.getCurrentCart) === null || _getters$getCurrentCa16 === void 0 ? void 0 : _getters$getCurrentCa16.ADDRESS_ID;

            if ((_getters$getContragen3 = getters.getContragent) !== null && _getters$getContragen3 !== void 0 && _getters$getContragen3.ADDRESS && !((_getters$getContragen4 = getters.getContragent) !== null && _getters$getContragen4 !== void 0 && (_getters$getContragen5 = _getters$getContragen4.ADDRESS) !== null && _getters$getContragen5 !== void 0 && _getters$getContragen5[address_id])) {
              var addressids = Object.keys(getters.getContragent.ADDRESS);
              var _address_id = 0;

              if (addressids.length == 1) {
                _address_id = parseInt(getters.getContragent.ADDRESS[addressids[0]].ID);
              }

              _address_id = _address_id;
            }

            return parseInt(address_id !== null && address_id !== void 0 ? address_id : 0);
          },
          getAddress: function getAddress(state, getters, rootState, rootGetters) {
            var _getters$getContragen6, _getters$getContragen7;

            return getters.getAddressId != null && ((_getters$getContragen6 = getters.getContragent) === null || _getters$getContragen6 === void 0 ? void 0 : _getters$getContragen6.ADDRESS) != undefined ? (_getters$getContragen7 = getters.getContragent) === null || _getters$getContragen7 === void 0 ? void 0 : _getters$getContragen7.ADDRESS[getters.getAddressId] : null;
          },
          getId: function getId(state, getters, rootState, rootGetters) {
            console.warn("// DEPRECATED basket_id use getBasketId insted");
            return getters.getBasketId;
          },
          basket_id: function basket_id(state, getters, rootState, rootGetters) {
            console.warn("// DEPRECATED basket_id use getBasketId insted");
            return getters.getBasketId;
          },
          getBasketId: function getBasketId(state, getters, rootState, rootGetters) {
            var _getters$getCurrentCa17, _getters$getCurrentCa18;

            return parseInt((_getters$getCurrentCa17 = (_getters$getCurrentCa18 = getters.getCurrentCart) === null || _getters$getCurrentCa18 === void 0 ? void 0 : _getters$getCurrentCa18.ID) !== null && _getters$getCurrentCa17 !== void 0 ? _getters$getCurrentCa17 : 0);
          },
          getCurrentBasket: function getCurrentBasket(state, getters, rootState, rootGetters) {
            console.warn("// DEPRECATED getCurrentBasket use getCurrentCart insted");
            return getters.getCurrentCart;
          },
          getCart: function getCart(state, getters, rootState, rootGetters) {
            return function (cart_id) {
              var _getters$getCartList2;

              return parseInt(cart_id !== null && cart_id !== void 0 ? cart_id : 0) ? (_getters$getCartList2 = getters.getCartList) === null || _getters$getCartList2 === void 0 ? void 0 : _getters$getCartList2[cart_id] : getters.getCurrentCart;
            };
          },
          getBasket: function getBasket(state, getters, rootState, rootGetters) {
            return function (cart_id) {
              var _getters$getCartList3;

              return parseInt(cart_id !== null && cart_id !== void 0 ? cart_id : 0) ? (_getters$getCartList3 = getters.getCartList) === null || _getters$getCartList3 === void 0 ? void 0 : _getters$getCartList3[cart_id] : getters.getCurrentCart;
            };
          },
          basket: function basket(state, getters, rootState, rootGetters) {
            console.warn("// DEPRECATED basket use getBasket insted");
            return getters.getBasket;
          },
          userBasket: function userBasket(state, getters, rootState, rootGetters) {
            console.warn("// DEPRECATED userBasket use getBasket insted");
            return getters.getBasket;
          }
        }
      });
      germes_multibasket_stores_user.userStore.dispatch('basket/initEventHandler');
    }

    exports.userStore = germes_multibasket_stores_user.userStore;

}((this.window = this.window || {}),BX,BX,BX,window,window,window,window));
//# sourceMappingURL=script.bundle.js.map
