mealz-components 2.6.0 → 2.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/dist/assets/accordion-BGFgJnk1.js +19 -0
  2. package/dist/assets/product-card-wIoU7Z_5.js +189 -0
  3. package/dist/assets/promotion-badge-CDaL7Tqv.js +12 -0
  4. package/dist/basket-transfer-modal/basket-transfer-modal.min.js +5 -5
  5. package/dist/catalog/basket-preview/basket-preview.min.js +14 -14
  6. package/dist/catalog/catalog-category/catalog-category.min.js +1 -1
  7. package/dist/catalog/catalog-favorites/catalog-favorites.min.js +1 -1
  8. package/dist/catalog/catalog-history/catalog-history.min.js +1 -1
  9. package/dist/catalog/catalog-home/catalog-home.min.js +1 -1
  10. package/dist/catalog/catalog-home-header/catalog-home-header.min.js +1 -1
  11. package/dist/catalog/catalog-list/catalog-list.min.js +1 -1
  12. package/dist/catalog/catalog-tabs/catalog-tabs.min.js +1 -1
  13. package/dist/catalog/catalog-toolbar/catalog-toolbar.min.js +1 -1
  14. package/dist/catalog/my-meals-button/my-meals-button.min.js +1 -1
  15. package/dist/counter/counter.min.js +2 -2
  16. package/dist/drawer/drawer.min.js +5 -5
  17. package/dist/drawer-view-swapper/drawer-view-swapper.min.js +23 -23
  18. package/dist/history-drawer/history-drawer.min.js +1 -1
  19. package/dist/history-order/history-order.min.js +1 -1
  20. package/dist/history-order-expanded/history-order-expanded.min.js +1 -1
  21. package/dist/last-order-badge/last-order-badge.min.js +2 -2
  22. package/dist/last-order-modal/last-order-modal.min.js +4 -4
  23. package/dist/like-button/like-button.min.js +1 -1
  24. package/dist/modal/modal.min.js +4 -4
  25. package/dist/no-supplier-add-to-cart-cta/no-supplier-add-to-cart-cta.min.js +2 -2
  26. package/dist/onboarding/onboarding.min.js +4 -4
  27. package/dist/order-again/order-again.min.js +2 -2
  28. package/dist/planner/helpers/get-planner-onboarding-modal-config.min.js +1 -1
  29. package/dist/planner/helpers/init-planner-onboarding-modal.min.js +1 -1
  30. package/dist/planner/helpers/open-onboarding-modal.min.js +1 -1
  31. package/dist/planner/helpers/planner-onboarding-storage.min.js +1 -0
  32. package/dist/planner/planner-abandon-modal/planner-abandon-modal.min.js +2 -2
  33. package/dist/planner/planner-budget-edit-modal/planner-budget-edit-modal.min.js +2 -2
  34. package/dist/planner/planner-budget-gauge/planner-budget-gauge.min.js +1 -1
  35. package/dist/planner/planner-catalog/planner-catalog.min.js +2 -2
  36. package/dist/planner/planner-current-menu/planner-current-menu.css +1 -1
  37. package/dist/planner/planner-current-menu/planner-current-menu.min.js +1 -1
  38. package/dist/planner/planner-current-menu-modal/planner-current-menu-modal.min.js +2 -2
  39. package/dist/planner/planner-form/planner-form.min.js +7 -7
  40. package/dist/planner/planner-menu-option/planner-menu-option.min.js +1 -1
  41. package/dist/planner/planner-onboarding/planner-onboarding.min.js +1 -1
  42. package/dist/planner/planner-onboarding-modal/planner-onboarding-modal.min.js +6 -6
  43. package/dist/planner/planner-open-catalog-modal/planner-open-catalog-modal.min.js +2 -2
  44. package/dist/planner/planner-quick-menu/planner-quick-menu.min.js +1 -1
  45. package/dist/planner/planner-recipe-card/planner-recipe-card.min.js +1 -1
  46. package/dist/planner/planner-recipe-list/planner-recipe-list.min.js +1 -1
  47. package/dist/planner/planner-recipe-suggestion/planner-recipe-suggestion.min.js +1 -1
  48. package/dist/planner/planner-welcome-modal/planner-welcome-modal.min.js +3 -3
  49. package/dist/planner/to-basket-loader/to-basket-loader.min.js +5 -5
  50. package/dist/planner-entry/planner-entry.min.js +1 -1
  51. package/dist/preferences/preferences.min.js +4 -4
  52. package/dist/price/price.min.js +3 -3
  53. package/dist/products-to-basket-cta/products-to-basket-cta.min.js +1 -1
  54. package/dist/recipe-card/recipe-card.min.js +1 -1
  55. package/dist/recipe-card-cta/recipe-card-cta.min.js +1 -1
  56. package/dist/recipe-details/recipe-details.min.js +111 -111
  57. package/dist/recipe-pricing/recipe-pricing.min.js +1 -1
  58. package/dist/recipe-to-basket/recipe-to-basket.min.js +1 -1
  59. package/dist/replace-item/replace-item-card/replace-item-card.min.js +11 -11
  60. package/dist/replace-item/replace-item.min.js +13 -13
  61. package/dist/replace-item-planner/replace-item-card-planner/replace-item-card-planner.min.js +4 -4
  62. package/dist/replace-item-planner/replace-item-planner.min.js +13 -13
  63. package/dist/select/select.min.js +6 -6
  64. package/dist/slider-tabs/slider-tabs.min.js +3 -3
  65. package/dist/store-indicator/store-indicator.min.js +2 -2
  66. package/dist/store-locator/store-locator.min.js +2 -2
  67. package/dist/store-locator-drawer/store-locator-drawer.min.js +2 -2
  68. package/dist/supplier-selector/supplier-selector.min.js +6 -6
  69. package/package.json +1 -1
  70. package/dist/assets/accordion-sjJSL32r.js +0 -19
  71. package/dist/assets/custom-element-BhZVzxrc.js +0 -5
  72. package/dist/assets/product-card-TLfT6URx.js +0 -189
  73. package/dist/assets/promotion-badge-B-er7bV2.js +0 -12
  74. package/dist/planner/planner-dashboard/planner-dashboard.css +0 -1
  75. package/dist/planner/planner-dashboard/planner-dashboard.min.js +0 -1
  76. package/dist/planner-banner/planner-banner.css +0 -1
  77. package/dist/planner-card-link/planner-card-link.css +0 -1
