1import{a as Pt}from"./chunk-RFPDSUGX.js";import{a as _t}from"./chunk-WT5ELSVY.js";import{f as C}from"./chunk-S4QAFMQA.js";import"./chunk-4C5MZVJG.js";import{a as Ct}from"./chunk-PBEZI4SF.js";import{b as N}from"./chunk-R56D37CD.js";import{u as ht,w as gt}from"./chunk-CADM6FGT.js";import"./chunk-SPRZFG3Z.js";import"./chunk-QMFR7M74.js";import{A as dt,B as ut,M as ft,n as mt,o as lt,p as w,s as p,v as pt}from"./chunk-LLVW753R.js";import{J as ct,M as st}from"./chunk-MGCVNTI4.js";import"./chunk-BNGI56ON.js";import"./chunk-QIOCMH4K.js";import"./chunk-23X24FME.js";import{a as xt}from"./chunk-76VB6WJN.js";import{k as nt}from"./chunk-YUMRTKSW.js";import{d as f}from"./chunk-MHZUFQJW.js";import{a as u}from"./chunk-6VEJTVKB.js";import{b as at}from"./chunk-N5XYEDAN.js";import"./chunk-JXTPHU4M.js";import{a as it,j as ot}from"./chunk-ACDOVIT7.js";import{c as et}from"./chunk-EPNRNPFG.js";import{$b as Y,A as B,Aa as r,G as z,Ga as Q,Gc as J,H as G,Ha as R,Ib as x,Kb as P,Ma as V,Mc as X,Nd as tt,Oc as c,Pb as y,Pc as s,Q as T,Qb as b,Rb as d,Sb as $,V as j,W as _,Zb as K,bc as a,gb as l,he as O,je as rt,oa as S,qc as F,ra as L,rb as W,rc as v,sb as U,sd as Z,wa as g,wb as H,xa as E}from"./chunk-TZKVW664.js";import"./chunk-OAOUCCYY.js";var yt=(()=>{class i{constructor(){this.alertSettings={minWidth:300,maxWidth:350,autoFocus:!1,closeOnNavigation:!0,panelClass:["alert-dialog","ngmAlertDialogPanel"]},this.tryAgain="Try Again",this.contactSupport="Contact Support",this.addToCartFailure={title:"Add to Cart Failed",content:"Please try again and if you continue to get this error, contact support for assistance.",icon:void 0,actions:[{name:this.tryAgain,color:"primary",type:"stroked"},{name:this.contactSupport,color:"primary",type:"stroked"}]},this._alertDialogService=r(Pt),this._platformService=r(f),this._window=r(u)}showAddToCartFailureAlert(){this._alertDialogService.open(this.addToCartFailure,this.alertSettings).afterClosed().pipe(_(1)).subscribe(t=>this.addToCartFailureAlertAction(t))}addToCartFailureAlertAction(t){t===this.contactSupport&&this._platformService.isBrowser&&(this._window.location.href="/contact-us")}static{this.\u0275fac=function(e){return new(e||i)}}static{this.\u0275prov=g({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})();var M=(()=>{class i{constructor(){this._version="v1.0",this._client=r(tt)}addToCart(t){let e=`${et.api.path}${this._version}/cart/product`,o={name:t.name,qty:t.qty,lineItems:[{groupName:"printboxcolorlig",name:t.printboxcolorlig}]};return this._client.post(e,o,{withCredentials:!0})}static{this.\u0275fac=function(e){return new(e||i)}}static{this.\u0275prov=g({token:i,factory:i.\u0275fac})}}return i})();var bt={form:new w({name:new p,qty:new p,printboxcolorlig:new p}),globals:void 0},I=(()=>{class i extends xt{constructor(){super(bt),this._getPrintBoxGQL=r(ht.GetPrintBoxGQL),this._addToCartService=r(M),this._addToCartFailureAlertService=r(yt),this._platformService=r(f),this._window=r(u),this.addToCart=this.effect(t=>t.pipe(L(()=>this.patchState({formLock:!0})),S(()=>this.select(e=>e.form?.value)),S(e=>e?.name&&e.qty&&e.printboxcolorlig?this._addToCartService.addToCart(e):B(void 0)),N({next:e=>{this.patchState({formLock:!1}),e?.isSuccess?this._platformService.isBrowser&&(this._window.location.href="/customer/ShoppingCart.aspx"):this._addToCartFailureAlertService.showAddToCartFailureAlert()},error:()=>{this.patchState({formLock:!1}),this._addToCartFailureAlertService.showAddToCartFailureAlert()}}))),this.getPrintBoxGlobals=this.effect(t=>t.pipe(S(()=>this._getPrintBoxGQL.fetch()),N({next:e=>{let o=e.data?.globals?.[0]?.flatData?.printBox?.[0];if(o){let n={qtyFormSingleName:o.qtyFormSingleName,qtyFormPluralName:o.qtyFormPluralName};this.patchState({globals:n})}else this.patchState({globals:void 0})},error:()=>{this.patchState({globals:void 0})}}))),this.getPrintBoxGlobals()}showForm(t){return B(!0)}selectColorRadioItems(t){return this.select(()=>{let e=t?.[0]?.lineItemGroupPrices?.[0]?.lineItemPrices;return e?e.map(o=>({value:o.name,label:o.description})):[]})}selectColorName(t){return this.select(()=>t?.[0]?.lineItemGroupPrices?.[0]?.description??"Color")}selectMaterialSelectValues$(t){return this.select(e=>{let o=[];if(!e.globals)return o;let n=t?.[0]?.paperPrices?.[0]?.qtyPrices;if(n)for(let m=1;m<=10;m++){let k=(n.find(q=>q.minUnit<=m&&q.maxUnit>=m)?.price??0)*m;k>0&&o.push({value:m,description:`${m} ${m===1?e.globals?.qtyFormSingleName:e.globals?.qtyFormPluralName}`,price:k})}return o}
1)}static{this.\u0275fac=function(e){return new(e||i)}}static{this.\u0275prov=g({token:i,factory:i.\u0275fac})}}return i})();var St=(i,h,t,e,o)=>({cta:i,globals:h,routeCreateQueryParams:t,isAuthorized:e,colorName:o});function Ft(i,h){if(i&1&&(b(0,"div",2)(1,"div",3),F(2),d(),$(3,"mpix-material-form-radio-text",4),c(4,"async"),d(),b(5,"div",2)(6,"div",3),F(7),d(),$(8,"mpix-material-form-select-w-price",5),c(9,"async"),d()),i&2){let t=a(2),e=a();l(2),v(t.colorName),l(),y("list",s(4,4,e.colors$)),l(4),v(t.globals.quantity),l(),y("options",s(9,6,e.quantityValues$))}}function vt(i,h){if(i&1){let t=K();b(0,"button",6),Y("click",function(){Q(t);let o=a(2),n=a();return R(o.isAuthorized?n.addToCart():n.login(o.routeCreateQueryParams))}),F(1),d()}if(i&2){let t=a(2),e=a();y("title",e.getButtonText(t.isAuthorized,t.cta.btnText,t.cta.btnTextNoAuth)),l(),v(e.getButtonText(t.isAuthorized,t.cta.btnText,t.cta.btnTextNoAuth))}}function wt(i,h){if(i&1&&(b(0,"form",0),x(1,Ft,10,8),x(2,vt,2,2,"button",1),d()),i&2){let t=a();y("formGroup",h),l(),P(t.isAuthorized&&t.globals?1:-1),l(),P(t.cta&&t.isAuthorized!==void 0&&t.isAuthorized!==null?2:-1)}}function At(i,h){if(i&1&&(x(0,wt,3,3,"form",0),c(1,"async")),i&2){let t,e=a();P((t=s(1,1,e.form$))?0:-1,t)}}var Mt=1,D=(()=>{class i extends gt{constructor(){super(r(O),r(f),r(u)),this.destroyRef=r(V),this._router=r(O),this._store$=r(ot),this._errorFacade=r(nt),this._printBoxStore$=r(I),this._platformService=r(f),this._window=r(u),this.pricing$=this._store$.select(C.pricing),this.defaultProduct$=this._store$.select(C.cmsData.defaultProduct),this.callToActionArea$=this._store$.select(C.cmsData.callToActionArea),this.isAuthorized$=this._store$.select(at),this.routeCreateQueryParams$=this._store$.select(C.routeCreateQueryParams),this.globals$=this._store$.select(C.globals),this.form$=this._printBoxStore$.select(t=>t.form)}ngOnInit(){G([this.defaultProduct$,this.pricing$]).pipe(T(([t,e])=>!!t&&!!e),it(this.destroyRef)).subscribe(([t,e])=>{(e?.length??0)>0&&(this.quantityValues$=this._printBoxStore$.selectMaterialSelectValues$(e),this.colors$=this._printBoxStore$.selectColorRadioItems(e),this.colorName$=this._printBoxStore$.selectColorName(e),this.initForm(t?.name))})}initForm(t){this.colors$?.pipe(T(e=>(e?.length??0)>0),z(e=>e?.[0]?.value),_(1),j("not set")).subscribe(e=>this._printBoxStore$.patchState({form:new w({name:new p(t),qty:new p(Mt),printboxcolorlig:new p(e)})}))}addToCart(){this._printBoxStore$.select(t=>t.formLock).pipe(_(1)).subscribe(t=>{t||this._printBoxStore$.addToCart()})}static{this.\u0275fac=function(e){return new(e||i)}}static{this.\u0275cmp=W({type:i,selectors:[["mpix-product-form-print-box"]],features:[J([I]),H],decls:6,vars:17,consts:[[3,"formGroup"],["mat-flat-button","","color","primary",1,"action","fs-create-btn",3,"title"],[1,"option"],[1,"option-headline"],["formControlName","printboxcolorlig","fsItemKey","color",3,"list"],["formControlName","qty",3,"options"],["mat-flat-button","","color","primary",1,"action","fs-create-btn",3,"click","title"]],template:function(e,o){if(e&1&&(x(0,At,2,3),c(1,"async"),c(2,"async"),c(3,"async"),c(4,"async"),c(5,"async")),e&2){let n;P((n=X(11,St,s(1,1,o.callToActionArea$),s(2,3,o.globals$),s(3,5,o.routeCreateQueryParams$),s(4,7,o.isAuthorized$),s(5,9,o.colorName$)))?0:-1,n)}},dependencies:[Ct,_t,st,ct,ft,pt,mt,lt,ut,dt,Z],styles:[".option[_ngcontent-%COMP%]{margin-bottom:1rem;text-align:left}.option[_ngcontent-%COMP%]:last-child{margin-bottom:2rem}.option-v-thin[_ngcontent-%COMP%]{margin-bottom:.5rem}.option-v-thin[_ngcontent-%COMP%]:last-child{margin-bottom:.5rem}.icon-sizes[_ngcontent-%COMP%]{margin-bottom:1rem;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:.5rem}@media(min-width:640px){.icon-sizes[_ngcontent-%COMP%]{gap:1rem}}.option-headline[_ngcontent-%COMP%]{margin-bottom:.5rem;display:inline-block;font-size:.875rem;line-height:1.25rem;font-weight:500;text-transform:uppercase;--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity))}.price[_ngcontent-%COMP%]{display:flex;align-items:center}.price[_ngcontent-%COMP%] .currency[_ngcontent-%COMP%], .price[_ngcontent-%COMP%] .amount[_ng
1content-%COMP%]{font-weight:400}.price[_ngcontent-%COMP%] .currency[_ngcontent-%COMP%]{margin-right:.25rem;font-size:.875rem;line-height:1.25rem}@media(min-width:975px){.price[_ngcontent-%COMP%] .currency[_ngcontent-%COMP%]{font-size:1rem;line-height:1.5rem}}.price[_ngcontent-%COMP%] .amount[_ngcontent-%COMP%]{margin-right:.5rem;font-size:1.25rem;line-height:1.75rem}@media(min-width:975px){.price[_ngcontent-%COMP%] .amount[_ngcontent-%COMP%]{margin-right:1rem;font-size:1.5rem;line-height:2rem}}.price[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{margin-top:.5rem;font-size:.875rem;line-height:1.25rem}@media(min-width:975px){.price[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{margin-top:.75rem}}.price[_ngcontent-%COMP%] .fs-view-all-pricing[_ngcontent-%COMP%]{margin-top:0}",".action[_ngcontent-%COMP%]{margin-top:.5rem;display:inline-block;width:100%;max-width:24rem}"],changeDetection:0})}}return i})();var ve=(()=>{class i{static{this.\u0275fac=function(e){return new(e||i)}}static{this.\u0275mod=U({type:i})}static{this.\u0275inj=E({providers:[M],imports:[rt.forChild([{component:D,path:"",pathMatch:"full"}]),D]})}}return i})();export{ve as ProductFormPrintBoxModule};
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.