PageSourceSearch

https://foodshe.ru/bitrix/templates/foodshe/js/core/basketModal.min.js?176832922925549

js foodshe.ru collected 2026-10-09 23:08:08 UTC 25,549 bytes, 1 lines download raw bytes

1document.addEventListener("alpine:init",()=>{const e=BX.message("SITE_ID");Alpine.data("basketModal",()=>({basketStatesCache:new Map,maxCountCache:new Map,shakingItems:new Set,isInitialized:!1,isVisible:!1,basketOperations:new Map,cutleryCount:0,cutleryDebounceTimer:null,handleBasketContentUpdated:null,handleDeliveryInfoUpdated:null,recSwiper:null,lastRecommendationsCount:0,cachedBasketItems:null,cachedRecommendations:null,cachedGroupRecommendations:null,cachedProductRecommendations:null,mediaQuery:null,boundHandleMediaChange:null,giftData:{enabled:!1,minLimit:0,isInitialized:!1},async init(){this.handleBasketContentUpdated=()=>{this.basketStatesCache.clear(),this.maxCountCache.clear(),this.basketOperations.clear(),this.cachedBasketItems=null,this.cachedRecommendations=null,this.cachedGroupRecommendations=null,this.cachedProductRecommendations=null;const e=Alpine.store("basket");void 0!==e?.content?.cutlery_count&&(this.cutleryCount=e.content.cutlery_count),this.$nextTick(()=>{this.initSwiper()})},this.handleDeliveryInfoUpdated=()=>{this.$nextTick(()=>{})},this.handleDeliveryZonesLoaded=()=>{this.$nextTick(()=>{})},document.addEventListener("basketContentUpdated",this.handleBasketContentUpdated),document.addEventListener("deliveryInfoUpdated",this.handleDeliveryInfoUpdated),document.addEventListener("deliveryZonesLoaded",this.handleDeliveryZonesLoaded),await this.waitForBasketLoad(),await this.waitForSettingsLoad(),this.isInitialized=!0,this.initGiftsFromSettings(),this.$nextTick(()=>{this.needsSwiperReinit()?this.initSwiper():this.recSwiper&&this.recSwiper.update()}),this.mediaQuery=window.matchMedia("(min-width: 1280px)"),this.boundHandleMediaChange=e=>{e.matches&&this.isVisible&&this.close()},this.mediaQuery.addListener(this.boundHandleMediaChange),this.mediaQuery.matches&&this.isVisible&&this.close(),window.addEventListener("basket:open",e=>{this.open()}),window.addEventListener("basket:toggle",e=>{this.open()})},async waitForBasketLoad(){let e=0;for(;e<200;){const t=Alpine.store("basket"),i=t.content?.products?.length>0,n=!t.isLoading;if(i||n&&e>20)break;await new Promise(e=>setTimeout(e,50)),e++}},async waitForSettingsLoad(){const e=Alpine.store("Settings");if(!e||!e.initialized)return new Promise(e=>{const t=()=>{document.removeEventListener("settingsLoaded",t),e()};document.addEventListener("settingsLoaded",t),setTimeout(()=>{document.removeEventListener("settingsLoaded",t),e()},3e3)})},initGiftsFromSettings(){const e=Alpine.store("Settings");if(e&&e.initialized)this.giftData.enabled=e.isGiftsEnabled,this.giftData.minLimit=e.giftsMinLimit,this.giftData.isInitialized=!0;else{const e=()=>{const t=Alpine.store("Settings");t&&(this.giftData.enabled=t.isGiftsEnabled,this.giftData.minLimit=t.giftsMinLimit,this.giftData.isInitialized=!0),document.removeEventListener("settingsLoaded",e)};document.addEventListener("settingsLoaded",e),setTimeout(()=>{document.removeEventListener("settingsLoaded",e),this.giftData.isInitialized=!0},3e3)}},initSwiper(){this.recSwiper&&(this.recSwiperPosition=this.recSwiper.activeIndex||0,this.recSwiper.destroy(!0,!0),this.recSwiper=null);const e=document.querySelector(".rec-swiper");if(!e)return;if(0!==e.querySelectorAll(".swiper-slide").length)try{this.recSwiper=new Swiper(e,{direction:"horizontal",lazy:!0,slidesPerView:"auto",slidesPerGroup:2,loop:!1,initialSlide:this.recSwiperPosition,navigation:{nextEl:".rec-swiper .custom-swiper-button-next",prevEl:".rec-swiper .custom-swiper-button-prev"},lazy:{loadPrevNext:!0,loadPrevNextAmount:2,loadOnTransitionStart:!1},breakpoints:{0:{slidesOffsetBefore:15,slidesOffsetAfter:15},768:{slidesOffsetBefore:0,slidesOffsetAfter:0}},on:{slideChange:()=>{this.recSwiper&&(this.recSwiperPosition=this.recSwiper.activeIndex)}}}),this.lastRecommendationsCount=this.recommendations.length}catch(e){}},updateSwiper(){this.recSwiper&&this.recSwiper.update()},needsSwiperReinit(){const e=this.recommendations.length!==this.lastRecommendationsCount,t=!!this.recSwiper,i=!!document.querySelector(".rec-swiper");return e||!t||!i},open(){if(window.innerWidth>=1280)return;this.isVisible=!0;const e=document.querySelector(".basket");e?.classList.remove("Closed");const t=window.innerWidth-document.documentElement.clientWidth;document.body.style.overflow="hidden",document.body.style.position="relative",document.body.style.width=`calc(100% - ${t}px)`;const i=document.querySelector(".floating-button-wrapper");
1i?.classList.add("Float-ModalFixer"),document.body.classList.add("basket-open")},close(){this.isVisible=!1;const e=document.querySelector(".basket");e?.classList.add("Closed"),document.body.style.overflow="",document.body.style.position="",document.body.style.width="";const t=document.querySelector(".floating-button-wrapper");t?.classList.remove("Float-ModalFixer"),document.body.classList.remove("basket-open")},toggle(){this.isVisible?this.close():this.open()},handleClickOutside(e){const t=Alpine.store("modal");if(t&&t.isOpen)return;const i=document.querySelector(".basket-button"),n=document.querySelector(".floating-button");if(i?.contains(e.target)||n?.contains(e.target))return;const s=document.querySelector(".modals");s?.contains(e.target)||this.isVisible&&this.close()},getBasketItemState(e){const t=e.ID;if(this.basketStatesCache.has(t))return this.basketStatesCache.get(t);const i=Alpine.store("basket").productStates.get(t);let n={serverAmount:parseInt(e.AMOUNT),isProcessingGlobally:!!i&&i.pendingOperations>0};return this.basketStatesCache.set(t,n),n},isItemProcessing(e){return this.basketOperations.get(e.INDEX)||!1},setItemLoadingState(e,t,i){const n=document.querySelector(`[data-basket-index="${e.INDEX}"]`);if(i){if(!n)return;const e=n.querySelector(".basket-action-btn:last-child"),i=n.querySelector(".basket-action-btn:first-child");this.isOperationInProgress=!0;document.querySelectorAll(".basket-action-btn").forEach(e=>e.classList.add("disabled")),"increment"===t?e?.classList.add("loading"):"decrement"===t&&i?.classList.add("loading")}else{this.isOperationInProgress=!1;if(document.querySelectorAll(".basket-action-btn").forEach(e=>e.classList.remove("disabled")),n){const e=n.querySelector(".basket-action-btn:last-child"),t=n.querySelector(".basket-action-btn:first-child");e?.classList.remove("loading"),t?.classList.remove("loading")}}},getCurrentAmount(e){const t=Alpine.store("basket");if(e.OPTIONS&&Object.keys(e.OPTIONS).length>0&&Object.values(e.OPTIONS).some(e=>null!=e)){return parseInt(e.AMOUNT)}if(this.isAdditionalItem(e)){return parseInt(e.AMOUNT)}const i=t.productStates.get(e.ID);if(i)return i.clientAmount;return parseInt(e.AMOUNT)},async incrementItem(e){if(this.isOperationInProgress)return;e.ID;const t=this.getCurrentAmount(e),i=this.getMaxCount(e);if(t>=i&&i>0)return void this.triggerShake(e);const n=t+1;this.setItemLoadingState(e,"increment",!0);try{await Alpine.store("basket").changeAmount(e.INDEX,n),await new Promise(e=>setTimeout(e,500))}catch(t){this.triggerShake(e)}finally{this.setItemLoadingState(e,"increment",!1)}},async decrementItem(e){if(this.isOperationInProgress)return;if(this.isItemUnavailable(e)){this.setItemLoadingState(e,"decrement",!0);try{e.OPTIONS&&Object.keys(e.OPTIONS).length>0&&Object.values(e.OPTIONS).some(e=>null!=e)?await Alpine.store("basket").removeItem(e.INDEX):await Alpine.store("basket").removeItemById(e.ID),await new Promise(e=>setTimeout(e,500))}catch(t){this.triggerShake(e)}finally{this.setItemLoadingState(e,"decrement",!1)}return}if(this.isGiftItem(e)){this.setItemLoadingState(e,"decrement",!0);try{"gift"===e.ID||"gift"===e.PRODUCT_ID?await this.removeGift(e.GIFT_ID):await Alpine.store("basket").clearPromo()}catch(t){this.triggerShake(e)}finally{this.setItemLoadingState(e,"decrement",!1)}return}e.ID;const t=this.getCurrentAmount(e);if(!(t<=0)){this.setItemLoadingState(e,"decrement",!0);try{if(1===t){e.OPTIONS&&Object.keys(e.OPTIONS).length>0&&Object.values(e.OPTIONS).some(e=>null!=e)?await Alpine.store("basket").removeItem(e.INDEX):await Alpine.store("basket").removeItemById(e.ID)}else{const i=t-1;await Alpine.store("basket").changeAmount(e.INDEX,i)}await new Promise(e=>setTimeout(e,500))}catch(t){this.triggerShake(e)}finally{this.setItemLoadingState(e,"decrement",!1)}}},async removeGift(t){try{const i=await axios.post("/bitrix/components/bd/basket/component.php?action=removeGift&SITE_ID="+e,{PRODUCT_ID:t,IS_GIFT:1},{headers:{"Content-Type":"application/x-www-form-urlencoded"}});return await Alpine.store("basket").getBasket(),i.data}catch(e){throw e}},async saveCutleryCount(){try{(await axios.post("/bitrix/components/bd/basket/component.php?action=setCutlery&SITE_ID="+e,{count:this.cutleryCount},{headers:{"Content-Type":"application/x-www-form-urlencoded"}})).data.success||console.warn("Не удалось сохранить количество приборов")}catch(e){console.warn("Ошибка при сохранении количества приборов:",e)}},debounceSaveCutlery(){clearTimeout(this.cutleryDebounceTimer),this.cutleryDebounceTimer=setTimeout(()=>{this.saveCutleryCount()},500)},incrementCutlery(){this.cutleryCount<20&&(this.cutleryCount++,this.debounceSaveCutlery())},decrementCutlery(){this.cutleryCount>0&&(this.cutleryCount--,this.debounceSaveCutlery())},async clearBasket(){await Alpine.store("basket").clearBasket()},getMaxCount(e){const t=e.ID;if(this.maxCountCache.has(t))return this.maxCountCache.get(t);let i;return i=void 0!==e.MAX_COUNT?parseInt(e.MAX_COUNT):this.calculateMaxCountPHP(e),this.maxCountCache.set(t,i),i},calculateMaxCountPHP(e){const t=e.PROPERTY_MAXCOUNT_ORDER||"",i=parseInt(e.PROPERTY_BUY_IT||0),n=parseInt(e.PROPERTY_BUY_IT_COMPLETE||0);if("0"===t||0===t)return 0;const s=parseInt(t)||0,r=i>0||n>0,o=Math.max(0,i-n);if(r&&0===o)return 0;if(!t||0===s)return r&&o>0?o:r?0:10;const a=Math.min(s,20);return r&&o>0?Math.min(a,o):r&&0===o?0:a},isPlusDisabled(e){if(this.isOperationInProgress)return!0;
1if(this.isItemProcessing(e))return!0;if("promo"===e.ID||"promo"===e.PRODUCT_ID)return!0;if(this.isGiftItem(e))return!0;const t=this.getMaxCount(e);if(e.OPTIONS&&Object.keys(e.OPTIONS).length>0&&Object.values(e.OPTIONS).some(e=>null!=e)){return Alpine.store("basket").content.products.filter(t=>t.ID===e.ID).reduce((e,t)=>e+parseInt(t.AMOUNT||0),0)>=t&&t>0}return this.getCurrentAmount(e)>=t&&t>0},isMinusDisabled(e){if(this.isItemProcessing(e))return!0;if(this.isGiftItem(e))return!1;if("promo"===e.ID||"promo"===e.PRODUCT_ID)return!0;if(e.OPTIONS&&Object.keys(e.OPTIONS).length>0&&Object.values(e.OPTIONS).some(e=>null!=e)){return parseInt(e.AMOUNT)<=0}return this.getCurrentAmount(e)<=0},isItemUnavailable(e){if(0===this.getMaxCount(e))return!0;if(e.PROPERTY_BUY_IT&&e.PROPERTY_BUY_IT_COMPLETE){if((parseInt(e.PROPERTY_BUY_IT)||0)-(parseInt(e.PROPERTY_BUY_IT_COMPLETE)||0)<=0)return!0}return!1},shouldShowRemoveButton(e){return this.isItemUnavailable(e)},isGiftItem:e=>"gift"===e.ID||"gift"===e.PRODUCT_ID,isAdditionalItem:e=>e.ID&&0===e.ID.toString().indexOf("additional_"),isOutOfStock:e=>"without_sale"===e.APPEND_WITHOUT_SALE||e.CLASSES&&e.CLASSES.includes("without_sale"),isPromoItem:e=>"promo"===e.ID||"promo"===e.PRODUCT_ID||e.CLASSES&&e.CLASSES.includes("not_change_amount"),hasOptions:e=>e.OPTIONS&&Object.keys(e.OPTIONS).length>0&&Object.values(e.OPTIONS).some(e=>null!=e),isShaking(e){return this.shakingItems.has(e.INDEX)},triggerShake(e){this.shakingItems.add(e.INDEX),setTimeout(()=>{this.shakingItems.delete(e.INDEX)},400)},triggerShakeCSS(e,t){const i=t.target.closest(".basket-actions");i&&(i.classList.add("shake"),setTimeout(()=>i.classList.remove("shake"),400))},getSubtitle(e){if(this.isGiftItem(e)||this.isAdditionalItem(e)||this.isPromoItem(e))return e.SECTION||"";if(this.isItemUnavailable(e))return"Закончилось, выберите другое";const t=[];if(e.OPTIONS_NATIVE&&e.OPTIONS_NATIVE.length>0){if(e.OPTIONS_NATIVE[0]&&e.OPTIONS&&void 0!==e.OPTIONS[1]&&null!==e.OPTIONS[1]){const i=e.OPTIONS_NATIVE[0][e.OPTIONS[1]];i&&i.VALUE&&t.push(i.VALUE)}if(e.OPTIONS_NATIVE[1]&&e.OPTIONS&&void 0!==e.OPTIONS[2]&&null!==e.OPTIONS[2]){const i=e.OPTIONS_NATIVE[1][e.OPTIONS[2]];i&&i.VALUE&&t.push(i.VALUE)}}if(e.TOPPINGS&&e.OPTIONS&&e.OPTIONS[3]&&Array.isArray(e.OPTIONS[3])){const i=[];e.OPTIONS[3].forEach(t=>{e.TOPPINGS[t]&&e.TOPPINGS[t].VALUE&&i.push(e.TOPPINGS[t].VALUE)}),i.length>0&&t.push(`<span style="color: #8B49AB;">+ ${i.join(", ")}</span>`)}if(t.length>0)return t.join(", ");const i=e.G||e.WEIGHT||e.GRAMM||e.PROPERTY_G;return i&&parseInt(i)>0?parseInt(i)+" г":""},formatPrice(e){if(!e)return"0 "+(window.currencyFont||"₽");if(window.priceRoundingDisabled){const t=parseFloat(e);if(t%1!=0){return t.toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g," ")+" "+(window.currencyFont||"₽")}return parseInt(t).toLocaleString()+" "+(window.currencyFont||"₽")}return parseInt(e).toLocaleString()+" "+(window.currencyFont||"₽")},formatOldPriceSimple(e){if(!e)return"";if(window.priceRoundingDisabled){const t=parseFloat(e);return t%1!=0?t.toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g," "):parseInt(t).toLocaleString()}return parseInt(e).toLocaleString()},getTotalPrice(e){return(window.priceRoundingDisabled?parseFloat(e.PRICE||0):parseInt(e.PRICE||0))*this.getCurrentAmount(e)},formatTotalPrice(e){const t=this.getTotalPrice(e);return this.formatPrice(t)},shouldShowOldPrice(e){if(this.hasOptions(e)){const t=this.calculateOldPriceFromOptions(e),i=window.priceRoundingDisabled?parseFloat(e.PRICE||0):parseInt(e.PRICE||0);return!(t<=0)&&t>i}if(!e.OLD_PRICE)return!1;const t=window.priceRoundingDisabled?parseFloat(e.OLD_PRICE):parseInt(e.OLD_PRICE),i=window.priceRoundingDisabled?parseFloat(e.PRICE||0):parseInt(e.PRICE||0);return!(t<=0)&&!(t<=i)},getTotalOldPrice(e){if(!this.shouldShowOldPrice(e))return 0;const t=this.getCurrentAmount(e);let i;i=this.hasOptions(e)?this.calculateOldPriceFromOptions(e):window.priceRoundingDisabled?parseFloat(e.OLD_PRICE||0):parseInt(e.OLD_PRICE||0);return i*t},calculateOldPriceFromOptions(e){if(!e.OPTIONS_NATIVE||!Array.isArray(e.OPTIONS_NATIVE))return 0;let t=0;if(e.OPTIONS_NATIVE[0]&&e.OPTIONS&&void 0!==e.OPTIONS[1]&&null!==e.OPTIONS[1]){const i=e.OPTIONS_NATIVE[0][e.OPTIONS[1]];i&&i.OLD_PRICE&&(t+=window.priceRoundingDisabled?parseFloat(i.OLD_PRICE):parseInt(i.OLD_PRICE))}if(e.OPTIONS_NATIVE[1]&&e.OPTIONS&&void 0!==e.OPTIONS[2]&&null!==e.OPTIONS[2]){const i=e.OPTIONS_NATIVE[1][e.OPTIONS[2]];i&&i.OLD_PRICE&&(t+=window.priceRoundingDisabled?parseFloat(i.OLD_PRICE):parseInt(i.OLD_PRICE))}return e.TOPPINGS&&e.OPTIONS&&e.OPTIONS[3]&&Array.isArray(e.OPTIONS[3])&&e.OPTIONS[3].forEach(i=>
1{const n=e.TOPPINGS[i];n&&n.OLD_PRICE&&(t+=window.priceRoundingDisabled?parseFloat(n.OLD_PRICE):parseInt(n.OLD_PRICE))}),t},formatTotalOldPrice(e){const t=this.getTotalOldPrice(e);if(t<=0)return"";if(window.priceRoundingDisabled){return t%1!=0?t.toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g," "):parseInt(t).toLocaleString()}return parseInt(t).toLocaleString()},get currentTimeWithOffset(){if(!window.workTimeConfig?.serverDateTime){const e=new Date,t=window.workTimeConfig?.timezoneOffset||0;return e.setHours(e.getHours()+t),e}const e=new Date(window.workTimeConfig.serverDateTime),t=window.workTimeConfig.timezoneOffset||0,i=new Date(e);return i.setHours(i.getHours()+t),i},parseTimeString(e,t){const[i,n]=e.split(":").map(Number),s=new Date(t);return s.setHours(i,n,0,0),s},get isWorkingHours(){if(!window.workTimeConfig)return!0;if(window.workTimeConfig.preorderEnabled)return!0;const e=Alpine.store("basket"),t=e?e.currentWorkTime:null;if("Выходной"===t)return!1;if(!t)return!0;try{const[e,i]=t.split(" - ");if(!e||!i)return!0;const n=this.currentTimeWithOffset,s=new Date(n),r=this.parseTimeString(e,s),o=this.parseTimeString(i,s);return n>=r&&n<=o}catch(e){return!0}},get workTimeText(){const e=Alpine.store("basket"),t=e?e.currentWorkTime:null;return"Выходной"===t?"Сегодня выходной":t&&"09:00 - 21:00"!==t?`Работаем с ${t}`:"Работаем с 09:00 до 21:00"},isRecommendationLiked:e=>!!e.IS_LIKED,handleGroupClick(e){Alpine.store("modal").open("showMore",{groupName:e.NAME,productIds:e.PRODUCT_IDS})},getGiftProgressStyle(){return`--gift-progress: ${this.getGiftProgress()}`},getGiftProgress(){if(!this.giftData.enabled||!this.giftData.isInitialized||0===this.giftData.minLimit)return 0;const e=this.totalAmountForGifts;return Math.min(e/this.giftData.minLimit,1)},isGiftAvailable(){return!(!this.giftData.enabled||!this.giftData.isInitialized)&&this.totalAmountForGifts>=this.giftData.minLimit},getAmountToGift(){return this.giftData.enabled&&this.giftData.isInitialized&&!this.isGiftAvailable()?this.giftData.minLimit-this.totalAmountForGifts:0},formatAmountToGift(){const e=this.getAmountToGift();if(window.priceRoundingDisabled){if(e%1!=0){return e.toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g," ")+" "+(window.currencyFont||"₽")}return parseInt(e).toLocaleString()+" "+(window.currencyFont||"₽")}return e.toLocaleString()+" "+(window.currencyFont||"₽")},getGiftState(){if(!this.giftData.enabled||!this.giftData.isInitialized||0===this.giftData.minLimit)return"hidden";return this.basketItems.some(e=>this.isGiftItem(e))?"hidden":this.isGiftAvailable()?"available":"progress"},handleGiftClick(){this.isGiftAvailable()&&Alpine.store("modal").open("gift")},handleCheckoutClick(){this.isCheckoutButtonEnabled&&(this.isUserAuthorized?(this.close(),window.location.href=window.site_dir+"checkout/"):Alpine.store("modal").open("auth"))},destroy(){this.mediaQuery&&this.boundHandleMediaChange&&this.mediaQuery.removeListener(this.boundHandleMediaChange),window.removeEventListener("basket:open",this.boundHandleOpen),window.removeEventListener("basket:toggle",this.boundHandleToggle),this.handleBasketContentUpdated&&document.removeEventListener("basketContentUpdated",this.handleBasketContentUpdated),this.handleDeliveryInfoUpdated&&document.removeEventListener("deliveryInfoUpdated",this.handleDeliveryInfoUpdated),this.handleSettingsLoaded&&document.removeEventListener("settingsLoaded",this.handleSettingsLoaded),this.recSwiper&&(this.recSwiper.destroy(!0,!0),this.recSwiper=null)},get hasActivePromocode(){return!!this.isInitialized&&Alpine.store("basket").hasActivePromocode},get activePromocodeText(){return this.isInitialized?Alpine.store("basket").activePromocodeText:""},get promocodeDiscountPercent(){if(!this.hasActivePromocode)return 0;const e=Alpine.store("basket");return e.content?.discount||0},get promocodeDiscountAmount(){if(!this.hasActivePromocode)return 0;const e=Alpine.store("basket");if(e.content?.discount_sum)return e.content.discount_sum;const t=(e.content?.basket_sum_native||0)-((e.content?.basket_sum||0)-(e.content?.service_fee||0));return window.priceRoundingDisabled?Math.max(0,t):Math.round(Math.max(0,t))},get shouldShowPromocodeRow(){return this.hasActivePromocode&&this.promocodeDiscountAmount>0},get shouldShowServiceFeeRow(){const e=Alpine.store("Settings");return e&&e.isServiceFeeEnabled},get serviceFeeDescription(){const e=Alpine.store("Settings");return e?e.serviceFeeDescription:"Сервисный сбор"},get formattedServiceFee(){const e=Alpine.store("Settings");return e&&e.isServiceFeeEnabled?e.formattedServiceFee:""},get shouldShowCashbackRow(){return this.isCashbackEnabled},get currentCashback(){const e=Alpine.store("basket").cashback||0;return window.priceRoundingDisabled?e:Math.round(e)},get isCashbackEnabled(){const e=this.currentCashback;return!(!e||e<=0)&&!(void 0!==window.bonusesEnabled&&!window.bonusesEnabled)},get formattedCashback(){return this.isCashbackEnabled?"+"+this.currentCashback.toLocaleStr
1ing():""},get isPickupDiscountActive(){if(this.hasActivePromocode)return!1;const e=Alpine.store("Settings");return"takeaway"===this.deliveryInfo.type&&e&&e.isPickupAvailable&&e.isPickupDiscountEnabled},get pickupDiscountPercent(){const e=Alpine.store("Settings");return e?e.pickupDiscountPercent:0},get pickupDiscountAmount(){if(!this.isPickupDiscountActive)return 0;const e=Alpine.store("basket"),t=(e.content?.basket_sum_native||0)-((e.content?.basket_sum||0)-(e.content?.service_fee||0));return window.priceRoundingDisabled?Math.max(0,t):Math.round(Math.max(0,t))},get formattedPickupDiscountAmount(){return this.formatPrice(this.pickupDiscountAmount)},get deliveryInfo(){return this.isInitialized&&Alpine.store("basket").deliveryInfo||{type:null,zoneId:null}},get currentZoneData(){if(!this.isInitialized||"delivery"!==this.deliveryInfo.type)return null;const e=Alpine.store("Settings");if(!e||!e.initialized)return null;const t=this.deliveryInfo.zoneId;return t&&e.deliveryZones[t]||null},get shouldShowDeliverySection(){const e=Alpine.store("Settings");return e&&e.isDeliverySelected&&!this.isEmpty},get shouldShowFreeDeliveryProgress(){if(!this.shouldShowDeliverySection)return!1;const e=Alpine.store("Settings");return!(!e||!e.freeDeliveryFrom)&&!this.isFreeDelivery},get isFreeDelivery(){const e=Alpine.store("Settings");if(!e||!e.isDeliverySelected)return!1;const t=e.freeDeliveryFrom;return!!t&&this.totalAmount>=t},get freeDeliveryProgressPercent(){const e=Alpine.store("Settings");if(!e||!e.isDeliverySelected)return 0;const t=e.freeDeliveryFrom;return t?Math.round(100*Math.min(this.totalAmount/t,1)):0},get amountToFreeDelivery(){if(this.isFreeDelivery)return 0;const e=Alpine.store("Settings");if(!e||!e.isDeliverySelected)return 0;const t=e.freeDeliveryFrom;return t?t-this.totalAmount:0},get formattedAmountToFreeDelivery(){return this.formatPrice(this.amountToFreeDelivery)},get deliveryCost(){const e=Alpine.store("Settings");if(!e||!e.isDeliverySelected)return 0;const t=e.deliveryCost;return t?this.isFreeDelivery?0:t:0},get formattedDeliveryCost(){return 0===this.deliveryCost&&this.isFreeDelivery?"Бесплатно":this.formatPrice(this.deliveryCost)},get isMinOrderReached(){const e=Alpine.store("Settings");if(!e||!e.isDeliverySelected)return!0;const t=e.minOrderAmount;if(!t)return!0;return Alpine.store("basket").totalAmountForMinOrder>=t},get amountToMinOrder(){if(this.isMinOrderReached)return 0;const e=Alpine.store("Settings");if(!e||!e.isDeliverySelected)return 0;const t=e.minOrderAmount;if(!t)return 0;return t-Alpine.store("basket").totalAmountForMinOrder},get formattedAmountToMinOrder(){return this.formatPrice(this.amountToMinOrder)},get deliveryProgressStyle(){return`--delivery-progress: ${this.freeDeliveryProgressPercent}%`},get deliveryRegulationText(){const e=Alpine.store("Settings");if(!e||!e.isDeliverySelected)return"";const t=e.currentRegulation;return t&&0!==t?` · ~${t} мин`:""},get pickupRegulationText(){const e=Alpine.store("Settings");if(!e||!e.isPickupSelected)return"";const t=e.currentRegulation;return t&&0!==t?` · ~${t} мин`:""},get basketItems(){if(!this.isInitialized)return[];if(null!==this.cachedBasketItems)return this.cachedBasketItems;const e=Alpine.store("basket")?.content?.products||[];return this.cachedBasketItems=e,e},get isEmpty(){return!!this.isInitialized&&0===this.basketItems.length},get totalItems(){return this.basketItems.length},get totalAmount(){return Alpine.store("basket").totalAmount},get totalAmountBeforePickupDiscount(){return Alpine.store("basket").totalAmountBeforeDiscount},get totalAmountForGifts(){const e=Alpine.store("basket").content?.basket_sum_gift||0;return window.priceRoundingDisabled?e:Math.round(e)},get totalOrderAmount(){return this.totalAmount+this.deliveryCost},get formattedTotalOrderAmount(){return this.formatPrice(this.totalOrderAmount)},get hasUnavailableItems(){return!(!this.isInitialized||this.isEmpty)&&this.basketItems.some(e=>this.isItemUnavailable(e))},get unavailableItemsCount(){return!this.isInitialized||this.isEmpty?0:this.basketItems.filter(e=>this.isItemUnavailable(e)).length},get recommendations(){if(!this.isInitialized)return[];if(null!==this.cachedRecommendations)return this.cachedRecommendations;const e=Alpine.store("basket"),t=e?.content?.recommendation?.list||[];return this.cachedRecommendations=t,t},get groupRecommendations(){return null!==this.cachedGroupRecommendations||(this.cachedGroupRecommendations=this.recommendations.filter(e=>"group"===e.TYPE)),this.cachedGroupRecommendations},get productRecommendations(){return null!==this.cachedProductRecommendations||(this.cachedProductRecommendations=this.recommendations.filter(e=>"simple"===e.TYPE)),this.cachedProductRecommendations},get hasRecommendations(){return this.recommendations.length>0},get checkoutButtonText(){return this.isEmpty?"Корзина пуста":this.isWorkingHours?this.isMinOrderReached?"К оформлению":`Добавьте блюд на ${this.formattedAmountToMinOrder}`:this.workTimeText},get isCheckoutButtonEnabled(){const e=this.isEmpty,t=this.isMinOrderReached,i=this.isWorkingHours,n=Alpine.store("basket").isLoading,s=Alpine.store("basket").isProcessing;return!e&&t&&i&&!n&&!s},get checkoutButtonClass(){const e="basket-checkout-btn";return this.isCheckoutButtonEnabled?e:`${e} disabled`},get isClearButtonDisabled(){return this.isEmpty||Alpine.store("basket").isLoading},getDishDeclension(e){const t=e%10,i=e%100;return i>=11&&i<=14?"блюд":1===t?"блюдо":t>=2&&t<=4?"блюда":"блюд"},get totalItemsCount(){return!this.isInitialized||this.isEmpty?0:this.basketItems.reduce((e,t)=>
1e+this.getCurrentAmount(t),0)},get basketItemsText(){const e=this.totalItemsCount;return`${e} ${this.getDishDeclension(e)} на сумму`},get isUserAuthorized(){if(window.guestCheckoutEnabled)return!0;const e=window.BX?.message?window.BX.message("USER_ID"):null;return e&&parseInt(e)>0}}))});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.