@@ -1,19 +1,19 @@
1
- import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";import{_ as re,n as D,p as X,b as ne,c as oe,q as le,N as $,D as c,k as r}from"../assets/no-shadow-element-D62BBu0I.js";import{t as k}from"../assets/custom-element-BhZVzxrc.js";import{n as h}from"../assets/property-CoRN-Ln2.js";import{P as ce}from"../assets/price-D6RVRYHJ.js";import{m as o}from"../assets/mealz-sdk-E_fNZM-c.js";import{m as Z}from"../assets/merge-DzIA6T0M.js";import{m as y}from"../assets/map-DT-7dkaR.js";import{t as L}from"../assets/take-CpvJwza7.js";import{c as ee}from"../assets/capitalize-DUAqYmp4.js";import"../counter/counter.min.js";import"../assets/product-card-TLfT6URx.js";import"../price/price.min.js";import"../assets/promotion-badge-B-er7bV2.js";import{G as te}from"../assets/guestObserver-C5qvv1Ll.js";import"../assets/accordion-sjJSL32r.js";import"../store-indicator/store-indicator.min.js";import"../last-order-badge/last-order-badge.min.js";import"../order-again/order-again.min.js";import"../like-button/like-button.min.js";import{L as de}from"../last-order-modal/last-order-modal.min.js";import{a as pe}from"../assets/unsafe-html-DWUMaK1p.js";import{M as ue}from"../planner/planner-onboarding/planner-onboarding.min.js";import{o as se,c as he}from"../assets/OperatorSubscriber-DfCnFunn.js";import{i as H}from"../assets/innerFrom-DePszgj9.js";import{f as Q}from"../assets/filter-q99GWcpD.js";import{t as T}from"../assets/tap-BN_fPb40.js";import{s as Y}from"../assets/switchMap-BAdE9Uzw.js";import{c as J}from"../assets/combineLatest-Capvy1jI.js";import{d as me}from"../assets/async-C5Kj_SqM.js";import"../assets/viewport-listener-DsRHfwo4.js";import"../assets/debounceTime-Cf_7YmIn.js";import"../assets/skipWhile-Beza3ws3.js";import"../assets/singleton-COF3iBbF.js";import"../assets/mergeAll-DpEYIxY3.js";import"../assets/mergeMap-D2yctTHQ.js";import"../assets/executeSchedule-CEDvgTzM.js";import"../assets/empty-qrpgDBbc.js";import"../assets/args-DAL2bHut.js";import"../assets/isScheduler-CqHuyMwD.js";import"../assets/from-D8c5akO7.js";import"../assets/delay-DHNms76g.js";import"../assets/timer-3Kpx74mt.js";import"../assets/isDate-BwHtzZM4.js";import"../store-locator/store-locator.min.js";import"../assets/state-DDIoBQp5.js";import"../assets/query-BApjzB0v.js";import"../onboarding/onboarding.min.js";import"../onboarding/events.min.js";import"../onboarding/analytics/onboarding-analytics.min.js";import"../assets/responsive-C7Qf71r3.js";import"../assets/mapOneOrManyArgs-CHGhEDCk.js";var ge=function(e){re(t,e);function t(s,a,i){s===void 0&&(s=1/0),a===void 0&&(a=1/0),i===void 0&&(i=me);var n=e.call(this)||this;return n._bufferSize=s,n._windowTime=a,n._timestampProvider=i,n._buffer=[],n._infiniteTimeWindow=!0,n._infiniteTimeWindow=a===1/0,n._bufferSize=Math.max(1,s),n._windowTime=Math.max(1,a),n}return t.prototype.next=function(s){var a=this,i=a.isStopped,n=a._buffer,l=a._infiniteTimeWindow,d=a._timestampProvider,u=a._windowTime;i||(n.push(s),!l&&n.push(d.now()+u)),this._trimBuffer(),e.prototype.next.call(this,s)},t.prototype._subscribe=function(s){this._throwIfClosed(),this._trimBuffer();for(var a=this._innerSubscribe(s),i=this,n=i._infiniteTimeWindow,l=i._buffer,d=l.slice(),u=0;u<d.length&&!s.closed;u+=n?1:2)s.next(d[u]);return this._checkFinalizedStatuses(s),a},t.prototype._trimBuffer=function(){var s=this,a=s._bufferSize,i=s._timestampProvider,n=s._buffer,l=s._infiniteTimeWindow,d=(l?1:2)*a;if(a<1/0&&d<n.length&&n.splice(0,n.length-d),!l){for(var u=i.now(),g=0,p=1;p<n.length&&n[p]<=u;p+=2)g=p;g&&n.splice(0,g+1)}},t}(D);function ve(e){e===void 0&&(e={});var t=e.connector,s=t===void 0?function(){return new D}:t,a=e.resetOnError,i=a===void 0?!0:a,n=e.resetOnComplete,l=n===void 0?!0:n,d=e.resetOnRefCountZero,u=d===void 0?!0:d;return function(g){var p,m,v,b=0,_=!1,f=!1,z=function(){m==null||m.unsubscribe(),m=void 0},A=function(){z(),p=v=void 0,_=f=!1},ae=function(){var w=p;A(),w==null||w.unsubscribe()};return se(function(w,K){b++,!f&&!_&&z();var R=v=v??s();K.add(function(){b--,b===0&&!f&&!_&&(m=U(ae,u))}),R.subscribe(K),!p&&b>0&&(p=new X({next:function(x){return R.next(x)},error:function(x){f=!0,z(),m=U(A,i,x),R.error(x)},complete:function(){_=!0,z(),m=U(A,l),R.complete()}}),H(w).subscribe(p))})(g)}}function U(e,t){for(var s=[],a=2;a<arguments.length;a++)s[a-2]=arguments[a];if(t===!0){e();return}if(t!==!1){var i=new X({next:function(){i.unsubscribe(),e()}});return H(t.apply(void 0,ne([],oe(s)))).subscribe(i)}}function be(e,t,s){var a,i=!1;return a=e,ve({connector:function(){return new ge(a,t,s)},resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:i})}function O(e){return se(function(t,s){H(e).subscribe(he(s,function(){return s.complete()},le)),!s.closed&&t.subscribe(s)})}var _e=Object.defineProperty,fe=Object.getOwnPropertyDescriptor,E=(e,t,s,a)=>{for(var i=a>1?void 0:a?fe(t,s):t,n=e.length-1,l;n>=0;n--)(l=e[n])&&(i=(a?l(t,s,i):l(i))||i);return a&&i&&_e(t,s,i),i};let I=class extends ${constructor(){super(),this.noPosDisplay=!1,this.noSupplier=!1,this.recipeId="",this.plannerMode=!1,this.guests=0,this.recipe=null,this.analyticsPath="",this.subscriptions=[],this.remainingBasketEntries=[],this.recipePrice={remaining:0,inBasket:0,total:0,totalPerGuest:0},this.priceService=ce.getInstance(),this.allIngredientsToBasketLoading=!1,this.ingredientToBasketLoading=!1,this.updateIngredientFromBasketLoading=!1,this.productsLoading=!1,this.inMenu=!1,this.menuUpdateLoading=!1,this.styleURL=new URL("./recipe-details/details-footer/details-footer.css",this.getBaseURL())}connectedCallback(){super.connectedCallback(),this.priceService.initFormatter(),this.analyticsPath=`/recipes/${this.recipeId}/shopping`,this.subscriptions.push(Z(o.recipes.remainingBasketEntries$.pipe(y(e=>{this.remainingBasketEntries=e})),o.recipes.recipePrice$.pipe(y(e=>{const t=e.remaining+e.inBasket;this.recipePrice={...e,total:t,totalPerGuest:0}})),o.recipes.allIngredientsToBasketLoading$.pipe(y(e=>{this.allIngredientsToBasketLoading=e})),o.recipes.ingredientToBasketLoading$.pipe(y(e=>{this.ingredientToBasketLoading=e})),o.recipes.updateIngredientFromBasketLoading$.pipe(y(e=>{this.updateIngredientFromBasketLoading=e})),o.recipes.productsLoading$.pipe(y(e=>{this.productsLoading=e})),o.planner.plannerRecipePrice$.pipe(y(e=>{this.recipePrice.totalPerGuest=this.guests>0?e/this.guests:e}))).subscribe(()=>this.requestUpdate())),this.subscribeIsRecipeInMenu()}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(e=>e.unsubscribe()),this.isRecipeInMenuSub&&(this.isRecipeInMenuSub.unsubscribe(),this.isRecipeInMenuSub=void 0)}updated(e){super.updated(e),e.has("recipeId")&&this.subscribeIsRecipeInMenu()}subscribeIsRecipeInMenu(){this.recipeId&&(this.isRecipeInMenuSub&&this.isRecipeInMenuSub.unsubscribe(),this.isRecipeInMenuSub=o.planner.isRecipeInMenu$(this.recipeId).pipe(y(e=>{this.inMenu=e})).subscribe(()=>this.requestUpdate()))}closeRecipeDetails(e=!1){o.recipes.displayedRecipe$.next(null),e&&o.basket.basketPreviewState$.next({isOpen:!0,activeTabIndex:o.basket.basketPreviewState$.getValue().activeTabIndex})}continueShopping(){this.closeRecipeDetails(),this.sendContinueEvent()}addToMenu(){var a,i;this.menuUpdateLoading=!0,this.requestUpdate();const e=document.querySelector("mealz-planner-recipe-suggestion"),t=!!e&&!!e.recipeId&&e.recipeId===this.recipeId,s=document.querySelector("mealz-planner-current-menu");if(!s){const n=(i=(a=o.recipes)==null?void 0:a.productsPlannerByCategory$)==null?void 0:i.value,l=(n==null?void 0:n.toPickProducts)||[];o.planner.addRecipeToMenu(this.recipeId,this.guests,!!o.pos.currentPos().value,l).pipe(L(1)).subscribe(()=>{this.inMenu=!0;const d=document.querySelector("mealz-planner-recipe-list");d==null||d.addRecipeCardToList(this.recipeId),this.menuUpdateLoading=!1,this.requestUpdate(),this.closeRecipeDetails()});return}if(t){e.addRecipeFromDetails$(this.guests).subscribe({next:()=>{this.inMenu=!0,this.menuUpdateLoading=!1,this.requestUpdate(),this.closeRecipeDetails()},error:()=>{this.menuUpdateLoading=!1,this.requestUpdate()}});return}s.addRecipe(this.recipeId,this.guests).pipe(L(1)).subscribe({next:()=>{this.inMenu=!0,e==null||e.addAndSelectNewSuggestion(this.recipe||void 0),this.menuUpdateLoading=!1,this.requestUpdate(),this.closeRecipeDetails()},error:()=>{this.menuUpdateLoading=!1,this.requestUpdate()}})}removeFromMenu(){this.menuUpdateLoading=!0,this.requestUpdate();const e=document.querySelector("mealz-planner-recipe-suggestion");if(!e){o.planner.removeRecipeFromMenu(this.recipeId).pipe(L(1)).subscribe(()=>{this.inMenu=!1,this.menuUpdateLoading=!1,this.requestUpdate()});return}e.removeRecipe(this.recipeId).subscribe(()=>{this.inMenu=!1,this.menuUpdateLoading=!1,this.requestUpdate()})}addAllIngredients(){o.recipes.addAllIngredientsToBasket({originPath:this.analyticsPath,props:{}}),this.sendAddAllEvent(),this.recipePrice.inBasket===0&&this.sendAddRecipeEvent()}render(){if(this.noPosDisplay&&!this.plannerMode)return c;const e=this.remainingBasketEntries.length>0&&!this.plannerMode,t=this.plannerMode&&this.noPosDisplay,s=this.plannerMode&&!this.inMenu;return r`
1
+ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";import{_ as J,n as O,p as F,b as X,c as Z,q as ee,N as k,D as d,k as i}from"../assets/no-shadow-element-D62BBu0I.js";import{n as h}from"../assets/property-CoRN-Ln2.js";import{P as te}from"../assets/price-D6RVRYHJ.js";import{m as r}from"../assets/mealz-sdk-E_fNZM-c.js";import{m as V}from"../assets/merge-DzIA6T0M.js";import{m as y}from"../assets/map-DT-7dkaR.js";import{t as B}from"../assets/take-CpvJwza7.js";import{c as H}from"../assets/capitalize-DUAqYmp4.js";import"../counter/counter.min.js";import"../assets/product-card-wIoU7Z_5.js";import"../price/price.min.js";import"../assets/promotion-badge-CDaL7Tqv.js";import{G as j}from"../assets/guestObserver-C5qvv1Ll.js";import"../assets/accordion-BGFgJnk1.js";import"../store-indicator/store-indicator.min.js";import"../last-order-badge/last-order-badge.min.js";import"../order-again/order-again.min.js";import"../like-button/like-button.min.js";import{L as se}from"../last-order-modal/last-order-modal.min.js";import{a as ie}from"../assets/unsafe-html-DWUMaK1p.js";import{M as ae}from"../planner/planner-onboarding/planner-onboarding.min.js";import{o as W,c as re}from"../assets/OperatorSubscriber-DfCnFunn.js";import{i as L}from"../assets/innerFrom-DePszgj9.js";import{f as N}from"../assets/filter-q99GWcpD.js";import{t as I}from"../assets/tap-BN_fPb40.js";import{s as q}from"../assets/switchMap-BAdE9Uzw.js";import{c as G}from"../assets/combineLatest-Capvy1jI.js";import{d as ne}from"../assets/async-C5Kj_SqM.js";import"../assets/viewport-listener-DsRHfwo4.js";import"../assets/debounceTime-Cf_7YmIn.js";import"../assets/skipWhile-Beza3ws3.js";import"../assets/singleton-COF3iBbF.js";import"../assets/mergeAll-DpEYIxY3.js";import"../assets/mergeMap-D2yctTHQ.js";import"../assets/executeSchedule-CEDvgTzM.js";import"../assets/empty-qrpgDBbc.js";import"../assets/args-DAL2bHut.js";import"../assets/isScheduler-CqHuyMwD.js";import"../assets/from-D8c5akO7.js";import"../assets/delay-DHNms76g.js";import"../assets/timer-3Kpx74mt.js";import"../assets/isDate-BwHtzZM4.js";import"../store-locator/store-locator.min.js";import"../assets/state-DDIoBQp5.js";import"../assets/query-BApjzB0v.js";import"../onboarding/onboarding.min.js";import"../onboarding/events.min.js";import"../onboarding/analytics/onboarding-analytics.min.js";import"../assets/responsive-C7Qf71r3.js";import"../planner/helpers/planner-onboarding-storage.min.js";import"../assets/mapOneOrManyArgs-CHGhEDCk.js";var oe=function(o){J(e,o);function e(t,s,a){t===void 0&&(t=1/0),s===void 0&&(s=1/0),a===void 0&&(a=ne);var n=o.call(this)||this;return n._bufferSize=t,n._windowTime=s,n._timestampProvider=a,n._buffer=[],n._infiniteTimeWindow=!0,n._infiniteTimeWindow=s===1/0,n._bufferSize=Math.max(1,t),n._windowTime=Math.max(1,s),n}return e.prototype.next=function(t){var s=this,a=s.isStopped,n=s._buffer,l=s._infiniteTimeWindow,c=s._timestampProvider,p=s._windowTime;a||(n.push(t),!l&&n.push(c.now()+p)),this._trimBuffer(),o.prototype.next.call(this,t)},e.prototype._subscribe=function(t){this._throwIfClosed(),this._trimBuffer();for(var s=this._innerSubscribe(t),a=this,n=a._infiniteTimeWindow,l=a._buffer,c=l.slice(),p=0;p<c.length&&!t.closed;p+=n?1:2)t.next(c[p]);return this._checkFinalizedStatuses(t),s},e.prototype._trimBuffer=function(){var t=this,s=t._bufferSize,a=t._timestampProvider,n=t._buffer,l=t._infiniteTimeWindow,c=(l?1:2)*s;if(s<1/0&&c<n.length&&n.splice(0,n.length-c),!l){for(var p=a.now(),g=0,u=1;u<n.length&&n[u]<=p;u+=2)g=u;g&&n.splice(0,g+1)}},e}(O);function le(o){o===void 0&&(o={});var e=o.connector,t=e===void 0?function(){return new O}:e,s=o.resetOnError,a=s===void 0?!0:s,n=o.resetOnComplete,l=n===void 0?!0:n,c=o.resetOnRefCountZero,p=c===void 0?!0:c;return function(g){var u,m,v,b=0,f=!1,_=!1,z=function(){m==null||m.unsubscribe(),m=void 0},$=function(){z(),u=v=void 0,f=_=!1},Y=function(){var S=u;$(),S==null||S.unsubscribe()};return W(function(S,M){b++,!_&&!f&&z();var C=v=v??t();M.add(function(){b--,b===0&&!_&&!f&&(m=A(Y,p))}),C.subscribe(M),!u&&b>0&&(u=new F({next:function(x){return C.next(x)},error:function(x){_=!0,z(),m=A($,a,x),C.error(x)},complete:function(){f=!0,z(),m=A($,l),C.complete()}}),L(S).subscribe(u))})(g)}}function A(o,e){for(var t=[],s=2;s<arguments.length;s++)t[s-2]=arguments[s];if(e===!0){o();return}if(e!==!1){var a=new F({next:function(){a.unsubscribe(),o()}});return L(e.apply(void 0,X([],Z(t)))).subscribe(a)}}function ce(o,e,t){var s,a=!1;return s=o,le({connector:function(){return new oe(s,e,t)},resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:a})}function w(o){return W(function(e,t){L(o).subscribe(re(t,function(){return t.complete()},ee)),!t.closed&&e.subscribe(t)})}var de=Object.defineProperty,P=(o,e,t,s)=>{for(var a=void 0,n=o.length-1,l;n>=0;n--)(l=o[n])&&(a=l(e,t,a)||a);return a&&de(e,t,a),a};class T extends k{constructor(){super(),this.noPosDisplay=!1,this.noSupplier=!1,this.recipeId="",this.plannerMode=!1,this.guests=0,this.recipe=null,this.analyticsPath="",this.subscriptions=[],this.remainingBasketEntries=[],this.recipePrice={remaining:0,inBasket:0,total:0,totalPerGuest:0},this.priceService=te.getInstance(),this.allIngredientsToBasketLoading=!1,this.ingredientToBasketLoading=!1,this.updateIngredientFromBasketLoading=!1,this.productsLoading=!1,this.inMenu=!1,this.menuUpdateLoading=!1,this.styleURL=new URL("./recipe-details/details-footer/details-footer.css",this.getBaseURL())}connectedCallback(){super.connectedCallback(),this.priceService.initFormatter(),this.analyticsPath=`/recipes/${this.recipeId}/shopping`,this.subscriptions.push(V(r.recipes.remainingBasketEntries$.pipe(y(e=>{this.remainingBasketEntries=e})),r.recipes.recipePrice$.pipe(y(e=>{const t=e.remaining+e.inBasket;this.recipePrice={...e,total:t,totalPerGuest:0}})),r.recipes.allIngredientsToBasketLoading$.pipe(y(e=>{this.allIngredientsToBasketLoading=e})),r.recipes.ingredientToBasketLoading$.pipe(y(e=>{this.ingredientToBasketLoading=e})),r.recipes.updateIngredientFromBasketLoading$.pipe(y(e=>{this.updateIngredientFromBasketLoading=e})),r.recipes.productsLoading$.pipe(y(e=>{this.productsLoading=e})),r.planner.plannerRecipePrice$.pipe(y(e=>{this.recipePrice.totalPerGuest=this.guests>0?e/this.guests:e}))).subscribe(()=>this.requestUpdate())),this.subscribeIsRecipeInMenu()}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(e=>e.unsubscribe()),this.isRecipeInMenuSub&&(this.isRecipeInMenuSub.unsubscribe(),this.isRecipeInMenuSub=void 0)}updated(e){super.updated(e),e.has("recipeId")&&this.subscribeIsRecipeInMenu()}subscribeIsRecipeInMenu(){this.recipeId&&(this.isRecipeInMenuSub&&this.isRecipeInMenuSub.unsubscribe(),this.isRecipeInMenuSub=r.planner.isRecipeInMenu$(this.recipeId).pipe(y(e=>{this.inMenu=e})).subscribe(()=>this.requestUpdate()))}closeRecipeDetails(e=!1){r.recipes.displayedRecipe$.next(null),e&&r.basket.basketPreviewState$.next({isOpen:!0,activeTabIndex:r.basket.basketPreviewState$.getValue().activeTabIndex})}continueShopping(){this.closeRecipeDetails(),this.sendContinueEvent()}addToMenu(){var a,n;this.menuUpdateLoading=!0,this.requestUpdate();const e=document.querySelector("mealz-planner-recipe-suggestion"),t=!!e&&!!e.recipeId&&e.recipeId===this.recipeId,s=document.querySelector("mealz-planner-current-menu");if(!s){const l=(n=(a=r.recipes)==null?void 0:a.productsPlannerByCategory$)==null?void 0:n.value,c=(l==null?void 0:l.toPickProducts)||[];r.planner.addRecipeToMenu(this.recipeId,this.guests,!!r.pos.currentPos().value,c).pipe(B(1)).subscribe(()=>{this.inMenu=!0;const p=document.querySelector("mealz-planner-recipe-list");p==null||p.addRecipeCardToList(this.recipeId),this.menuUpdateLoading=!1,this.requestUpdate(),this.closeRecipeDetails()});return}if(t){e.addRecipeFromDetails$(this.guests).subscribe({next:()=>{this.inMenu=!0,this.menuUpdateLoading=!1,this.requestUpdate(),this.closeRecipeDetails()},error:()=>{this.menuUpdateLoading=!1,this.requestUpdate()}});return}s.addRecipe(this.recipeId,this.guests).pipe(B(1)).subscribe({next:()=>{this.inMenu=!0,e==null||e.addAndSelectNewSuggestion(this.recipe||void 0),this.menuUpdateLoading=!1,this.requestUpdate(),this.closeRecipeDetails()},error:()=>{this.menuUpdateLoading=!1,this.requestUpdate()}})}removeFromMenu(){this.menuUpdateLoading=!0,this.requestUpdate();const e=document.querySelector("mealz-planner-recipe-suggestion");if(!e){r.planner.removeRecipeFromMenu(this.recipeId).pipe(B(1)).subscribe(()=>{this.inMenu=!1,this.menuUpdateLoading=!1,this.requestUpdate()});return}e.removeRecipe(this.recipeId).subscribe(()=>{this.inMenu=!1,this.menuUpdateLoading=!1,this.requestUpdate()})}addAllIngredients(){r.recipes.addAllIngredientsToBasket({originPath:this.analyticsPath,props:{}}),this.sendAddAllEvent(),this.recipePrice.inBasket===0&&this.sendAddRecipeEvent()}render(){if(this.noPosDisplay&&!this.plannerMode)return d;const e=this.remainingBasketEntries.length>0&&!this.plannerMode,t=this.plannerMode&&this.noPosDisplay,s=this.plannerMode&&!this.inMenu;return i`
2
2
  <div class="mealz-recipe-details__footer">
