/*! For license information please see ptoFood.cfc8c0f533577b3be6de.js.LICENSE.txt */ (()=>{var t={41026:t=>{window,t.exports=function(t){var e={};function s(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,s),i.l=!0,i.exports}return s.m=t,s.c=e,s.d=function(t,e,n){s.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},s.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},s.t=function(t,e){if(1&e&&(t=s(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(s.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)s.d(n,i,function(e){return t[e]}.bind(null,i));return n},s.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return s.d(e,"a",e),e},s.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},s.p="",s(s.s=0)}([function(t,e,s){"use strict";s.r(e),s.d(e,"default",function(){return b});function n(t,e){for(var s=0;st.length)&&(e=t.length);for(var s=0,n=new Array(e);s0?setTimeout(function(){e.setTransitionCSS(),e.elementContainer.classList.add("simple-parallax-initialized")},10):this.elementContainer.classList.add("simple-parallax-initialized"),this.isInit=!0))}},{key:"wrapElement",value:function(){var t=this.element.closest("picture")||this.element,e=this.customWrapper||document.createElement("div");e.classList.add("simpleParallax"),e.style.overflow="hidden",this.customWrapper||(t.parentNode.insertBefore(e,t),e.appendChild(t)),this.elementContainer=e}},{key:"unWrapElement",value:function(){var t=this.elementContainer;this.customWrapper?(t.classList.remove("simpleParallax"),t.style.overflow=""):t.replaceWith.apply(t,function(t){return function(t){if(Array.isArray(t))return a(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return a(t,e);var s=Object.prototype.toString.call(t).slice(8,-1);return"Object"===s&&t.constructor&&(s=t.constructor.name),"Map"===s||"Set"===s?Array.from(t):"Arguments"===s||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s)?a(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(t.childNodes))}},{key:"setTransformCSS",value:function(){!1===this.settings.overflow&&(this.element.style[r]="scale(".concat(this.settings.scale,")")),this.element.style.willChange="transform"}},{key:"setTransitionCSS",value:function(){this.element.style.transition="transform ".concat(this.settings.delay,"s ").concat(this.settings.transition)}},{key:"unSetStyle",value:function(){this.element.style.willChange="",this.element.style[r]="",this.element.style.transition=""}},{key:"getElementOffset",value:function(){var t=this.elementContainer.getBoundingClientRect();if(this.elementHeight=t.height,this.elementTop=t.top+i.positions.top,this.settings.customContainer){var e=this.settings.customContainer.getBoundingClientRect();this.elementTop=t.top-e.top+i.positions.top}this.elementBottom=this.elementHeight+this.elementTop}},{key:"buildThresholdList",value:function(){for(var t=[],e=1;e<=this.elementHeight;e++){var s=e/this.elementHeight;t.push(s)}return t}},{key:"intersectionObserver",value:function(){var t={root:null,threshold:this.buildThresholdList()};this.observer=new IntersectionObserver(this.intersectionObserverCallback.bind(this),t),this.observer.observe(this.element)}},{key:"intersectionObserverCallback",value:function(t){var e=this;t.forEach(function(t){t.isIntersecting?e.isVisible=!0:e.isVisible=!1})}},{key:"checkIfVisible",value:function(){return this.elementBottom>i.positions.top&&this.elementTopthis.settings.maxTransition&&(t=this.settings.maxTransition),this.oldPercentage!==t&&(this.rangeMax||this.getRangeMax(),this.translateValue=(t/100*this.rangeMax-this.rangeMax/2).toFixed(0),this.oldTranslateValue!==this.translateValue&&(this.oldPercentage=t,this.oldTranslateValue=this.translateValue,!0))}},{key:"animate",value:function(){var t,e=0,s=0;(this.settings.orientation.includes("left")||this.settings.orientation.includes("right"))&&(s="".concat(this.settings.orientation.includes("left")?-1*this.translateValue:this.translateValue,"px")),(this.settings.orientation.includes("up")||this.settings.orientation.includes("down"))&&(e="".concat(this.settings.orientation.includes("up")?-1*this.translateValue:this.translateValue,"px")),t=!1===this.settings.overflow?"translate3d(".concat(s,", ").concat(e,", 0) scale(").concat(this.settings.scale,")"):"translate3d(".concat(s,", ").concat(e,", 0)"),this.element.style[r]=t}}])&&l(e.prototype,s),t}();function c(t){return function(t){if(Array.isArray(t))return m(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||h(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(t,e){if(t){if("string"==typeof t)return m(t,e);var s=Object.prototype.toString.call(t).slice(8,-1);return"Object"===s&&t.constructor&&(s=t.constructor.name),"Map"===s||"Set"===s?Array.from(t):"Arguments"===s||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s)?m(t,e):void 0}}function m(t,e){(null==e||e>t.length)&&(e=t.length);for(var s=0,n=new Array(e);s{var e=t&&t.__esModule?()=>t.default:()=>t;return s.d(e,{a:e}),e},s.d=(t,e)=>{for(var n in e)s.o(e,n)&&!s.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},s.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{"use strict";var t=s(41026),e=s.n(t);class n{constructor(t,e){this._inputSelector=t.inputSelector,this._inputErrorClass=t.inputErrorClass,this._errorClass=t.errorClass,this._submitButtonSelector=t.submitButtonSelector,this._inactiveButtonClass=t.inactiveButtonClass,this._formElement=e,this._inputList=Array.from(this._formElement.querySelectorAll(`${this._inputSelector}:not([type="radio"])`)),this._buttonElement=this._formElement.querySelector(this._submitButtonSelector),this._showErrorsAnimationClasses=["translate-x-5","opacity-0"],this._showErrorsTransitionsClasses=["transition-all","duration-300"],Array.from(this._formElement.querySelectorAll(".form__input-error")).map(t=>t.classList.add(...this._showErrorsAnimationClasses,...this._showErrorsTransitionsClasses))}_animateErrMessage(t){t.classList.add(...this._showErrorsAnimationClasses),requestAnimationFrame(()=>{t.classList.add(...this._showErrorsTransitionsClasses),t.classList.remove(...this._showErrorsAnimationClasses);const e=()=>{t.removeEventListener("transitionend",e),t.classList.remove(...this._showErrorsTransitionsClasses)};t.addEventListener("transitionend",e),setTimeout(e,350)})}_showInputError(t,e){const s=this._formElement.querySelector(`.${t.id}-error`);t.classList.add(this._inputErrorClass),s.textContent=e,s.classList.add(this._errorClass),this._animateErrMessage(s)}_hideInputError(t){const e=this._formElement.querySelector(`.${t.id}-error`);t.classList.remove(this._inputErrorClass),e.classList.remove(this._errorClass),e.classList.add(...this._showErrorsAnimationClasses),e.textContent=""}_checkInputValidity(t){t.validity.valid?this._hideInputError(t):this._showInputError(t,t.validationMessage)}_hasInvalidInput(t){return t.some(t=>!t.validity.valid)}_toggleButtonState(t,e){this._hasInvalidInput(t)?(e.classList.add(this._inactiveButtonClass),e.setAttribute("disabled",!0)):(e.classList.remove(this._inactiveButtonClass),e.removeAttribute("disabled"))}_showErrors(t,e){t.forEach(t=>{this._checkInputValidity(t)})}toggleButtonState(){this._toggleButtonState(this._inputList,this._buttonElement)}hasInvalidInput(){return this._hasInvalidInput(this._inputList)}disableSaveButton(){this._buttonElement.classList.add(this._inactiveButtonClass),this._buttonElement.setAttribute("disabled",!0)}cleanAllErrors(){this._inputList.forEach(t=>{this._hideInputError(t)})}showErrors(){this._inputList.forEach(t=>{this._checkInputValidity(t)})}_setEventListeners(){this._inputList.forEach(t=>{let e=null;t.addEventListener("input",()=>{e&&clearTimeout(e),e=setTimeout(()=>{this._checkInputValidity(t)},400)})})}_setStepEventListeners(t){t.forEach(t=>{const e=t.inputs,s=t.button;console.log(`123 ${s}`),e.forEach(t=>{t.addEventListener("input",()=>{this._checkInputValidity(t),this._toggleButtonState(e,s)})})})}checkStep(t){const e=this._sets[t].inputs,s=this._sets[t].button;return!this._hasInvalidInput(e)||(this._showErrors(e,s),this._toggleButtonState(e,s),!1)}enableStepValidation(){this._sets=[];const t=this._formElement.querySelector(".first-step"),e=t.querySelector(".first-step-button"),s=Array.from(t.querySelectorAll(this._inputSelector));this._sets.push({inputs:s,button:e});const n=this._formElement.querySelector(".second-step"),i=n.querySelector(".second-step-button"),o=Array.from(n.querySelectorAll(this._inputSelector));this._sets.push({inputs:o,button:i}),this._setStepEventListeners(this._sets)}enableValidation(){this._formElement.addEventListener("submit",t=>{t.preventDefault()}),this._setEventListeners()}}class i{constructor({baseUrl:t,headers:e}){this._baseUrl=t,this._headers=e}_isResponseOk(t){return t.ok?t.json():Promise.reject(`Ошибка: ${t.status}`)}getDataRequest(t){return fetch(`https://${this._baseUrl}/data/${t}`,{headers:this._headers}).then(t=>this._isResponseOk(t))}getCustomRequest(t){return fetch(`https://${this._baseUrl}/custom/${t}`,{headers:this._headers}).then(t=>this._isResponseOk(t))}getSharedTable(t){return fetch(`https://${this._baseUrl}/${t}`,{headers:this._headers}).then(t=>this._isResponseOk(t))}getReviewRequest(t){return fetch(`https://${this._baseUrl}/reviews/${t}`,{headers:this._headers}).then(t=>this._isResponseOk(t))}sendForm(t,e){return fetch(`https://${this._baseUrl}/forms/${t}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),isBase64Encoded:!1}).then(t=>(console.log(t),this._isResponseOk(t)))}}class o{constructor({formSubmitHandler:t,formCleanError:e,checherValidation:s},n,i){this._formSubmitHandler=t,this._formCleanError=e,this._formElement=n,this._inputSelector=i,this._checker=s}_getInputValues(){return this._inputList=this._formElement.querySelectorAll(this._inputSelector),this._formValues={},this._inputList.forEach(t=>{"checkbox"===t.type?(this._formValues[t.name]||(this._formValues[t.name]=[]),t.checked&&this._formValues[t.name].push(t.value)):"radio"===t.type?t.checked&&(this._formValues[t.name]=t.value):this._formValues[t.name]=t.value}),localStorage.getItem("clientId")&&(this._formValues.clientId=localStorage.getItem("clientId")),this._formValues.page=window.location.pathname,console.log("Поля формы на отправку",this._formValues),this._formValues}cleanAll(){this._formElement.reset(),this._formCleanError()}setEventListeners(){this._formElement.addEventListener("submit",t=>{t.preventDefault(),this._checker()&&this._formSubmitHandler(this._getInputValues())})}}function r(t,e,s,n,i){switch(t){case"default":default:e.textContent=s;break;case"loading":e.textContent=n;break;case"sended":e.textContent=i}}const a={inputSelector:".form__input",submitButtonSelector:".form__submit-button",inactiveButtonClass:"form__submit-button_disabled",inputErrorClass:"form__input_type_error",errorClass:"form__input-error_visible"};class l{constructor(t,e){this._modal=document.querySelector(t),this._buttonClose=this._modal.querySelector(".popup-button-close"),this._closeButtonSelector=".popup-button-close",this._openedClass="popup_opened",this._handleEscButton=t=>{"Escape"===t.key&&this.close()},this._handleOverlayClick=t=>{t.target.classList.contains("popup_opened")&&this.close()},this._isOpened=!1}open(){this._modal.classList.add(this._openedClass),this._isOpened=!0,this._isEscHandleEnabled&&document.addEventListener("keydown",this._handleEscButton),this._isOverlayEnabled&&this._modal.addEventListener("mousedown",this._handleOverlayClick),this._isBodyFixWhenOpen&&document.querySelector("body").classList.add("body-fixed")}close(){this._modal.classList.remove(this._openedClass),this._isOpened=!1,this._isEscHandleEnabled&&document.removeEventListener("keydown",this._handleEscButton),this._isOverlayEnabled&&this._modal.removeEventListener("mousedown",this._handleOverlayClick),this._isBodyFixWhenOpen&&document.querySelector("body").classList.remove("body-fixed")}setEventListeners({overlay:t=!0,esc:e=!0,bodyfix:s=!0}={}){this._isOverlayEnabled=t,this._isEscHandleEnabled=e,this._isBodyFixWhenOpen=s,this._buttonClose.addEventListener("mousedown",()=>{this.close()})}}class u extends l{constructor({handleClose:t,formConfig:e,headingSelector:s,commentSelector:l,buttonCloseSelector:u},c){super(c),u&&(this._buttonClose=this._modal.querySelector(u)),this._formInstance=function(t){const{formSelector:e,formId:s,handleCloseCallback:l,handleSuccessSendedCallback:u,buttonText:c="Оставить заявку",loadingText:h="Отправляем...",successText:m="Отправлено успешно!",newFormConfig:d,isStepValidation:p=!1,dataTransformCallback:f}=t,_=d||a;console.log("configForm",_);const v=document.querySelector(e);if(!v)return void console.warn(`Форма ${e} не найдена`);const b=v.querySelector(_.submitButtonSelector),y=new i({baseUrl:"api.termoblok.ru",headers:{Accept:"application/json","Content-Type":"application/json;charset=utf-8"}}),g=new n(_,v);p?g.enableStepValidation():g.enableValidation();const E=new o({formSubmitHandler:t=>{let e=t;f&&(e=f(t)),r("loading",b,c,h,m),y.sendForm(s,e).then(e=>{r("sended",b,c,h,m),u?.(e,t)}).catch(t=>console.log(t)).finally(()=>{v.reset(),setTimeout(()=>{r("default",b,c,h,m)},900),l&&l()})},formCleanError:()=>{},checherValidation:t=>!g.hasInvalidInput()||(g.showErrors(),!1)},v,_.inputSelector);return E.setEventListeners(),{form:v,formValidator:g,formStatic:E}}({...e,formSelector:`${c} form`,handleCloseCallback:()=>{this.close()}}),this._formElement=this._formInstance.form,this._formValidator=this._formInstance.formValidator,this._heading=this._modal.querySelector(s),this._comment=this._modal.querySelector(l),t&&(this._handleCloseFunc=t),this._step=0}increaseStep(){this._step=1}decreaseStep(){this._step=0}open(t,e){this._heading&&(this._heading.textContent=t||"Отправить заявку"),this._comment&&(this._comment.textContent=e||""),super.open()}close(){super.close(),this._handleCloseFunc&&this._handleCloseFunc(),this._formElement.reset(),this._formValidator.cleanAllErrors()}setEventListeners(t){super.setEventListeners(t)}setSubmitHandler(t){this._formInstance.formStatic.setSubmitHandler(t)}validate(){return this._formValidator.hasInvalidInput()}}const c=function(t){const{popupSelector:e,buttonOpenSelector:s,formConfig:n,popupConfig:i={}}=t,o=new u({...i,formConfig:{...n,formSelector:`${e} form`}},e),r=document.querySelector(s);return r?(r.addEventListener("click",t=>{t.preventDefault(),o.open(i.heading,i.comment)}),o.setEventListeners({overlay:!1,esc:!1}),o):(console.warn(`Кнопка ${s} не найдена`),o.setEventListeners({overlay:!1,esc:!1}),o)}({popupSelector:".popup-callback",buttonOpenSelector:".popup-callback-button",formConfig:{formId:"small-form",loadingText:"Отправляем заявку в термоблок 2...",newFormConfig:{inputSelector:".raschet-bem__input",submitButtonSelector:".button-bem_submit",inactiveButtonClass:"popup__button-save_disabled",inputErrorClass:"raschet-bem__input_type_error",errorClass:"raschet-bem__input-error_visible"}},popupConfig:{buttonCloseSelector:".popup__button-close",heading:"Заказать обратный звонок ПФФ",comment:"Мы перезвоним в течение 15 минут",headingSelector:".raschet-bem__title",commentSelector:"#comment-free-input",handleClose:()=>{console.log('Попап "Перезвоните мне" закрыт')}}});document.querySelector(".introgrid__button")?.addEventListener("mousedown",t=>{t.preventDefault(),c.open("Проконсультироваться с инженером")});let h=document.querySelectorAll(".food-grid__image");new(e())(h,{delay:.4,overflow:!0,scale:1.2,transition:"ease-out"})})()})();