1import{c as _e}from"./chunk-TJKZZNZW.js";import"./chunk-S73WYAIX.js";import{$ as se,R as re,U as ae,V as ce,t as te,v as ie,w as ne,y as oe}from"./chunk-QDOPSZDL.js";import"./chunk-LBFRPAWW.js";import{D as W,De as Y,Eb as p,Fb as x,Gb as f,Hb as g,Ib as u,Jc as D,Jg as K,Kb as y,Kg as X,M as w,Mb as L,Me as O,Nb as r,Nd as Q,Oc as j,Pd as H,Ub as S,Va as a,Vb as A,Wb as B,Xb as k,Xc as N,Xd as U,Xg as Z,Yb as h,Yf as q,Yg as ee,Zb as T,Zf as z,ab as I,bg as G,cb as V,cg as J,da as E,db as R,hb as m,ic as $,la as M,nc as _,oa as P,oc as d,q as F,rb as c,tc as b,ua as v,va as C}from"./chunk-M7EHSRRK.js";import"./chunk-YBVLHYO3.js";var de=["addToWishlistButton"],pe=["removeFromWishlistButton"],le=()=>({cxRoute:"login"});function me(e,n){if(e&1){let t=y();p(0,"div")(1,"button",7,2),_(3,"async"),_(4,"cxTranslate"),L("click",function(){let o=v(t).ngIf,s=r(6);return C(s.remove(o))}),f(5,"cx-icon",8),p(6,"span",9),h(7),_(8,"cxTranslate"),x()()()}if(e&2){let t=r(6);a(),c("disabled",d(3,4,t.loading$))("cxAtMessage",d(4,6,"addToWishList.removedFromWishList")),a(4),c("type",t.iconTypes.HEART),a(2),T(d(8,8,"addToWishList.remove"))}}function ge(e,n){if(e&1){let t=y();p(0,"button",10,3),_(2,"async"),_(3,"cxTranslate"),L("click",function(){v(t);let o=r(5).ngIf,s=r();return C(s.add(o))}),f(4,"cx-icon",8),p(5,"span",9),h(6),_(7,"cxTranslate"),x()()}if(e&2){let t=r(6);c("disabled",d(2,4,t.loading$))("cxAtMessage",d(3,6,"addToWishList.addedToWishList")),a(4),c("type",t.iconTypes.EMPTY_HEART),a(2),T(d(7,8,"addToWishList.add"))}}function ue(e,n){if(e&1&&(g(0),m(1,me,9,10,"div",5)(2,ge,8,10,"ng-template",null,1,b),u()),e&2){let t=k(3),i=r(2).ngIf,o=r(2).ngIf,s=r();a(),c("ngIf",s.getProductInWishList(o,i))("ngIfElse",t)}}function xe(e,n){if(e&1){let t=y();p(0,"div")(1,"button",11),_(2,"async"),_(3,"cxTranslate"),L("click",function(){let o=v(t).ngIf,s=r(6);return C(s.remove(o))}),f(4,"cx-icon",8),p(5,"span",9),h(6),_(7,"cxTranslate"),x()()()}if(e&2){let t=r(6);a(),c("disabled",d(2,4,t.loading$))("cxAtMessage",d(3,6,"addToWishList.removedFromWishList")),a(3),c("type",t.iconTypes.HEART),a(2),T(d(7,8,"addToWishList.remove"))}}function fe(e,n){if(e&1){let t=y();p(0,"button",12),_(1,"async"),_(2,"cxTranslate"),L("click",function(){v(t);let o=r(5).ngIf,s=r();return C(s.add(o))}),f(3,"cx-icon",8),p(4,"span",9),h(5),_(6,"cxTranslate"),x()()}if(e&2){let t=r(6);c("disabled",d(1,4,t.loading$))("cxAtMessage",d(2,6,"addToWishList.addedToWishList")),a(3),c("type",t.iconTypes.EMPTY_HEART),a(2),T(d(6,8,"addToWishList.add"))}}function he(e,n){if(e&1&&(g(0),m(1,xe,8,10,"div",5)(2,fe,7,10,"ng-template",null,1,b),u()),e&2){let t=k(3),i=r(2).ngIf,o=r(2).ngIf,s=r();a(),c("ngIf",s.getProductInWishList(o,i))("ngIfElse",t)}}function Te(e,n){e&1&&(g(0),m(1,ue,4,2,"ng-container",6)(2,he,4,2,"ng-container",6),u()),e&2&&(a(),c("cxFeature","a11yLinkBtnsToTertiaryBtns"),a(),c("cxFeature","!a11yLinkBtnsToTertiaryBtns"))}function ve(e,n){if(e&1&&(g(0),m(1,Te,3,2,"ng-container",4),u()),e&2){let t=r(3);a(),c("ngIf",t.hasStock)}}function Ce(e,n){if(e&1&&(g(0),m(1,ve,2,1,"ng-container",4),_(2,"async"),u()),e&2){let t=r(2);a(),c("ngIf",d(2,1,t.wishListEntries$))}}function ye(e,n){if(e&1&&(g(0),m(1,Ce,3,3,"ng-container",5),_(2,"async"),u()),e&2){let t=r(),i=k(3);a(),c("ngIf",d(2,2,t.userLoggedIn$))("ngIfElse",i)}}function Le(e,n){if(e&1&&(g(0),p(1,"a",13),_(2,"cxUrl"),f(3,"cx-icon",8),p(4,"span",9),h(5),_(6,"cxTranslate"),x()(),u()),e&2){let t=r(2);a(),c("routerLink",d(2,3,$(7,le))),a(2),c("type",t.iconTypes.EMPTY_HEART),a(2),T(d(6,5,"addToWishList.anonymous"))}}function We(e,n){if(e&1&&m(0,Le,7,8,"ng-container",4),e&2){let t=r();c("ngIf",t.hasStock)}}var Ie=(()=>{let n=class n{constructor(i,o,s){this.wishListFacade=i,this.currentProductService=o,this.authService=s,this.product$=this.currentProductService.getProduct().pipe(W(Y),E(l=>this.setStockInfo(l))),this.featureConfigService=P(q),this.userLoggedIn$=this.authService.isUserLoggedIn().pipe(E(l=>{l&&(this.wishListEntries$=this.getWishListEntries(),this.loading$=this.wishListFacade.getWishListLoading())})),this.hasStock=!1,this.iconTypes=te,J("a11yVisibleFocusOverflows")}
1add(i){i.code&&(this.wishListFacade.addEntry(i.code),this.featureConfigService.isEnabled("a11yAddToWishlistFocus")&&this.restoreFocus())}remove(i){this.wishListFacade.removeEntry(i),this.featureConfigService.isEnabled("a11yAddToWishlistFocus")&&this.restoreFocus()}getProductInWishList(i,o){return o.find(l=>l.product?.code===i.code)}setStockInfo(i){this.hasStock=!!(i.stock&&i.stock.stockLevelStatus!=="outOfStock")}getWishListEntries(){return this.wishListFacade.getWishList().pipe(W(i=>!!i),F(i=>i.entries??[]))}restoreFocus(){this.loading$.pipe(W(i=>!i),w(1)).subscribe(()=>{this.removeFromWishlistButton?.nativeElement.focus()||this.addToWishlistButton?.nativeElement.focus()})}};n.\u0275fac=function(o){return new(o||n)(I(_e),I(re),I(O))},n.\u0275cmp=V({type:n,selectors:[["cx-add-to-wishlist"]],viewQuery:function(o,s){if(o&1&&(S(de,5),S(pe,5)),o&2){let l;A(l=B())&&(s.addToWishlistButton=l.first),A(l=B())&&(s.removeFromWishlistButton=l.first)}},standalone:!1,decls:4,vars:3,consts:[["loginPrompt",""],["addItem",""],["removeFromWishlistButton",""],["addToWishlistButton",""],[4,"ngIf"],[4,"ngIf","ngIfElse"],[4,"cxFeature"],[1,"btn","btn-tertiary","button-remove",3,"click","disabled","cxAtMessage"],["aria-hidden","true",3,"type"],[1,"button-text"],[1,"btn","btn-tertiary","button-add",3,"click","disabled","cxAtMessage"],[1,"btn","btn-link","button-remove","cx-action-link",3,"click","disabled","cxAtMessage"],[1,"btn","btn-link","button-add","cx-action-link",3,"click","disabled","cxAtMessage"],["cxBtnLikeLink","",1,"btn","btn-link","button-add-link","cx-action-link",3,"routerLink"]],template:function(o,s){o&1&&(m(0,ye,3,4,"ng-container",4),_(1,"async"),m(2,We,1,1,"ng-template",null,0,b)),o&2&&c("ngIf",d(1,1,s.product$))},dependencies:[D,ie,Q,oe,z,ae,j,Z,K],encapsulation:2,changeDetection:0});let e=n;return e})(),Qe=(()=>{let n=class n{};n.\u0275fac=function(o){return new(o||n)},n.\u0275mod=R({type:n}),n.\u0275inj=M({providers:[U({cmsComponents:{AddToWishListComponent:{component:Ie}}})],imports:[N,ee,ne,H,X,se,G,ce]});let e=n;return e})();export{Ie as AddToWishListComponent,Qe as AddToWishListModule};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.