3
- ${this.productsLoading&&!this.plannerMode?c:r`
3
+ ${this.productsLoading&&!this.plannerMode?d:i`
4
4
  <!-- ADD TO BASKET CTA -->
5
- ${e||t||s?this.renderAddToBasketButton():r`
5
+ ${e||t||s?this.renderAddToBasketButton():i`
6
6
  <div class="mealz-recipe-details__recipe-is-in-basket-cta-container">
7
7
  ${this.renderBasketActions()}
8
8
  </div>
9
9
  `}
10
10
  `}
11
- ${this.noPosDisplay?c:this.renderPrice()}
12
- </div>`}renderAddToBasketButton(){const e=this.remainingBasketEntries.length;return this.allIngredientsToBasketLoading||this.menuUpdateLoading?r`
11
+ ${this.noPosDisplay?d:this.renderPrice()}
12
+ </div>`}renderAddToBasketButton(){const e=this.remainingBasketEntries.length;return this.allIngredientsToBasketLoading||this.menuUpdateLoading?i`
13
13
  <button class="mealz-recipe-details__add-to-basket-cta mealz-recipe-details__add-to-basket-cta--loading mealz-ds-button primary">
14
14
  <div class="mealz-ds-loader"></div>
15
15
  </button>
16
- `:this.plannerMode?r`
16
+ `:this.plannerMode?i`
17
17
  <button
18
18
  class="mealz-recipe-details__add-to-basket-cta mealz-recipe-details__add-to-basket-cta--to-menu mealz-ds-button primary"
19
19
  @click=${()=>this.addToMenu()}
@@ -21,7 +21,7 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
21
21
  <span class="mealz-ds-text size-s weight-xl">Ajouter au menu</span>
22
22
  <img src="https://storage.googleapis.com/assets.miam.tech/generic/icons/Pot-add_white.svg" alt="add to menu icon" />
23
23
  </button>
24
- `:r`
24
+ `:i`
25
25
  <button
26
26
  class="mealz-recipe-details__add-to-basket-cta mealz-recipe-details__add-to-basket-cta--to-basket mealz-ds-text mealz-ds-button size-m weight-xl primary"
27
27
  @click=${()=>this.addAllIngredients()}
@@ -42,11 +42,11 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
42
42
  </div>
43
43
  </div>
44
44
  </button>
45
- `}renderBasketActions(){return this.menuUpdateLoading?r`
45
+ `}renderBasketActions(){return this.menuUpdateLoading?i`
46
46
  <button class="mealz-ds-button">
47
47
  <div class="mealz-ds-loader"></div>
48
48
  </button>
49
- `:this.plannerMode?r`
49
+ `:this.plannerMode?i`
50
50
  <!-- REMOVE FROM MENU CTA -->
51
51
  <button class="mealz-ds-button secondary mealz-recipe-details__remove-from-menu-cta" @click=${()=>this.removeFromMenu()}>
52
52
  <img alt="remove icon"
@@ -55,7 +55,7 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
55
55
  Retirer du menu
56
56
  </span>
57
57
  </button>
58
- `:r`
58
+ `:i`
59
59
  <!-- CONTINUE CTA -->
60
60
  <button
61
61
  class="mealz-ds-button secondary mealz-recipe-details__continue-shopping-cta ${this.noSupplier?"mobile-hidden":""}"
@@ -66,7 +66,7 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
66
66
  </button>
67
67
 
68
68
  <!-- VIEW BASKET CTA (ONLY IF NO SUPPLIER MODE) -->
69
- ${this.noSupplier?r`
69
+ ${this.noSupplier?i`
70
70
  <button
71
71
  @click=${()=>this.closeRecipeDetails(!0)}
72
72
  class="mealz-ds-button mealz-ds-text size-m weight-xl primary mealz-recipe-details__see-basket-cta">
@@ -77,8 +77,8 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
77
77
  alt="basket icon"
78
78
  src="https://storage.googleapis.com/assets.miam.tech/generic/icons/Basket.svg"/>
79
79
  </button>
80
- `:c}
81
- `}renderPrice(){if(this.recipePrice.inBasket<=0&&!this.plannerMode)return c;const e=this.ingredientToBasketLoading||this.updateIngredientFromBasketLoading||this.productsLoading,t=this.plannerMode?this.recipePrice.totalPerGuest:this.recipePrice.inBasket;return r`
80
+ `:d}
81
+ `}renderPrice(){if(this.recipePrice.inBasket<=0&&!this.plannerMode)return d;const e=this.ingredientToBasketLoading||this.updateIngredientFromBasketLoading||this.productsLoading,t=this.plannerMode?this.recipePrice.totalPerGuest:this.recipePrice.inBasket;return i`
82
82
  <div class="mealz-recipe-details__price">
83
83
  <div
84
84
  class="mealz-recipe-details__price-label ${this.plannerMode?"":"primary"} mealz-ds-text size-l weight-xxl">
@@ -91,7 +91,7 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
91
91
  ${this.plannerMode?"par personne":"dans votre panier"}
92
92
  </span>
93
93
  </div>
94
- `}sendAddAllEvent(){o.analytics.sendEvent("entry.add-all",this.analyticsPath,{recipe_id:this.recipeId,entry_count:this.remainingBasketEntries.length})}sendAddRecipeEvent(){o.analytics.sendEvent("recipe.add",this.analyticsPath,{recipe_id:this.recipeId})}sendContinueEvent(){o.analytics.sendEvent("recipe.continue",this.analyticsPath,{recipe_id:this.recipeId})}};E([h({type:Boolean})],I.prototype,"noPosDisplay",2);E([h({type:Boolean})],I.prototype,"noSupplier",2);E([h({type:String})],I.prototype,"recipeId",2);E([h({type:Boolean})],I.prototype,"plannerMode",2);E([h({type:Number})],I.prototype,"guests",2);E([h({attribute:!1})],I.prototype,"recipe",2);I=E([k("mealz-details-footer")],I);customElements.get("mealz-details-footer")||customElements.define("mealz-details-footer",I);var ze=Object.getOwnPropertyDescriptor,ye=(e,t,s,a)=>{for(var i=a>1?void 0:a?ze(t,s):t,n=e.length-1,l;n>=0;n--)(l=e[n])&&(i=l(i)||i);return i};let N=class extends ${constructor(){super(),this.tags=[],this.displayTags=!1,this.subscriptions=[],this.styleURL=new URL("./recipe-details/details-infos/details-infos.css",this.getBaseURL())}connectedCallback(){super.connectedCallback(),this.subscriptions.push(o.recipes.displayedRecipe$.subscribe(e=>{e&&(this.recipe=e.recipe,this.tags=e.recipe.relationships.tags.data.map(t=>t.attributes.name),this.requestUpdate())}))}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(e=>e.unsubscribe())}toggleTags(){this.displayTags=!this.displayTags,this.requestUpdate()}noTimePlaceholder(){return r`<span class="mealz-recipe-details-infos__no-time-placeholder">0 min</span>`}noDataPlaceholder(){return r`<span class="mealz-recipe-details-infos__no-data-placeholder">-</span>`}getRecipeDifficultyIntoClassName(){switch(this.recipe.attributes.difficulty){case 1:return"easy";case 2:return"medium";case 3:return"hard";default:return"no-difficulty-defined"}}getRecipeDifficultyIntoText(){switch(this.recipe.attributes.difficulty){case 1:return r`<span class="mealz-ds-text">Facile</span>`;case 2:return r`<span class="mealz-ds-text">Moyen</span>`;case 3:return r`<span class="mealz-ds-text">Difficile</span>`;default:return c}}renderPreparationTime(){return r`
94
+ `}sendAddAllEvent(){r.analytics.sendEvent("entry.add-all",this.analyticsPath,{recipe_id:this.recipeId,entry_count:this.remainingBasketEntries.length})}sendAddRecipeEvent(){r.analytics.sendEvent("recipe.add",this.analyticsPath,{recipe_id:this.recipeId})}sendContinueEvent(){r.analytics.sendEvent("recipe.continue",this.analyticsPath,{recipe_id:this.recipeId})}}P([h({type:Boolean})],T.prototype,"noPosDisplay");P([h({type:Boolean})],T.prototype,"noSupplier");P([h({type:String})],T.prototype,"recipeId");P([h({type:Boolean})],T.prototype,"plannerMode");P([h({type:Number})],T.prototype,"guests");P([h({attribute:!1})],T.prototype,"recipe");customElements.get("mealz-details-footer")||customElements.define("mealz-details-footer",T);class pe extends k{constructor(){super(),this.tags=[],this.displayTags=!1,this.subscriptions=[],this.styleURL=new URL("./recipe-details/details-infos/details-infos.css",this.getBaseURL())}connectedCallback(){super.connectedCallback(),this.subscriptions.push(r.recipes.displayedRecipe$.subscribe(e=>{e&&(this.recipe=e.recipe,this.tags=e.recipe.relationships.tags.data.map(t=>t.attributes.name),this.requestUpdate())}))}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(e=>e.unsubscribe())}toggleTags(){this.displayTags=!this.displayTags,this.requestUpdate()}noTimePlaceholder(){return i`<span class="mealz-recipe-details-infos__no-time-placeholder">0 min</span>`}noDataPlaceholder(){return i`<span class="mealz-recipe-details-infos__no-data-placeholder">-</span>`}getRecipeDifficultyIntoClassName(){switch(this.recipe.attributes.difficulty){case 1:return"easy";case 2:return"medium";case 3:return"hard";default:return"no-difficulty-defined"}}getRecipeDifficultyIntoText(){switch(this.recipe.attributes.difficulty){case 1:return i`<span class="mealz-ds-text">Facile</span>`;case 2:return i`<span class="mealz-ds-text">Moyen</span>`;case 3:return i`<span class="mealz-ds-text">Difficile</span>`;default:return d}}renderPreparationTime(){return i`
95
95
  <!-- PREPARATION TIME -->
96
96
  <div
97
97
  class="
@@ -103,9 +103,9 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
103
103
  >
104
104
  <img alt="preparation time icon"
105
105
  src="https://storage.googleapis.com/assets.miam.tech/generic/icons/knife-primary.svg"/>
106
- ${this.recipe.preparationTime?r`<span class="mealz-ds-text">${this.recipe.preparationTime}</span>`:this.noTimePlaceholder()}
106
+ ${this.recipe.preparationTime?i`<span class="mealz-ds-text">${this.recipe.preparationTime}</span>`:this.noTimePlaceholder()}
107
107
  </div>
108
- `}renderCookingTime(){return r`
108
+ `}renderCookingTime(){return i`
109
109
  <!-- COOKING TIME -->
110
110
  <div class="
111
111
  mealz-ds-badge
@@ -115,11 +115,11 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
115
115
  ${this.recipe.cookingTime==="-"?"no-cooking-time-defined":""}"
116
116
  >
117
117
  <img alt="cooking time icon" src="https://storage.googleapis.com/assets.miam.tech/generic/icons/pan-primary.svg"/>
118
- ${this.recipe.cookingTime?r`<span class="mealz-ds-text">${this.recipe.cookingTime}</span>`:this.noTimePlaceholder()}
118
+ ${this.recipe.cookingTime?i`<span class="mealz-ds-text">${this.recipe.cookingTime}</span>`:this.noTimePlaceholder()}
119
119
  </div>
120
- `}renderRecipeDifficulty(){return r`
120
+ `}renderRecipeDifficulty(){return i`
121
121
  <!-- RECIPE DIFFICULTY -->
122
- ${this.recipe.difficulty?r`
122
+ ${this.recipe.difficulty?i`
123
123
  <div class="
124
124
  mealz-ds-badge
125
125
  size-l
@@ -130,9 +130,9 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
130
130
  src="https://storage.googleapis.com/assets.miam.tech/generic/icons/chef-hat-primary.svg"/>
131
131
  ${this.getRecipeDifficultyIntoText()}
132
132
  </div>
133
- `:c}`}renderMoreTags(){return r`
133
+ `:d}`}renderMoreTags(){return i`
134
134
  <!-- MORE INFO -->
135
- ${this.displayTags?this.renderTags():r`
135
+ ${this.displayTags?this.renderTags():i`
136
136
  <div
137
137
  class="mealz-ds-badge size-l mealz-recipe-details-infos__badge more-info"
138
138
  @click=${()=>this.toggleTags()}
@@ -143,21 +143,21 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
143
143
  />
144
144
  </div>
145
145
  `}
146
- `}renderTags(){return r`
146
+ `}renderTags(){return i`
147
147
  <!-- TAGS -->
148
- ${this.tags.map(e=>r`
148
+ ${this.tags.map(e=>i`
149
149
  <div class="mealz-ds-badge size-l mealz-recipe-details-infos__badge tag">
150
150
  <span class="mealz-ds-text">${e}</span>
151
151
  </div>
152
152
  `)}
153
- `}render(){return r`
153
+ `}render(){return i`
154
154
  <div class="mealz-recipe-details-infos__container ${this.displayTags?"tags-displayed":""}">
155
155
  ${this.renderPreparationTime()}
156
156
  ${this.renderCookingTime()}
157
157
  ${this.renderRecipeDifficulty()}
158
158
  ${this.renderMoreTags()}
159
159
  </div>
160
- `}};N=ye([k("mealz-details-infos")],N);customElements.get("mealz-details-infos")||customElements.define("mealz-details-infos",N);var $e=Object.getOwnPropertyDescriptor,ke=(e,t,s,a)=>{for(var i=a>1?void 0:a?$e(t,s):t,n=e.length-1,l;n>=0;n--)(l=e[n])&&(i=l(i)||i);return i};let q=class extends ${constructor(){super(),this.steps=[],this.subscriptions=[],this.styleURL=new URL("./recipe-details/details-steps/details-steps.css",this.getBaseURL())}connectedCallback(){super.connectedCallback(),this.subscriptions.push(o.recipes.displayedRecipe$.subscribe(e=>{e&&(this.steps=e.recipe.relationships["recipe-steps"].data.sort((t,s)=>t.attributes["step-number"]-s.attributes["step-number"]).map(t=>t.attributes.description),this.requestUpdate())}))}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(e=>e.unsubscribe())}render(){return r`
160
+ `}}customElements.get("mealz-details-infos")||customElements.define("mealz-details-infos",pe);class ue extends k{constructor(){super(),this.steps=[],this.subscriptions=[],this.styleURL=new URL("./recipe-details/details-steps/details-steps.css",this.getBaseURL())}connectedCallback(){super.connectedCallback(),this.subscriptions.push(r.recipes.displayedRecipe$.subscribe(e=>{e&&(this.steps=e.recipe.relationships["recipe-steps"].data.sort((t,s)=>t.attributes["step-number"]-s.attributes["step-number"]).map(t=>t.attributes.description),this.requestUpdate())}))}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(e=>e.unsubscribe())}render(){return i`
161
161
  <div class="mealz-details-steps">
162
162
  <!-- HEADER -->
163
163
  <div class="mealz-ds-text weight-xxl mealz-details-steps__header">
@@ -166,7 +166,7 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
166
166
  </div>
167
167
  <!-- LIST -->
168
168
  <div class="mealz-details-steps__list">
169
- ${this.steps.map((e,t)=>r`
169
+ ${this.steps.map((e,t)=>i`
170
170
  <div class="mealz-details-steps__step">
171
171
  <!-- INDEX -->
172
172
  <div class="mealz-details-steps__step__idx">
@@ -180,16 +180,16 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
180
180
  `)}
181
181
  </div>
182
182
  </div>
183
- `}};q=ke([k("mealz-details-steps")],q);customElements.get("mealz-details-steps")||customElements.define("mealz-details-steps",q);var Ie=Object.getOwnPropertyDescriptor,Pe=(e,t,s,a)=>{for(var i=a>1?void 0:a?Ie(t,s):t,n=e.length-1,l;n>=0;n--)(l=e[n])&&(i=l(i)||i);return i};let G=class extends ${constructor(){super(),this.ingredients=[],this.subscriptions=[],this.styleURL=new URL("./recipe-details/details-ingredients/details-ingredients.css",this.getBaseURL())}connectedCallback(){super.connectedCallback(),this.subscriptions.push(o.recipes.displayedRecipe$.subscribe(e=>{e&&(this.ingredients=e.recipe.relationships.ingredients.data,this.requestUpdate())}))}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(e=>e.unsubscribe())}render(){var e,t;return r`
183
+ `}}customElements.get("mealz-details-steps")||customElements.define("mealz-details-steps",ue);class he extends k{constructor(){super(),this.ingredients=[],this.subscriptions=[],this.styleURL=new URL("./recipe-details/details-ingredients/details-ingredients.css",this.getBaseURL())}connectedCallback(){super.connectedCallback(),this.subscriptions.push(r.recipes.displayedRecipe$.subscribe(e=>{e&&(this.ingredients=e.recipe.relationships.ingredients.data,this.requestUpdate())}))}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(e=>e.unsubscribe())}render(){var e,t;return i`
184
184
  <div class="mealz-details-ingredients">
185
185
  <!-- HEADER -->
186
186
  <div class="mealz-ds-text weight-xxl mealz-details-ingredients__header">
187
187
  <span>${(e=this.ingredients)==null?void 0:e.length}</span>
188
- ${((t=this.ingredients)==null?void 0:t.length)>1?r`<span>ingrédients</span>`:r`<span>ingrédient</span>`}
188
+ ${((t=this.ingredients)==null?void 0:t.length)>1?i`<span>ingrédients</span>`:i`<span>ingrédient</span>`}
189
189
  </div>
190
190
  <!-- LIST -->
191
191
  <div class="mealz-details-ingredients__list">
192
- ${this.ingredients.map(s=>r`
192
+ ${this.ingredients.map(s=>i`
193
193
  <div class="mealz-details-ingredients__item">
194
194
  <!-- PICTURE -->
195
195
  <div class="mealz-ds-avatar mealz-details-ingredients__picture_container">
@@ -199,7 +199,7 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
199
199
  </div>
200
200
  <!-- NAME -->
201
201
  <span class="mealz-ds-text size-s weight-xxl mealz-details-ingredients__name">
202
- ${ee(s.attributes.name)}
202
+ ${H(s.attributes.name)}
203
203
  </span>
204
204
  <!-- QUANTITY -->
205
205
  <div class="mealz-ds-text size-s weight-l mealz-details-ingredients__row__qty">
@@ -209,10 +209,10 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
209
209
  `)}
210
210
  </div>
211
211
  </div>
212
- `}ingredientPicture(e){return e.picture||"https://storage.googleapis.com/assets.miam.tech/generic/images/default-ingredient-picture.svg"}};G=Pe([k("mealz-details-ingredients")],G);customElements.get("mealz-details-ingredients")||customElements.define("mealz-details-ingredients",G);var Te=Object.defineProperty,Ee=Object.getOwnPropertyDescriptor,S=(e,t,s,a)=>{for(var i=a>1?void 0:a?Ee(t,s):t,n=e.length-1,l;n>=0;n--)(l=e[n])&&(i=(a?l(t,s,i):l(i))||i);return a&&i&&Te(t,s,i),i};const M=["unavailable"],Se=["ticked","unselected"];let P=class extends ${constructor(){super(),this.recipeId="",this.initialGuests=0,this.currentGuests=0,this.oftenIgnored=!1,this.subscriptions=[],this.guestObserverService=te.getInstance(),this.modifiedIngQty=0,this.analyticsPath="/meals-planner/current",this.styleURL=new URL("./product-card/product-card-planner.css",this.getBaseURL())}get status(){var e;return(e=this.product)==null?void 0:e.status}set status(e){this.product.status=e,this.requestUpdate()}get productImage(){var e;return((e=this.product.item)==null?void 0:e.attributes.image)||"https://storage.googleapis.com/assets.miam.tech/generic/images/default-ingredient-picture.svg"}get ingredientPicture(){return this.product.ingredient.picture||"https://storage.googleapis.com/assets.miam.tech/generic/images/default-ingredient-picture.svg"}get isSponsored(){var e,t,s;return((s=(t=(e=this.product)==null?void 0:e.item)==null?void 0:t.attributes)==null?void 0:s.sponsored)===!0}connectedCallback(){super.connectedCallback(),this.listenGuestsChange(),this.calculateQty()}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(e=>e.unsubscribe())}listenGuestsChange(){this.subscriptions.push(this.guestObserverService.guests$.subscribe(e=>{this.currentGuests=e,this.calculateQty()}))}calculateQty(){const e=this.product.ingredient.attributes.quantity/this.initialGuests;this.modifiedIngQty=Number((e*this.currentGuests).toFixed(2)),this.requestUpdate()}openReplaceItemView(){o.planner.openReplaceItemView(this.product),this.replaceItemViewEvent()}onCheckboxChange(e){e.target.checked?(this.status="ticked",o.planner.selectProduct(+this.product.item.id,this.product.ingredient.relationships.definition.data.id),this.addItemEvent()):(this.status="unselected",o.planner.unselectProduct(+this.product.item.id,this.product.ingredient.relationships.definition.data.id),this.deleteItemEvent()),this.requestUpdate()}render(){return r`
212
+ `}ingredientPicture(e){return e.picture||"https://storage.googleapis.com/assets.miam.tech/generic/images/default-ingredient-picture.svg"}}customElements.get("mealz-details-ingredients")||customElements.define("mealz-details-ingredients",he);var me=Object.defineProperty,R=(o,e,t,s)=>{for(var a=void 0,n=o.length-1,l;n>=0;n--)(l=o[n])&&(a=l(e,t,a)||a);return a&&me(e,t,a),a};const U=["unavailable"],ge=["ticked","unselected"];class E extends k{constructor(){super(),this.recipeId="",this.initialGuests=0,this.currentGuests=0,this.oftenIgnored=!1,this.subscriptions=[],this.guestObserverService=j.getInstance(),this.modifiedIngQty=0,this.analyticsPath="/meals-planner/current",this.styleURL=new URL("./product-card/product-card-planner.css",this.getBaseURL())}get status(){var e;return(e=this.product)==null?void 0:e.status}set status(e){this.product.status=e,this.requestUpdate()}get productImage(){var e;return((e=this.product.item)==null?void 0:e.attributes.image)||"https://storage.googleapis.com/assets.miam.tech/generic/images/default-ingredient-picture.svg"}get ingredientPicture(){return this.product.ingredient.picture||"https://storage.googleapis.com/assets.miam.tech/generic/images/default-ingredient-picture.svg"}get isSponsored(){var e,t,s;return((s=(t=(e=this.product)==null?void 0:e.item)==null?void 0:t.attributes)==null?void 0:s.sponsored)===!0}connectedCallback(){super.connectedCallback(),this.listenGuestsChange(),this.calculateQty()}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(e=>e.unsubscribe())}listenGuestsChange(){this.subscriptions.push(this.guestObserverService.guests$.subscribe(e=>{this.currentGuests=e,this.calculateQty()}))}calculateQty(){var t;if(!((t=this.product)!=null&&t.ingredient)||!this.initialGuests)return;const e=this.product.ingredient.attributes.quantity/this.initialGuests;this.modifiedIngQty=Number((e*(this.currentGuests??this.initialGuests)).toFixed(2)),this.requestUpdate()}openReplaceItemView(){r.planner.openReplaceItemView(this.product),this.replaceItemViewEvent()}onCheckboxChange(e){e.target.checked?(this.status="ticked",r.planner.selectProduct(+this.product.item.id,this.product.ingredient.relationships.definition.data.id),this.addItemEvent()):(this.status="unselected",r.planner.unselectProduct(+this.product.item.id,this.product.ingredient.relationships.definition.data.id),this.deleteItemEvent()),this.requestUpdate()}render(){var e;if((e=this.product)!=null&&e.ingredient)return i`
213
213
  <div class="mealz-product-card-planner
214
214
  ${this.status==="ticked"?"added":""}
215
- ${M.includes(this.status)||this.oftenIgnored?"disabled":""}
215
+ ${U.includes(this.status)||this.oftenIgnored?"disabled":""}
216
216
  ${this.status==="unavailable"?"unavailable":""}"
217
217
  >
218
218
  ${this.renderHeader()}
@@ -220,10 +220,10 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
220
220
  ${this.oftenIgnored?"disabled":""}
221
221
  ${this.status==="unavailable"?"unavailable":""}"
222
222
  >
223
- ${Se.includes(this.status)&&!this.oftenIgnored?this.renderEnabledProductCard():this.renderDisabledOrUnavailableProduct()}
223
+ ${ge.includes(this.status)&&!this.oftenIgnored?this.renderEnabledProductCard():this.renderDisabledOrUnavailableProduct()}
224
224
  </div>
225
225
  </div>
226
- `}renderEnabledProductCard(){return r`
226
+ `}renderEnabledProductCard(){return i`
227
227
  <mealz-promotion-badge .priceData="${this.product.price}"></mealz-promotion-badge>
228
228
  <div class="mealz-product-card-planner__selected-product">
229
229
  <div class="mealz-product-card-planner__picture-column">
@@ -257,7 +257,7 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
257
257
  </div>
258
258
  </div>
259
259
  ${this.renderFooterActions()}
260
- `}renderHeader(){return r`
260
+ `}renderHeader(){return i`
261
261
  <div
262
262
  class="mealz-product-card-planner__header
263
263
  ${this.status==="ticked"?"added":""}
@@ -267,21 +267,21 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
267
267
  class="
268
268
  mealz-product-card-planner__header-name
269
269
  mealz-ds-text weight-xl
270
- ${M.includes(this.status)||this.oftenIgnored?"mealz-product-card-planner__disabled-text":""}"
270
+ ${U.includes(this.status)||this.oftenIgnored?"mealz-product-card-planner__disabled-text":""}"
271
271
  >
272
- ${ee(this.product.ingredient.attributes.name)}
272
+ ${H(this.product.ingredient.attributes.name)}
273
273
  </span>
274
274
  <span
275
275
  class="
276
276
  mealz-product-card-planner__header-quantity
277
277
  mealz-ds-text size-s weight-l
278
- ${M.includes(this.status)||this.oftenIgnored?"mealz-product-card-planner__disabled-text":""}"
278
+ ${U.includes(this.status)||this.oftenIgnored?"mealz-product-card-planner__disabled-text":""}"
279
279
  >
280
280
  <span>${this.modifiedIngQty?this.modifiedIngQty:this.product.ingredient.attributes.quantity}</span>
281
281
  <span>${this.product.ingredient.attributes.unit}</span>
282
282
  </span>
283
283
  </div>
284
- `}renderFooterActions(){return r`
284
+ `}renderFooterActions(){return i`
285
285
  <div class="mealz-product-card-planner__footer__actions">
286
286
  <button
287
287
  @click="${()=>this.openReplaceItemView()}"
@@ -290,7 +290,7 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
290
290
  <span>Remplacer</span>
291
291
  </button>
292
292
  </div>
293
- `}renderCTA(){return r`
293
+ `}renderCTA(){return i`
294
294
  <div class="mealz-product-card-planner__checkbox mealz-ds-checkbox">
295
295
  <input
296
296
  type="checkbox"
@@ -298,8 +298,8 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
298
298
  @change="${e=>this.onCheckboxChange(e)}"
299
299
  >
300
300
  </div>
301
- `}renderDisabledOrUnavailableProduct(){return r`
302
- ${this.oftenIgnored?r`
301
+ `}renderDisabledOrUnavailableProduct(){return i`
302
+ ${this.oftenIgnored?i`
303
303
  <span class="mealz-ds-text mealz-product-card-planner__disabled-text">
304
304
  Cet ingrédient ne sera pas ajouté à votre panier
305
305
  </span>
@@ -309,7 +309,7 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
309
309
  <span>Ajouter un produit</span>
310
310
  </button>
311
311
  `:""}
312
- ${this.status==="unavailable"&&!this.oftenIgnored?r`
312
+ ${this.status==="unavailable"&&!this.oftenIgnored?i`
313
313
  <img class="mealz-ds-avatar" src="${this.ingredientPicture}" alt="ingredient picture">
314
314
  <mealz-unavailable-badge></mealz-unavailable-badge>
315
315
  <button
@@ -318,7 +318,7 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
318
318
  <span>Remplacer</span>
319
319
  </button>
320
320
  `:""}
321
- `}addItemEvent(){o.analytics.sendEvent("planner.item.add",this.analyticsPath,{recipe_id:this.recipeId,item_id:this.product.item.id})}deleteItemEvent(){o.analytics.sendEvent("planner.item.delete",this.analyticsPath,{recipe_id:this.recipeId,item_id:this.product.item.id})}replaceItemViewEvent(){o.analytics.sendEvent("planner.item.replace",this.analyticsPath,{recipe_id:this.recipeId,item_id:this.product.item.id})}};S([h({type:Object})],P.prototype,"product",2);S([h({type:String})],P.prototype,"recipeId",2);S([h({type:Number})],P.prototype,"initialGuests",2);S([h({type:Number})],P.prototype,"currentGuests",2);S([h({type:Boolean})],P.prototype,"oftenIgnored",2);P=S([k("mealz-product-card-planner")],P);customElements.get("mealz-product-card-planner")||customElements.define("mealz-product-card-planner",P);var we=Object.defineProperty,Ce=Object.getOwnPropertyDescriptor,ie=(e,t,s,a)=>{for(var i=a>1?void 0:a?Ce(t,s):t,n=e.length-1,l;n>=0;n--)(l=e[n])&&(i=(a?l(t,s,i):l(i))||i);return a&&i&&we(t,s,i),i};let B=class extends ${constructor(){super(),this.styleURL=new URL("./legal-notice/legal-notice.css",this.getBaseURL())}get containsAlcohol(){var t;return(((t=this.tags)==null?void 0:t.data)||[]).some(s=>s.id==="ingredient_category_alcool")}render(){return this.containsAlcohol?r`
321
+ `}addItemEvent(){r.analytics.sendEvent("planner.item.add",this.analyticsPath,{recipe_id:this.recipeId,item_id:this.product.item.id})}deleteItemEvent(){r.analytics.sendEvent("planner.item.delete",this.analyticsPath,{recipe_id:this.recipeId,item_id:this.product.item.id})}replaceItemViewEvent(){r.analytics.sendEvent("planner.item.replace",this.analyticsPath,{recipe_id:this.recipeId,item_id:this.product.item.id})}}R([h({type:Object})],E.prototype,"product");R([h({type:String})],E.prototype,"recipeId");R([h({type:Number})],E.prototype,"initialGuests");R([h({type:Number})],E.prototype,"currentGuests");R([h({type:Boolean})],E.prototype,"oftenIgnored");customElements.get("mealz-product-card-planner")||customElements.define("mealz-product-card-planner",E);var ve=Object.defineProperty,be=(o,e,t,s)=>{for(var a=void 0,n=o.length-1,l;n>=0;n--)(l=o[n])&&(a=l(e,t,a)||a);return a&&ve(e,t,a),a};class K extends k{constructor(){super(),this.styleURL=new URL("./legal-notice/legal-notice.css",this.getBaseURL())}get containsAlcohol(){var t;return(((t=this.tags)==null?void 0:t.data)||[]).some(s=>s.id==="ingredient_category_alcool")}render(){return this.containsAlcohol?i`
322
322
  <div class="mealz-products-picker__legal-notices">
323
323
  <span class="mealz-ds-text weight-xxl mealz-products-picker__legal-notices-header">Mentions légales</span>
324
324
  <div class="mealz-products-picker__legal-notices-content">
@@ -330,7 +330,7 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
330
330
  </span>
331
331
  </div>
332
332
  </div>
333
- `:c}};ie([h()],B.prototype,"tags",2);B=ie([k("mealz-legal-notice")],B);customElements.get("mealz-legal-notice")||customElements.define("mealz-legal-notice",B);var Re=Object.getOwnPropertyDescriptor,xe=(e,t,s,a)=>{for(var i=a>1?void 0:a?Re(t,s):t,n=e.length-1,l;n>=0;n--)(l=e[n])&&(i=l(i)||i);return i};let F=class extends ${constructor(){super(),this.styleURL=[new URL("./product-card/product-card-skeleton/product-card-skeleton.css",this.getBaseURL()),new URL("./product-card/product-card.css",this.getBaseURL())]}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback()}render(){return r`
333
+ `:d}}be([h()],K.prototype,"tags");customElements.get("mealz-legal-notice")||customElements.define("mealz-legal-notice",K);class fe extends k{constructor(){super(),this.styleURL=[new URL("./product-card/product-card-skeleton/product-card-skeleton.css",this.getBaseURL()),new URL("./product-card/product-card.css",this.getBaseURL())]}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback()}render(){return i`
334
334
  <!-- PRODUCT CARD -->
335
335
  <div class="mealz-product-card skeleton">
336
336
  <!-- HEADER -->
@@ -373,9 +373,9 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
373
373
  </div>
374
374
  </div>
375
375
  </div>
376
- `}};F=xe([k("mealz-products-card-skeleton")],F);customElements.get("mealz-products-card-skeleton")||customElements.define("mealz-products-card-skeleton",F);var Oe=Object.defineProperty,De=Object.getOwnPropertyDescriptor,W=(e,t,s,a)=>{for(var i=a>1?void 0:a?De(t,s):t,n=e.length-1,l;n>=0;n--)(l=e[n])&&(i=(a?l(t,s,i):l(i))||i);return a&&i&&Oe(t,s,i),i};let C=class extends ${constructor(){super(),this.inBasket=!1,this.plannerMode=!1,this.productsByCategory={toPickProducts:[],oftenIgnoredProducts:[]},this.numberUnavailableProducts=0,this.analyticsPath="",this.subscriptions=[],this.noSupplier=o.supplier.isNoSupplier(),this.hasEmittedReady=!1,this.hydrateOnly=!1,this.ssrTemplateRemoved=!1,this.styleURL=new URL("./products-picker/products-picker.css",this.getBaseURL())}get selectors(){return{unavailableBadge:"mealz-unavailable-badge"}}get totalProducts(){var e,t,s;return Array.isArray((s=(t=(e=this.recipe)==null?void 0:e.relationships)==null?void 0:t.ingredients)==null?void 0:s.data)?this.recipe.relationships.ingredients.data.length:0}connectedCallback(){var t,s;super.connectedCallback(),this.getInitialStatus(),this.resetProducts(),this.listenToProducts();const e=(s=(t=o)==null?void 0:t.recipes)==null?void 0:s.displayedRecipe$;e&&typeof e.subscribe=="function"&&this.subscriptions.push(e.subscribe(a=>{a&&(this.recipe=a.recipe,this.analyticsPath=`/recipes/${this.recipe.id}/shopping`,this.requestUpdate())}))}disconnectedCallback(){super.disconnectedCallback(),this.resetProducts(),this.subscriptions.forEach(e=>e.unsubscribe())}resetProducts(){this.productsByCategory={toPickProducts:[],oftenIgnoredProducts:[]},this.numberUnavailableProducts=0,this.requestUpdate()}getInitialStatus(){const e=this.getAttribute("starting-data");if(e)try{const t=JSON.parse(e);this.plannerMode=!!t.planner,this.hydrateOnly=!0,t.analyticsPath&&(this.analyticsPath=t.analyticsPath),t.recipeId&&(this.recipe={id:t.recipeId,attributes:{"number-of-guests":t.guests||4}})}catch(t){console.warn("[products-picker] starting-data parse error",t)}finally{this.removeAttribute("starting-data")}}removeSSRTemplate(){const e=this.querySelector(".mealz-products-picker");e&&e.parentElement===this&&e.remove()}listenToProducts(){const e=this.plannerMode?o.recipes.productsPlannerByCategory$:o.recipes.productsByCategory$;!e||typeof e.subscribe!="function"||this.subscriptions.push(e.subscribe(t=>{(t.toPickProducts.length>0||t.oftenIgnoredProducts.length>0)&&!this.ssrTemplateRemoved&&this.hydrateOnly&&(this.removeSSRTemplate(),this.ssrTemplateRemoved=!0),this.productsByCategory=t,this.plannerMode?this.numberUnavailableProducts=[...t.oftenIgnoredProducts,...t.toPickProducts].filter(s=>s.status==="unavailable").length:this.numberUnavailableProducts=[...t.oftenIgnoredProducts,...t.toPickProducts].filter(s=>s.basketEntry.status==="out_of_stock").length,this.requestUpdate(),this.notifyReadyIfRendered()}))}async notifyReadyIfRendered(){if(this.hasEmittedReady)return;if(await this.updateComplete,this.querySelector(".mealz-product-card-planner__checkbox")||this.querySelector(".mealz-product-card__checkbox")){this.hasEmittedReady=!0;const t=new CustomEvent("products-picker-ready",{bubbles:!0,composed:!0});this.dispatchEvent(t)}}scrollToFirstUnavailable(){const e=document.querySelector(this.plannerMode?".mealz-products-picker":".mealz-products-picker__container");if(e){const t=e.querySelector(this.plannerMode?".mealz-product-card-planner.unavailable":".mealz-product-card__container.out_of_stock");t&&t.scrollIntoView({behavior:"smooth",block:"center"})}}isAlreadyOnCatalogPage(){return window.location.href.includes(o.router.getCatalogUrl())}closeRecipeModal(){}currentPath(){return""}guestsChange(e){const t=new CustomEvent("guestChange",{bubbles:!0,composed:!0,detail:{value:e.detail.value}});this.dispatchEvent(t)}render(){var i,n;const e=!!this.recipe&&this.recipe.id!==void 0,t=Array.isArray((i=this.productsByCategory)==null?void 0:i.toPickProducts)?this.productsByCategory.toPickProducts:[],s=Array.isArray((n=this.productsByCategory)==null?void 0:n.oftenIgnoredProducts)?this.productsByCategory.oftenIgnoredProducts:[],a=this.totalProducts||t.length||0;return r`
376
+ `}}customElements.get("mealz-products-card-skeleton")||customElements.define("mealz-products-card-skeleton",fe);var _e=Object.defineProperty,Q=(o,e,t,s)=>{for(var a=void 0,n=o.length-1,l;n>=0;n--)(l=o[n])&&(a=l(e,t,a)||a);return a&&_e(e,t,a),a};class D extends k{constructor(){super(),this.inBasket=!1,this.plannerMode=!1,this.productsByCategory={toPickProducts:[],oftenIgnoredProducts:[]},this.numberUnavailableProducts=0,this.analyticsPath="",this.subscriptions=[],this.noSupplier=r.supplier.isNoSupplier(),this.hasEmittedReady=!1,this.hydrateOnly=!1,this.ssrTemplateRemoved=!1,this.styleURL=new URL("./products-picker/products-picker.css",this.getBaseURL())}get selectors(){return{unavailableBadge:"mealz-unavailable-badge"}}get totalProducts(){var e,t,s;return Array.isArray((s=(t=(e=this.recipe)==null?void 0:e.relationships)==null?void 0:t.ingredients)==null?void 0:s.data)?this.recipe.relationships.ingredients.data.length:0}connectedCallback(){var t,s;super.connectedCallback(),this.getInitialStatus(),this.resetProducts(),this.listenToProducts();const e=(s=(t=r)==null?void 0:t.recipes)==null?void 0:s.displayedRecipe$;e&&typeof e.subscribe=="function"&&this.subscriptions.push(e.subscribe(a=>{a&&(this.recipe=a.recipe,this.analyticsPath=`/recipes/${this.recipe.id}/shopping`,this.requestUpdate())}))}disconnectedCallback(){super.disconnectedCallback(),this.resetProducts(),this.subscriptions.forEach(e=>e.unsubscribe())}resetProducts(){this.productsByCategory={toPickProducts:[],oftenIgnoredProducts:[]},this.numberUnavailableProducts=0,this.requestUpdate()}getInitialStatus(){const e=this.getAttribute("starting-data");if(e)try{const t=JSON.parse(e);this.plannerMode=!!t.planner,this.hydrateOnly=!0,t.analyticsPath&&(this.analyticsPath=t.analyticsPath),t.recipeId&&(this.recipe={id:t.recipeId,attributes:{"number-of-guests":t.guests||4}})}catch(t){console.warn("[products-picker] starting-data parse error",t)}finally{this.removeAttribute("starting-data")}}removeSSRTemplate(){const e=this.querySelector(".mealz-products-picker");e&&e.parentElement===this&&e.remove()}listenToProducts(){const e=this.plannerMode?r.recipes.productsPlannerByCategory$:r.recipes.productsByCategory$;!e||typeof e.subscribe!="function"||this.subscriptions.push(e.subscribe(t=>{(t.toPickProducts.length>0||t.oftenIgnoredProducts.length>0)&&!this.ssrTemplateRemoved&&this.hydrateOnly&&(this.removeSSRTemplate(),this.ssrTemplateRemoved=!0),this.productsByCategory=t,this.plannerMode?this.numberUnavailableProducts=[...t.oftenIgnoredProducts,...t.toPickProducts].filter(s=>(s==null?void 0:s.ingredient)&&s.status==="unavailable").length:this.numberUnavailableProducts=[...t.oftenIgnoredProducts,...t.toPickProducts].filter(s=>{var a;return((a=s==null?void 0:s.basketEntry)==null?void 0:a.status)==="out_of_stock"}).length,this.requestUpdate(),this.notifyReadyIfRendered()}))}async notifyReadyIfRendered(){if(this.hasEmittedReady)return;if(await this.updateComplete,this.querySelector(".mealz-product-card-planner__checkbox")||this.querySelector(".mealz-product-card__checkbox")){this.hasEmittedReady=!0;const t=new CustomEvent("products-picker-ready",{bubbles:!0,composed:!0});this.dispatchEvent(t)}}scrollToFirstUnavailable(){const e=document.querySelector(this.plannerMode?".mealz-products-picker":".mealz-products-picker__container");if(e){const t=e.querySelector(this.plannerMode?".mealz-product-card-planner.unavailable":".mealz-product-card__container.out_of_stock");t&&t.scrollIntoView({behavior:"smooth",block:"center"})}}isAlreadyOnCatalogPage(){return window.location.href.includes(r.router.getCatalogUrl())}closeRecipeModal(){}currentPath(){return""}guestsChange(e){const t=new CustomEvent("guestChange",{bubbles:!0,composed:!0,detail:{value:e.detail.value}});this.dispatchEvent(t)}render(){var n,l;const e=!!this.recipe&&this.recipe.id!==void 0,t=Array.isArray((n=this.productsByCategory)==null?void 0:n.toPickProducts)?this.productsByCategory.toPickProducts:[],s=Array.isArray((l=this.productsByCategory)==null?void 0:l.oftenIgnoredProducts)?this.productsByCategory.oftenIgnoredProducts:[],a=this.totalProducts||t.length||0;return i`
377
377
  <div class="mealz-products-picker">
378
- ${this.inBasket&&this.plannerMode?r`
378
+ ${this.inBasket&&this.plannerMode?i`
379
379
  <div class="mealz-products-picker__overlay">
380
380
  <div class="mealz-products-picker__overlay-text">
381
381
  <span class="mealz-ds-text">
@@ -383,31 +383,31 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
383
383
  </span>
384
384
  </div>
385
385
  </div>
386
- `:c}
386
+ `:d}
387
387
  <!-- HEADER -->
388
388
  ${this.renderHeader()}
389
389
  <div class="mealz-products-picker__list">
390
390
  <!-- TO PICK PRODUCTS -->
391
- ${e&&t.length>0?t.map(l=>{var d,u,g,p,m,v,b,_,f,z;return this.plannerMode?r`
391
+ ${e&&t.length>0?t.filter(c=>c==null?void 0:c.ingredient).map(c=>{var p,g,u,m,v,b,f,_,z,$;return this.plannerMode?i`
392
392
  <mealz-product-card-planner
393
- .product="${l}"
393
+ .product="${c}"
394
394
  .recipeId="${this.recipe.id}"
395
395
  .oftenIgnored="${!1}"
396
- .initialGuests="${((u=(d=this.recipe)==null?void 0:d.attributes)==null?void 0:u["number-of-guests"])||4}"
397
- .currentGuests="${((g=this.recipe)==null?void 0:g.modifiedGuests)||((m=(p=this.recipe)==null?void 0:p.attributes)==null?void 0:m["number-of-guests"])||4}"
396
+ .initialGuests="${((g=(p=this.recipe)==null?void 0:p.attributes)==null?void 0:g["number-of-guests"])||4}"
397
+ .currentGuests="${((u=this.recipe)==null?void 0:u.modifiedGuests)||((v=(m=this.recipe)==null?void 0:m.attributes)==null?void 0:v["number-of-guests"])||4}"
398
398
  ></mealz-product-card-planner>
399
- `:r`
399
+ `:i`
400
400
  <mealz-product-card
401
- .product="${l}"
401
+ .product="${c}"
402
402
  .recipeId="${this.recipe.id}"
403
- .initialGuests="${((b=(v=this.recipe)==null?void 0:v.attributes)==null?void 0:b["number-of-guests"])||4}"
404
- .currentGuests="${((_=this.recipe)==null?void 0:_.modifiedGuests)||((z=(f=this.recipe)==null?void 0:f.attributes)==null?void 0:z["number-of-guests"])||4}"
403
+ .initialGuests="${((f=(b=this.recipe)==null?void 0:b.attributes)==null?void 0:f["number-of-guests"])||4}"
404
+ .currentGuests="${((_=this.recipe)==null?void 0:_.modifiedGuests)||(($=(z=this.recipe)==null?void 0:z.attributes)==null?void 0:$["number-of-guests"])||4}"
405
405
  ></mealz-product-card>
406
- `}):new Array(a).fill(r`<mealz-products-card-skeleton></mealz-products-card-skeleton>`)}
406
+ `}):new Array(a).fill(i`<mealz-products-card-skeleton></mealz-products-card-skeleton>`)}
407
407
  </div>
408
408
  <!-- OFTEN IGNORED PRODUCTS -->
409
409
  <div class="mealz-products-picker__secondary-list">
410
- ${e&&s.length>0?r`
410
+ ${e&&s.length>0?i`
411
411
  <mealz-accordion
412
412
  .noStyling=${!0}
413
413
  >
@@ -418,47 +418,47 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
418
418
  </div>
419
419
  <div slot="content">
420
420
  <div class="mealz-products-picker__list">
421
- ${s.map(l=>{var d,u,g,p,m,v,b,_,f,z;return this.plannerMode?r`
421
+ ${s.filter(c=>c==null?void 0:c.ingredient).map(c=>{var p,g,u,m,v,b,f,_,z,$;return this.plannerMode?i`
422
422
  <mealz-product-card-planner
423
- .product="${l}"
423
+ .product="${c}"
424
424
  .recipeId="${this.recipe.id}"
425
425
  .oftenIgnored="${!0}"
426
- .initialGuests="${((u=(d=this.recipe)==null?void 0:d.attributes)==null?void 0:u["number-of-guests"])||4}"
427
- .currentGuests="${((g=this.recipe)==null?void 0:g.modifiedGuests)||((m=(p=this.recipe)==null?void 0:p.attributes)==null?void 0:m["number-of-guests"])||4}"
426
+ .initialGuests="${((g=(p=this.recipe)==null?void 0:p.attributes)==null?void 0:g["number-of-guests"])||4}"
427
+ .currentGuests="${((u=this.recipe)==null?void 0:u.modifiedGuests)||((v=(m=this.recipe)==null?void 0:m.attributes)==null?void 0:v["number-of-guests"])||4}"
428
428
  ></mealz-product-card-planner>
429
- `:r`
429
+ `:i`
430
430
  <mealz-product-card
431
- .product="${l}"
431
+ .product="${c}"
432
432
  .recipeId="${this.recipe.id}"
433
- .initialGuests="${((b=(v=this.recipe)==null?void 0:v.attributes)==null?void 0:b["number-of-guests"])||4}"
434
- .currentGuests="${((_=this.recipe)==null?void 0:_.modifiedGuests)||((z=(f=this.recipe)==null?void 0:f.attributes)==null?void 0:z["number-of-guests"])||4}"
433
+ .initialGuests="${((f=(b=this.recipe)==null?void 0:b.attributes)==null?void 0:f["number-of-guests"])||4}"
434
+ .currentGuests="${((_=this.recipe)==null?void 0:_.modifiedGuests)||(($=(z=this.recipe)==null?void 0:z.attributes)==null?void 0:$["number-of-guests"])||4}"
435
435
  ></mealz-product-card>
436
436
  `})}
437
437
  </div>
438
438
  </div>
439
439
  </mealz-accordion>
440
- `:c}
440
+ `:d}
441
441
  </div>
442
- ${this.noSupplier?c:this.renderLowerContent()}
442
+ ${this.noSupplier?d:this.renderLowerContent()}
443
443
  </div>
444
- `}renderHeader(){var e;return r`
444
+ `}renderHeader(){var e;return i`
445
445
  <div class="mealz-products-picker__header">
446
- ${this.totalProducts>0?r`
446
+ ${this.totalProducts>0?i`
447
447
  <div class="mealz-products-picker__header-text mealz-ds-text weight-xxl">
448
448
  <div class="mealz-products-picker__number-of-products">
449
449
  <span>${this.totalProducts}</span>
450
- ${this.totalProducts>1?r`<span>ingrédients</span>`:r`<span>ingrédient</span>`}
450
+ ${this.totalProducts>1?i`<span>ingrédients</span>`:i`<span>ingrédient</span>`}
451
451
  </div>
452
- ${this.numberUnavailableProducts>0?r`
452
+ ${this.numberUnavailableProducts>0?i`
453
453
  <mealz-unavailable-badge
454
454
  .numberUnavailable="${this.numberUnavailableProducts}"
455
455
  @clicked="${()=>this.scrollToFirstUnavailable()}">
456
456
  </mealz-unavailable-badge>
457
- `:c}
457
+ `:d}
458
458
  </div>
459
- `:c}
459
+ `:d}
460
460
  <!-- GUEST COUNTER FOR NO SUPPLIER MODE-->
461
- ${this.noSupplier?r`
461
+ ${this.noSupplier?i`
462
462
  <mealz-counter
463
463
  .floating="${!0}"
464
464
  .value="${(e=this.recipe)==null?void 0:e.modifiedGuests}"
@@ -467,7 +467,7 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
467
467
  class="mealz-products-picker__guest-counter"
468
468
  @valueChange="${t=>this.guestsChange(t)}"
469
469
  ></mealz-counter>
470
- `:c}
470
+ `:d}
471
471
  <!-- <div class="mealz-ds-dropdown">
472
472
  <select>
473
473
  <option *ngFor="let option of productsTypeOption">
@@ -476,27 +476,27 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
476
476
  </select>
477
477
  </div> -->
478
478
  </div>
479
- `}renderLowerContent(){var e,t;return r`
479
+ `}renderLowerContent(){var e,t;return i`
480
480
  <!-- MORE RECIPE IDEAS -->
481
481
  <div class="mealz-products-picker__more">
482
- ${!this.isAlreadyOnCatalogPage()&&!this.plannerMode?r`
482
+ ${!this.isAlreadyOnCatalogPage()&&!this.plannerMode?i`
483
483
  <a class="mealz-products-picker__more-anchor"
484
- href="${o.router.getCatalogUrl()}"
484
+ href="${r.router.getCatalogUrl()}"
485
485
  @click="${this.sendHomeDisplayEvent}">
486
486
  <button class="mealz-products-picker__go-to-catalog-button mealz-ds-button secondary">
487
487
  <span class="mealz-ds-text weight-l size-s">Voir plus d'idées repas</span>
488
488
  </button>
489
489
  </a>
490
- `:r`
490
+ `:i`
491
491
  <button class="mealz-products-picker__close-modal-button mealz-ds-button secondary" @click="${this.closeRecipeModal}">
492
492
  <span class="mealz-ds-text weight-l size-s">Voir plus d'idées repas</span>
493
493
  </button>
494
494
  `}
495
495
  </div>
496
496
  <mealz-legal-notice .tags="${(t=(e=this.recipe)==null?void 0:e.relationships)==null?void 0:t.tags}"></mealz-legal-notice>
497
- `}sendHomeDisplayEvent(){o.analytics.sendEvent("home.display",this.analyticsPath,{})}};W([h({type:Boolean})],C.prototype,"inBasket",2);W([h({type:Boolean})],C.prototype,"plannerMode",2);C=W([k("mealz-products-picker")],C);customElements.get("mealz-products-picker")||customElements.define("mealz-products-picker",C);var Be=Object.getOwnPropertyDescriptor,Ae=(e,t,s,a)=>{for(var i=a>1?void 0:a?Be(t,s):t,n=e.length-1,l;n>=0;n--)(l=e[n])&&(i=l(i)||i);return i};let V=class extends ${constructor(){super(),this.invalidPos=!1,this.subscriptions=[],this.styleURL=new URL("./recipe-details/no-pos-selected/no-pos-selected.css",this.getBaseURL())}connectedCallback(){super.connectedCallback(),this.listenIfPosInvalid()}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(e=>e.unsubscribe())}listenIfPosInvalid(){this.subscriptions.push(o.recipes.invalidPosDisplay$.subscribe(e=>{this.invalidPos=e,this.requestUpdate()}))}callPosSelector(){const e=new CustomEvent("posSelected",{bubbles:!0,composed:!0});this.dispatchEvent(e)}openStoreLocator(){window.mealzInternal.noSupplier.displaySupplierSelector$.next(!0)}render(){return r`
497
+ `}sendHomeDisplayEvent(){r.analytics.sendEvent("home.display",this.analyticsPath,{})}}Q([h({type:Boolean})],D.prototype,"inBasket");Q([h({type:Boolean})],D.prototype,"plannerMode");customElements.get("mealz-products-picker")||customElements.define("mealz-products-picker",D);class ze extends k{constructor(){super(),this.invalidPos=!1,this.subscriptions=[],this.styleURL=new URL("./recipe-details/no-pos-selected/no-pos-selected.css",this.getBaseURL())}connectedCallback(){super.connectedCallback(),this.listenIfPosInvalid()}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(e=>e.unsubscribe())}listenIfPosInvalid(){this.subscriptions.push(r.recipes.invalidPosDisplay$.subscribe(e=>{this.invalidPos=e,this.requestUpdate()}))}openStoreSelector(){sessionStorage.setItem("_miam/cachedRecipeUrl",window.location.href),this.subscriptions.push(r.hook.hookCallback(!1,!0).subscribe())}render(){return i`
498
498
  <div class="mealz-no-pos-selected">
499
- ${this.invalidPos?r`
499
+ ${this.invalidPos?i`
500
500
  <!-- INVALID POS -->
501
501
  <img
502
502
  class="mealz-no-pos-selected__picture"
@@ -511,7 +511,7 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
511
511
  Vous pouvez sélectionner un autre magasin ou consulter la fiche recette
512
512
  </span>
513
513
  </div>
514
- `:r`
514
+ `:i`
515
515
  <!-- NO POS SELECTED -->
516
516
  <img
517
517
  class="mealz-no-pos-selected__picture"
@@ -529,18 +529,18 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
529
529
  `}
530
530
  <button
531
531
  class="mealz-ds-button mealz-ds-text size-m weight-xl mealz-no-pos-selected__select-pos-button secondary"
532
- @click=${()=>this.openStoreLocator()}
532
+ @click=${()=>this.openStoreSelector()}
533
533
  >
534
534
  Sélectionner un magasin
535
535
  </button>
536
536
  </div>
537
- `}};V=Ae([k("mealz-no-pos-selected")],V);customElements.get("mealz-no-pos-selected")||customElements.define("mealz-no-pos-selected",V);var Le=Object.getOwnPropertyDescriptor,Ue=(e,t,s,a)=>{for(var i=a>1?void 0:a?Le(t,s):t,n=e.length-1,l;n>=0;n--)(l=e[n])&&(i=l(i)||i);return i};let j=class extends ${constructor(){super(),this.activeTabIndex=0,this.destroy$=new D,this.remainingBasketEntries=[],this.guestObserverService=te.getInstance(),this.isSticky=!1,this.hasBackNavigation=!1,this.drawerViewSwapper=null,this.styleURL=new URL("./recipe-details/recipe-details.css",this.getBaseURL())}connectedCallback(){super.connectedCallback(),this.destroy$=new D,this.handleNoSupplierMode(),Z(o.recipes.displayedRecipe$.pipe(O(this.destroy$),Q(e=>!!e),T(e=>{e.recipe!==null&&(this.recipe=e.recipe,this.sponsor=e.recipe.relationships.sponsors.data[0],this.analyticsPath=`/recipes/${this.recipe.id}/shopping`,this.plannerMode=!!e.planner,this.getLikeButton(),this.checkSponsorStorytelling(),this.pageview(),this.listenToCloseEvent(),this.setStickyObserver())}),Y(e=>e.recipe===null?[]:this.listenToRecipeInBasket())),this.listenPosStatus(),this.listenRemainingBasketEntries(),this.listenLastOrderDate(),this.listenToLoadingStates(),this.listenToAddAllToBasket()).pipe(O(this.destroy$)).subscribe({next:()=>this.requestUpdate(),error:e=>console.error("Recipe details error:",e)}),this.addEventListener("products-picker-ready",()=>this.startRecipeDetailsOnboardingIfNeeded()),this.setupDrawerBackNavigationIndicator()}disconnectedCallback(){super.disconnectedCallback(),this.destroy$.next(),this.destroy$.complete(),this.topObserver&&this.topObserver.disconnect(),this.stickyTimeout&&clearTimeout(this.stickyTimeout),this.drawerViewSwapper&&this.onActiveViewsChanged&&this.drawerViewSwapper.removeEventListener("mealz-active-views-changed",this.onActiveViewsChanged)}setupDrawerBackNavigationIndicator(){const e=this.closest("mealz-drawer-view-swapper");this.drawerViewSwapper=e??document.querySelector("mealz-drawer-view-swapper"),this.drawerViewSwapper&&(this.updateBackNavigationFromActiveViews(this.drawerViewSwapper.getActiveViewNames()),this.onActiveViewsChanged=t=>{const s=t==null?void 0:t.detail;s!=null&&s.activeViews&&this.updateBackNavigationFromActiveViews(s.activeViews)},this.drawerViewSwapper.addEventListener("mealz-active-views-changed",this.onActiveViewsChanged))}updateBackNavigationFromActiveViews(e){const t=Array.isArray(e)&&e.length>1;this.hasBackNavigation!==t&&(this.hasBackNavigation=t,this.requestUpdate())}getRecipeDetailsCloseIcon(){return this.hasBackNavigation?{src:"https://storage.googleapis.com/assets.miam.tech/generic/icons/arrow-right.svg",alt:"back button",className:"mealz-recipe-details__close-icon is-back"}:{src:"https://storage.googleapis.com/assets.miam.tech/generic/icons/Cross_primary.svg",alt:"modal close button",className:"mealz-recipe-details__close-icon"}}getRecipeDetailsStickyCloseIcon(){return this.hasBackNavigation?{src:"https://storage.googleapis.com/assets.miam.tech/generic/icons/ArrowLeft_dark.svg",alt:"back button",className:"mealz-recipe-details__close-icon before-title is-back"}:{src:"https://storage.googleapis.com/assets.miam.tech/generic/icons/Cross_Black.svg",alt:"modal close button",className:"mealz-recipe-details__close-icon"}}setStickyObserver(){this.topObserver||this.updateComplete.then(()=>{const e=this.querySelector(".mealz-recipe-details__sticky-anchor");e&&(this.topObserver=new IntersectionObserver(([t])=>{this.stickyTimeout&&clearTimeout(this.stickyTimeout),this.stickyTimeout=window.setTimeout(()=>{const s=!t.isIntersecting;this.isSticky!==s&&(this.isSticky=s,this.requestUpdate())},150)},{threshold:0}),this.topObserver.observe(e))})}startRecipeDetailsOnboardingIfNeeded(){localStorage.getItem("_miam/recipeDetailsOnboarding")==="true"||!this.plannerMode||this.updateComplete.then(()=>{this.scrollJustAfterImage();let t=document.querySelector("mealz-planner-onboarding");t?t.type="recipe-details":(t=new ue,t.type="recipe-details",document.body.appendChild(t)),t.launchOnboardingTour()})}scrollJustAfterImage(){const e=this.querySelector(".mealz-recipe-details__tabs");if(!e)return;const t=document.querySelector(".mealz-drawer__content-container");if(t){const s=e.getBoundingClientRect(),a=t.getBoundingClientRect();t.scrollTop+=s.top-a.top;return}e.scrollIntoView({behavior:"smooth",block:"start"})}handleNoSupplierMode(){this.noSupplier=!!o.supplier.isNoSupplier(),this.requestUpdate()}close(){this.sendCloseEvent(),o.recipes.displayedRecipe$.next(null)}listenToCloseEvent(){const e=document.querySelector("mealz-drawer");e&&e.addEventListener("drawerClosed",()=>{this.sendCloseEvent()})}selectTab(e){this.activeTabIndex=e,this.activeTabIndex===1&&this.sendCookingDisplayEvent(),this.requestUpdate()}getLikeButton(){this.noSupplier||o.user.isAuthenticated().pipe(O(this.destroy$),Q(e=>e),Y(()=>o.html.like(this.recipe.id))).subscribe({next:e=>{this.likeButtonHTML=e,this.requestUpdate()},error:e=>console.error("Like button error:",e)})}checkSponsorStorytelling(){this.sponsor&&o.sponsor.hasStorytelling(this.sponsor.id).pipe(O(this.destroy$)).subscribe({next:e=>{this.hasSponsorStorytelling=e,this.requestUpdate()},error:e=>console.error("Sponsor storytelling error:",e)})}listenPosStatus(){return J({noPosDisplay:o.recipes.noPosDisplay$,invalidPosDisplay:o.recipes.invalidPosDisplay$}).pipe(T(({noPosDisplay:e,invalidPosDisplay:t})=>{this.noPosDisplay=e,this.invalidPosDisplay=t,this.activeTabIndex=e?1:0}),y(()=>{}))}listenLastOrderDate(){return o.recipes.orderHistoryDate$.pipe(T(e=>{this.orderHistoryDate=e}))}listenToLoadingStates(){return J([o.recipes.ingredientToBasketLoading$,o.recipes.updateIngredientFromBasketLoading$]).pipe(y(([e,t])=>e||t),T(e=>{this.basketIsUpdating=e}),be(1))}listenRemainingBasketEntries(){return o.recipes.remainingBasketEntries$.pipe(T(e=>{this.remainingBasketEntries=e}))}listenToAddAllToBasket(){return o.recipes.allIngredientsToBasketLoading$.pipe(T(e=>{e&&(this.selectTab(0),setTimeout(()=>{this.scrollToPicker()},50))}))}listenToRecipeInBasket(){return o.recipes.isRecipeInBasket(this.recipe.id).pipe(T(e=>{this.inBasket=e}))}scrollToPicker(){const e=this.querySelector(".mealz-products-picker");if(e){const t=this.querySelector(".mealz-recipe-details__title-container"),s=(t==null?void 0:t.offsetHeight)||0;e.style.scrollMarginTop=`${s}px`,e.scrollIntoView({behavior:"instant",block:"start"})}}scrollToReplacedItem(e){var s,a;const t=this.querySelectorAll("mealz-product-card-planner");for(const i of Array.from(t)){const n=i;if(((a=(s=n.product)==null?void 0:s.item)==null?void 0:a.id)===e){n.scrollIntoView({behavior:"instant",block:"center"});break}}}openLastOrderModal(){this.sendOrderedDisplayEvent();const e=new de;e.recipeId=this.recipe.id,e.addEventListener("orderAgain",()=>this.orderAgain()),e.displayLastOrderModal(this.orderHistoryDate)}orderAgain(){o.recipes.addAllIngredientsToBasket({originPath:this.analyticsPath,props:{}})}updateGuests(e){if(this.recipe.modifiedGuests===e.detail.value)return;this.recipe.modifiedGuests=e.detail.value,this.guestObserverService.updateGuests(this.recipe.modifiedGuests);const t={originPath:this.analyticsPath,props:{}};this.plannerMode?o.planner.updateGuests(this.recipe.modifiedGuests,t):o.recipes.updateGuests(t),this.requestUpdate()}render(){const e=this.getRecipeDetailsCloseIcon(),t=this.getRecipeDetailsStickyCloseIcon();return r`
537
+ `}}customElements.get("mealz-no-pos-selected")||customElements.define("mealz-no-pos-selected",ze);class ye extends k{constructor(){super(),this.activeTabIndex=0,this.destroy$=new O,this.remainingBasketEntries=[],this.guestObserverService=j.getInstance(),this.isSticky=!1,this.hasBackNavigation=!1,this.drawerViewSwapper=null,this.styleURL=new URL("./recipe-details/recipe-details.css",this.getBaseURL())}connectedCallback(){super.connectedCallback(),this.destroy$=new O,this.handleNoSupplierMode(),V(r.recipes.displayedRecipe$.pipe(w(this.destroy$),N(e=>!!e),I(e=>{e.recipe!==null&&(this.recipe=e.recipe,this.sponsor=e.recipe.relationships.sponsors.data[0],this.analyticsPath=`/recipes/${this.recipe.id}/shopping`,this.plannerMode=!!e.planner,this.getLikeButton(),this.checkSponsorStorytelling(),this.pageview(),this.listenToCloseEvent(),this.setStickyObserver())}),q(e=>e.recipe===null?[]:this.listenToRecipeInBasket())),this.listenPosStatus(),this.listenRemainingBasketEntries(),this.listenLastOrderDate(),this.listenToLoadingStates(),this.listenToAddAllToBasket()).pipe(w(this.destroy$)).subscribe({next:()=>this.requestUpdate(),error:e=>console.error("Recipe details error:",e)}),this.addEventListener("products-picker-ready",()=>this.startRecipeDetailsOnboardingIfNeeded()),this.setupDrawerBackNavigationIndicator()}disconnectedCallback(){super.disconnectedCallback(),this.destroy$.next(),this.destroy$.complete(),this.topObserver&&this.topObserver.disconnect(),this.stickyTimeout&&clearTimeout(this.stickyTimeout),this.drawerViewSwapper&&this.onActiveViewsChanged&&this.drawerViewSwapper.removeEventListener("mealz-active-views-changed",this.onActiveViewsChanged)}setupDrawerBackNavigationIndicator(){const e=this.closest("mealz-drawer-view-swapper");this.drawerViewSwapper=e??document.querySelector("mealz-drawer-view-swapper"),this.drawerViewSwapper&&(this.updateBackNavigationFromActiveViews(this.drawerViewSwapper.getActiveViewNames()),this.onActiveViewsChanged=t=>{const s=t==null?void 0:t.detail;s!=null&&s.activeViews&&this.updateBackNavigationFromActiveViews(s.activeViews)},this.drawerViewSwapper.addEventListener("mealz-active-views-changed",this.onActiveViewsChanged))}updateBackNavigationFromActiveViews(e){const t=Array.isArray(e)&&e.length>1;this.hasBackNavigation!==t&&(this.hasBackNavigation=t,this.requestUpdate())}getRecipeDetailsCloseIcon(){return this.hasBackNavigation?{src:"https://storage.googleapis.com/assets.miam.tech/generic/icons/arrow-right.svg",alt:"back button",className:"mealz-recipe-details__close-icon is-back"}:{src:"https://storage.googleapis.com/assets.miam.tech/generic/icons/Cross_primary.svg",alt:"modal close button",className:"mealz-recipe-details__close-icon"}}getRecipeDetailsStickyCloseIcon(){return this.hasBackNavigation?{src:"https://storage.googleapis.com/assets.miam.tech/generic/icons/ArrowLeft_dark.svg",alt:"back button",className:"mealz-recipe-details__close-icon before-title is-back"}:{src:"https://storage.googleapis.com/assets.miam.tech/generic/icons/Cross_Black.svg",alt:"modal close button",className:"mealz-recipe-details__close-icon"}}setStickyObserver(){this.topObserver||this.updateComplete.then(()=>{const e=this.querySelector(".mealz-recipe-details__sticky-anchor");e&&(this.topObserver=new IntersectionObserver(([t])=>{this.stickyTimeout&&clearTimeout(this.stickyTimeout),this.stickyTimeout=window.setTimeout(()=>{const s=!t.isIntersecting;this.isSticky!==s&&(this.isSticky=s,this.requestUpdate())},150)},{threshold:0}),this.topObserver.observe(e))})}startRecipeDetailsOnboardingIfNeeded(){localStorage.getItem("_miam/recipeDetailsOnboarding")==="true"||!this.plannerMode||this.updateComplete.then(()=>{this.scrollJustAfterImage();let t=document.querySelector("mealz-planner-onboarding");t?t.type="recipe-details":(t=new ae,t.type="recipe-details",document.body.appendChild(t)),t.launchOnboardingTour()})}scrollJustAfterImage(){const e=this.querySelector(".mealz-recipe-details__tabs");if(!e)return;const t=document.querySelector(".mealz-drawer__content-container");if(t){const s=e.getBoundingClientRect(),a=t.getBoundingClientRect();t.scrollTop+=s.top-a.top;return}e.scrollIntoView({behavior:"smooth",block:"start"})}handleNoSupplierMode(){this.noSupplier=!!r.supplier.isNoSupplier(),this.requestUpdate()}close(){this.sendCloseEvent(),r.recipes.displayedRecipe$.next(null)}listenToCloseEvent(){const e=document.querySelector("mealz-drawer");e&&e.addEventListener("drawerClosed",()=>{this.sendCloseEvent()})}selectTab(e){this.activeTabIndex=e,this.activeTabIndex===1&&this.sendCookingDisplayEvent(),this.requestUpdate()}getLikeButton(){this.noSupplier||r.user.isAuthenticated().pipe(w(this.destroy$),N(e=>e),q(()=>r.html.like(this.recipe.id))).subscribe({next:e=>{this.likeButtonHTML=e,this.requestUpdate()},error:e=>console.error("Like button error:",e)})}checkSponsorStorytelling(){this.sponsor&&r.sponsor.hasStorytelling(this.sponsor.id).pipe(w(this.destroy$)).subscribe({next:e=>{this.hasSponsorStorytelling=e,this.requestUpdate()},error:e=>console.error("Sponsor storytelling error:",e)})}listenPosStatus(){return G({noPosDisplay:r.recipes.noPosDisplay$,invalidPosDisplay:r.recipes.invalidPosDisplay$}).pipe(I(({noPosDisplay:e,invalidPosDisplay:t})=>{this.noPosDisplay=e,this.invalidPosDisplay=t,this.activeTabIndex=e?1:0}),y(()=>{}))}listenLastOrderDate(){return r.recipes.orderHistoryDate$.pipe(I(e=>{this.orderHistoryDate=e}))}listenToLoadingStates(){return G([r.recipes.ingredientToBasketLoading$,r.recipes.updateIngredientFromBasketLoading$]).pipe(y(([e,t])=>e||t),I(e=>{this.basketIsUpdating=e}),ce(1))}listenRemainingBasketEntries(){return r.recipes.remainingBasketEntries$.pipe(I(e=>{this.remainingBasketEntries=e}))}listenToAddAllToBasket(){return r.recipes.allIngredientsToBasketLoading$.pipe(I(e=>{e&&(this.selectTab(0),setTimeout(()=>{this.scrollToPicker()},50))}))}listenToRecipeInBasket(){return r.recipes.isRecipeInBasket(this.recipe.id).pipe(I(e=>{this.inBasket=e}))}scrollToPicker(){const e=this.querySelector(".mealz-products-picker");if(e){const t=this.querySelector(".mealz-recipe-details__title-container"),s=(t==null?void 0:t.offsetHeight)||0;e.style.scrollMarginTop=`${s}px`,e.scrollIntoView({behavior:"instant",block:"start"})}}scrollToReplacedItem(e){var s,a;const t=this.querySelectorAll("mealz-product-card-planner");for(const n of Array.from(t)){const l=n;if(((a=(s=l.product)==null?void 0:s.item)==null?void 0:a.id)===e){l.scrollIntoView({behavior:"instant",block:"center"});break}}}openLastOrderModal(){this.sendOrderedDisplayEvent();const e=new se;e.recipeId=this.recipe.id,e.addEventListener("orderAgain",()=>this.orderAgain()),e.displayLastOrderModal(this.orderHistoryDate)}orderAgain(){r.recipes.addAllIngredientsToBasket({originPath:this.analyticsPath,props:{}})}updateGuests(e){if(this.recipe.modifiedGuests===e.detail.value)return;this.recipe.modifiedGuests=e.detail.value,this.guestObserverService.updateGuests(this.recipe.modifiedGuests);const t={originPath:this.analyticsPath,props:{}};this.plannerMode?r.planner.updateGuests(this.recipe.modifiedGuests,t):r.recipes.updateGuests(t),this.requestUpdate()}render(){const e=this.getRecipeDetailsCloseIcon(),t=this.getRecipeDetailsStickyCloseIcon();return i`
538
538
  <div class="mealz-recipe-details">
539
539
  <!-- IF IS LOADING -->
540
- ${this.recipe?c:r`
540
+ ${this.recipe?d:i`
541
541
  <div class="mealz-ds-loader mealz-recipe-details__loader"></div>`}
542
542
  <!-- IF IS NOT LOADING AND RECIPE EXISTS -->
543
- ${this.recipe?r`
543
+ ${this.recipe?i`
544
544
  <div class="mealz-recipe-details__container">
545
545
  <!-- BANNER CONTAINER -->
546
546
  <div class="mealz-recipe-details__picture ${this.noSupplier?"no-supplier":""}">
@@ -573,25 +573,25 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
573
573
  src="${this.recipe.attributes["media-url"]}"
574
574
  class="mealz-recipe-details__picture-img">
575
575
  <!-- Filigrane logo -->
576
- ${this.recipe.attributes["filigrane-logo-url"]?r`
576
+ ${this.recipe.attributes["filigrane-logo-url"]?i`
577
577
  <div class="mealz-recipe-details__picture__filigrane">
578
578
  <img alt="filigrane logo" src=${this.recipe.filigraneLogoUrl}>
579
- </div>`:c}
579
+ </div>`:d}
580
580
  </div>
581
581
  <!-- SPONSOR -->
582
582
  <div class="mealz-recipe-details__sponsor">
583
- ${this.recipe.attributes["informational-page-html"]&&this.hasSponsorStorytelling?this.renderAddonLink():c}
583
+ ${this.recipe.attributes["informational-page-html"]&&this.hasSponsorStorytelling?this.renderAddonLink():d}
584
584
  <hr class="mealz-recipe-details__sponsor-separator">
585
585
  </div>
586
586
  <!-- LAST ORDER BADGE -->
587
- ${this.orderHistoryDate?r`
587
+ ${this.orderHistoryDate?i`
588
588
  <div class="mealz-recipe-details__last-order-badge">
589
589
  <mealz-last-order-badge
590
590
  .orderHistoryDate=${this.orderHistoryDate}
591
591
  .disabled=${this.plannerMode}
592
592
  @openLastOrderModal=${()=>this.openLastOrderModal()}>
593
593
  </mealz-last-order-badge>
594
- </div>`:c}
594
+ </div>`:d}
595
595
  <div class="mealz-recipe-details__sticky-anchor"></div>
596
596
  <!-- STICKY HEADER -->
597
597
  <div class="mealz-recipe-details__sticky-header">
@@ -605,7 +605,7 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
605
605
  <div class="mealz-recipe-details__actions__icon">
606
606
  <!-- LIKE BUTTON -->
607
607
  <div class="mealz-recipe-details__like-button">
608
- ${pe(this.likeButtonHTML)}
608
+ ${ie(this.likeButtonHTML)}
609
609
  </div>
610
610
  <!-- CLOSE MODAL BUTTON -->
611
611
  <div class="mealz-recipe-details__hideable-actions ${this.isSticky?"sticky":""}">
@@ -620,11 +620,11 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
620
620
  </div>
621
621
  </div>
622
622
  <!-- STORE INDICATOR -->
623
- ${this.noSupplier?r`
624
- <mealz-store-indicator .analyticsPath=${this.analyticsPath}></mealz-store-indicator>`:c}
623
+ ${this.noSupplier?i`
624
+ <mealz-store-indicator .analyticsPath=${this.analyticsPath}></mealz-store-indicator>`:d}
625
625
  </div>
626
626
  <!-- RECIPE BASIC INFORMATIONS + TABS -->
627
- ${this.noSupplier?c:r`
627
+ ${this.noSupplier?d:i`
628
628
  <!-- RECIPE BASIC INFORMATIONS -->
629
629
  <mealz-details-infos class="mealz-recipe-details__infos"></mealz-details-infos>
630
630
  <!-- TABS TO SWITCH BETWEEN BASKET AND INSTRUCTIONS -->
@@ -642,7 +642,7 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
642
642
  ${this.renderTabContent()}
643
643
  </div>
644
644
  <!-- FOOTER -->
645
- ${this.activeTabIndex===0&&!this.noPosDisplay||this.plannerMode?r`
645
+ ${this.activeTabIndex===0&&!this.noPosDisplay||this.plannerMode?i`
646
646
  <mealz-details-footer
647
647
  .noPosDisplay=${this.noPosDisplay}
648
648
  .noSupplier=${this.noSupplier}
@@ -650,18 +650,18 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
650
650
  .plannerMode=${this.plannerMode}
651
651
  .guests=${this.recipe.modifiedGuests}
652
652
  .recipe=${this.recipe}
653
- ></mealz-details-footer>`:c}
653
+ ></mealz-details-footer>`:d}
654
654
  </div>
655
- `:c}
655
+ `:d}
656
656
  </div>
657
- `}renderTabContent(){return r`
657
+ `}renderTabContent(){return i`
658
658
  <div class="mealz-recipe-details__products-tab ${this.activeTabIndex===0?"":"hidden"}">
659
- ${!this.noPosDisplay&&!this.invalidPosDisplay?r`
659
+ ${!this.noPosDisplay&&!this.invalidPosDisplay?i`
660
660
  <mealz-products-picker
661
661
  .inBasket=${this.inBasket}
662
662
  .plannerMode=${this.plannerMode}
663
663
  @guestChange=${e=>this.updateGuests(e)}
664
- ></mealz-products-picker>`:r`
664
+ ></mealz-products-picker>`:i`
665
665
  <mealz-no-pos-selected
666
666
  .noPos=${this.noPosDisplay}
667
667
  .invalidPos=${this.invalidPosDisplay}
@@ -675,14 +675,14 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
675
675
  <!-- RECIPE INSTRUCTIONS -->
676
676
  <mealz-details-steps></mealz-details-steps>
677
677
  <!-- ORDER AGAIN -->
678
- ${this.orderHistoryDate&&this.remainingBasketEntries.length>0&&!this.plannerMode?r`
678
+ ${this.orderHistoryDate&&this.remainingBasketEntries.length>0&&!this.plannerMode?i`
679
679
  <mealz-order-again .recipeId=${this.recipe.id} @orderAgain=${()=>this.orderAgain()}></mealz-order-again>
680
- `:c}
680
+ `:d}
681
681
  </div>
682
- `}renderAddonLink(){var e;return r`
682
+ `}renderAddonLink(){var e;return i`
683
683
  <div class="mealz-addon-link">
684
684
  <div class="mealz-addon-link__info">
685
- ${this.recipe.attributes["informational-sentence"]?r`<span class="mealz-ds-text size-s weight-l">${this.recipe.attributes["informational-sentence"]}</span>`:r`
685
+ ${this.recipe.attributes["informational-sentence"]?i`<span class="mealz-ds-text size-s weight-l">${this.recipe.attributes["informational-sentence"]}</span>`:i`
686
686
  <span class="mealz-ds-text size-s weight-l">
687
687
  <span>Cette recette vous est proposée par notre partenaire</span>
688
688
  <span class="mealz-addon-link__sponsor-name">
@@ -690,16 +690,16 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
690
690
  </span>
691
691
  </span>
692
692
  `}
693
- ${(e=this.recipe.attributes)!=null&&e["informational-page-html"]||this.hasSponsorStorytelling?r`
693
+ ${(e=this.recipe.attributes)!=null&&e["informational-page-html"]||this.hasSponsorStorytelling?i`
694
694
  <span class="mealz-addon-link__link mealz-ds-text size-s weight-xl" @click=${()=>this.showRecipeAddon()}>
695
695
  En savoir plus
696
696
  </span>
697
- `:c}
697
+ `:d}
698
698
  </div>
699
- ${this.sponsor.attributes["logo-url"]?r`
699
+ ${this.sponsor.attributes["logo-url"]?i`
700
700
  <div class="mealz-addon-link__logo">
701
701
  <img src="${this.sponsor.attributes["logo-url"]}" alt="${this.sponsor.attributes.name} logo" />
702
702
  </div>
703
- `:c}
703
+ `:d}
704
704
  </div>
705
- `}showRecipeAddon(){this.sendSponsorDisplayEvent();const e=document.querySelector("mealz-drawer-view-swapper");e&&e.displayRecipeAddon$.next(!0)}pageview(){o.analytics.sendEvent("pageview",this.analyticsPath,{})}sendSponsorDisplayEvent(){o.analytics.sendEvent("sponsor.display",this.analyticsPath,{recipe_id:this.recipe.id})}sendCloseEvent(){o.analytics.sendEvent("recipe.close",this.analyticsPath,{recipe_id:this.recipe.id})}sendCookingDisplayEvent(){o.analytics.sendEvent("recipe.cooking.display",this.analyticsPath,{recipe_id:this.recipe.id})}sendOrderedDisplayEvent(){o.analytics.sendEvent("recipe.ordered.display",this.analyticsPath,{recipe_id:this.recipe.id})}};j=Ue([k("mealz-recipe-details")],j);customElements.get("mealz-recipe-details")||customElements.define("mealz-recipe-details",j);
705
+ `}showRecipeAddon(){this.sendSponsorDisplayEvent();const e=document.querySelector("mealz-drawer-view-swapper");e&&e.displayRecipeAddon$.next(!0)}pageview(){r.analytics.sendEvent("pageview",this.analyticsPath,{})}sendSponsorDisplayEvent(){r.analytics.sendEvent("sponsor.display",this.analyticsPath,{recipe_id:this.recipe.id})}sendCloseEvent(){r.analytics.sendEvent("recipe.close",this.analyticsPath,{recipe_id:this.recipe.id})}sendCookingDisplayEvent(){r.analytics.sendEvent("recipe.cooking.display",this.analyticsPath,{recipe_id:this.recipe.id})}sendOrderedDisplayEvent(){r.analytics.sendEvent("recipe.ordered.display",this.analyticsPath,{recipe_id:this.recipe.id})}}customElements.get("mealz-recipe-details")||customElements.define("mealz-recipe-details",ye);