1"use strict";(globalThis.webpackChunksitebuilder_client=globalThis.webpackChunksitebuilder_client||[]).push([[5660],{3132:(t,e,i)=>{i.d(e,{l:()=>n});var s=i(624537);class n extends s.l{}n.PEANUTS="peanuts",n.GLUTEN="gluten",n.LACTOSE="lactose",n.EGGS="eggs",n.SOY_BEANS="soyBeans",n.FISH_AND_SEAFOOD="fishAndSeafood",n.SPICINESS="spiciness",n.ECO="eco",n.NO_SALT="noSalt",n.LOW_CALORY="lowCalory",n.ALCOHOL="alcohol",n.VEGETARIAN="vegetarian",n.VEGAN="vegan",n.GLUTEN_FREE="glutenFree",n.LACTOSE_FREE="lactoseFree",n.NO_SUGAR="noSugar",n.NO_EGGS="noEggs"},67319:(t,e,i)=>{i.d(e,{y:()=>n});var s=i(624537);class n extends s.l{}n.LEFT="left",n.CENTER="center",n.RIGHT="right"},120689:(t,e,i)=>{i.d(e,{Ec:()=>o,IV:()=>a,OZ:()=>d,Wk:()=>l,YD:()=>S,a_:()=>c,ag:()=>I,c8:()=>E,eB:()=>_,ni:()=>p,r3:()=>r,yp:()=>P});var s=i(740457),n=i(822065),h=i(67319);const d={[h.y.LEFT]:"dishPopup_left",[h.y.CENTER]:"dishPopup_center",[h.y.RIGHT]:"dishPopup_right"};function r(t,e){const i=t.filter(t=>t.type===n._.CATEGORY)[e],s=t.indexOf(i);let h=null;for(let e=s+1;e<t.length;e++)if(t[e].type===n._.CATEGORY){h=e;break}return h?t.slice(s+1,h).filter(t=>!t.isHidden):t.slice(s+1,t.length)}function o(t,e,i){const n=r(t,e);let h=[];return h=n.length?n.map(n=>[null,n.name,null,"",null,null,s.c.EMPTY,null,`${i}_${e}_${t.indexOf(n)}`]):[[null,"Background",null,"",null,null,s.c.EMPTY,null,`${i}_${e}`]],h}function P(t,e,i,s){const n=r(t,s),h=[];let d=1;return n.forEach(t=>{d===i&&h.push(t),d===e?d=1:d+=1}),h}function _(t,e){const i=e.split("_"),s=parseInt(i[3],10),n=parseInt(i[4],10),h=parseInt(i[5],10);return P(t.items,t.columnsCount,n,s)[h]}function E(t,e){const i=e.split("_"),s=parseInt(i[3],10);return t.items[s]}function l(t,e){return`${t}_allergenButton_${e}`}function c(t,e){return`${t}_filterPopup_dietPref_checkbox_${e}`}function I(t,e){return`${t}_filterPopup_ingredient_checkbox_${e+1}`}function a(t,e){return`${t}_filterPopup_spicinessIcon_${e}`}function S(t,e,i,s){return`column_${t}_${e}_${i}_${s}`}function p(t,e,i,s,n,h){return`${t}_${e}_${i}_${s}_${n}_${h}`}},429120:(t,e,i)=>{i.d(e,{h:()=>n});var s=i(624537);class n extends s.l{}n.LIST="list",n.SLIDER="slider"},455660:(t,e,i)=>{i.r(e),i.d(e,{default:()=>R});var s=i(105656),n=i(120689),h=i(906561);class d{constructor(){this.spicinessLevel=0,this.excludeAllergens=[],this.dietPreferences=[],this.ingredients=[]}}var r,o=i(46996),P=i(822065),_=i(333783),E=i(803371),l=i(274692),c=i.n(l),I=i(795098),a=i(649632),S=i(429120),p=i(640114),O=i(3132),g=(i(655076),i(415868)),C=i(992629),T=function(t,e,i,s){var n,h=arguments.length,d=h<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)d=Reflect.decorate(t,e,i,s);else for(var r=t.length-1;r>=0;r--)(n=t[r])&&(d=(h<3?n(d):h>3?n(e,i,d):n(e,i))||d);return h>3&&d&&Object.defineProperty(e,i,d),d},u=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},m=function(t,e,i,s){return new(i||(i=C))(function(n,h){function d(t){try{o(s.next(t))}catch(t){h(t)}}function r(t){try{o(s.throw(t))}catch(t){h(t)}}function o(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(d,r)}o((s=s.apply(t,e||[])).next())})};class R extends s.w{constructor(){super(...arguments),this.ACTIVE_CLASS="active",this.POPUP_WRAPPER_ID=`${this.widgetId}_dishPopup_wrapper`,this.POPUP_SPICINESS_ICONS_WRAPPER_ID=`${this.widgetId}_dishPopup_spicinessIconsWrapper`,this.POPUP_ICONS_WRAPPER_ID=`${this.widgetId}_dishPopup_iconsWrapper`,this.POPUP_BUTTONS_WRAPPER_ID=`${this.widgetId}_dishPopup_variantButtonsWrapper`,this.POPUP_NAME_SELECTOR=`#${this.widgetId}_dishPopup_name`,this.POPUP_DESCRIPTION_SELECTOR=`#${this.widgetId}_dishPopup_description`,this.POPUP_PRICE_SELECTOR=`#${this.widgetId}_dishPopup_price`,this.POPUP_FIRST_COLUMN_SELECTOR=`#${this.widgetId}_dishPopup_column_1`,this.POPUP_CLOSE_SELECTOR=`#${this.widgetId}_dishPopup_close`,this.POPUP_MASK_SELECTOR=`#${this.widgetId}_dishPopup_mask`,this.POPUP_WRAPPER_SELECTOR=`#${this.POPUP_WRAPPER_ID}`,this.POPUP_SPICINESS_ICONS_WRAPPER_SELECTOR=`#${this.POPUP_SPICINESS_ICONS_WRAPPER_ID}`,this.POPUP_ICONS_WRAPPER_SELECTOR=`#${this.POPUP_ICONS_WRAPPER_ID}`,this.POPUP_BUTTONS_WRAPPER_SELECTOR=`#${this.POPUP_BUTTONS_WRAPPER_ID}`,this.POPUP_ICON_CLASS="dishPopup_otherIcon",this.POPUP_SPICINESS_ICON_CLASS="dishPopup_spicinessIcon",this.POPUP_VARIANT_BUTTON_CLASS="dishPopup_variantButton",this.POPUP_SPICINESS_ICON_NESTED_CLASS=`.${this.POPUP_SPICINESS_ICON_CLASS}`,this.POPUP_ICON_NESTED_CLASS=`.${this.POPUP_ICON_CLASS}
1`,this.POPUP_VARIANT_BUTTON_NESTED_CLASS=`.${this.POPUP_VARIANT_BUTTON_CLASS}`,this.DISH_HEADER_SELECTOR=".dishWrapper_name",this.DISH_IMAGE_SELECTOR=".dishWrapper_image",this.WIDGET_SELECTOR=`#${this.widgetId}`,this.FILTER_POPUP="filterPopup",this.FILTER_POPUP_SPICINESS_ICON_ACTIVE_CLASS=`${this.FILTER_POPUP}_spicinessIcon_${this.ACTIVE_CLASS}`,this.FILTER_POPUP_ACTIVE_CLASS=`${this.FILTER_POPUP}_${this.ACTIVE_CLASS}`,this.SPACE_WRAPPER="space_wrapper",this.FILTER_BUTTON_SELECTOR=`#${this.widgetId}_filterButton`,this.FILTER_ACCEPT_BUTTON_SELECTOR=`#${this.widgetId}_${this.FILTER_POPUP}_acceptButton`,this.FILTER_RESET_BUTTON_SELECTOR=`#${this.widgetId}_${this.FILTER_POPUP}_resetButton`,this.FILTER_INCREASE_SPICINESS_BUTTON_SELECTOR=`#${this.widgetId}_${this.FILTER_POPUP}_increaseSpicinessButton`,this.FILTER_DECREASE_SPICINESS_BUTTON_SELECTOR=`#${this.widgetId}_${this.FILTER_POPUP}_decreaseSpicinessButton`,this.FILTER_WRAPPER_SELECTOR=`#${this.widgetId}_${this.FILTER_POPUP}_wrapper`,this.FILTER_MASK_SELECTOR=`#${this.widgetId}_${this.FILTER_POPUP}_mask`,this.FILTER_CLOSE_SELECTOR=`#${this.widgetId}_${this.FILTER_POPUP}_close`,this.FILTER_VARIANT_BUTTON_CLASS="dishPopup_variantButton",this.MIN_SPICINESS_LEVEL=0,this.MAX_SPICINESS_LEVEL=3,this.ANIMATION_DURATION=200,this.$dishName=null,this.$dishDescription=null,this.$dishPrice=null,this.$dishImage=null,this.filterOptions=null,this.initialColumnItems={}}init(){this.$widgetElement=c()(this.WIDGET_SELECTOR),this.widgetParams.showPopup&&(this.addDishPopupEventListeners(),this.setWidgetElements()),this.widgetParams.showFilter&&(this.resetFilters(),this.addFilterPopupEventListeners(),this.setInitialColumnItems())}get isDesignMode(){return bowweConfig.viewMode===h.Q.DESIGN}addDishPopupEventListeners(){this.$widgetElement.find(this.POPUP_CLOSE_SELECTOR).on("click",this.closePopup.bind(this)),this.$widgetElement.find(this.POPUP_MASK_SELECTOR).on("click",this.closePopup.bind(this)),this.$widgetElement.find(this.DISH_HEADER_SELECTOR).on("click",this.handleDishClick.bind(this)),this.$widgetElement.find(this.DISH_IMAGE_SELECTOR).on("click",this.handleDishClick.bind(this))}addFilterPopupEventListeners(){this.$widgetElement.find(this.FILTER_BUTTON_SELECTOR).on("click",this.openFilterPopup.bind(this)),this.$widgetElement.find(this.FILTER_MASK_SELECTOR).on("click",this.closeFilterPopup.bind(this)),this.$widgetElement.find(this.FILTER_CLOSE_SELECTOR).on("click",this.closeFilterPopup.bind(this)),this.$widgetElement.find(this.FILTER_INCREASE_SPICINESS_BUTTON_SELECTOR).on("click",this.handleIncreaseSpicinessButtonClick.bind(this)),this.$widgetElement.find(this.FILTER_DECREASE_SPICINESS_BUTTON_SELECTOR).on("click",this.handleDecreaseSpicinessButtonClick.bind(this)),this.widgetParams.allergenIcons.forEach((t,e)=>{const i=(0,n.Wk)(this.widgetId,e),s=this.$widgetElement.find(`#${i}`);s.on("click",()=>this.handleAllergenButtonClick.bind(this)(t,s))}),this.widgetParams.dietPreferencesIcons.forEach((t,e)=>{const i=(0,n.a_)(this.widgetId,e);this.$widgetElement.find(`#${i}`).on("change",()=>this.handleDietPreferenceCheckboxChange.bind(this)(t))}),this.widgetParams.ingredientsIcons.filter(t=>t.name==O.l.ECO).forEach((t,e)=>{const i=(0,n.ag)(this.widgetId,e);this.$widgetElement.find(`#${i}`).on("change",()=>this.handleIngredientCheckboxChange.bind(this)(t))}),this.isDesignMode||(this.$widgetElement.find(this.FILTER_RESET_BUTTON_SELECTOR).on("click",this.resetFilters.bind(this)),this.$widgetElement.find(this.FILTER_ACCEPT_BUTTON_SELECTOR).on("click",this.applyFilters.bind(this)))}setWidgetElements(){this.$dishName=this.$widgetElement.find(this.POPUP_NAME_SELECTOR),this.$dishDescription=this.$widgetElement.find(this.POPUP_DESCRIPTION_SELECTOR),this.$dishPrice=this.$widgetElement.find(this.POPUP_PRICE_SELECTOR),this.$dishImage=this.$widgetElement.find(this.POPUP_FIRST_COLUMN_SELECTOR)}handleDishClick(t){this.clearWrappers(),this.renderItems(t),this.openPopup()}handleIncreaseSpicinessButtonClick(){this.filterOptions.spicinessLevel=Math.min(this.MAX_SPICINESS_LEVEL,this.filterOptions.spicinessLevel+1),this.updateSpicinessIconsClasse
1s()}handleDecreaseSpicinessButtonClick(){this.filterOptions.spicinessLevel=Math.max(this.MIN_SPICINESS_LEVEL,this.filterOptions.spicinessLevel-1),this.updateSpicinessIconsClasses()}handleAllergenButtonClick(t,e){e.toggleClass(this.FILTER_POPUP_ACTIVE_CLASS),this.filterOptions.excludeAllergens.includes(t)?this.filterOptions.excludeAllergens.splice(this.filterOptions.excludeAllergens.indexOf(t),1):this.filterOptions.excludeAllergens.push(t)}handleDietPreferenceCheckboxChange(t){this.filterOptions.dietPreferences.includes(t)?this.filterOptions.dietPreferences.splice(this.filterOptions.dietPreferences.indexOf(t),1):this.filterOptions.dietPreferences.push(t)}handleIngredientCheckboxChange(t){this.filterOptions.ingredients.includes(t)?this.filterOptions.ingredients.splice(this.filterOptions.ingredients.indexOf(t),1):this.filterOptions.ingredients.push(t)}updateSpicinessIconsClasses(){for(let t=1;t<=this.MAX_SPICINESS_LEVEL;t++){const e=this.$widgetElement.find(`#${(0,n.IV)(this.widgetId,t)}`);t<=this.filterOptions.spicinessLevel?e.addClass(this.FILTER_POPUP_SPICINESS_ICON_ACTIVE_CLASS):e.removeClass(this.FILTER_POPUP_SPICINESS_ICON_ACTIVE_CLASS)}}resetFilters(){this.filterOptions=new d,this.widgetParams.allergenIcons.forEach((t,e)=>{const i=(0,n.Wk)(this.widgetId,e);this.$widgetElement.find(`#${i}`).removeClass(this.FILTER_POPUP_ACTIVE_CLASS)});const t=this.widgetParams.dietPreferencesIcons,e=this.widgetParams.ingredientsIcons.filter(t=>t.name==O.l.ECO);[...this.getDietPreferenceCheckboxesIDs(t),...this.getIngredientCheckboxesIDs(e)].forEach(t=>{this.$widgetElement.find(`#${t}`).prop("checked",!1)}),this.updateSpicinessIconsClasses()}applyFilters(){const t=this.getIDsOfItems(this.widgetParams.items),e=this.getItemToHide(),i=this.getIDsOfItems(e);if(this.widgetParams.menuLayout===S.h.LIST&&(this.showItems(t),this.hideItems(i),this.revertItemsPositionToInitial(),this.moveItemsToNewColumns()),this.widgetParams.menuLayout===S.h.SLIDER){const e=t.map(t=>this.getSlideIDForItem(t)),s=i.map(t=>this.getSlideIDForItem(t)),n=e.filter(t=>!s.includes(t)).map(t=>`#${t}`).join(",");this.showSlides(e),this.hideSlides(s),_.B.emit(E.z.SLIDER.UPDATE_SLIDES,c()(n))}this.closeFilterPopup()}getIngredientCheckboxesIDs(t){return t.map((t,e)=>(0,n.ag)(this.widgetId,e))}getDietPreferenceCheckboxesIDs(t){return t.map((t,e)=>(0,n.a_)(this.widgetId,e))}getSlideIDForItem(t){return this.$widgetElement.find(`#${t}`).parents(".item").first().attr("id")}getIDsOfItems(t){return this.widgetParams.items.filter(t=>t.type===P._.CATEGORY).flatMap((e,i)=>this.widgetParams.menuLayout===S.h.LIST?this.getIDsForColumnItems(t,i):this.widgetParams.menuLayout===S.h.SLIDER?this.getIDsForSliderItems(t,i):void 0).filter(t=>t)}getIDsForColumnItems(t,e){const i=[];for(let s=1;s<=this.widgetParams.columnsCount;s++){const h=(0,n.yp)(this.widgetParams.items,this.widgetParams.columnsCount,s,e).map((i,h)=>{if(t.includes(i))return(0,n.ni)(this.SPACE_WRAPPER,this.widgetParams.categoryLayout,this.widgetId,e,s,h)});i.push(...h)}return i}getIDsForSliderItems(t,e){const i=[],s=(0,n.r3)(this.widgetParams.items,e);for(let h=0;h<s.length;h++){const d=s[h];if(t.includes(d)){const t=(0,n.ni)(this.SPACE_WRAPPER,this.widgetParams.categoryLayout,this.widgetId,e,1,h);i.push(t)}}return i}getItemToHide(){return this.widgetParams.items.filter(t=>{if(t.type===P._.CATEGORY)return!1;const e=!!this.filterOptions.excludeAllergens.length,i=t.icons.some(t=>this.filterOptions.excludeAllergens.some(e=>(0,o.A)(t,e))),s=!!this.filterOptions.dietPreferences.length,n=t.icons.some(t=>this.filterOptions.dietPreferences.some(e=>(0,o.A)(t,e))),h=0!==this.filterOptions.spicinessLevel,d=t.spicinessLevel!==this.filterOptions.spicinessLevel,r=!!this.filterOptions.ingredients.length,_=t.icons.some(t=>this.filterOptions.ingredients.some(e=>(0,o.A)(t,e)));return e&&i||s&&!n||h&&d||r&&!_})}setInitialColumnItems(){this.widgetParams.items.filter(t=>t.type===P._.CATEGORY).forEach((t,e)=>{for(let t=1;t<=this.widgetParams.columnsCount;t++){const i=(0,n.YD)(this.widgetParams.categoryLayout,this.widgetId,e,t),s=(0,n.yp)(this.widgetParams.items,this.widgetParams.columnsCount,t,e);this.initialColumnItems[i]=this.getIDsOfItems(s)}})}revertItemsPositionToInitial(){Object.entries(this.initialColumnItems).forEac
1h(([t,e])=>{e.forEach(e=>{this.$widgetElement.find(`#${e}`).appendTo(this.$widgetElement.find(`#${t}`))})})}moveItemsToNewColumns(){const t=this.getItemToHide(),e=this.widgetParams.items.reduce((e,i)=>t.includes(i)?e:[...e,i],[]);e.filter(t=>t.type===P._.CATEGORY).forEach((t,i)=>{for(let t=1;t<=this.widgetParams.columnsCount;t++){const s=(0,n.YD)(this.widgetParams.categoryLayout,this.widgetId,i,t),h=(0,n.yp)(e,this.widgetParams.columnsCount,t,i);this.getIDsOfItems(h).forEach(t=>{this.$widgetElement.find(`#${t}`).appendTo(this.$widgetElement.find(`#${s}`))})}})}hideSlides(t){t.forEach(t=>{this.$widgetElement.find(`#${t}`).hide()})}showSlides(t){t.forEach(t=>{this.$widgetElement.find(`#${t}`).css("display","")})}showItems(t){t.forEach(t=>{this.$widgetElement.find(`#${t}`).show()})}hideItems(t){t.forEach(t=>{this.$widgetElement.find(`#${t}`).hide()})}closePopup(){this.clearDesignElements(!1),c()(this.POPUP_WRAPPER_SELECTOR).fadeOut(this.ANIMATION_DURATION)}openPopup(){this.clearDesignElements(!0),c()(this.POPUP_WRAPPER_SELECTOR).fadeIn(this.ANIMATION_DURATION)}openFilterPopup(){this.clearDesignElements(!0),c()(this.FILTER_WRAPPER_SELECTOR).fadeIn(this.ANIMATION_DURATION)}closeFilterPopup(){this.clearDesignElements(!1),c()(this.FILTER_WRAPPER_SELECTOR).fadeOut(this.ANIMATION_DURATION)}clearDesignElements(t){return m(this,void 0,void 0,function*(){this.isDesignMode&&(_.B.emit(a.m.WIDGET.UNMARK),_.B.emit(a.m.ADD_SECTION_DIALOG.ON_WIDGET_POPUP_OPEN,t))})}renderItems(t){const e=t.target.getAttribute(I.C.WIDGET_TYPE)===p.f.ICON?(0,n.c8)(this.widgetParams,t.target.id):(0,n.eB)(this.widgetParams,t.target.id);this.$dishName.text(e.name),this.$dishDescription.text(e.description),this.$dishPrice.text(e.variants[0].price),this.$dishImage.css("background-image",`url(${e.image})`),this.renderSpicinessIcons(e),this.renderItemIcons(e),this.renderItemButtons(e)}clearWrappers(){this.$widgetElement.find(this.POPUP_SPICINESS_ICONS_WRAPPER_SELECTOR).empty(),this.$widgetElement.find(this.POPUP_ICONS_WRAPPER_SELECTOR).empty(),this.$widgetElement.find(this.POPUP_BUTTONS_WRAPPER_SELECTOR).empty(),this.$dishImage.css("background-image","none")}getIconHTML(t,e,i,s){return`<div id="${e}" data-id="${e}" class="js-widget-element nested-widget dishPopup_icon ${i}" nested-class="${s}" widget-type="nestedcontainer" style="background-image: url(${t.icon})"></div>`}getButtonHTML(t,e,i,s){return`<button type="button" id="${e}" data-id="${e}" class="js-widget-element nested-widget ${this.FILTER_VARIANT_BUTTON_CLASS} ${i}" nested-class="${s}" widget-type="nestedcontainer">${t.portionSize}</button>`}renderSpicinessIcons(t){for(let e=1;e<=t.spicinessLevel;e++){const t=`${this.widgetId}_dishPopup_spicinessIcon_${e}`,i=this.getIconHTML(this.widgetParams.ingredientsIcons[0],t,this.POPUP_SPICINESS_ICON_CLASS,this.POPUP_SPICINESS_ICON_NESTED_CLASS);this.$widgetElement.find(this.POPUP_SPICINESS_ICONS_WRAPPER_SELECTOR).append(i),this.registerNestedWidget(t)}}renderItemIcons(t){t.icons.forEach((t,e)=>{const i=`${this.widgetId}_dishPopup_icon_${e}`,s=this.getIconHTML(t,i,this.POPUP_ICON_CLASS,this.POPUP_ICON_NESTED_CLASS);this.$widgetElement.find(this.POPUP_ICONS_WRAPPER_SELECTOR).append(s),this.registerNestedWidget(i)})}
1renderItemButtons(t){t.variants.forEach((t,e)=>{const i=`${this.widgetId}_dishPopup_button_${e}`;if(t.portionSize){const e=this.getButtonHTML(t,i,this.POPUP_VARIANT_BUTTON_CLASS,this.POPUP_VARIANT_BUTTON_NESTED_CLASS);this.$widgetElement.find(this.POPUP_BUTTONS_WRAPPER_SELECTOR).append(e)}this.registerNestedWidget(i),0===e&&c()(`#${i}`).addClass(this.ACTIVE_CLASS),c()(`#${i}`).on("click",()=>{c()(`.${this.FILTER_VARIANT_BUTTON_CLASS}`).removeClass(this.ACTIVE_CLASS),c()(`#${i}`).addClass(this.ACTIVE_CLASS),this.onVariantButtonClick.bind(this)(t)})})}registerNestedWidget(t){this.isDesignMode&&_.B.emit(a.m.WIDGET.REGISTER_NESTED,t,this.POPUP_BUTTONS_WRAPPER_ID)}onVariantButtonClick(t){this.$dishPrice.text(t.price)}}T([g.K,u("design:type",Function),u("design:paramtypes",[Boolean]),u("design:returntype","function"==typeof(r=void 0!==C&&C)?r:Object)],R.prototype,"clearDesignElements",null)},822065:(t,e,i)=>{i.d(e,{_:()=>n});var s=i(624537);class n extends s.l{}n.DISH="dish",n.CATEGORY="category"}}]); 2//# sourceMappingURL=https://bowwe.preprod/static/build/5660.6952270df1b675c85cba.js.map
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.