@vendure/admin-ui-plugin 3.0.1 → 3.0.3

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.
@@ -24,7 +24,7 @@
24
24
  totalItems
25
25
  }
26
26
  }
27
- `;class K{constructor(n){this.dataService=n,this.addCouponCode=new e._w7,this.removeCouponCode=new e._w7,this.couponCodeInput$=new Q.E}ngOnInit(){this.availableCouponCodes$=(0,et.W)(this.couponCodeInput$.pipe((0,Ne.o)(200),(0,tt.a)(),(0,f.G)(n=>this.dataService.query(d.MNc,{options:{take:10,skip:0,filter:{couponCode:{contains:n}}}}).single$),(0,R.k)(({promotions:n})=>n.items.map(t=>({code:t.couponCode,promotionName:t.name}))),(0,nt.W)([]))),this.control||(this.control=new l.yM(this.couponCodes??[]))}static#e=this.\u0275fac=function(t){return new(t||K)(e.GI1(d.Aj0))};static#t=this.\u0275cmp=e.In1({type:K,selectors:[["vdr-coupon-code-selector"]],inputs:{couponCodes:"couponCodes",control:"control"},outputs:{addCouponCode:"addCouponCode",removeCouponCode:"removeCouponCode"},decls:3,vars:9,consts:[["appendTo","body","bindLabel","code","bindValue","code","typeToSearchText","",3,"items","addTag","multiple","hideSelected","minTermLength","typeahead","formControl","add","remove"],["ng-option-tmp",""],[1,"flex","items-center"],[1,"mr-1"]],template:function(t,o){1&t&&(e.I0R(0,"ng-select",0),e.qCj("add",function(a){return o.addCouponCode.emit(a.code)})("remove",function(a){return o.removeCouponCode.emit(null==a.value?null:a.value.code)}),e.wVc(1,"async"),e.yuY(2,Yt,5,2,"ng-template",1),e.C$Y()),2&t&&e.E7m("items",e.kDX(1,7,o.availableCouponCodes$))("addTag",!1)("multiple",!0)("hideSelected",!0)("minTermLength",2)("typeahead",o.couponCodeInput$)("formControl",o.control)},dependencies:[l.ue,l.ug,S.UT,S.kn,D.g,m.a],changeDetection:0})}var At=s(64),x=s(9128),Vt=s(8904),v=s(7980),de=s(7616),se=s(1485),rt=s(4648),ot=s(1760),it=s(660);function Nt(r,n){1&r&&(e.OEk(0),e.wVc(1,"translate")),2&r&&e.cNF(e.kDX(1,1,"order.select-address"))}function Xt(r,n){if(1&r&&(e.I0R(0,"vdr-radio-card",7),e.wR5(1,"vdr-formatted-address",8),e.C$Y()),2&r){const t=n.$implicit;e.E7m("item",t),e.yG2(),e.E7m("address",t)}}function Lt(r,n){if(1&r){const t=e.KQA();e.I0R(0,"clr-tab-content")(1,"vdr-radio-card-fieldset",5),e.qCj("selectItem",function(i){e.usT(t);const a=e.GaO(3);return e.CGJ(a.selectedAddress=i)}),e.yuY(2,Xt,2,2,"vdr-radio-card",6),e.C$Y()()}if(2&r){const t=e.GaO(2).ngIf,o=e.GaO();e.yG2(),e.E7m("idFn",o.addressIdFn)("selectedItemId",o.selectedAddress&&o.addressIdFn(o.selectedAddress)),e.yG2(),e.E7m("ngForOf",t)}}function jt(r,n){if(1&r){const t=e.KQA();e.I0R(0,"clr-tab")(1,"button",3),e.OEk(2),e.wVc(3,"translate"),e.C$Y(),e.yuY(4,Lt,3,3,"ng-template",4),e.iHE("clrIfActiveChange",function(i){e.usT(t);const a=e.GaO(2);return e.kNx(a.useExisting,i)||(a.useExisting=i),e.CGJ(i)}),e.C$Y()}if(2&r){const t=e.GaO(2);e.yG2(2),e.cNF(e.kDX(3,2,"order.existing-address")),e.yG2(2),e.E7m("clrIfActive",t.useExisting)}}function Qt(r,n){if(1&r&&(e.I0R(0,"clr-tab-content"),e.wR5(1,"vdr-address-form",9),e.wVc(2,"async"),e.C$Y()),2&r){const t=e.GaO(2);e.yG2(),e.E7m("formGroup",t.addressForm)("availableCountries",e.kDX(2,2,t.availableCountries$))}}function Kt(r,n){if(1&r){const t=e.KQA();e.I0R(0,"clr-tabs"),e.yuY(1,jt,5,4,"clr-tab",1),e.I0R(2,"clr-tab")(3,"button",3),e.OEk(4),e.wVc(5,"translate"),e.C$Y(),e.yuY(6,Qt,3,4,"ng-template",4),e.iHE("clrIfActiveChange",function(i){e.usT(t);const a=e.GaO();return e.kNx(a.createNew,i)||(a.createNew=i),e.CGJ(i)}),e.C$Y()()}if(2&r){const t=n.ngIf,o=e.GaO();e.yG2(),e.E7m("ngIf",o.customerId&&t.length),e.yG2(3),e.cNF(e.kDX(5,3,"customer.create-new-address")),e.yG2(2),e.E7m("clrIfActive",o.createNew)}}function qt(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",10),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.cancel())}),e.OEk(1),e.wVc(2,"translate"),e.C$Y(),e.I0R(3,"button",11),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.select())}),e.OEk(4),e.wVc(5,"translate"),e.C$Y()}if(2&r){const t=e.GaO();e.yG2(),e.cNF(e.kDX(2,3,"common.cancel")),e.yG2(2),e.E7m("disabled",t.useExisting&&!t.selectedAddress||t.createNew&&t.addressForm.invalid),e.yG2(),e.oRS(" ",e.kDX(5,5,"common.okay")," ")}}class q{constructor(n,t){this.dataService=n,this.formBuilder=t,this.useExisting=!0,this.createNew=!1}ngOnInit(){this.addressForm=this.formBuilder.group({fullName:[this.currentAddress?.fullName??""],company:[this.currentAddress?.company??""],streetLine1:[this.currentAddress?.streetLine1??"",l.AQ.required],streetLine2:[this.currentAddress?.streetLine2??""],city:[this.currentAddress?.city??"",l.AQ.required],province:[this.currentAddress?.province??""],postalCode:[this.currentAddress?.postalCode??"",l.AQ.required],countryCode:[this.currentAddress?.countryCode??"",l.AQ.required],phoneNumber:[this.currentAddress?.phoneNumber??""]}),this.useExisting=!!this.customerId,this.addresses$=this.customerId?this.dataService.query(d.sTc,{customerId:this.customerId}).mapSingle(({customer:n})=>n?.addresses??[]).pipe((0,de.y)(n=>{this.currentAddress&&(this.selectedAddress=n.find(t=>t.streetLine1===this.currentAddress?.streetLine1&&t.postalCode===this.currentAddress?.postalCode)),0===n.length&&(this.createNew=!0,this.useExisting=!1)})):(0,v.of)([]),this.availableCountries$=this.dataService.settings.getAvailableCountries().mapSingle(({countries:n})=>n.items)}trackByFn(n){return n.id}addressIdFn(n){return n.streetLine1+n.postalCode}cancel(){this.resolveWith()}select(){if(this.useExisting&&this.selectedAddress&&this.resolveWith({...(0,Vt.g)(this.selectedAddress,["fullName","company","streetLine1","streetLine2","city","province","phoneNumber","postalCode"]),countryCode:this.selectedAddress.country.code}),this.createNew&&this.addressForm.valid){const n=this.addressForm.value;this.resolveWith(n)}}static#e=this.\u0275fac=function(t){return new(t||q)(e.GI1(d.Aj0),e.GI1(l.KE))};static#t=this.\u0275cmp=e.In1({type:q,selectors:[["vdr-select-address-dialog"]],decls:4,vars:3,consts:[["vdrDialogTitle",""],[4,"ngIf"],["vdrDialogButtons",""],["clrTabLink",""],[3,"clrIfActive","clrIfActiveChange"],[1,"block","mt-4",3,"idFn","selectedItemId","selectItem"],[3,"item",4,"ngFor","ngForOf"],[3,"item"],[3,"address"],[3,"formGroup","availableCountries"],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"disabled","click"]],template:function(t,o){1&t&&(e.yuY(0,Nt,2,3,"ng-template",0)(1,Kt,7,5,"clr-tabs",1),e.wVc(2,"async"),e.yuY(3,qt,6,7,"ng-template",2)),2&t&&(e.yG2(),e.E7m("ngIf",e.kDX(2,1,o.addresses$)))},dependencies:[_.gxU,_.o1y,_._IX,_.k1p,_.wfG,_.M9m,_.ULu,m.ay,m.u_,l.u,l.uW,E.E,b.a,se.o,rt.w,ot.W,it.e,m.a,p.sD],changeDetection:0})}var at=s(9923);function Ht(r,n){if(1&r&&(e.OEk(0),e.wVc(1,"translate")),2&r){const t=e.GaO();e.cNF(e.kDX(1,1,t.title))}}function Jt(r,n){1&r&&e.C_f(0)}function Bt(r,n){if(1&r){const t=e.KQA();e.I0R(0,"vdr-form-field",7),e.wVc(1,"translate"),e.I0R(2,"textarea",8),e.iHE("ngModelChange",function(i){e.usT(t);const a=e.GaO(2);return e.kNx(a.note,i)||(a.note=i),e.CGJ(i)}),e.C$Y()()}if(2&r){const t=e.GaO(2);e.E7m("label",e.kDX(1,2,"common.add-note")),e.yG2(2),e.OKB("ngModel",t.note)}}function Wt(r,n){if(1&r&&(e.SAx(0),e.yuY(1,Jt,1,0,"ng-container",5)(2,Bt,3,4,"vdr-form-field",6),e.k70()),2&r){const t=e.GaO(),o=e.Gew(4);e.yG2(),e.E7m("ngTemplateOutlet",o),e.yG2(),e.E7m("ngIf",t.includeNoteInput)}}function Ut(r,n){1&r&&e.C_f(0)}function zt(r,n){if(1&r&&(e.I0R(0,"clr-tab-content")(1,"div",12),e.yuY(2,Ut,1,0,"ng-container",5),e.C$Y()()),2&r){e.GaO(2);const t=e.Gew(4);e.yG2(2),e.E7m("ngTemplateOutlet",t)}}function Zt(r,n){if(1&r&&(e.I0R(0,"clr-tab-content")(1,"form",13)(2,"vdr-form-field",14),e.wVc(3,"translate"),e.wR5(4,"input",15),e.C$Y(),e.I0R(5,"vdr-form-field",16),e.wVc(6,"translate"),e.wR5(7,"input",17),e.C$Y(),e.I0R(8,"vdr-form-field",18),e.wVc(9,"translate"),e.wR5(10,"input",19),e.C$Y(),e.I0R(11,"vdr-form-field",20),e.wVc(12,"translate"),e.wR5(13,"input",21),e.C$Y(),e.I0R(14,"vdr-form-field",22),e.wVc(15,"translate"),e.wR5(16,"input",23),e.C$Y()()()),2&r){const t=e.GaO(3);e.yG2(),e.E7m("formGroup",t.customerForm),e.yG2(),e.E7m("label",e.kDX(3,6,"customer.title")),e.yG2(3),e.E7m("label",e.kDX(6,8,"customer.first-name")),e.yG2(3),e.E7m("label",e.kDX(9,10,"customer.last-name")),e.yG2(3),e.E7m("label",e.kDX(12,12,"customer.email-address")),e.yG2(3),e.E7m("label",e.kDX(15,14,"customer.phone-number"))}}function en(r,n){if(1&r){const t=e.KQA();e.I0R(0,"clr-tab")(1,"button",10),e.OEk(2),e.wVc(3,"translate"),e.C$Y(),e.yuY(4,Zt,17,16,"ng-template",11),e.iHE("clrIfActiveChange",function(i){e.usT(t);const a=e.GaO(2);return e.kNx(a.createNew,i)||(a.createNew=i),e.CGJ(i)}),e.C$Y()}if(2&r){const t=e.GaO(2);e.yG2(2),e.cNF(e.kDX(3,2,"customer.create-new-customer")),e.yG2(2),e.E7m("clrIfActive",t.createNew)}}function tn(r,n){if(1&r){const t=e.KQA();e.I0R(0,"clr-tabs",9)(1,"clr-tab")(2,"button",10),e.OEk(3),e.wVc(4,"translate"),e.C$Y(),e.yuY(5,zt,3,1,"ng-template",11),e.iHE("clrIfActiveChange",function(i){e.usT(t);const a=e.GaO();return e.kNx(a.useExisting,i)||(a.useExisting=i),e.CGJ(i)}),e.C$Y(),e.yuY(6,en,5,4,"clr-tab",1),e.C$Y()}if(2&r){const t=e.GaO();e.yG2(3),e.cNF(e.kDX(4,3,"order.existing-customer")),e.yG2(2),e.E7m("clrIfActive",t.useExisting),e.yG2(),e.E7m("ngIf",t.canCreateNew)}}function nn(r,n){if(1&r&&(e.I0R(0,"span",27),e.wR5(1,"clr-icon",28),e.I0R(2,"span",29),e.OEk(3),e.C$Y(),e.I0R(4,"vdr-chip"),e.OEk(5),e.C$Y()()),2&r){const t=n.item;e.yG2(3),e.CAO("",t.firstName," ",t.lastName,""),e.yG2(2),e.cNF(t.emailAddress)}}function rn(r,n){if(1&r&&(e.I0R(0,"span",27),e.wR5(1,"clr-icon",28),e.I0R(2,"span",29),e.OEk(3),e.C$Y(),e.I0R(4,"vdr-chip"),e.OEk(5),e.C$Y()()),2&r){const t=n.item;e.yG2(3),e.CAO("",t.firstName," ",t.lastName,""),e.yG2(2),e.cNF(t.emailAddress)}}function on(r,n){if(1&r){const t=e.KQA();e.I0R(0,"ng-select",24),e.iHE("ngModelChange",function(i){e.usT(t);const a=e.GaO();return e.kNx(a.selectedCustomer,i)||(a.selectedCustomer=i),e.CGJ(i)}),e.wVc(1,"async"),e.yuY(2,nn,6,3,"ng-template",25)(3,rn,6,3,"ng-template",26),e.C$Y()}if(2&r){const t=e.GaO();e.E7m("items",e.kDX(1,9,t.customers$))("addTag",!1)("multiple",!0)("hideSelected",!0)("trackByFn",t.trackByFn)("minTermLength",2)("loading",t.isLoading)("typeahead",t.input$),e.OKB("ngModel",t.selectedCustomer)}}function an(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",30),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.cancel())}),e.OEk(1),e.wVc(2,"translate"),e.C$Y(),e.I0R(3,"button",31),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.select())}),e.OEk(4),e.wVc(5,"translate"),e.C$Y()}if(2&r){const t=e.GaO();e.yG2(),e.cNF(e.kDX(2,3,"common.cancel")),e.yG2(2),e.E7m("disabled",t.useExisting&&0===t.selectedCustomer.length||t.createNew&&t.customerForm.invalid),e.yG2(),e.oRS(" ",e.kDX(5,5,"common.okay")," ")}}class H{constructor(n,t){this.dataService=n,this.formBuilder=t,this.canCreateNew=!0,this.includeNoteInput=!1,this.title=(0,u.s)("order.set-customer-for-order"),this.isLoading=!1,this.input$=new Q.E,this.selectedCustomer=[],this.useExisting=!0,this.createNew=!1,this.note="",this.customerForm=this.formBuilder.group({title:"",firstName:["",l.AQ.required],lastName:["",l.AQ.required],phoneNumber:"",emailAddress:["",[l.AQ.required,l.AQ.email]]})}ngOnInit(){this.customers$=(0,et.W)((0,v.of)([]),this.input$.pipe((0,Ne.o)(200),(0,tt.a)(),(0,de.y)(()=>this.isLoading=!0),(0,f.G)(n=>this.dataService.customer.getCustomerList(10,0,n).mapStream(({customers:t})=>t.items).pipe((0,at.a)(()=>(0,v.of)([])),(0,de.y)(()=>this.isLoading=!1)))))}trackByFn(n){return n.id}cancel(){this.resolveWith()}select(){if(this.useExisting&&1===this.selectedCustomer.length)this.resolveWith({...this.selectedCustomer[0],note:this.note});else if(this.createNew&&this.customerForm.valid){const n=this.customerForm.value;this.resolveWith({...n,note:this.note})}}static#e=this.\u0275fac=function(t){return new(t||H)(e.GI1(d.Aj0),e.GI1(l.KE))};static#t=this.\u0275cmp=e.In1({type:H,selectors:[["vdr-select-customer-dialog"]],decls:6,vars:2,consts:[["vdrDialogTitle",""],[4,"ngIf"],["class","pt-1",4,"ngIf"],["customerSelect",""],["vdrDialogButtons",""],[4,"ngTemplateOutlet"],["class","mt-4",3,"label",4,"ngIf"],[1,"mt-4",3,"label"],[3,"ngModel","ngModelChange"],[1,"pt-1"],["clrTabLink",""],[3,"clrIfActive","clrIfActiveChange"],[1,"mt-4"],[3,"formGroup"],["for","title",3,"label"],["id","title","type","text","formControlName","title"],["for","firstName",3,"label"],["id","firstName","type","text","formControlName","firstName"],["for","lastName",3,"label"],["id","lastName","type","text","formControlName","lastName"],["for","emailAddress",3,"label"],["id","emailAddress","type","text","formControlName","emailAddress"],["for","phoneNumber",3,"label"],["id","phoneNumber","type","text","formControlName","phoneNumber"],["appendTo","body","bindLabel","name",3,"items","addTag","multiple","hideSelected","trackByFn","minTermLength","loading","typeahead","ngModel","ngModelChange"],["ng-label-tmp",""],["ng-option-tmp",""],[1,"item-row"],["shape","user",1,"is-solid"],[1,"mx-1"],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"disabled","click"]],template:function(t,o){1&t&&e.yuY(0,Ht,2,3,"ng-template",0)(1,Wt,3,2,"ng-container",1)(2,tn,7,5,"clr-tabs",2)(3,on,4,11,"ng-template",null,3,e.gJz)(5,an,6,7,"ng-template",4),2&t&&(e.yG2(),e.E7m("ngIf",!o.canCreateNew),e.yG2(),e.E7m("ngIf",o.canCreateNew))},dependencies:[_.o3d,_.gxU,_.o1y,_._IX,_.k1p,_.wfG,_.M9m,_.ULu,m.u_,m.XV,l.sz,l.ot,l.ue,l.u,l._G,l.uW,l.Wo,S.UT,S.kn,S.Ar,D.g,P._,C.w,E.E,b.a,m.a,p.sD],styles:[".item-row[_ngcontent-%COMP%]{display:flex;align-items:center}clr-tabs[_ngcontent-%COMP%]{display:block}"],changeDetection:0})}var O=s(2524),ce=s(7196);function ln(r,n){1&r&&(e.OEk(0),e.wVc(1,"translate")),2&r&&e.cNF(e.kDX(1,1,"order.select-shipping-method"))}function dn(r,n){if(1&r&&e.wR5(0,"vdr-object-tree",9),2&r){const t=e.GaO().$implicit;e.E7m("value",t.metadata)}}function sn(r,n){if(1&r&&(e.I0R(0,"vdr-radio-card",4)(1,"div",5)(2,"vdr-labeled-data",6),e.wVc(3,"translate"),e.OEk(4),e.C$Y(),e.I0R(5,"div",7)(6,"vdr-labeled-data",6),e.wVc(7,"translate"),e.OEk(8),e.wVc(9,"localeCurrency"),e.C$Y(),e.I0R(10,"vdr-labeled-data",6),e.wVc(11,"translate"),e.OEk(12),e.wVc(13,"localeCurrency"),e.C$Y()(),e.yuY(14,dn,1,1,"vdr-object-tree",8),e.C$Y()()),2&r){const t=n.$implicit,o=e.GaO();e.E7m("item",t),e.yG2(2),e.E7m("label",e.kDX(3,8,"settings.shipping-method")),e.yG2(2),e.oRS(" ",t.name," "),e.yG2(2),e.E7m("label",e.kDX(7,10,"common.price")),e.yG2(2),e.oRS(" ",e.g7$(9,12,t.price,o.currencyCode)," "),e.yG2(2),e.E7m("label",e.kDX(11,15,"common.price-with-tax")),e.yG2(2),e.oRS(" ",e.g7$(13,17,t.priceWithTax,o.currencyCode)," "),e.yG2(2),e.E7m("ngIf",t.metadata)}}function cn(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",10),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.cancel())}),e.OEk(1),e.wVc(2,"translate"),e.C$Y(),e.I0R(3,"button",11),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.select())}),e.OEk(4),e.wVc(5,"translate"),e.C$Y()}if(2&r){const t=e.GaO();e.yG2(),e.cNF(e.kDX(2,3,"common.cancel")),e.yG2(2),e.E7m("disabled",!t.selectedMethod),e.yG2(),e.oRS(" ",e.kDX(5,5,"common.okay")," ")}}class J{ngOnInit(){this.currentSelectionId&&(this.selectedMethod=this.eligibleShippingMethods.find(n=>n.id===this.currentSelectionId))}methodIdFn(n){return n.id}cancel(){this.resolveWith()}select(){this.selectedMethod&&this.resolveWith(this.selectedMethod.id)}static#e=this.\u0275fac=function(t){return new(t||J)};static#t=this.\u0275cmp=e.In1({type:J,selectors:[["vdr-select-shipping-method-dialog"]],decls:4,vars:3,consts:[["vdrDialogTitle",""],[3,"idFn","selectedItemId","selectItem"],[3,"item",4,"ngFor","ngForOf"],["vdrDialogButtons",""],[3,"item"],[1,"result-details"],[3,"label"],[1,"price-row"],[3,"value",4,"ngIf"],[3,"value"],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"disabled","click"]],template:function(t,o){1&t&&(e.yuY(0,ln,2,3,"ng-template",0),e.I0R(1,"vdr-radio-card-fieldset",1),e.qCj("selectItem",function(a){return o.selectedMethod=a}),e.yuY(2,sn,15,20,"vdr-radio-card",2),e.C$Y(),e.yuY(3,cn,6,7,"ng-template",3)),2&t&&(e.yG2(),e.E7m("idFn",o.methodIdFn)("selectedItemId",null==o.selectedMethod?null:o.selectedMethod.id),e.yG2(),e.E7m("ngForOf",o.eligibleShippingMethods))},dependencies:[m.ay,m.u_,E.E,b.a,O.a,ce.W,ot.W,it.e,p.sD,g.u],changeDetection:0})}var F=s(3200),mn=s(356),un=s(8256),lt=s(7724);var pn=s(8296),$=s(5032);function fn(r,n){1&r&&(e.OEk(0),e.wVc(1,"translate")),2&r&&e.cNF(e.kDX(1,1,"order.select-state"))}function gn(r,n){if(1&r&&(e.I0R(0,"option",4),e.OEk(1),e.wVc(2,"translate"),e.wVc(3,"stateI18nToken"),e.C$Y()),2&r){const t=n.$implicit;e.E7m("value",t),e.yG2(),e.oRS(" ",e.kDX(2,2,e.kDX(3,4,t))," ")}}function yn(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",7),e.qCj("click",function(){e.usT(t);const i=e.GaO(2);return e.CGJ(i.cancel())}),e.OEk(1),e.wVc(2,"translate"),e.C$Y()}2&r&&(e.yG2(),e.oRS(" ",e.kDX(2,1,"common.cancel")," "))}const Cn=r=>({state:r});function hn(r,n){if(1&r){const t=e.KQA();e.yuY(0,yn,3,3,"button",5),e.I0R(1,"button",6),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.select())}),e.OEk(2),e.wVc(3,"translate"),e.wVc(4,"translate"),e.wVc(5,"stateI18nToken"),e.C$Y()}if(2&r){const t=e.GaO();e.E7m("ngIf",t.cancellable),e.yG2(),e.E7m("disabled",!t.selectedState),e.yG2(),e.oRS(" ",e.g7$(3,3,"order.transition-to-state",e.S45(10,Cn,e.kDX(4,6,e.kDX(5,8,t.selectedState))))," ")}}class me{constructor(){this.nextStates=[],this.message="",this.selectedState=""}select(){this.selectedState&&this.resolveWith(this.selectedState)}cancel(){this.resolveWith()}static#e=this.\u0275fac=function(t){return new(t||me)};static#t=this.\u0275cmp=e.In1({type:me,selectors:[["vdr-order-state-select-dialog"]],decls:8,vars:5,consts:[["vdrDialogTitle",""],["name","state",3,"ngModel","ngModelChange"],[3,"value",4,"ngFor","ngForOf"],["vdrDialogButtons",""],[3,"value"],["type","submit","class","btn btn-secondary",3,"click",4,"ngIf"],["type","submit",1,"btn","btn-primary",3,"disabled","click"],["type","submit",1,"btn","btn-secondary",3,"click"]],template:function(t,o){1&t&&(e.yuY(0,fn,2,3,"ng-template",0),e.I0R(1,"p"),e.OEk(2),e.wVc(3,"translate"),e.C$Y(),e.I0R(4,"vdr-form-field")(5,"select",1),e.iHE("ngModelChange",function(a){return e.kNx(o.selectedState,a)||(o.selectedState=a),a}),e.yuY(6,gn,4,6,"option",2),e.C$Y()(),e.yuY(7,hn,6,12,"ng-template",3)),2&t&&(e.yG2(2),e.cNF(e.kDX(3,3,o.message)),e.yG2(3),e.OKB("ngModel",o.selectedState),e.yG2(),e.E7m("ngForOf",o.nextStates))},dependencies:[m.ay,m.u_,l.wd,l.GO,l.GC,l.ue,l._G,P._,C.w,E.E,b.a,p.sD,$.Q],changeDetection:0})}class M{constructor(n,t,o,i){this.dataService=n,this.modalService=t,this.notificationService=o,this.i18nService=i}transitionToPreModifyingState(n,t){return this.getPreModifyingState(n).pipe((0,f.G)(o=>{const i={orderId:n,nextStates:t,message:this.i18nService.translate((0,u.s)("order.unable-to-transition-to-state-try-another"),{state:o}),cancellable:!1,retry:10};return o?this.transitionToStateOrThrow(n,o).pipe((0,at.a)(a=>this.manuallyTransitionToState(i))):this.manuallyTransitionToState(i)}))}manuallyTransitionToState(n){return this.modalService.fromComponent(me,{locals:{nextStates:n.nextStates,cancellable:n.cancellable,message:n.message},closable:!1,size:"md"}).pipe((0,f.G)(t=>{if(t)return this.transitionToStateOrThrow(n.orderId,t);if(n.cancellable)return F.k;throw new Error("An order state must be selected")}),function _n(r){return(0,un.i)((n,t)=>{let o,a,i=!1;const c=()=>{o=n.subscribe((0,lt.e)(t,void 0,void 0,y=>{a||(a=new Q.E,(0,mn.Uv)(r(a)).subscribe((0,lt.e)(t,()=>o?c():i=!0))),a&&a.next(y)})),i&&(o.unsubscribe(),o=null,i=!1,c())};c()})}(t=>t.pipe((0,pn.o)(2e3),(0,x.U)(n.retry))))}getPreModifyingState(n){return this.dataService.order.getOrderHistory(n,{filter:{type:{eq:d.YjR.ORDER_STATE_TRANSITION}},sort:{createdAt:d._8$.DESC}}).mapSingle(t=>t.order).pipe((0,R.k)(t=>{const o=t?.history.items.find(i=>"Modifying"===i.data.to);if(o)return o.data.from}))}transitionToStateOrThrow(n,t){return this.dataService.order.transitionToState(n,t).pipe((0,R.k)(({transitionOrderToState:o})=>{switch(o?.__typename){case"Order":return o?.state;case"OrderStateTransitionError":throw this.notificationService.error(o?.transitionError),new Error(o?.transitionError)}}))}static#e=this.\u0275fac=function(t){return new(t||M)(e.CoB(d.Aj0),e.CoB(d.Ajm),e.CoB(d.gnT),e.CoB(d.WYg))};static#t=this.\u0275prov=e.wxM({token:M,factory:M.\u0275fac,providedIn:"root"})}var I=s(900),Xe=s(7856),Le=s(8008),ue=s(5752),Me=s(4311),je=s(6744),dt=s(6539),Ye=s(6500),st=s(5556),Qe=s(4788),Ke=s(4956),G=s(8084),ct=s(5536);function On(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",9),e.qCj("click",function(){e.usT(t);const i=e.GaO(2);return e.CGJ(i.editable=!0)}),e.wR5(1,"clr-icon",10),e.OEk(2),e.wVc(3,"translate"),e.C$Y()}2&r&&(e.yG2(2),e.oRS(" ",e.kDX(3,1,"common.edit")," "))}function vn(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",11),e.qCj("click",function(){e.usT(t);const i=e.GaO(2);return e.CGJ(i.onUpdateClick())}),e.wR5(1,"clr-icon",12),e.OEk(2),e.wVc(3,"translate"),e.C$Y()}if(2&r){const t=e.GaO(2);e.E7m("disabled",t.customFieldForm.pristine||t.customFieldForm.invalid),e.yG2(2),e.oRS(" ",e.kDX(3,2,"common.update")," ")}}function bn(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",9),e.qCj("click",function(){e.usT(t);const i=e.GaO(2);return e.CGJ(i.onCancelClick())}),e.wR5(1,"clr-icon",13),e.OEk(2),e.wVc(3,"translate"),e.C$Y()}2&r&&(e.yG2(2),e.oRS(" ",e.kDX(3,1,"common.cancel")," "))}function In(r,n){if(1&r&&(e.I0R(0,"div",1)(1,"div",2),e.OEk(2),e.wVc(3,"translate"),e.C$Y(),e.I0R(4,"div",3)(5,"div",4),e.wR5(6,"vdr-tabbed-custom-fields",5),e.C$Y()(),e.I0R(7,"div",6),e.yuY(8,On,4,3,"button",7)(9,vn,4,4,"button",8)(10,bn,4,3,"button",7),e.C$Y()()),2&r){const t=e.GaO();e.yG2(2),e.oRS(" ",e.kDX(3,10,"common.custom-fields")," "),e.yG2(3),e.eAK("editable",t.editable),e.yG2(),e.E7m("customFields",t.customFieldsConfig)("customFieldsFormGroup",t.customFieldForm)("readonly",!t.editable)("compact",!0),e.yG2(2),e.E7m("ngIf",!t.editable),e.yG2(),e.E7m("ngIf",t.editable),e.yG2(),e.E7m("ngIf",t.editable)}}class _e{constructor(n,t){this.formBuilder=n,this.modalService=t,this.customFieldsConfig=[],this.customFieldValues={},this.updateClick=new e._w7,this.editable=!1}ngOnInit(){this.customFieldForm=this.formBuilder.group({});for(const n of this.customFieldsConfig)this.customFieldForm.addControl(n.name,this.formBuilder.control(this.customFieldValues[n.name]))}onUpdateClick(){this.updateClick.emit(this.customFieldForm.value),this.customFieldForm.markAsPristine(),this.editable=!1}onCancelClick(){this.customFieldForm.dirty?this.modalService.dialog({title:(0,u.s)("catalog.confirm-cancel"),buttons:[{type:"secondary",label:(0,u.s)("common.keep-editing")},{type:"danger",label:(0,u.s)("common.discard-changes"),returnValue:!0}]}).subscribe(n=>{n&&(this.customFieldForm.reset(),this.customFieldForm.markAsPristine(),this.editable=!1)}):this.editable=!1}static#e=this.\u0275fac=function(t){return new(t||_e)(e.GI1(l.KE),e.GI1(d.Ajm))};static#t=this.\u0275cmp=e.In1({type:_e,selectors:[["vdr-order-custom-fields-card"]],inputs:{customFieldsConfig:"customFieldsConfig",customFieldValues:"customFieldValues"},outputs:{updateClick:"updateClick"},decls:1,vars:1,consts:[["class","card",4,"ngIf"],[1,"card"],[1,"card-header"],[1,"card-block"],[1,"card-text","custom-field-form"],["entityName","Order",3,"customFields","customFieldsFormGroup","readonly","compact"],[1,"card-footer"],["class","btn btn-sm btn-secondary",3,"click",4,"ngIf"],["class","btn btn-sm btn-primary",3,"disabled","click",4,"ngIf"],[1,"btn","btn-sm","btn-secondary",3,"click"],["shape","pencil"],[1,"btn","btn-sm","btn-primary",3,"disabled","click"],["shape","check"],["shape","times"]],template:function(t,o){1&t&&e.yuY(0,In,11,12,"div",0),2&t&&e.E7m("ngIf",o.customFieldsConfig.length)},dependencies:[_.o3d,m.u_,ct.w,p.sD],styles:["vdr-custom-field-control[_ngcontent-%COMP%]{margin-bottom:6px;display:block}.custom-field-form[_ngcontent-%COMP%] .clr-control-label{color:var(--color-grey-400)}.custom-field-form.editable[_ngcontent-%COMP%] .clr-control-label{color:inherit}"],changeDetection:0})}var k=s(656),B=s(8168),W=s(3428),U=s(4024),Pe=s(7800),mt=s(4944),A=s(9604);function Gn(r,n){1&r&&e.wR5(0,"clr-icon",9)}function En(r,n){1&r&&e.wR5(0,"clr-icon",10)}function Rn(r,n){1&r&&e.wR5(0,"clr-icon",11)}function kn(r,n){1&r&&(e.I0R(0,"label",12),e.OEk(1),e.wVc(2,"translate"),e.C$Y()),2&r&&(e.yG2(),e.oRS(" ",e.kDX(2,1,"order.line-fulfillment-all")," "))}const wn=(r,n)=>({total:r,count:n});function Tn(r,n){if(1&r&&(e.I0R(0,"label",12),e.OEk(1),e.wVc(2,"translate"),e.C$Y()),2&r){const t=e.GaO(2);e.yG2(),e.oRS(" ",e.g7$(2,1,"order.line-fulfillment-partial",e.IBC(4,wn,t.line.quantity,t.fulfilledCount))," ")}}function Sn(r,n){1&r&&(e.I0R(0,"label",12),e.OEk(1),e.wVc(2,"translate"),e.C$Y()),2&r&&(e.yG2(),e.oRS(" ",e.kDX(2,1,"order.line-fulfillment-none")," "))}function Dn(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",15),e.wVc(1,"translate"),e.OEk(2),e.C$Y()),2&r){const t=e.GaO().$implicit;e.E7m("label",e.kDX(1,2,"order.tracking-code")),e.yG2(2),e.oRS(" ",t.fulfillment.trackingCode," ")}}const xn=r=>({count:r});function Fn(r,n){if(1&r&&(e.I0R(0,"div",13)(1,"div",14),e.OEk(2),e.wVc(3,"translate"),e.wVc(4,"translate"),e.C$Y(),e.I0R(5,"vdr-labeled-data",15),e.wVc(6,"translate"),e.OEk(7),e.wVc(8,"localeDate"),e.C$Y(),e.I0R(9,"vdr-labeled-data",15),e.wVc(10,"translate"),e.OEk(11),e.C$Y(),e.yuY(12,Dn,3,4,"vdr-labeled-data",16),e.C$Y()),2&r){const t=n.$implicit;e.yG2(2),e.MjK(" ",e.kDX(3,8,"order.fulfillment")," #",t.fulfillment.id," (",e.g7$(4,10,"order.item-count",e.S45(20,xn,t.count)),") "),e.yG2(3),e.E7m("label",e.kDX(6,13,"common.created-at")),e.yG2(2),e.oRS(" ",e.g7$(8,15,t.fulfillment.createdAt,"medium")," "),e.yG2(2),e.E7m("label",e.kDX(10,18,"order.fulfillment-method")),e.yG2(2),e.oRS(" ",t.fulfillment.method," "),e.yG2(),e.E7m("ngIf",t.fulfillment.trackingCode)}}function $n(r,n){if(1&r&&(e.I0R(0,"vdr-dropdown",1)(1,"button",2),e.yuY(2,Gn,1,0,"clr-icon",3)(3,En,1,0,"clr-icon",4)(4,Rn,1,0,"clr-icon",5),e.C$Y(),e.I0R(5,"vdr-dropdown-menu",6),e.yuY(6,kn,3,3,"label",7)(7,Tn,3,7,"label",7)(8,Sn,3,3,"label",7)(9,Fn,13,22,"div",8),e.C$Y()()),2&r){const t=e.GaO();e.yG2(2),e.E7m("ngIf","full"===t.fulfillmentStatus),e.yG2(),e.E7m("ngIf","partial"===t.fulfillmentStatus),e.yG2(),e.E7m("ngIf","none"===t.fulfillmentStatus),e.yG2(2),e.E7m("ngIf","full"===t.fulfillmentStatus),e.yG2(),e.E7m("ngIf","partial"===t.fulfillmentStatus),e.yG2(),e.E7m("ngIf","none"===t.fulfillmentStatus),e.yG2(),e.E7m("ngForOf",t.fulfillments)}}class z{constructor(){this.fulfilledCount=0,this.fulfillments=[]}ngOnChanges(n){this.line&&(this.fulfilledCount=this.getDeliveredCount(this.line),this.fulfillmentStatus=this.getFulfillmentStatus(this.fulfilledCount,this.line.quantity),this.fulfillments=this.getFulfillments(this.line))}getDeliveredCount(n){return n.fulfillmentLines?.reduce((t,o)=>t+o.quantity,0)??0}getFulfillmentStatus(n,t){return n===t?"full":0<n&&n<t?"partial":"none"}getFulfillments(n){return n.fulfillmentLines?.map(t=>{const o=this.allOrderFulfillments?.find(i=>i.id===t.fulfillmentId);if(o)return{count:t.quantity,fulfillment:o}}).filter(h.notNullOrUndefined)??[]}static#e=this.\u0275fac=function(t){return new(t||z)};static#t=this.\u0275cmp=e.In1({type:z,selectors:[["vdr-line-fulfillment"]],inputs:{line:"line",allOrderFulfillments:"allOrderFulfillments",orderState:"orderState"},features:[e.SYr],decls:1,vars:1,consts:[["class","search-settings-menu",4,"ngIf"],[1,"search-settings-menu"],["type","button","vdrDropdownTrigger","",1,"icon-button"],["class","item-fulfilled","shape","check-circle",4,"ngIf"],["class","item-partially-fulfilled","shape","check-circle",4,"ngIf"],["class","item-not-fulfilled","shape","exclamation-circle",4,"ngIf"],["vdrPosition","bottom-right"],["class","dropdown-header",4,"ngIf"],["class","fulfillment-detail",4,"ngFor","ngForOf"],["shape","check-circle",1,"item-fulfilled"],["shape","check-circle",1,"item-partially-fulfilled"],["shape","exclamation-circle",1,"item-not-fulfilled"],[1,"dropdown-header"],[1,"fulfillment-detail"],[1,"fulfillment-title"],[3,"label"],[3,"label",4,"ngIf"]],template:function(t,o){1&t&&e.yuY(0,$n,10,7,"vdr-dropdown",0),2&t&&e.E7m("ngIf",o.fulfilledCount||"PartiallyDelivered"===o.orderState)},dependencies:[_.o3d,_.ojz,m.ay,m.u_,B.i,W.m,U.q,O.a,p.sD,A.m],styles:[".item-fulfilled[_ngcontent-%COMP%]{color:var(--color-success-700)}.item-partially-fulfilled[_ngcontent-%COMP%]{color:var(--color-warning-700)}.item-not-fulfilled[_ngcontent-%COMP%]{color:var(--color-error-700)}.fulfillment-detail[_ngcontent-%COMP%]{margin:6px 12px}.fulfillment-detail[_ngcontent-%COMP%]:not(:last-of-type){border-bottom:1px dashed var(--color-component-border-200)}"],changeDetection:0})}var ut=s(6019);const Mn=r=>({count:r});function Yn(r,n){if(1&r&&(e.I0R(0,"span",1),e.wVc(1,"translate"),e.wR5(2,"clr-icon",2),e.C$Y()),2&r){const t=e.GaO();e.E7m("title",e.g7$(1,1,"order.refunded-count",e.S45(4,Mn,t.getRefundedCount())))}}class V{getRefundedCount(){return(this.payments?.reduce((t,o)=>[...t,...o.refunds],[]).filter(t=>"Failed"!==t.state).reduce((t,o)=>[...t,...o.lines],[])??[]).filter(t=>t.orderLineId===this.line.id).reduce((t,o)=>t+o.quantity,0)}static#e=this.\u0275fac=function(t){return new(t||V)};static#t=this.\u0275cmp=e.In1({type:V,selectors:[["vdr-line-refunds"]],inputs:{line:"line",payments:"payments"},decls:1,vars:1,consts:[[3,"title",4,"ngIf"],[3,"title"],["shape","redo","dir","down",1,"is-solid"]],template:function(t,o){1&t&&e.yuY(0,Yn,3,6,"span",0),2&t&&e.E7m("ngIf",o.getRefundedCount())},dependencies:[_.o3d,m.u_,ut.CM,p.sD],styles:["[_nghost-%COMP%]{color:var(--color-error-500)}"],changeDetection:0})}class N extends d.Mrq{constructor(){super(...arguments),this.orderable=!1}static#e=this.\u0275fac=(()=>{let n;return function(o){return(n||(n=e.otF(N)))(o||N)}})();static#t=this.\u0275cmp=e.In1({type:N,selectors:[["vdr-order-total-column"]],exportAs:["row"],features:[e.eg9],decls:0,vars:0,template:function(t,o){},encapsulation:2})}var Pn=s(3508),An=s(9508),Vn=s(6832),Nn=s(288),Xn=s(9076);function Ln(r,n){if(1&r){const t=e.KQA();e.I0R(0,"th",18)(1,"input",19),e.qCj("change",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.onToggleAllClick())}),e.C$Y()()}if(2&r){const t=e.GaO();e.yG2(),e.E7m("checked",null==t.selectionManager?null:t.selectionManager.areAllCurrentItemsSelected())}}function jn(r,n){1&r&&e.wR5(0,"clr-icon",29)}function Qn(r,n){1&r&&e.wR5(0,"clr-icon",30)}function Kn(r,n){1&r&&e.wR5(0,"clr-icon",31)}function qn(r,n){if(1&r&&(e.I0R(0,"div",32),e.OEk(1),e.C$Y()),2&r){const t=e.GaO().ngIf;e.yG2(),e.cNF(t.sortOrder)}}function Hn(r,n){if(1&r){const t=e.KQA();e.I0R(0,"div",23)(1,"button",24),e.qCj("click",function(){const a=e.usT(t).ngIf;return e.CGJ(a.toggleSortOrder())}),e.yuY(2,jn,1,0,"clr-icon",25)(3,Qn,1,0,"clr-icon",26)(4,Kn,1,0,"clr-icon",27),e.C$Y(),e.yuY(5,qn,2,1,"div",28),e.C$Y()}if(2&r){const t=n.ngIf;e.yG2(),e.eAK("active",t.sortOrder),e.yG2(),e.E7m("ngIf",!t.sortOrder),e.yG2(),e.E7m("ngIf","ASC"===t.sortOrder),e.yG2(),e.E7m("ngIf","DESC"===t.sortOrder),e.yG2(),e.E7m("ngIf",t.sortOrder)}}function Jn(r,n){if(1&r&&(e.I0R(0,"th")(1,"div",20)(2,"vdr-ui-extension-point",21)(3,"span"),e.OEk(4),e.C$Y()(),e.yuY(5,Hn,6,6,"div",22),e.C$Y()()),2&r){const t=n.$implicit,o=e.GaO();e.eAK("expand",t.expand),e.yG2(),e.E7m("ngClass",t.align),e.yG2(),e.E7m("locationId",o.id)("metadata",t.id)("topPx",-6)("leftPx",-24),e.yG2(2),e.cNF(t.heading),e.yG2(),e.E7m("ngIf",t.sort)}}function Bn(r,n){1&r&&e.C_f(0)}function Wn(r,n){1&r&&e.C_f(0)}function Un(r,n){if(1&r&&e.wR5(0,"vdr-data-table-filters",41),2&r){const t=n.$implicit,o=e.GaO(3);e.E7m("filterWithValue",t)("filters",o.filters)}}function zn(r,n){if(1&r&&e.wR5(0,"vdr-data-table-filters",42),2&r){const t=e.GaO(3);e.E7m("filters",t.filters)}}function Zn(r,n){if(1&r&&(e.SAx(0),e.I0R(1,"div",38),e.yuY(2,Un,1,2,"vdr-data-table-filters",39)(3,zn,1,1,"vdr-data-table-filters",40),e.C$Y(),e.k70()),2&r){const t=e.GaO(2);e.yG2(2),e.E7m("ngForOf",t.filters.activeFilters),e.yG2(),e.E7m("ngIf",t.filters.length)}}function er(r,n){if(1&r){const t=e.KQA();e.I0R(0,"tr")(1,"th",33)(2,"button",34),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.toggleSearchFilterRow())}),e.wVc(3,"translate"),e.wR5(4,"clr-icon",35),e.C$Y(),e.I0R(5,"div",36),e.yuY(6,Bn,1,0,"ng-container",37)(7,Wn,1,0,"ng-container",37)(8,Zn,4,2,"ng-container",8),e.C$Y()()()}if(2&r){const t=e.GaO();e.yG2(),e.eAK("active",t.showSearchFilterRow),e.e48("colspan",t.visibleSortedColumns.length+(t.selectionManager?2:1)),e.yG2(),e.eAK("active",t.showSearchFilterRow),e.E7m("title",e.kDX(3,11,"common.search-and-filter-list")),e.yG2(3),e.eAK("hidden",!t.showSearchFilterRow),e.yG2(),e.E7m("ngTemplateOutlet",null==t.searchComponent?null:t.searchComponent.template),e.yG2(),e.E7m("ngTemplateOutlet",t.customSearchTemplate),e.yG2(),e.E7m("ngIf",t.filters)}}function tr(r,n){if(1&r){const t=e.KQA();e.I0R(0,"td",18)(1,"input",45),e.qCj("click",function(i){e.usT(t);const a=e.GaO().$implicit,c=e.GaO();return e.CGJ(c.onRowClick(a,i))}),e.C$Y()()}if(2&r){const t=e.GaO(),o=t.index,i=t.$implicit,a=e.GaO();e.eAK("active",a.activeIndex===o),e.yG2(),e.E7m("checked",null==a.selectionManager?null:a.selectionManager.isSelected(i))}}function nr(r,n){1&r&&e.C_f(0)}const rr=r=>({rowItem:r});function or(r,n){if(1&r&&(e.SAx(0),e.yuY(1,nr,1,0,"ng-container",48),e.k70()),2&r){const t=n.ngIf,o=e.GaO(2).$implicit;e.yG2(),e.E7m("ngComponentOutlet",t.config.component)("ngComponentOutletInputs",e.S45(3,rr,o))("ngComponentOutletInjector",t.injector)}}function ir(r,n){1&r&&e.C_f(0)}const ar=(r,n)=>({item:r,index:n});function lr(r,n){if(1&r&&e.yuY(0,ir,1,0,"ng-container",49),2&r){const t=e.GaO().$implicit,o=e.GaO(),i=o.$implicit,a=o.index;e.E7m("ngTemplateOutlet",t.template)("ngTemplateOutletContext",e.IBC(2,ar,i,a))}}function dr(r,n){if(1&r&&(e.I0R(0,"td")(1,"div",20),e.yuY(2,or,2,5,"ng-container",46)(3,lr,1,5,"ng-template",null,47,e.gJz),e.C$Y()()),2&r){const t=n.$implicit,o=e.Gew(4),i=e.GaO().index,a=e.GaO();e.eAK("active",a.activeIndex===i),e.yG2(),e.E7m("ngClass",t.align),e.yG2(),e.E7m("ngIf",a.customComponents.get(t.id))("ngIfElse",o)}}function sr(r,n){if(1&r&&(e.I0R(0,"tr"),e.yuY(1,tr,2,3,"td",43)(2,dr,5,5,"td",44),e.wR5(3,"td"),e.C$Y()),2&r){const t=n.index,o=e.GaO();e.yG2(),e.E7m("ngIf",o.selectionManager),e.yG2(),e.E7m("ngForOf",o.visibleSortedColumns),e.yG2(),e.eAK("active",o.activeIndex===t)}}function cr(r,n){if(1&r&&(e.I0R(0,"tr")(1,"td"),e.wR5(2,"vdr-empty-placeholder",50),e.wVc(3,"translate"),e.C$Y()()),2&r){const t=e.GaO();e.yG2(),e.e48("colspan",t.visibleSortedColumns.length+(t.selectionManager?2:1)),e.yG2(),e.E7m("emptyStateLabel",e.kDX(3,2,"order.order-is-empty"))}}function mr(r,n){if(1&r&&(e.I0R(0,"tr",51)(1,"td",52),e.OEk(2),e.C$Y(),e.I0R(3,"td",53),e.OEk(4),e.C$Y(),e.wR5(5,"td",54),e.I0R(6,"td",55),e.OEk(7),e.wVc(8,"localeCurrency"),e.I0R(9,"div",14),e.wVc(10,"translate"),e.OEk(11),e.wVc(12,"localeCurrency"),e.C$Y()(),e.wR5(13,"td"),e.C$Y()),2&r){const t=n.$implicit,o=e.GaO();e.yG2(2),e.cNF(t.description),e.yG2(2),e.cNF(t.sku),e.yG2(),e.e48("colspan",o.visibleSortedColumns.length-4),e.yG2(2),e.oRS(" ",e.g7$(8,6,t.priceWithTax,o.order.currencyCode)," "),e.yG2(2),e.E7m("title",e.kDX(10,9,"order.net-price")),e.yG2(2),e.oRS(" ",e.g7$(12,11,t.price,o.order.currencyCode)," ")}}function ur(r,n){if(1&r&&(e.I0R(0,"vdr-chip"),e.OEk(1),e.C$Y()),2&r){const t=n.ngIf;e.yG2(),e.cNF(t)}}function _r(r,n){if(1&r&&(e.I0R(0,"tr",57)(1,"td",2)(2,"a",58),e.OEk(3),e.C$Y(),e.yuY(4,ur,2,1,"vdr-chip",8),e.C$Y(),e.I0R(5,"td",2),e.OEk(6),e.wVc(7,"localeCurrency"),e.I0R(8,"div",14),e.wVc(9,"translate"),e.OEk(10),e.wVc(11,"localeCurrency"),e.C$Y()(),e.wR5(12,"td"),e.C$Y()),2&r){const t=e.GaO().$implicit,o=e.GaO();e.yG2(),e.e48("colspan",o.visibleSortedColumns.length-1),e.yG2(),e.E7m("routerLink",o.getPromotionLink(t)),e.yG2(),e.cNF(t.description),e.yG2(),e.E7m("ngIf",o.getCouponCodeForAdjustment(o.order,t)),e.yG2(2),e.oRS(" ",e.g7$(7,7,t.amountWithTax,o.order.currencyCode)," "),e.yG2(2),e.E7m("title",e.kDX(9,10,"order.net-price")),e.yG2(2),e.oRS(" ",e.g7$(11,12,t.amount,o.order.currencyCode)," ")}}function pr(r,n){if(1&r&&(e.SAx(0),e.yuY(1,_r,13,15,"tr",56),e.k70()),2&r){const t=n.$implicit;e.yG2(),e.E7m("ngIf","OTHER"!==t.type)}}function fr(r,n){if(1&r&&(e.I0R(0,"vdr-chip",59),e.OEk(1),e.C$Y()),2&r){const t=n.$implicit;e.yG2(),e.oRS(" ",t.shippingMethod.name," ")}}const gr=[[["vdr-bulk-action-menu"]]],yr=(r,n,t,o)=>({id:r,itemsPerPage:n,currentPage:t,totalItems:o}),Cr=["vdr-bulk-action-menu"];class Z extends d.qu{get allColumns(){return[...this.columns??[],...this.customFieldColumns??[],...this.totalColumns??[]]}get sortedColumns(){const n=this.allColumns,t=this.getDataTableConfig();for(const[o,i]of Object.entries(t[this.id].order)){const a=n.find(y=>y.id===o),c=n.findIndex(y=>y.id===o);-1!==c&&a&&(n.splice(c,1),n.splice(i,0,a))}return n}getPromotionLink(n){return["/marketing","promotions",n.adjustmentSource.split(":")[1]]}getCouponCodeForAdjustment(n,t){const o=t.adjustmentSource.split(":")[1],i=n.promotions.find(a=>a.id===o);if(i)return i.couponCode||void 0}getShippingNames(n){return n.shippingLines.length?n.shippingLines.map(t=>t.shippingMethod.name).join(", "):""}static#e=this.\u0275fac=(()=>{let n;return function(o){return(n||(n=e.otF(Z)))(o||Z)}})();static#t=this.\u0275cmp=e.In1({type:Z,selectors:[["vdr-order-data-table"]],contentQueries:function(t,o,i){if(1&t&&e.szK(i,N,4),2&t){let a;e.wto(a=e.Gqi())&&(o.totalColumns=a)}},inputs:{order:"order"},features:[e.eg9],ngContentSelectors:Cr,decls:60,vars:70,consts:[[1,"bulk-actions"],[1,"table-wrapper"],[1,""],[1,"heading-row"],["class","selection-col",4,"ngIf"],[3,"expand",4,"ngFor","ngForOf"],[1,"column-picker"],[3,"uiLanguage","columns","reorder","resetColumns"],[4,"ngIf"],[4,"ngFor","ngForOf","ngForTrackBy"],["class","surcharge",4,"ngFor","ngForOf"],[4,"ngFor","ngForOf"],[1,"sub-total"],[1,"clr-align-middle"],[1,"net-price",3,"title"],[1,"shipping"],["class","shipping-method-name",4,"ngFor","ngForOf"],[1,"total"],[1,"selection-col"],["type","checkbox","clrCheckbox","",3,"checked","change"],[1,"cell-content",3,"ngClass"],["api","dataTable","display","block",3,"locationId","metadata","topPx","leftPx"],["class","sort-toggle",4,"ngIf"],[1,"sort-toggle"],[3,"click"],["shape","two-way-arrows left",4,"ngIf"],["shape","arrow up",4,"ngIf"],["shape","arrow down",4,"ngIf"],["class","sort-label",4,"ngIf"],["shape","two-way-arrows left"],["shape","arrow up"],["shape","arrow down"],[1,"sort-label"],[1,"filter-row"],[1,"button-ghost","toggle-search-filter-row",3,"title","click"],["shape","search"],[1,"filter-row-wrapper"],[4,"ngTemplateOutlet"],[1,"filters"],["class","mt-1",3,"filterWithValue","filters",4,"ngFor","ngForOf"],["class","mt-1",3,"filters",4,"ngIf"],[1,"mt-1",3,"filterWithValue","filters"],[1,"mt-1",3,"filters"],["class","selection-col",3,"active",4,"ngIf"],[3,"active",4,"ngFor","ngForOf"],["type","checkbox","clrCheckbox","",3,"checked","click"],[4,"ngIf","ngIfElse"],["defaultComponent",""],[4,"ngComponentOutlet","ngComponentOutletInputs","ngComponentOutletInjector"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],[3,"emptyStateLabel"],[1,"surcharge"],["colspan","2",1,"align-middle","name","left"],[1,"align-middle","sku"],[1,"align-middle"],[1,"align-middle","total"],["class","order-adjustment",4,"ngIf"],[1,"order-adjustment"],[3,"routerLink"],[1,"shipping-method-name"]],template:function(t,o){1&t&&(e.kPM(gr),e.I0R(0,"div",0),e._Xx(1),e.C$Y(),e.I0R(2,"div",1)(3,"table",2)(4,"thead")(5,"tr",3),e.yuY(6,Ln,2,1,"th",4)(7,Jn,6,9,"th",5),e.I0R(8,"th")(9,"div",6)(10,"vdr-data-table-colum-picker",7),e.qCj("reorder",function(a){return o.onColumnReorder(a)})("resetColumns",function(){return o.onColumnsReset()}),e.wVc(11,"async"),e.C$Y()()()(),e.yuY(12,er,9,13,"tr",8),e.C$Y(),e.I0R(13,"tbody"),e.yuY(14,sr,4,4,"tr",9),e.wVc(15,"paginate"),e.SAx(16),e.yuY(17,cr,4,4,"tr",8),e.k70(),e.yuY(18,mr,14,14,"tr",10)(19,pr,2,1,"ng-container",11),e.I0R(20,"tr",12)(21,"td",2),e.OEk(22),e.wVc(23,"translate"),e.C$Y(),e.wR5(24,"td"),e.I0R(25,"td",13),e.OEk(26),e.wVc(27,"localeCurrency"),e.I0R(28,"div",14),e.wVc(29,"translate"),e.OEk(30),e.wVc(31,"localeCurrency"),e.C$Y()(),e.wR5(32,"td"),e.C$Y(),e.I0R(33,"tr",15)(34,"td",2),e.OEk(35),e.wVc(36,"translate"),e.C$Y(),e.I0R(37,"td"),e.yuY(38,fr,2,1,"vdr-chip",16),e.C$Y(),e.I0R(39,"td",13),e.OEk(40),e.wVc(41,"localeCurrency"),e.I0R(42,"div",14),e.wVc(43,"translate"),e.OEk(44),e.wVc(45,"localeCurrency"),e.C$Y()(),e.wR5(46,"td"),e.C$Y(),e.I0R(47,"tr",17)(48,"td",2),e.OEk(49),e.wVc(50,"translate"),e.C$Y(),e.wR5(51,"td"),e.I0R(52,"td",13),e.OEk(53),e.wVc(54,"localeCurrency"),e.I0R(55,"div",14),e.wVc(56,"translate"),e.OEk(57),e.wVc(58,"localeCurrency"),e.C$Y()(),e.wR5(59,"td"),e.C$Y()()()()),2&t&&(e.yG2(3),e.eAK("no-select",o.disableSelect),e.yG2(),e.eAK("items-selected",null==o.selectionManager?null:o.selectionManager.selection.length),e.yG2(2),e.E7m("ngIf",o.selectionManager),e.yG2(),e.E7m("ngForOf",o.visibleSortedColumns),e.yG2(3),e.E7m("uiLanguage",e.kDX(11,30,o.uiLanguage$))("columns",o.sortedColumns),e.yG2(2),e.E7m("ngIf",o.searchComponent||o.customSearchTemplate||(null==o.filters?null:o.filters.length)),e.yG2(2),e.E7m("ngForOf",e.g7$(15,32,o.items,e.WuN(65,yr,o.id,o.itemsPerPage,o.currentPage,o.totalItems)))("ngForTrackBy",o.trackByFn),e.yG2(3),e.E7m("ngIf",!(null!=o.items&&o.items.length)),e.yG2(),e.E7m("ngForOf",o.order.surcharges),e.yG2(),e.E7m("ngForOf",o.order.discounts),e.yG2(3),e.cNF(e.kDX(23,35,"order.sub-total")),e.yG2(2),e.e48("colspan",o.visibleSortedColumns.length-2),e.yG2(2),e.oRS(" ",e.g7$(27,37,o.order.subTotalWithTax,o.order.currencyCode)," "),e.yG2(2),e.E7m("title",e.kDX(29,40,"order.net-price")),e.yG2(2),e.oRS(" ",e.g7$(31,42,o.order.subTotal,o.order.currencyCode)," "),e.yG2(5),e.cNF(e.kDX(36,45,"order.shipping")),e.yG2(2),e.e48("colspan",o.visibleSortedColumns.length-2),e.yG2(),e.E7m("ngForOf",o.order.shippingLines),e.yG2(2),e.oRS(" ",e.g7$(41,47,o.order.shippingWithTax,o.order.currencyCode)," "),e.yG2(2),e.E7m("title",e.kDX(43,50,"order.net-price")),e.yG2(2),e.oRS(" ",e.g7$(45,52,o.order.shipping,o.order.currencyCode)," "),e.yG2(5),e.cNF(e.kDX(50,55,"order.total")),e.yG2(2),e.e48("colspan",o.visibleSortedColumns.length-2),e.yG2(2),e.oRS(" ",e.g7$(54,57,o.order.totalWithTax,o.order.currencyCode)," "),e.yG2(2),e.E7m("title",e.kDX(56,60,"order.net-price")),e.yG2(2),e.oRS(" ",e.g7$(58,62,o.order.total,o.order.currencyCode)," "))},dependencies:[_.o3d,_.y6l,m.QF,m.ov,m.ay,m.u_,m.XV,k.ER,D.g,C.w,Pn.A,An.K,Vn.Q,Nn.E,m.a,Xn.as,p.sD,g.u],styles:["[_nghost-%COMP%]{display:block;max-width:100%;position:relative;margin-bottom:calc(var(--space-unit) * 4);container-type:inline-size}th[_ngcontent-%COMP%]{border-bottom:1px solid var(--color-table-header-border);color:var(--color-weight-700);font-size:var(--font-size-xs);font-weight:600;text-transform:uppercase;position:relative;white-space:nowrap;background-color:transparent}th[_ngcontent-%COMP%], td[_ngcontent-%COMP%]{padding:calc(var(--space-unit) * 1.5) calc(var(--space-unit) * 1);color:var(--color-text-100)}tr[_ngcontent-%COMP%] td[_ngcontent-%COMP%]:first-of-type, tr[_ngcontent-%COMP%] th[_ngcontent-%COMP%]:first-of-type{text-align:center}@media screen and (min-width: 992px){tr[_ngcontent-%COMP%] td[_ngcontent-%COMP%]:first-of-type, tr[_ngcontent-%COMP%] th[_ngcontent-%COMP%]:first-of-type{padding-inline-start:var(--surface-margin-left);text-align:start}}th[_ngcontent-%COMP%]:last-of-type, td[_ngcontent-%COMP%]:last-of-type{border-inline-end:1px solid var(--color-table-header-border)}tr[_ngcontent-%COMP%]:first-of-type th[_ngcontent-%COMP%]:last-of-type{border-image:linear-gradient(0deg,var(--color-table-header-border),transparent) 1}tr[_ngcontent-%COMP%]:last-of-type td[_ngcontent-%COMP%]:last-of-type{border-image:linear-gradient(180deg,var(--color-table-header-border),transparent) 1}tbody[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{border-bottom:1px solid var(--color-table-row-separator)}tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:hover{background-color:var(--color-table-row-hover-bg)}.bulk-actions[_ngcontent-%COMP%]{margin-inline-start:calc(var(--space-unit) * 5);background-color:var(--color-surface-bg);z-index:10;display:flex;position:absolute;top:5px;height:40px}@media screen and (min-width: 992px){.bulk-actions[_ngcontent-%COMP%]{margin-inline-start:calc(var(--space-unit) * 8.5)}}@media screen and (min-width: 1280px){.bulk-actions[_ngcontent-%COMP%]{margin-inline-start:calc(var(--space-unit) * 10.5)}}.table-wrapper[_ngcontent-%COMP%]{display:block;overflow-y:hidden;overflow-x:auto;position:relative;width:100%;max-width:var(--surface-width)}table[_ngcontent-%COMP%]{width:100%}table.no-select[_ngcontent-%COMP%]{-webkit-user-select:none;user-select:none}.column-picker[_ngcontent-%COMP%]{width:24px}.sort-toggle[_ngcontent-%COMP%]{display:flex;align-items:center;margin-inline-start:calc(var(--space-unit) * .5)}.sort-toggle[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{border:0;border-radius:var(--border-radius-lg);color:var(--color-weight-500);padding:0 2px;cursor:pointer;background-color:transparent}.sort-toggle[_ngcontent-%COMP%] button.active[_ngcontent-%COMP%]{color:var(--color-primary-700)}.sort-toggle[_ngcontent-%COMP%] .sort-label[_ngcontent-%COMP%]{margin-inline-start:calc(var(--space-unit) * .5);font-size:10px;color:var(--color-primary-600);font-weight:400}.toggle-search-filter-row[_ngcontent-%COMP%]{position:absolute;top:-12px;left:4px}@media screen and (min-width: 1280px){.toggle-search-filter-row[_ngcontent-%COMP%]{left:8px}}.toggle-search-filter-row.active[_ngcontent-%COMP%]{background-color:var(--color-primary-700);color:var(--color-primary-100);border-color:var(--color-primary-700)}th.filter-row[_ngcontent-%COMP%]{position:relative;font-size:var(--font-size-base);font-weight:400;background-color:var(--color-weight-100);box-shadow:var(--data-table-filter-box-shadow);border-left-width:0;border-right-width:0;text-align:initial;padding:0}th.filter-row[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{width:100%}th.filter-row.active[_ngcontent-%COMP%]{border-bottom:1px solid var(--color-table-header-border)}th.filter-row[_ngcontent-%COMP%] .filters[_ngcontent-%COMP%]{margin-top:calc(var(--space-unit) * 1);display:flex;flex-wrap:wrap;gap:calc(var(--space-unit) * .5)}.filter-row-wrapper[_ngcontent-%COMP%]{padding:calc(var(--space-unit) * 4);padding-inline-start:0;max-height:150px;transition:max-height .2s,padding .2s,opacity .2s}.filter-row-wrapper.hidden[_ngcontent-%COMP%]{max-height:0px;padding-top:0;padding-bottom:0;overflow:hidden;opacity:0}.cell-link[_ngcontent-%COMP%]{display:block;width:100%;height:100%}td.active[_ngcontent-%COMP%]{background-color:var(--color-table-row-active-bg)}.cell-content[_ngcontent-%COMP%]{display:flex;align-items:center;line-height:var(--font-size-sm);color:var(--color-weight-700)}.cell-content.left[_ngcontent-%COMP%]{justify-content:flex-start}.cell-content.center[_ngcontent-%COMP%]{justify-content:center}.cell-content.right[_ngcontent-%COMP%]{justify-content:flex-end}.selection-col[_ngcontent-%COMP%]{width:calc(var(--space-unit) * 8)}vdr-empty-placeholder[_ngcontent-%COMP%]{width:100%}.table-footer[_ngcontent-%COMP%]{display:flex;align-items:baseline;justify-content:space-between;margin-top:var(--space-unit);margin-inline-start:var(--surface-margin-left);margin-inline-end:var(--space-unit)}.total-items-count[_ngcontent-%COMP%]{font-size:var(--font-size-xs)}@container (max-width: 500px){.total-items-count[_ngcontent-%COMP%]{display:none}}","[_nghost-%COMP%] .is-cancelled[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{text-decoration:line-through;background-color:var(--color-component-bg-200)}[_nghost-%COMP%] .sub-total[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{border-top:1px dashed var(--color-component-border-200)}[_nghost-%COMP%] .total[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{font-weight:700;border-top:1px dashed var(--color-component-border-200)}[_nghost-%COMP%] td.custom-fields-row[_ngcontent-%COMP%]{border-top-style:dashed;border-top-color:var(--color-grey-200)}[_nghost-%COMP%] img[_ngcontent-%COMP%]{border-radius:var(--border-radius-img)}[_nghost-%COMP%] .order-line-custom-fields[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap}[_nghost-%COMP%] .order-line-custom-fields[_ngcontent-%COMP%] .custom-field[_ngcontent-%COMP%]{text-align:start;max-width:200px;overflow:hidden;text-overflow:ellipsis;margin-bottom:6px;margin-inline-end:18px}[_nghost-%COMP%] .draft-qty[_ngcontent-%COMP%]{max-width:48px}[_nghost-%COMP%] .order-line-custom-field[_ngcontent-%COMP%]{background-color:var(--color-component-bg-100)}[_nghost-%COMP%] .order-line-custom-field[_ngcontent-%COMP%] .custom-field-ellipsis[_ngcontent-%COMP%]{color:var(--color-text-300)}[_nghost-%COMP%] .net-price[_ngcontent-%COMP%]{font-size:11px;color:var(--color-text-300);line-height:14px}[_nghost-%COMP%] .promotions-label[_ngcontent-%COMP%]{-webkit-text-decoration:underline dotted var(--color-text-200);text-decoration:underline dotted var(--color-text-200);font-size:11px;margin-top:6px;cursor:pointer;text-transform:lowercase}[_nghost-%COMP%] .thumb[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:50px;height:50px}[_nghost-%COMP%] .shipping-method-name[_ngcontent-%COMP%]{font-size:var(--font-size-xs);margin-inline-end:2px}[_nghost-%COMP%] .order-placed-quantity[_ngcontent-%COMP%]{text-decoration:line-through;color:var(--color-text-300);margin-inline-end:2px}"],changeDetection:0})}function hr(r,n){if(1&r&&e.OEk(0),2&r){const t=n.item;e.oRS(" ",t.id," ")}}function Or(r,n){if(1&r&&(e.OEk(0),e.wVc(1,"localeDate")),2&r){const t=n.item;e.oRS(" ",e.g7$(1,1,t.createdAt,"short")," ")}}function vr(r,n){if(1&r&&(e.OEk(0),e.wVc(1,"localeDate")),2&r){const t=n.item;e.oRS(" ",e.g7$(1,1,t.updatedAt,"short")," ")}}function br(r,n){if(1&r&&(e.wR5(0,"img",14),e.wVc(1,"assetPreview")),2&r){const t=n.ngIf;e.E7m("src",e.g7$(1,1,t,"tiny"),e.K6U)}}function Ir(r,n){1&r&&(e.I0R(0,"div",15),e.wR5(1,"clr-icon",16),e.C$Y())}function Gr(r,n){if(1&r&&(e.I0R(0,"div",11),e.yuY(1,br,2,4,"img",12)(2,Ir,2,0,"ng-template",null,13,e.gJz),e.C$Y()),2&r){const t=n.item,o=e.Gew(3);e.yG2(),e.E7m("ngIf",t.featuredAsset)("ngIfElse",o)}}function Er(r,n){if(1&r&&e.OEk(0),2&r){const t=n.item;e.oRS(" ",t.productVariant.name," ")}}function Rr(r,n){if(1&r&&e.OEk(0),2&r){const t=n.item;e.oRS(" ",t.productVariant.sku," ")}}function kr(r,n){if(1&r&&(e.I0R(0,"div",17),e.OEk(1),e.wVc(2,"localeCurrency"),e.I0R(3,"div",18),e.wVc(4,"translate"),e.OEk(5),e.wVc(6,"localeCurrency"),e.C$Y()()),2&r){const t=n.item,o=e.GaO();e.yG2(),e.oRS(" ",e.g7$(2,3,t.unitPriceWithTax,o.order.currencyCode)," "),e.yG2(2),e.E7m("title",e.kDX(4,6,"order.net-price")),e.yG2(2),e.oRS(" ",e.g7$(6,8,t.unitPrice,o.order.currencyCode)," ")}}function wr(r,n){if(1&r&&(e.I0R(0,"div",25),e.wVc(1,"translate"),e.OEk(2),e.C$Y()),2&r){const t=e.GaO(2).item;e.E7m("title",e.kDX(1,2,"order.original-quantity-at-checkout")),e.yG2(2),e.oRS(" ",t.orderPlacedQuantity," ")}}function Tr(r,n){if(1&r&&(e.SAx(0),e.I0R(1,"div",23),e.yuY(2,wr,3,4,"div",24),e.I0R(3,"div"),e.OEk(4),e.C$Y()(),e.k70()),2&r){const t=e.GaO().item;e.yG2(2),e.E7m("ngIf",t.orderPlacedQuantity&&t.quantity!==t.orderPlacedQuantity),e.yG2(2),e.cNF(t.quantity)}}function Sr(r,n){if(1&r){const t=e.KQA();e.I0R(0,"div",23)(1,"input",26,27),e.qCj("blur",function(){e.usT(t);const i=e.Gew(2),a=e.GaO().item,c=e.GaO();return e.CGJ(c.draftInputBlur(a,i.valueAsNumber))}),e.C$Y(),e.I0R(3,"button",28),e.qCj("click",function(){e.usT(t);const i=e.GaO().item,a=e.GaO();return e.CGJ(a.remove.emit({lineId:i.id}))}),e.wR5(4,"clr-icon",29),e.C$Y()()}if(2&r){const t=e.GaO().item;e.yG2(),e.E7m("value",t.quantity)}}function Dr(r,n){if(1&r&&(e.yuY(0,Tr,5,2,"ng-container",19)(1,Sr,5,1,"ng-template",null,20,e.gJz),e.wR5(3,"vdr-line-refunds",21)(4,"vdr-line-fulfillment",22)),2&r){const t=n.item,o=e.Gew(2),i=e.GaO();e.E7m("ngIf",!i.isDraft)("ngIfElse",o),e.yG2(3),e.E7m("line",t)("payments",i.order.payments),e.yG2(),e.E7m("line",t)("orderState",i.order.state)("allOrderFulfillments",i.order.fulfillments)}}function xr(r,n){if(1&r&&e.wR5(0,"vdr-dt2-custom-field-column",30),2&r){const t=n.$implicit;e.E7m("customField",t)}}function Fr(r,n){if(1&r&&(e.I0R(0,"div",34)(1,"a",35),e.OEk(2),e.C$Y(),e.I0R(3,"div",36),e.OEk(4),e.wVc(5,"localeCurrency"),e.I0R(6,"div",18),e.wVc(7,"translate"),e.OEk(8),e.wVc(9,"localeCurrency"),e.C$Y()()()),2&r){const t=n.$implicit,o=e.GaO(4);e.yG2(),e.E7m("routerLink",o.getPromotionLink(t)),e.yG2(),e.cNF(t.description),e.yG2(2),e.oRS(" ",e.g7$(5,5,t.amountWithTax,o.order.currencyCode)," "),e.yG2(2),e.E7m("title",e.kDX(7,8,"order.net-price")),e.yG2(2),e.oRS(" ",e.g7$(9,10,t.amount,o.order.currencyCode)," ")}}function $r(r,n){if(1&r&&(e.I0R(0,"vdr-dropdown")(1,"div",32),e.OEk(2),e.wVc(3,"translate"),e.C$Y(),e.I0R(4,"vdr-dropdown-menu"),e.yuY(5,Fr,10,13,"div",33),e.C$Y()()),2&r){const t=e.GaO().ngIf;e.yG2(2),e.oRS(" ",e.kDX(3,2,"order.promotions-applied")," "),e.yG2(3),e.E7m("ngForOf",t)}}function Mr(r,n){if(1&r&&(e.SAx(0),e.yuY(1,$r,6,4,"vdr-dropdown",31),e.k70()),2&r){const t=n.ngIf;e.yG2(),e.E7m("ngIf",t.length)}}function Yr(r,n){if(1&r&&(e.I0R(0,"div",17),e.OEk(1),e.wVc(2,"localeCurrency"),e.I0R(3,"div",18),e.wVc(4,"translate"),e.OEk(5),e.wVc(6,"localeCurrency"),e.C$Y()(),e.yuY(7,Mr,2,1,"ng-container",31)),2&r){const t=n.item,o=e.GaO();e.yG2(),e.oRS(" ",e.g7$(2,4,t.linePriceWithTax,o.order.currencyCode)," "),e.yG2(2),e.E7m("title",e.kDX(4,7,"order.net-price")),e.yG2(2),e.oRS(" ",e.g7$(6,9,t.linePrice,o.order.currencyCode)," "),e.yG2(2),e.E7m("ngIf",o.getLineDiscounts(t))}}class X{constructor(){this.isDraft=!1,this.adjust=new e._w7,this.remove=new e._w7,this.orderLineCustomFieldsVisible=!1,this.customFieldsForLine={}}get visibleOrderLineCustomFields(){return this.orderLineCustomFieldsVisible?this.orderLineCustomFields:[]}get showElided(){return!this.orderLineCustomFieldsVisible&&0<this.orderLineCustomFields.length}ngOnInit(){this.orderLineCustomFieldsVisible=this.orderLineCustomFields.length<2,this.getLineCustomFields()}draftInputBlur(n,t){n.quantity!==t&&this.adjust.emit({lineId:n.id,quantity:t})}toggleOrderLineCustomFields(){this.orderLineCustomFieldsVisible=!this.orderLineCustomFieldsVisible}getLineDiscounts(n){return n.discounts.filter(t=>t.type===d.yKQ.PROMOTION)}getLineCustomFields(){for(const n of this.order.lines){const t=new l.k1({}),o=this.orderLineCustomFields.map(i=>{const a=n.customFields[i.name];return t.addControl(i.name,new l.yM(a)),{config:i,formGroup:t,value:a}}).filter(i=>!!this.orderLineCustomFieldsVisible||null!=i.value);this.customFieldsForLine[n.id]=o}}getPromotionLink(n){return["/marketing","promotions",n.adjustmentSource.split(":")[1]]}getCouponCodeForAdjustment(n,t){const o=t.adjustmentSource.split(":")[1],i=n.promotions.find(a=>a.id===o);if(i)return i.couponCode||void 0}getShippingNames(n){return n.shippingLines.length?n.shippingLines.map(t=>t.shippingMethod.name).join(", "):""}static#e=this.\u0275fac=function(t){return new(t||X)};static#t=this.\u0275cmp=e.In1({type:X,selectors:[["vdr-order-table"]],inputs:{order:"order",orderLineCustomFields:"orderLineCustomFields",isDraft:"isDraft"},outputs:{adjust:"adjust",remove:"remove"},decls:29,vars:36,consts:[["id","order-detail-list",3,"items","order"],["id","id",3,"heading","hiddenByDefault"],["id","created-at",3,"heading","hiddenByDefault"],["id","updated-at",3,"heading","hiddenByDefault"],["id","image",3,"heading"],["id","product-name",3,"heading"],["id","product-sku",3,"heading","optional"],["id","unit-price",3,"heading"],["id","quantity",3,"heading","optional"],[3,"customField",4,"ngFor","ngForOf"],["id","total",3,"heading","optional"],[1,"image-placeholder"],[3,"src",4,"ngIf","ngIfElse"],["imagePlaceholder",""],[3,"src"],[1,"placeholder"],["shape","image","size","48"],[1,"unit-price"],[1,"net-price",3,"title"],[4,"ngIf","ngIfElse"],["draft",""],[3,"line","payments"],[3,"line","orderState","allOrderFulfillments"],[1,"flex"],["class","order-placed-quantity",3,"title",4,"ngIf"],[1,"order-placed-quantity",3,"title"],["type","number","min","0",1,"draft-qty",3,"value","blur"],["qtyInput",""],[1,"icon-button",3,"click"],["shape","trash"],[3,"customField"],[4,"ngIf"],["vdrDropdownTrigger","",1,"promotions-label"],["class","line-promotion",4,"ngFor","ngForOf"],[1,"line-promotion"],[1,"promotion-name",3,"routerLink"],[1,"promotion-amount"]],template:function(t,o){1&t&&(e.I0R(0,"vdr-order-data-table",0)(1,"vdr-dt2-column",1),e.wVc(2,"translate"),e.yuY(3,hr,1,1,"ng-template"),e.C$Y(),e.I0R(4,"vdr-dt2-column",2),e.wVc(5,"translate"),e.yuY(6,Or,2,4,"ng-template"),e.C$Y(),e.I0R(7,"vdr-dt2-column",3),e.wVc(8,"translate"),e.yuY(9,vr,2,4,"ng-template"),e.C$Y(),e.I0R(10,"vdr-dt2-column",4),e.wVc(11,"translate"),e.yuY(12,Gr,4,2,"ng-template"),e.C$Y(),e.I0R(13,"vdr-dt2-column",5),e.wVc(14,"translate"),e.yuY(15,Er,1,1,"ng-template"),e.C$Y(),e.I0R(16,"vdr-dt2-column",6),e.wVc(17,"translate"),e.yuY(18,Rr,1,1,"ng-template"),e.C$Y(),e.I0R(19,"vdr-dt2-column",7),e.wVc(20,"translate"),e.yuY(21,kr,7,11,"ng-template"),e.C$Y(),e.I0R(22,"vdr-dt2-column",8),e.wVc(23,"translate"),e.yuY(24,Dr,5,7,"ng-template"),e.C$Y(),e.yuY(25,xr,1,1,"vdr-dt2-custom-field-column",9),e.I0R(26,"vdr-order-total-column",10),e.wVc(27,"translate"),e.yuY(28,Yr,8,12,"ng-template"),e.C$Y()()),2&t&&(e.E7m("items",o.order.lines)("order",o.order),e.yG2(),e.E7m("heading",e.kDX(2,18,"common.id"))("hiddenByDefault",!0),e.yG2(3),e.E7m("heading",e.kDX(5,20,"common.created-at"))("hiddenByDefault",!0),e.yG2(3),e.E7m("heading",e.kDX(8,22,"common.updated-at"))("hiddenByDefault",!0),e.yG2(3),e.E7m("heading",e.kDX(11,24,"common.image")),e.yG2(3),e.E7m("heading",e.kDX(14,26,"order.product-name")),e.yG2(3),e.E7m("heading",e.kDX(17,28,"order.product-sku"))("optional",!1),e.yG2(3),e.E7m("heading",e.kDX(20,30,"order.unit-price")),e.yG2(3),e.E7m("heading",e.kDX(23,32,"order.quantity"))("optional",!1),e.yG2(3),e.E7m("ngForOf",o.orderLineCustomFields),e.yG2(),e.E7m("heading",e.kDX(27,34,"order.total"))("optional",!1))},dependencies:[_.o3d,m.ay,m.u_,k.ER,C.w,B.i,W.m,U.q,Pe.M,mt.K,z,V,Z,N,p.sD,j.w,A.m,g.u],styles:["[_nghost-%COMP%] .is-cancelled[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{text-decoration:line-through;background-color:var(--color-component-bg-200)}[_nghost-%COMP%] .sub-total[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{border-top:1px dashed var(--color-component-border-200)}[_nghost-%COMP%] .total[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{font-weight:700;border-top:1px dashed var(--color-component-border-200)}[_nghost-%COMP%] td.custom-fields-row[_ngcontent-%COMP%]{border-top-style:dashed;border-top-color:var(--color-grey-200)}[_nghost-%COMP%] img[_ngcontent-%COMP%]{border-radius:var(--border-radius-img)}[_nghost-%COMP%] .order-line-custom-fields[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap}[_nghost-%COMP%] .order-line-custom-fields[_ngcontent-%COMP%] .custom-field[_ngcontent-%COMP%]{text-align:start;max-width:200px;overflow:hidden;text-overflow:ellipsis;margin-bottom:6px;margin-inline-end:18px}[_nghost-%COMP%] .draft-qty[_ngcontent-%COMP%]{max-width:48px}[_nghost-%COMP%] .order-line-custom-field[_ngcontent-%COMP%]{background-color:var(--color-component-bg-100)}[_nghost-%COMP%] .order-line-custom-field[_ngcontent-%COMP%] .custom-field-ellipsis[_ngcontent-%COMP%]{color:var(--color-text-300)}[_nghost-%COMP%] .net-price[_ngcontent-%COMP%]{font-size:11px;color:var(--color-text-300);line-height:14px}[_nghost-%COMP%] .promotions-label[_ngcontent-%COMP%]{-webkit-text-decoration:underline dotted var(--color-text-200);text-decoration:underline dotted var(--color-text-200);font-size:11px;margin-top:6px;cursor:pointer;text-transform:lowercase}[_nghost-%COMP%] .thumb[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:50px;height:50px}[_nghost-%COMP%] .shipping-method-name[_ngcontent-%COMP%]{font-size:var(--font-size-xs);margin-inline-end:2px}[_nghost-%COMP%] .order-placed-quantity[_ngcontent-%COMP%]{text-decoration:line-through;color:var(--color-text-300);margin-inline-end:2px} .line-promotion{display:flex;justify-content:space-between;padding:6px 12px} .line-promotion .promotion-amount{margin-inline-start:12px} .line-promotion .net-price{font-size:11px;color:var(--color-text-300)}"],changeDetection:0})}var qe=s(1488),_t=s(5388);function Pr(r,n){if(1&r&&(e.I0R(0,"div",16),e.wR5(1,"vdr-custom-field-control",17),e.C$Y()),2&r){const t=n.$implicit,o=e.GaO(3);e.yG2(),e.E7m("compact",!0)("readonly",!1)("customField",t)("customFieldsFormGroup",o.customFieldsFormGroup)}}function Ar(r,n){if(1&r&&(e.SAx(0),e.yuY(1,Pr,2,4,"div",15),e.k70()),2&r){const t=e.GaO(2);e.yG2(),e.E7m("ngForOf",t.orderLineCustomFields)}}function Vr(r,n){if(1&r){const t=e.KQA();e.I0R(0,"div",1)(1,"div",5),e.wR5(2,"img",6),e.wVc(3,"assetPreview"),e.I0R(4,"div",7)(5,"div"),e.OEk(6),e.C$Y(),e.I0R(7,"div",8),e.OEk(8),e.C$Y()(),e.I0R(9,"div",9)(10,"div",8),e.OEk(11),e.wVc(12,"translate"),e.C$Y(),e.I0R(13,"div",8),e.OEk(14),e.wVc(15,"translate"),e.C$Y()(),e.wR5(16,"div",10),e.I0R(17,"div",7)(18,"div"),e.OEk(19),e.wVc(20,"localeCurrency"),e.C$Y(),e.I0R(21,"div",11),e.wVc(22,"translate"),e.OEk(23),e.wVc(24,"localeCurrency"),e.C$Y()(),e.I0R(25,"div")(26,"input",12),e.iHE("ngModelChange",function(i){e.usT(t);const a=e.GaO();return e.kNx(a.quantity,i)||(a.quantity=i),e.CGJ(i)}),e.C$Y()(),e.I0R(27,"button",13),e.qCj("click",function(){const a=e.usT(t).ngIf,c=e.GaO();return e.CGJ(c.addItemClick(a))}),e.OEk(28),e.wVc(29,"translate"),e.C$Y()(),e.yuY(30,Ar,2,1,"ng-container",14),e.C$Y()}if(2&r){const t=n.ngIf,o=e.GaO();e.yG2(2),e.E7m("src",e.g7$(3,15,t.featuredAsset||t.product.featuredAsset,32),e.K6U),e.yG2(4),e.cNF(null==t?null:t.name),e.yG2(2),e.cNF(null==t?null:t.sku),e.yG2(3),e.CAO(" ",e.kDX(12,18,"catalog.stock-on-hand"),": ",t.stockOnHand," "),e.yG2(3),e.CAO(" ",e.kDX(15,20,"catalog.stock-allocated"),": ",t.stockAllocated," "),e.yG2(5),e.cNF(e.g7$(20,22,null==t?null:t.priceWithTax,o.currencyCode)),e.yG2(2),e.E7m("title",e.kDX(22,25,"order.net-price")),e.yG2(2),e.oRS(" ",e.g7$(24,27,null==t?null:t.price,o.currencyCode)," "),e.yG2(3),e.E7m("disabled",!t),e.OKB("ngModel",o.quantity),e.yG2(),e.E7m("disabled",!t),e.yG2(),e.oRS(" ",e.kDX(29,30,"order.add-item-to-order")," "),e.yG2(2),e.E7m("ngIf",o.orderLineCustomFields.length)}}class pe{constructor(n){this.dataService=n,this.addItem=new e._w7,this.customFieldsFormGroup=new l.k1({}),this.selectedVariantId$=new Q.E,this.quantity=1}ngOnInit(){this.selectedVariant$=this.selectedVariantId$.pipe((0,f.G)(n=>n?this.dataService.product.getProductVariant(n).mapSingle(({productVariant:t})=>t):[void 0]));for(const n of this.orderLineCustomFields)this.customFieldsFormGroup.addControl(n.name,new l.yM(""))}addItemClick(n){n&&(this.addItem.emit({productVariantId:n.id,quantity:this.quantity,customFields:this.orderLineCustomFields.length?this.customFieldsFormGroup.value:void 0}),this.selectedVariantId$.next(void 0),this.customFieldsFormGroup.reset())}static#e=this.\u0275fac=function(t){return new(t||pe)(e.GI1(d.Aj0))};static#t=this.\u0275cmp=e.In1({type:pe,selectors:[["vdr-draft-order-variant-selector"]],inputs:{currencyCode:"currencyCode",orderLineCustomFields:"orderLineCustomFields"},outputs:{addItem:"addItem"},decls:8,vars:6,consts:[[1,"card"],[1,"card-block"],[1,"card-title"],[3,"productSelected"],["class","card-block",4,"ngIf"],[1,"variant-details"],[1,"mr-2",3,"src"],[1,"details"],[1,"small"],[1,"details","ml-4"],[1,"flex-spacer"],[1,"small",3,"title"],["type","number","min","0",3,"disabled","ngModel","ngModelChange"],[1,"btn","btn-small","btn-primary",3,"disabled","click"],[4,"ngIf"],["class","custom-field",4,"ngFor","ngForOf"],[1,"custom-field"],[3,"compact","readonly","customField","customFieldsFormGroup"]],template:function(t,o){1&t&&(e.I0R(0,"div",0)(1,"div",1)(2,"h4",2),e.OEk(3),e.wVc(4,"translate"),e.C$Y(),e.I0R(5,"vdr-product-variant-selector",3),e.qCj("productSelected",function(a){return o.selectedVariantId$.next(a.productVariantId)}),e.C$Y()(),e.yuY(6,Vr,31,32,"div",4),e.wVc(7,"async"),e.C$Y()),2&t&&(e.yG2(3),e.cNF(e.kDX(4,2,"order.add-item-to-order")),e.yG2(3),e.E7m("ngIf",e.kDX(7,4,o.selectedVariant$)))},dependencies:[m.ay,m.u_,l.ot,l.O4,l.ue,l.Gu,l._G,qe.E,C.w,_t.k,m.a,p.sD,j.w,g.u],styles:[".variant-details[_ngcontent-%COMP%]{display:flex;align-items:center}.variant-details[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{border-radius:var(--border-radius-img);width:32px;height:32px}.variant-details[_ngcontent-%COMP%] .details[_ngcontent-%COMP%]{font-size:.65rem;line-height:.7rem}.variant-details[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{width:48px;margin:0 6px}.variant-details[_ngcontent-%COMP%] .small[_ngcontent-%COMP%]{font-size:11px;color:var(--color-text-300)}"],changeDetection:0})}function Nr(r,n){if(1&r){const t=e.KQA();e.I0R(0,"vdr-action-bar")(1,"vdr-ab-left")(2,"div",1),e.wR5(3,"vdr-order-state-label",2),e.C$Y()(),e.I0R(4,"vdr-ab-right"),e.wR5(5,"vdr-action-bar-items",3),e.I0R(6,"button",4),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.completeOrder())}),e.wR5(7,"clr-icon",5),e.OEk(8),e.wVc(9,"translate"),e.C$Y(),e.I0R(10,"vdr-action-bar-dropdown-menu",6)(11,"button",7),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.deleteOrder())}),e.wR5(12,"clr-icon",8),e.OEk(13),e.wVc(14,"translate"),e.C$Y()()()()}if(2&r){const t=n.ngIf;e.yG2(3),e.E7m("state",t.state),e.yG2(3),e.E7m("disabled",!t.customer||!t.lines.length||!t.shippingLines.length),e.yG2(2),e.oRS(" ",e.kDX(9,5,"order.complete-draft-order")," "),e.yG2(2),e.E7m("alwaysShow",!0),e.yG2(3),e.oRS(" ",e.kDX(14,7,"order.delete-draft-order")," ")}}function Xr(r,n){1&r&&e.wR5(0,"clr-icon",24)}function Lr(r,n){1&r&&e.wR5(0,"clr-icon",25)}function jr(r,n){if(1&r&&e.yuY(0,Xr,1,0,"clr-icon",22)(1,Lr,1,0,"clr-icon",23),2&r){const t=e.GaO().ngIf;e.E7m("ngIf",!t.customer),e.yG2(),e.E7m("ngIf",t.customer)}}function Qr(r,n){if(1&r&&e.wR5(0,"vdr-customer-label",26),2&r){const t=e.GaO().ngIf;e.E7m("customer",t.customer)}}function Kr(r,n){1&r&&e.wR5(0,"clr-icon",24)}function qr(r,n){1&r&&e.wR5(0,"clr-icon",25)}function Hr(r,n){if(1&r&&e.yuY(0,Kr,1,0,"clr-icon",22)(1,qr,1,0,"clr-icon",23),2&r){const t=e.GaO().ngIf;e.E7m("ngIf",!t.billingAddress.streetLine1),e.yG2(),e.E7m("ngIf",t.billingAddress.streetLine1)}}function Jr(r,n){if(1&r&&e.wR5(0,"vdr-formatted-address",27),2&r){const t=e.GaO().ngIf;e.E7m("address",t.billingAddress)}}function Br(r,n){1&r&&e.wR5(0,"clr-icon",24)}function Wr(r,n){1&r&&e.wR5(0,"clr-icon",25)}function Ur(r,n){if(1&r&&e.yuY(0,Br,1,0,"clr-icon",22)(1,Wr,1,0,"clr-icon",23),2&r){const t=e.GaO().ngIf;e.E7m("ngIf",!t.shippingAddress.streetLine1||!t.shippingLines.length),e.yG2(),e.E7m("ngIf",t.shippingAddress.streetLine1&&t.shippingLines.length)}}function zr(r,n){if(1&r&&e.wR5(0,"vdr-formatted-address",27),2&r){const t=e.GaO().ngIf;e.E7m("address",t.shippingAddress)}}function Zr(r,n){if(1&r&&(e.I0R(0,"div"),e.OEk(1),e.C$Y()),2&r){const t=n.$implicit;e.yG2(),e.oRS(" ",t.shippingMethod.name," ")}}function eo(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",12),e.qCj("click",function(){e.usT(t);const i=e.GaO(2);return e.CGJ(i.displayCouponCodeInput=!i.displayCouponCodeInput)}),e.OEk(1),e.wVc(2,"translate"),e.C$Y()}2&r&&(e.yG2(),e.oRS(" ",e.kDX(2,1,"order.set-coupon-codes")," "))}function to(r,n){if(1&r){const t=e.KQA();e.I0R(0,"div")(1,"label"),e.OEk(2),e.wVc(3,"translate"),e.C$Y(),e.I0R(4,"vdr-coupon-code-selector",28),e.qCj("addCouponCode",function(i){e.usT(t);const a=e.GaO(2);return e.CGJ(a.applyCouponCode(i))})("removeCouponCode",function(i){e.usT(t);const a=e.GaO(2);return e.CGJ(a.removeCouponCode(i))}),e.C$Y()()}if(2&r){const t=e.GaO().ngIf;e.yG2(2),e.cNF(e.kDX(3,2,"order.set-coupon-codes")),e.yG2(2),e.E7m("couponCodes",t.couponCodes)}}function no(r,n){if(1&r&&e.wR5(0,"vdr-page-entity-info",29),2&r){const t=n.ngIf;e.E7m("entity",t)}}function ro(r,n){if(1&r&&(e.I0R(0,"tr")(1,"td"),e.OEk(2),e.C$Y(),e.I0R(3,"td"),e.OEk(4),e.wVc(5,"percent"),e.C$Y(),e.I0R(6,"td"),e.OEk(7),e.wVc(8,"localeCurrency"),e.C$Y(),e.I0R(9,"td"),e.OEk(10),e.wVc(11,"localeCurrency"),e.C$Y()()),2&r){const t=n.$implicit,o=e.GaO(2).ngIf;e.yG2(2),e.cNF(t.description),e.yG2(2),e.cNF(e.kDX(5,4,t.taxRate/100)),e.yG2(3),e.cNF(e.g7$(8,6,t.taxBase,o.currencyCode)),e.yG2(3),e.cNF(e.g7$(11,9,t.taxTotal,o.currencyCode))}}function oo(r,n){if(1&r&&(e.SAx(0),e.I0R(1,"table",30)(2,"thead")(3,"tr")(4,"th"),e.OEk(5),e.wVc(6,"translate"),e.C$Y(),e.I0R(7,"th"),e.OEk(8),e.wVc(9,"translate"),e.C$Y(),e.I0R(10,"th"),e.OEk(11),e.wVc(12,"translate"),e.C$Y(),e.I0R(13,"th"),e.OEk(14),e.wVc(15,"translate"),e.C$Y()()(),e.I0R(16,"tbody"),e.yuY(17,ro,12,12,"tr",15),e.C$Y()(),e.k70()),2&r){const t=e.GaO().ngIf;e.yG2(5),e.cNF(e.kDX(6,5,"common.description")),e.yG2(3),e.cNF(e.kDX(9,7,"order.tax-rate")),e.yG2(3),e.cNF(e.kDX(12,9,"order.tax-base")),e.yG2(3),e.cNF(e.kDX(15,11,"order.tax-total")),e.yG2(3),e.E7m("ngForOf",t.taxSummary)}}function io(r,n){if(1&r){const t=e.KQA();e.I0R(0,"vdr-page-detail-layout")(1,"vdr-page-detail-sidebar")(2,"vdr-card",9),e.wVc(3,"translate"),e.yuY(4,jr,2,2,"ng-template",10)(5,Qr,1,1,"vdr-customer-label",11),e.I0R(6,"button",12),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.setCustomer())}),e.OEk(7),e.wVc(8,"translate"),e.C$Y()(),e.I0R(9,"vdr-card",9),e.wVc(10,"translate"),e.yuY(11,Hr,2,2,"ng-template",10)(12,Jr,1,1,"vdr-formatted-address",13),e.I0R(13,"button",12),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.setBillingAddress())}),e.OEk(14),e.wVc(15,"translate"),e.C$Y()(),e.I0R(16,"vdr-card",9),e.wVc(17,"translate"),e.yuY(18,Ur,2,2,"ng-template",10)(19,zr,1,1,"vdr-formatted-address",13),e.I0R(20,"button",14),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.setShippingAddress())}),e.OEk(21),e.wVc(22,"translate"),e.C$Y(),e.yuY(23,Zr,2,1,"div",15),e.I0R(24,"button",12),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.setShippingMethod())}),e.OEk(25),e.wVc(26,"translate"),e.C$Y()(),e.I0R(27,"vdr-card"),e.yuY(28,eo,3,3,"button",16)(29,to,5,4,"div",0),e.C$Y(),e.I0R(30,"vdr-card"),e.yuY(31,no,1,1,"vdr-page-entity-info",17),e.wVc(32,"async"),e.C$Y()(),e.I0R(33,"vdr-page-block")(34,"vdr-card")(35,"vdr-draft-order-variant-selector",18),e.qCj("addItem",function(i){e.usT(t);const a=e.GaO();return e.CGJ(a.addItemToOrder(i))}),e.C$Y(),e.I0R(36,"vdr-order-table",19),e.qCj("adjust",function(i){e.usT(t);const a=e.GaO();return e.CGJ(a.adjustOrderLine(i))})("remove",function(i){e.usT(t);const a=e.GaO();return e.CGJ(a.removeOrderLine(i))}),e.C$Y()(),e.I0R(37,"vdr-card",9),e.wVc(38,"translate"),e.yuY(39,oo,18,13,"ng-container",0),e.C$Y(),e.wR5(40,"vdr-custom-detail-component-host",20),e.I0R(41,"vdr-order-custom-fields-card",21),e.qCj("updateClick",function(i){e.usT(t);const a=e.GaO();return e.CGJ(a.updateCustomFields(i))}),e.C$Y()()()}if(2&r){const t=n.ngIf,o=e.GaO();e.yG2(2),e.E7m("title",e.kDX(3,25,"order.customer")),e.yG2(3),e.E7m("ngIf",t.customer),e.yG2(2),e.oRS(" ",e.kDX(8,27,"order.set-customer-for-order")," "),e.yG2(2),e.E7m("title",e.kDX(10,29,"order.billing-address")),e.yG2(3),e.E7m("ngIf",t.billingAddress),e.yG2(2),e.oRS(" ",e.kDX(15,31,"order.set-billing-address")," "),e.yG2(2),e.E7m("title",e.kDX(17,33,"order.shipping")),e.yG2(3),e.E7m("ngIf",t.shippingAddress),e.yG2(2),e.oRS(" ",e.kDX(22,35,"order.set-shipping-address")," "),e.yG2(2),e.E7m("ngForOf",t.shippingLines),e.yG2(2),e.oRS(" ",e.kDX(26,37,"order.set-shipping-method")," "),e.yG2(3),e.E7m("ngIf",0===t.couponCodes.length&&!o.displayCouponCodeInput),e.yG2(),e.E7m("ngIf",t.couponCodes.length||o.displayCouponCodeInput),e.yG2(2),e.E7m("ngIf",e.kDX(32,39,o.entity$)),e.yG2(4),e.E7m("orderLineCustomFields",o.orderLineCustomFields)("currencyCode",t.currencyCode),e.yG2(),e.E7m("order",t)("orderLineCustomFields",o.orderLineCustomFields)("isDraft",!0),e.yG2(),e.E7m("title",e.kDX(38,41,"order.tax-summary")),e.yG2(2),e.E7m("ngIf",t.taxSummary.length),e.yG2(),e.E7m("entity$",o.entity$)("detailForm",o.detailForm),e.yG2(),e.E7m("customFieldsConfig",o.customFields)("customFieldValues",t.customFields)}}class fe extends d.uJQ{constructor(n,t,o,i,a){super(),this.changeDetector=n,this.dataService=t,this.notificationService=o,this.modalService=i,this.orderTransitionService=a,this.customFields=this.getCustomFieldConfig("Order"),this.orderLineCustomFields=this.getCustomFieldConfig("OrderLine"),this.detailForm=new l.k1({}),this.fetchHistory=new Q.E,this.displayCouponCodeInput=!1}ngOnInit(){this.init(),this.orderLineCustomFields=this.getCustomFieldConfig("OrderLine"),this.eligibleShippingMethods$=this.entity$.pipe((0,f.G)(n=>this.dataService.order.getDraftOrderEligibleShippingMethods(n.id).mapSingle(({eligibleShippingMethodsForDraftOrder:t})=>t)))}ngOnDestroy(){this.destroy()}addItemToOrder(n){this.dataService.order.addItemToDraftOrder(this.id,n).subscribe(t=>{"Order"!==t.addItemToDraftOrder.__typename&&this.notificationService.error(t.addItemToDraftOrder.message)})}adjustOrderLine(n){this.dataService.order.adjustDraftOrderLine(this.id,{orderLineId:n.lineId,quantity:n.quantity}).subscribe(t=>{"Order"!==t.adjustDraftOrderLine.__typename&&this.notificationService.error(t.adjustDraftOrderLine.message)})}removeOrderLine(n){this.dataService.order.removeDraftOrderLine(this.id,n.lineId).subscribe(t=>{"Order"!==t.removeDraftOrderLine.__typename&&this.notificationService.error(t.removeDraftOrderLine.message)})}getOrderAddressLines(n){return n?Object.values(n).filter(t=>"OrderAddress"!==t).filter(t=>!!t):[]}setCustomer(){this.modalService.fromComponent(H).subscribe(n=>{if(this.hasId(n))this.dataService.order.setCustomerForDraftOrder(this.id,{customerId:n.id}).subscribe();else if(n){const{note:t,...o}=n;this.dataService.order.setCustomerForDraftOrder(this.id,{input:o}).subscribe()}})}setShippingAddress(){this.entity$.pipe((0,x.U)(1),(0,f.G)(n=>this.modalService.fromComponent(q,{locals:{customerId:n.customer?.id,currentAddress:n.shippingAddress??void 0}}))).subscribe(n=>{n&&this.dataService.order.setDraftOrderShippingAddress(this.id,n).subscribe()})}setBillingAddress(){this.entity$.pipe((0,x.U)(1),(0,f.G)(n=>this.modalService.fromComponent(q,{locals:{customerId:n.customer?.id,currentAddress:n.billingAddress??void 0}}))).subscribe(n=>{n&&this.dataService.order.setDraftOrderBillingAddress(this.id,n).subscribe()})}applyCouponCode(n){this.dataService.order.applyCouponCodeToDraftOrder(this.id,n).subscribe()}removeCouponCode(n){this.dataService.order.removeCouponCodeFromDraftOrder(this.id,n).subscribe()}setShippingMethod(){(0,At.E)(this.entity$,this.eligibleShippingMethods$).pipe((0,x.U)(1),(0,f.G)(([n,t])=>this.modalService.fromComponent(J,{locals:{eligibleShippingMethods:t,currencyCode:n.currencyCode,currentSelectionId:n.shippingLines?.[0]?.shippingMethod.id}}))).subscribe(n=>{n&&this.dataService.order.setDraftOrderShippingMethod(this.id,n).subscribe()})}updateCustomFields(n){this.dataService.order.updateOrderCustomFields({id:this.id,customFields:n}).subscribe()}deleteOrder(){this.dataService.order.deleteDraftOrder(this.id).subscribe(({deleteDraftOrder:n})=>{n.result===d.yuD.DELETED?(this.notificationService.success((0,u.s)("common.notify-delete-success"),{entity:"Order"}),this.router.navigate(["/orders"])):n.message&&this.notificationService.error(n.message)})}completeOrder(){this.dataService.order.transitionToState(this.id,"ArrangingPayment").subscribe(({transitionOrderToState:n})=>{"Order"===n?.__typename?this.router.navigate(["/orders",this.id]):"OrderStateTransitionError"===n?.__typename&&this.notificationService.error(n.transitionError)})}hasId(n){return"object"==typeof n&&!!n.id}setFormValues(n){}static#e=this.\u0275fac=function(t){return new(t||fe)(e.GI1(e.kD9),e.GI1(d.Aj0),e.GI1(d.gnT),e.GI1(d.Ajm),e.GI1(M))};static#t=this.\u0275cmp=e.In1({type:fe,selectors:[["vdr-draft-order-detail"]],features:[e.eg9],decls:5,vars:6,consts:[[4,"ngIf"],[1,"flex","clr-align-items-center"],[3,"state"],["locationId","draft-order-detail"],[1,"btn","btn-primary",3,"disabled","click"],["shape","check"],["locationId","draft-order-detail",3,"alwaysShow"],["type","button","vdrDropdownItem","",3,"click"],["shape","trash",1,"is-danger"],[3,"title"],["vdrCardControls",""],["class","block mb-2",3,"customer",4,"ngIf"],[1,"button-small",3,"click"],["class","block mb-2",3,"address",4,"ngIf"],[1,"button-small","mr-2",3,"click"],[4,"ngFor","ngForOf"],["class","button-small",3,"click",4,"ngIf"],[3,"entity",4,"ngIf"],[3,"orderLineCustomFields","currencyCode","addItem"],[3,"order","orderLineCustomFields","isDraft","adjust","remove"],["locationId","draft-order-detail",3,"entity$","detailForm"],[3,"customFieldsConfig","customFieldValues","updateClick"],["shape","unknown-status","class","is-warning",4,"ngIf"],["shape","check","class","is-success",4,"ngIf"],["shape","unknown-status",1,"is-warning"],["shape","check",1,"is-success"],[1,"block","mb-2",3,"customer"],[1,"block","mb-2",3,"address"],[3,"couponCodes","addCouponCode","removeCouponCode"],[3,"entity"],[1,"table"]],template:function(t,o){1&t&&(e.I0R(0,"vdr-page-block"),e.yuY(1,Nr,15,9,"vdr-action-bar",0),e.wVc(2,"async"),e.C$Y(),e.yuY(3,io,42,43,"vdr-page-detail-layout",0),e.wVc(4,"async")),2&t&&(e.yG2(),e.E7m("ngIf",e.kDX(2,2,o.entity$)),e.yG2(2),e.E7m("ngIf",e.kDX(4,4,o.entity$)))},dependencies:[_.o3d,_.ojz,m.ay,m.u_,I.iK,I.Ix,I.eu,Xe.O,Le.G,ue.Q,Me.a,se.o,je.o,dt.K,Ye.m,st.k,Qe.g,Ke.e,G.u,G.M,_e,X,pe,K,m.a,m.Bz,p.sD,g.u],changeDetection:0})}var ao=s(204);function lo(r,n){1&r&&(e.OEk(0),e.wVc(1,"translate")),2&r&&e.cNF(e.kDX(1,1,"order.fulfill-order"))}function so(r,n){if(1&r&&(e.wR5(0,"img",17),e.wVc(1,"assetPreview")),2&r){const t=e.GaO().$implicit;e.E7m("src",e.g7$(1,1,t.featuredAsset,"tiny"),e.K6U)}}function co(r,n){if(1&r){const t=e.KQA();e.I0R(0,"input",18),e.iHE("ngModelChange",function(i){e.usT(t);const a=e.GaO().$implicit,c=e.GaO();return e.kNx(c.fulfillmentQuantities[a.id].fulfillCount,i)||(c.fulfillmentQuantities[a.id].fulfillCount=i),e.CGJ(i)}),e.C$Y()}if(2&r){const t=e.GaO().$implicit,o=e.GaO();e.E7m("disabled",0===o.getUnfulfilledCount(t)),e.OKB("ngModel",o.fulfillmentQuantities[t.id].fulfillCount),e.E7m("max",o.fulfillmentQuantities[t.id].max)}}function mo(r,n){if(1&r&&(e.I0R(0,"tr",9)(1,"td",10),e.yuY(2,so,2,4,"img",11),e.C$Y(),e.I0R(3,"td",12),e.OEk(4),e.C$Y(),e.I0R(5,"td",13),e.OEk(6),e.C$Y(),e.I0R(7,"td",14),e.OEk(8),e.C$Y(),e.I0R(9,"td",14),e.OEk(10),e.C$Y(),e.I0R(11,"td",15),e.yuY(12,co,1,3,"input",16),e.C$Y()()),2&r){const t=n.$implicit,o=e.GaO();e.eAK("ignore",0===o.getUnfulfilledCount(t)),e.yG2(2),e.E7m("ngIf",t.featuredAsset),e.yG2(2),e.cNF(t.productVariant.name),e.yG2(2),e.cNF(t.productVariant.sku),e.yG2(2),e.cNF(o.getUnfulfilledCount(t)),e.yG2(2),e.cNF(t.productVariant.stockOnHand),e.yG2(2),e.E7m("ngIf",o.fulfillmentQuantities[t.id])}}function uo(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",19),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.cancel())}),e.OEk(1),e.wVc(2,"translate"),e.C$Y(),e.I0R(3,"button",20),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.select())}),e.OEk(4),e.wVc(5,"translate"),e.C$Y()}if(2&r){const t=e.GaO();e.yG2(),e.cNF(e.kDX(2,3,"common.cancel")),e.yG2(2),e.E7m("disabled",!t.canSubmit()),e.yG2(),e.oRS(" ",e.kDX(5,5,"order.create-fulfillment")," ")}}class ge{constructor(n,t){this.dataService=n,this.changeDetector=t,this.fulfillmentHandlerControl=new l.yM,this.fulfillmentQuantities={}}ngOnInit(){this.dataService.settings.getGlobalSettings().single$.subscribe(({globalSettings:n})=>{this.fulfillmentQuantities=this.order.lines.reduce((t,o)=>{const i=this.getFulfillableCount(o,n.trackInventory);return{...t,[o.id]:{fulfillCount:i,max:i}}},{}),this.changeDetector.markForCheck()}),this.dataService.shippingMethod.getShippingMethodOperations().mapSingle(n=>n.fulfillmentHandlers).subscribe(n=>{this.fulfillmentHandlerDef=n.find(t=>t.code===this.order.shippingLines[0]?.shippingMethod?.fulfillmentHandlerCode)||n[0],this.fulfillmentHandler=(0,d.kt8)(this.fulfillmentHandlerDef),this.fulfillmentHandlerControl.patchValue(this.fulfillmentHandler),this.changeDetector.markForCheck()})}getFulfillableCount(n,t){const{trackInventory:o,stockOnHand:i}=n.productVariant,a=o===d.w1i.INHERIT?t:o===d.w1i.TRUE,c=this.getUnfulfilledCount(n);return a?Math.min(c,i):c}getUnfulfilledCount(n){const t=this.order.fulfillments?.filter(o=>"Cancelled"!==o.state).map(o=>o.lines).flat().filter(o=>o.orderLineId===n.id).reduce((o,i)=>o+i.quantity,0)??0;return n.quantity-t}canSubmit(){const n=Object.values(this.fulfillmentQuantities).reduce((i,{fulfillCount:a})=>i+a,0),t=Object.values(this.fulfillmentQuantities).every(({fulfillCount:i,max:a})=>i<=a);return(0,d.W2F)(this.fulfillmentHandlerDef,this.fulfillmentHandlerControl.value)&&this.fulfillmentHandlerControl.valid&&0<n&&t}select(){const n=Object.entries(this.fulfillmentQuantities).map(([t,{fulfillCount:o}])=>({orderLineId:t,quantity:o}));this.resolveWith({lines:n,handler:(0,d.iMd)(this.fulfillmentHandler,this.fulfillmentHandlerControl.value)})}cancel(){this.resolveWith()}static#e=this.\u0275fac=function(t){return new(t||ge)(e.GI1(d.Aj0),e.GI1(e.kD9))};static#t=this.\u0275cmp=e.In1({type:ge,selectors:[["vdr-fulfill-order-dialog"]],decls:34,vars:29,consts:[["vdrDialogTitle",""],[1,"fulfillment-wrapper"],[1,"order-table"],[1,"table"],["class","order-line",3,"ignore",4,"ngFor","ngForOf"],[1,"shipping-details"],[3,"address"],[3,"operationDefinition","operation","formControl","removable"],["vdrDialogButtons",""],[1,"order-line"],[1,"align-middle","thumb"],[3,"src",4,"ngIf"],[1,"align-middle","name"],[1,"align-middle","sku"],[1,"align-middle","quantity"],[1,"align-middle","fulfil"],["type","number","min","0",3,"disabled","ngModel","max","ngModelChange",4,"ngIf"],[3,"src"],["type","number","min","0",3,"disabled","ngModel","max","ngModelChange"],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"disabled","click"]],template:function(t,o){1&t&&(e.yuY(0,lo,2,3,"ng-template",0),e.I0R(1,"div",1)(2,"div",2)(3,"table",3)(4,"thead")(5,"tr"),e.wR5(6,"th"),e.I0R(7,"th"),e.OEk(8),e.wVc(9,"translate"),e.C$Y(),e.I0R(10,"th"),e.OEk(11),e.wVc(12,"translate"),e.C$Y(),e.I0R(13,"th"),e.OEk(14),e.wVc(15,"translate"),e.C$Y(),e.I0R(16,"th"),e.OEk(17),e.wVc(18,"translate"),e.C$Y(),e.I0R(19,"th"),e.OEk(20),e.wVc(21,"translate"),e.C$Y()()(),e.yuY(22,mo,13,8,"tr",4),e.C$Y()(),e.I0R(23,"div",5),e.wR5(24,"vdr-formatted-address",6),e.I0R(25,"h6"),e.OEk(26),e.wVc(27,"translate"),e.C$Y(),e.OEk(28),e.I0R(29,"strong"),e.OEk(30),e.wVc(31,"localeCurrency"),e.C$Y(),e.wR5(32,"vdr-configurable-input",7),e.C$Y()(),e.yuY(33,uo,6,7,"ng-template",8)),2&t&&(e.yG2(8),e.cNF(e.kDX(9,14,"order.product-name")),e.yG2(3),e.cNF(e.kDX(12,16,"order.product-sku")),e.yG2(3),e.cNF(e.kDX(15,18,"order.unfulfilled")),e.yG2(3),e.cNF(e.kDX(18,20,"catalog.stock-on-hand")),e.yG2(3),e.cNF(e.kDX(21,22,"order.fulfill")),e.yG2(2),e.E7m("ngForOf",o.order.lines),e.yG2(2),e.E7m("address",o.order.shippingAddress),e.yG2(2),e.cNF(e.kDX(27,24,"order.shipping-method")),e.yG2(2),e.oRS(" ",null==o.order.shippingLines[0]||null==o.order.shippingLines[0].shippingMethod?null:o.order.shippingLines[0].shippingMethod.name," "),e.yG2(2),e.cNF(e.g7$(31,26,o.order.shipping,o.order.currencyCode)),e.yG2(2),e.E7m("operationDefinition",o.fulfillmentHandlerDef)("operation",o.fulfillmentHandler)("formControl",o.fulfillmentHandlerControl)("removable",!1))},dependencies:[m.ay,m.u_,l.ot,l.O4,l.ue,l.Gu,l._t,l._G,l.ug,ao.K,C.w,E.E,b.a,se.o,p.sD,j.w,g.u],styles:["[_nghost-%COMP%]{height:100%;display:flex;min-height:64vh}[_nghost-%COMP%] .is-cancelled[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{text-decoration:line-through;background-color:var(--color-component-bg-200)}[_nghost-%COMP%] .sub-total[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{border-top:1px dashed var(--color-component-border-200)}[_nghost-%COMP%] .total[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{font-weight:700;border-top:1px dashed var(--color-component-border-200)}[_nghost-%COMP%] td.custom-fields-row[_ngcontent-%COMP%]{border-top-style:dashed;border-top-color:var(--color-grey-200)}[_nghost-%COMP%] img[_ngcontent-%COMP%]{border-radius:var(--border-radius-img)}[_nghost-%COMP%] .order-line-custom-fields[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap}[_nghost-%COMP%] .order-line-custom-fields[_ngcontent-%COMP%] .custom-field[_ngcontent-%COMP%]{text-align:start;max-width:200px;overflow:hidden;text-overflow:ellipsis;margin-bottom:6px;margin-inline-end:18px}[_nghost-%COMP%] .draft-qty[_ngcontent-%COMP%]{max-width:48px}[_nghost-%COMP%] .order-line-custom-field[_ngcontent-%COMP%]{background-color:var(--color-component-bg-100)}[_nghost-%COMP%] .order-line-custom-field[_ngcontent-%COMP%] .custom-field-ellipsis[_ngcontent-%COMP%]{color:var(--color-text-300)}[_nghost-%COMP%] .net-price[_ngcontent-%COMP%]{font-size:11px;color:var(--color-text-300);line-height:14px}[_nghost-%COMP%] .promotions-label[_ngcontent-%COMP%]{-webkit-text-decoration:underline dotted var(--color-text-200);text-decoration:underline dotted var(--color-text-200);font-size:11px;margin-top:6px;cursor:pointer;text-transform:lowercase}[_nghost-%COMP%] .thumb[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:50px;height:50px}[_nghost-%COMP%] .shipping-method-name[_ngcontent-%COMP%]{font-size:var(--font-size-xs);margin-inline-end:2px}[_nghost-%COMP%] .order-placed-quantity[_ngcontent-%COMP%]{text-decoration:line-through;color:var(--color-text-300);margin-inline-end:2px}.fulfillment-wrapper[_ngcontent-%COMP%]{flex:1}@media screen and (min-width: 768px){.fulfillment-wrapper[_ngcontent-%COMP%]{display:flex;flex-direction:row}}.fulfillment-wrapper[_ngcontent-%COMP%] .shipping-details[_ngcontent-%COMP%]{margin-top:24px}@media screen and (min-width: 768px){.fulfillment-wrapper[_ngcontent-%COMP%] .shipping-details[_ngcontent-%COMP%]{margin-top:0;margin-inline-start:24px;width:250px}}.fulfillment-wrapper[_ngcontent-%COMP%] .shipping-details[_ngcontent-%COMP%] clr-input-container[_ngcontent-%COMP%]{margin-top:24px}.fulfillment-wrapper[_ngcontent-%COMP%] .order-table[_ngcontent-%COMP%]{flex:1;overflow-y:auto}.fulfillment-wrapper[_ngcontent-%COMP%] .order-table[_ngcontent-%COMP%] table[_ngcontent-%COMP%]{margin-top:0}.fulfillment-wrapper[_ngcontent-%COMP%] tr.ignore[_ngcontent-%COMP%]{color:var(--color-grey-300)}"],changeDetection:0})}function _o(r,n){if(1&r&&(e.I0R(0,"div",5),e.OEk(1),e.C$Y()),2&r){const t=e.GaO().$implicit;e.yG2(),e.cNF(t.quantity)}}function po(r,n){1&r&&e.wR5(0,"clr-icon",6)}function fo(r,n){if(1&r&&(e.I0R(0,"li",2),e.yuY(1,_o,2,1,"div",3)(2,po,1,0,"clr-icon",4),e.OEk(3),e.C$Y()),2&r){const t=n.$implicit;e.E7m("title",t.name),e.yG2(),e.E7m("ngIf",null!=t.quantity),e.yG2(),e.E7m("ngIf",null!=t.quantity),e.yG2(),e.oRS(" ",t.name," ")}}class L{static#e=this.\u0275fac=function(t){return new(t||L)};static#t=this.\u0275cmp=e.In1({type:L,selectors:[["vdr-simple-item-list"]],inputs:{items:"items"},decls:3,vars:1,consts:[[1,"items-list"],[3,"title",4,"ngFor","ngForOf"],[3,"title"],["class","quantity",4,"ngIf"],["shape","times","size","12",4,"ngIf"],[1,"quantity"],["shape","times","size","12"]],template:function(t,o){1&t&&(e.I0R(0,"div",0)(1,"ul"),e.yuY(2,fo,4,4,"li",1),e.C$Y()()),2&t&&(e.yG2(2),e.E7m("ngForOf",o.items))},dependencies:[_.o3d,m.ay,m.u_],styles:[".items-list[_ngcontent-%COMP%]{font-size:12px}.items-list[_ngcontent-%COMP%] ul[_ngcontent-%COMP%]{margin-top:6px;list-style-type:none;margin-inline-start:2px}.items-list[_ngcontent-%COMP%] ul[_ngcontent-%COMP%] li[_ngcontent-%COMP%]{line-height:14px;text-overflow:ellipsis;overflow:hidden}.items-list[_ngcontent-%COMP%] .quantity[_ngcontent-%COMP%]{min-width:16px;display:inline-block}"],changeDetection:0})}function go(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",0),e.wVc(1,"translate"),e.OEk(2),e.C$Y()),2&r){const t=e.GaO();e.E7m("label",e.kDX(1,2,"order.tracking-code")),e.yG2(2),e.oRS(" ",null==t.fulfillment?null:t.fulfillment.trackingCode,"\n")}}function yo(r,n){if(1&r&&e.wR5(0,"vdr-custom-field-control",5),2&r){const t=e.GaO().$implicit,o=e.GaO();e.E7m("readonly",!0)("compact",!0)("customField",t)("customFieldsFormGroup",o.customFieldFormGroup)}}function Co(r,n){if(1&r&&(e.SAx(0),e.yuY(1,yo,1,4,"vdr-custom-field-control",4),e.k70()),2&r){const t=n.$implicit,o=e.GaO();e.yG2(),e.E7m("ngIf",o.customFieldFormGroup.get(t.name))}}class ee{constructor(n){this.serverConfigService=n,this.customFieldConfig=[],this.customFieldFormGroup=new l.k1({})}ngOnInit(){this.customFieldConfig=this.serverConfigService.getCustomFieldsFor("Fulfillment")}ngOnChanges(n){this.buildCustomFieldsFormGroup()}get fulfillment(){return this.order.fulfillments&&this.order.fulfillments.find(n=>n.id===this.fulfillmentId)}get items(){return this.fulfillment?.lines.map(n=>({name:this.order.lines.find(t=>t.id===n.orderLineId)?.productVariant.name??"",quantity:n.quantity}))??[]}buildCustomFieldsFormGroup(){const n=this.fulfillment.customFields;for(const t of this.serverConfigService.getCustomFieldsFor("Fulfillment"))this.customFieldFormGroup.addControl(t.name,new l.yM(n[t.name]))}customFieldIsObject(n){return Array.isArray(n)||(0,h.isObject)(n)}static#e=this.\u0275fac=function(t){return new(t||ee)(e.GI1(d.ctz))};static#t=this.\u0275cmp=e.In1({type:ee,selectors:[["vdr-fulfillment-detail"]],inputs:{fulfillmentId:"fulfillmentId",order:"order"},features:[e.SYr],decls:12,vars:17,consts:[[3,"label"],[3,"label",4,"ngIf"],[3,"items"],[4,"ngFor","ngForOf"],[3,"readonly","compact","customField","customFieldsFormGroup",4,"ngIf"],[3,"readonly","compact","customField","customFieldsFormGroup"]],template:function(t,o){1&t&&(e.I0R(0,"vdr-labeled-data",0),e.wVc(1,"translate"),e.OEk(2),e.wVc(3,"localeDate"),e.C$Y(),e.I0R(4,"vdr-labeled-data",0),e.wVc(5,"translate"),e.OEk(6),e.C$Y(),e.yuY(7,go,3,4,"vdr-labeled-data",1),e.I0R(8,"vdr-labeled-data",0),e.wVc(9,"translate"),e.wR5(10,"vdr-simple-item-list",2),e.C$Y(),e.yuY(11,Co,2,1,"ng-container",3)),2&t&&(e.E7m("label",e.kDX(1,8,"common.created-at")),e.yG2(2),e.oRS(" ",e.g7$(3,10,null==o.fulfillment?null:o.fulfillment.createdAt,"medium"),"\n"),e.yG2(2),e.E7m("label",e.kDX(5,13,"order.fulfillment-method")),e.yG2(2),e.oRS(" ",null==o.fulfillment?null:o.fulfillment.method,"\n"),e.yG2(),e.E7m("ngIf",null==o.fulfillment?null:o.fulfillment.trackingCode),e.yG2(),e.E7m("label",e.kDX(9,15,"order.contents")),e.yG2(2),e.E7m("items",o.items),e.yG2(),e.E7m("ngForOf",o.customFieldConfig))},dependencies:[m.ay,m.u_,qe.E,O.a,L,p.sD,A.m],changeDetection:0})}function ho(r,n){1&r&&e.wR5(0,"clr-icon",2)}class ye{get chipColorType(){switch(this.state){case"Pending":case"Shipped":return"warning";case"Delivered":return"success";case"Cancelled":return"error"}}static#e=this.\u0275fac=function(t){return new(t||ye)};static#t=this.\u0275cmp=e.In1({type:ye,selectors:[["vdr-fulfillment-state-label"]],inputs:{state:"state"},decls:6,vars:10,consts:[[3,"title","colorType"],["shape","check-circle",4,"ngIf"],["shape","check-circle"]],template:function(t,o){1&t&&(e.I0R(0,"vdr-chip",0),e.wVc(1,"translate"),e.yuY(2,ho,1,0,"clr-icon",1),e.OEk(3),e.wVc(4,"translate"),e.wVc(5,"stateI18nToken"),e.C$Y()),2&t&&(e.E7m("title",e.kDX(1,4,"order.payment-state"))("colorType",o.chipColorType),e.yG2(2),e.E7m("ngIf","Delivered"===o.state),e.yG2(),e.oRS(" ",e.kDX(4,6,e.kDX(5,8,o.state)),"\n"))},dependencies:[_.o3d,m.u_,D.g,p.sD,$.Q],styles:["[_nghost-%COMP%]{font-size:14px}"],changeDetection:0})}function Oo(r,n){if(1&r&&e.wR5(0,"vdr-fulfillment-detail",7),2&r){const t=e.GaO();e.E7m("fulfillmentId",null==t.fulfillment?null:t.fulfillment.id)("order",t.order)}}const pt=r=>({state:r});function vo(r,n){if(1&r){const t=e.KQA();e.SAx(0),e.I0R(1,"button",14),e.qCj("click",function(){const a=e.usT(t).ngIf,c=e.GaO(2);return e.CGJ(c.transitionState.emit(a))}),e.OEk(2),e.wVc(3,"translate"),e.wVc(4,"translate"),e.wVc(5,"stateI18nToken"),e.C$Y(),e.k70()}if(2&r){const t=n.ngIf;e.yG2(2),e.oRS(" ",e.g7$(3,1,"order.set-fulfillment-state",e.S45(8,pt,e.kDX(4,4,e.kDX(5,6,t))))," ")}}function bo(r,n){if(1&r&&(e.SAx(0),e.wR5(1,"clr-icon",18),e.OEk(2),e.wVc(3,"translate"),e.wVc(4,"translate"),e.wVc(5,"stateI18nToken"),e.k70()),2&r){const t=e.GaO().$implicit;e.yG2(2),e.oRS(" ",e.g7$(3,1,"order.transition-to-state",e.S45(8,pt,e.kDX(4,4,e.kDX(5,6,t))))," ")}}function Io(r,n){1&r&&(e.wR5(0,"clr-icon",19),e.OEk(1),e.wVc(2,"translate")),2&r&&(e.yG2(),e.oRS(" ",e.kDX(2,1,"order.cancel-fulfillment")," "))}function Go(r,n){if(1&r){const t=e.KQA();e.SAx(0),e.I0R(1,"button",15),e.qCj("click",function(){const a=e.usT(t).$implicit,c=e.GaO(2);return e.CGJ(c.transitionState.emit(a))}),e.yuY(2,bo,6,10,"ng-container",16)(3,Io,3,3,"ng-template",null,17,e.gJz),e.C$Y(),e.k70()}if(2&r){const t=n.$implicit,o=e.Gew(4);e.yG2(2),e.E7m("ngIf","Cancelled"!==t)("ngIfElse",o)}}function Eo(r,n){if(1&r&&(e.I0R(0,"div",8),e.yuY(1,vo,6,10,"ng-container",9),e.I0R(2,"vdr-dropdown")(3,"button",10),e.wR5(4,"clr-icon",11),e.C$Y(),e.I0R(5,"vdr-dropdown-menu",12),e.yuY(6,Go,5,2,"ng-container",13),e.C$Y()()()),2&r){const t=e.GaO();e.yG2(),e.E7m("ngIf",t.nextSuggestedState()),e.yG2(5),e.E7m("ngForOf",t.nextOtherStates())}}class Ce{constructor(){this.transitionState=new e._w7}nextSuggestedState(){if(!this.fulfillment)return;const{nextStates:n}=this.fulfillment,t=o=>n.includes(o)?o:n[0];switch(this.fulfillment?.state){case"Pending":return t("Shipped");case"Shipped":return t("Delivered");default:return n.find(o=>"Cancelled"!==o)}}nextOtherStates(){if(!this.fulfillment)return[];const n=this.nextSuggestedState();return this.fulfillment.nextStates.filter(t=>t!==n)}static#e=this.\u0275fac=function(t){return new(t||Ce)};static#t=this.\u0275cmp=e.In1({type:Ce,selectors:[["vdr-fulfillment-card"]],inputs:{fulfillment:"fulfillment",order:"order"},outputs:{transitionState:"transitionState"},decls:10,vars:6,consts:[[1,"card"],[1,"card-header","fulfillment-header"],[1,"fulfillment-state"],[3,"state"],[1,"card-block"],[3,"fulfillmentId","order",4,"ngIf"],["class","card-footer",4,"ngIf"],[3,"fulfillmentId","order"],[1,"card-footer"],[4,"ngIf"],["vdrDropdownTrigger","",1,"icon-button"],["shape","ellipsis-vertical"],["vdrPosition","bottom-right"],[4,"ngFor","ngForOf"],[1,"btn","btn-sm","btn-primary",3,"click"],["type","button","vdrDropdownItem","",3,"click"],[4,"ngIf","ngIfElse"],["cancel",""],["shape","step-forward-2"],["shape","error-standard",1,"is-error"]],template:function(t,o){1&t&&(e.I0R(0,"div",0)(1,"div",1)(2,"div"),e.OEk(3),e.wVc(4,"translate"),e.C$Y(),e.I0R(5,"div",2),e.wR5(6,"vdr-fulfillment-state-label",3),e.C$Y()(),e.I0R(7,"div",4),e.yuY(8,Oo,1,2,"vdr-fulfillment-detail",5),e.C$Y(),e.yuY(9,Eo,7,2,"div",6),e.C$Y()),2&t&&(e.yG2(3),e.cNF(e.kDX(4,4,"order.fulfillment")),e.yG2(3),e.E7m("state",null==o.fulfillment?null:o.fulfillment.state),e.yG2(2),e.E7m("ngIf",!!o.fulfillment),e.yG2(),e.E7m("ngIf",null==o.fulfillment?null:o.fulfillment.nextStates.length))},dependencies:[_.o3d,m.ay,m.u_,B.i,W.m,U.q,ue.Q,ee,ye,p.sD,$.Q],styles:[".fulfillment-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center}.card-footer[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:flex-end}"],changeDetection:0})}function Ro(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",0),e.wVc(1,"translate"),e.OEk(2),e.C$Y()),2&r){const t=e.GaO();e.E7m("label",e.kDX(1,2,"order.note")),e.yG2(2),e.cNF(t.modification.note)}}function ko(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",0),e.wVc(1,"translate"),e.OEk(2),e.wVc(3,"localeCurrency"),e.C$Y()),2&r){const t=n.$implicit,o=e.GaO();let i;e.E7m("label",e.kDX(1,3,"order.surcharges")),e.yG2(2),e.CAO(" ",null==(i=o.getSurcharge(t.id))?null:i.description," ",e.g7$(3,5,null==(i=o.getSurcharge(t.id))?null:i.priceWithTax,o.order.currencyCode),"")}}function wo(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",0),e.wVc(1,"translate"),e.wR5(2,"vdr-simple-item-list",3),e.C$Y()),2&r){const t=e.GaO();e.E7m("label",e.kDX(1,2,"order.added-items")),e.yG2(2),e.E7m("items",t.getAddedItems())}}function To(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",0),e.wVc(1,"translate"),e.wR5(2,"vdr-simple-item-list",3),e.C$Y()),2&r){const t=e.GaO();e.E7m("label",e.kDX(1,2,"order.removed-items")),e.yG2(2),e.E7m("items",t.getRemovedItems())}}function So(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",0),e.wVc(1,"translate"),e.wR5(2,"vdr-simple-item-list",3),e.C$Y()),2&r){const t=e.GaO();e.E7m("label",e.kDX(1,2,"order.modified-items")),e.yG2(2),e.E7m("items",t.getModifiedItems())}}class he{constructor(){this.addedItems=new Map,this.removedItems=new Map,this.modifiedItems=new Set}ngOnChanges(){const{added:n,removed:t,modified:o}=this.getModifiedLines();this.addedItems=n,this.removedItems=t,this.modifiedItems=o}getSurcharge(n){return this.order.surcharges.find(t=>t.id===n)}getAddedItems(){return[...this.addedItems.entries()].map(([n,t])=>({name:n.productVariant.name,quantity:t}))}getRemovedItems(){return[...this.removedItems.entries()].map(([n,t])=>({name:n.productVariant.name,quantity:t}))}getModifiedItems(){return[...this.modifiedItems].map(n=>({name:n.productVariant.name}))}getModifiedLines(){const n=new Map,t=new Map,o=new Set;for(const i of this.modification.lines||[]){const a=this.order.lines.find(c=>c.id===i.orderLineId);a&&(0===i.quantity?o.add(a):i.quantity<0?t.set(a,-i.quantity):n.set(a,i.quantity))}return{added:n,removed:t,modified:o}}static#e=this.\u0275fac=function(t){return new(t||he)};static#t=this.\u0275cmp=e.In1({type:he,selectors:[["vdr-modification-detail"]],inputs:{order:"order",modification:"modification"},features:[e.SYr],decls:8,vars:9,consts:[[3,"label"],[3,"label",4,"ngIf"],[3,"label",4,"ngFor","ngForOf"],[3,"items"]],template:function(t,o){1&t&&(e.I0R(0,"vdr-labeled-data",0),e.wVc(1,"translate"),e.OEk(2),e.C$Y(),e.yuY(3,Ro,3,4,"vdr-labeled-data",1)(4,ko,4,8,"vdr-labeled-data",2)(5,wo,3,4,"vdr-labeled-data",1)(6,To,3,4,"vdr-labeled-data",1)(7,So,3,4,"vdr-labeled-data",1)),2&t&&(e.E7m("label",e.kDX(1,7,"common.ID")),e.yG2(2),e.cNF(o.modification.id),e.yG2(),e.E7m("ngIf",o.modification.note),e.yG2(),e.E7m("ngForOf",o.modification.surcharges),e.yG2(),e.E7m("ngIf",o.getAddedItems().length),e.yG2(),e.E7m("ngIf",o.getRemovedItems().length),e.yG2(),e.E7m("ngIf",o.getModifiedItems().length))},dependencies:[m.ay,m.u_,O.a,L,p.sD,g.u],changeDetection:0})}var Do=s(80),ft=s(5172),He=s(5623);const Je=72;function xo(r,n){if(1&r&&(e.I0R(0,"div",3),e.wR5(1,"div",4)(2,"clr-icon",5),e.I0R(3,"div",6),e.OEk(4),e.wVc(5,"translate"),e.wVc(6,"stateI18nToken"),e.C$Y()()),2&r){const t=e.GaO();e.yG2(4),e.oRS(" ",e.kDX(5,1,e.kDX(6,3,t.cancelledState))," ")}}class te{constructor(n){this.elementRef=n,this.active$=new He.g(!1),this.activeTarget$=new He.g(!1),this.isCancellable=!1,this.cancelledState="Cancelled"}ngOnChanges(n){this.isCancellable=!!this.node.to.find(t=>"Cancelled"===t.name),n.active&&this.active$.next(this.active)}getPos(n="top"){this.elementRef.nativeElement.getBoundingClientRect();const o=this.elementRef.nativeElement.querySelector(".node")?.getBoundingClientRect().height??0;return{x:10,y:this.index*Je+("bottom"===n?o:0)}}getStyle(){const n=this.getPos();return{"top.px":n.y,"left.px":n.x}}static#e=this.\u0275fac=function(t){return new(t||te)(e.GI1(e.GMv))};static#t=this.\u0275cmp=e.In1({type:te,selectors:[["vdr-order-process-node"]],inputs:{node:"node",index:"index",active:"active"},features:[e.SYr],decls:8,vars:15,consts:[[1,"node-wrapper",3,"ngStyle"],[1,"node"],["class","cancelled-wrapper",4,"ngIf"],[1,"cancelled-wrapper"],[1,"cancelled-edge"],["shape","dot-circle"],[1,"cancelled-node"]],template:function(t,o){1&t&&(e.I0R(0,"div",0),e.wVc(1,"async"),e.I0R(2,"div",1),e.wVc(3,"async"),e.OEk(4),e.wVc(5,"translate"),e.wVc(6,"stateI18nToken"),e.C$Y(),e.yuY(7,xo,7,5,"div",2),e.C$Y()),2&t&&(e.eAK("active",e.kDX(1,7,o.active$)),e.E7m("ngStyle",o.getStyle()),e.yG2(2),e.eAK("active-target",e.kDX(3,9,o.activeTarget$)),e.yG2(2),e.oRS(" ",e.kDX(5,11,e.kDX(6,13,o.node.name))," "),e.yG2(3),e.E7m("ngIf",o.isCancellable))},dependencies:[_.o3d,m.u_,m.Qt,m.a,p.sD,$.Q],styles:["[_nghost-%COMP%]{display:block}.node-wrapper[_ngcontent-%COMP%]{position:absolute;z-index:1;display:flex;align-items:center}.node[_ngcontent-%COMP%]{display:inline-block;border:2px solid var(--color-component-border-200);border-radius:3px;padding:3px 6px;z-index:1;background-color:var(--color-component-bg-100);opacity:.7;transition:opacity .2s,background-color .2s,color .2s;cursor:default}.node.active-target[_ngcontent-%COMP%]{border-color:var(--color-primary-500);opacity:.9}.cancelled-wrapper[_ngcontent-%COMP%]{display:flex;align-items:center;color:var(--color-grey-300);transition:color .2s,opacity .2s;opacity:.7}.cancelled-edge[_ngcontent-%COMP%]{width:48px;height:2px;background-color:var(--color-component-bg-300);transition:background-color .2s}clr-icon[_ngcontent-%COMP%]{margin-inline-start:-1px}.cancelled-node[_ngcontent-%COMP%]{margin-inline-start:6px}.active[_ngcontent-%COMP%] .cancelled-wrapper[_ngcontent-%COMP%]{opacity:1}.active[_ngcontent-%COMP%] .node[_ngcontent-%COMP%]{opacity:1;background-color:var(--color-primary-600);border-color:var(--color-primary-600);color:var(--color-primary-100)}.active[_ngcontent-%COMP%] .cancelled-wrapper[_ngcontent-%COMP%]{color:var(--color-error-500)}.active[_ngcontent-%COMP%] .cancelled-edge[_ngcontent-%COMP%]{background-color:var(--color-error-500)}"],changeDetection:0})}class Oe{ngOnInit(){this.active$=this.from.active$.asObservable().pipe((0,de.y)(n=>this.to.activeTarget$.next(n)))}getStyle(){const n=this.from.index<this.to.index?"down":"up",t=this.from.getPos("down"===n?"bottom":"top"),o=this.to.getPos("down"===n?"top":"bottom"),i=Math.abs(t.x-o.x),a=Math.abs(t.y-o.y),c=Math.sqrt(i**2+a**2);return{"top.px":t.y,"left.px":t.x+("down"===n?10:40)+12*this.index,"height.px":c,"width.px":1,..."up"===n?{transform:"rotateZ(180deg)","transform-origin":"top"}:{}}}static#e=this.\u0275fac=function(t){return new(t||Oe)};static#t=this.\u0275cmp=e.In1({type:Oe,selectors:[["vdr-order-process-edge"]],inputs:{from:"from",to:"to",index:"index"},decls:3,vars:7,consts:[[1,"edge",3,"ngStyle"],["shape","arrow","flip","vertical",1,"arrow"]],template:function(t,o){1&t&&(e.I0R(0,"div",0),e.wVc(1,"async"),e.wR5(2,"clr-icon",1),e.C$Y()),2&t&&(e.eAK("active",e.kDX(1,5,o.active$)),e.E7m("ngStyle",o.getStyle()),e.e48("data-from",o.from.node.name)("data-to",o.to.node.name))},dependencies:[_.o3d,m.Qt,m.a],styles:[".edge[_ngcontent-%COMP%]{position:absolute;border:1px solid var(--color-component-border-200);background-color:var(--color-component-bg-300);opacity:.3;transition:border .2s,opacity .2s,background-color .2s}.edge.active[_ngcontent-%COMP%]{border-color:var(--color-primary-500);background-color:var(--color-primary-500);opacity:1}.edge.active[_ngcontent-%COMP%] .arrow[_ngcontent-%COMP%]{color:var(--color-primary-500)}.edge[_ngcontent-%COMP%] .arrow[_ngcontent-%COMP%]{position:absolute;bottom:-4px;left:-8px;color:var(--color-grey-300)}"],changeDetection:0})}function Fo(r,n){if(1&r){const t=e.KQA();e.SAx(0),e.I0R(1,"vdr-order-process-node",1),e.qCj("mouseenter",function(){const a=e.usT(t).$implicit,c=e.GaO();return e.CGJ(c.onMouseOver(a.name))})("mouseleave",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.onMouseOut())}),e.wVc(2,"async"),e.C$Y(),e.k70()}if(2&r){const t=n.$implicit,o=n.index,i=e.GaO();e.yG2(),e.E7m("node",t)("index",o)("active",e.kDX(2,3,i.activeState$)===t.name)}}function $o(r,n){if(1&r&&(e.SAx(0),e.wR5(1,"vdr-order-process-edge",2),e.k70()),2&r){const t=n.$implicit;e.yG2(),e.E7m("from",t.from)("to",t.to)("index",t.index)}}class ve{constructor(n){this.changeDetector=n,this.setActiveState$=new He.g(void 0),this.nodes=[],this.edges=[]}get outerHeight(){return this.nodes.length*Je}ngOnInit(){this.setActiveState$.next(this.initialState),this.activeState$=this.setActiveState$.pipe((0,Ne.o)(150))}ngOnChanges(n){this.populateNodes()}ngAfterViewInit(){setTimeout(()=>this.populateEdges())}onMouseOver(n){this.setActiveState$.next(n)}onMouseOut(){this.setActiveState$.next(this.initialState)}getNodeFor(n){if(this.nodeComponents)return this.nodeComponents.find(t=>t.node.name===n)}populateNodes(){const n=new Map;for(const t of this.states)n.set(t.name,{name:t.name,to:[]});for(const[t,o]of n.entries()){const i=this.states.find(a=>a.name===t)?.to??[];for(const a of i){const c=n.get(a);c&&o.to.push(c)}}this.nodes=[...n.values()].filter(t=>"Cancelled"!==t.name)}populateEdges(){for(const n of this.nodes){const t=this.getNodeFor(n.name);let o=0;for(const i of n.to){const a=this.getNodeFor(i.name);t&&a&&t!==a&&(this.edges.push({to:a,from:t,index:o}),o++)}}this.edges=[...this.edges],this.changeDetector.markForCheck()}static#e=this.\u0275fac=function(t){return new(t||ve)(e.GI1(e.kD9))};static#t=this.\u0275cmp=e.In1({type:ve,selectors:[["vdr-order-process-graph"]],viewQuery:function(t,o){if(1&t&&e.CC$(te,5),2&t){let i;e.wto(i=e.Gqi())&&(o.nodeComponents=i)}},hostVars:2,hostBindings:function(t,o){2&t&&e.m4B("height",o.outerHeight,"px")},inputs:{states:"states",initialState:"initialState"},features:[e.SYr],decls:2,vars:2,consts:[[4,"ngFor","ngForOf"],[3,"node","index","active","mouseenter","mouseleave"],[3,"from","to","index"]],template:function(t,o){1&t&&e.yuY(0,Fo,3,5,"ng-container",0)(1,$o,2,3,"ng-container",0),2&t&&(e.E7m("ngForOf",o.nodes),e.yG2(),e.E7m("ngForOf",o.edges))},dependencies:[m.ay,te,Oe,m.a],styles:["[_nghost-%COMP%]{display:block;border:1px hotpink;margin:20px;padding:12px;position:relative}.state-row[_ngcontent-%COMP%]{display:flex}"],changeDetection:0})}function Mo(r,n){1&r&&(e.OEk(0),e.wVc(1,"translate")),2&r&&e.cNF(e.kDX(1,1,"order.order-state-diagram"))}class be{constructor(n){this.serverConfigService=n,this.states=[]}ngOnInit(){this.states=this.serverConfigService.getOrderProcessStates()}static#e=this.\u0275fac=function(t){return new(t||be)(e.GI1(d.ctz))};static#t=this.\u0275cmp=e.In1({type:be,selectors:[["vdr-order-process-graph-dialog"]],decls:2,vars:2,consts:[["vdrDialogTitle",""],[3,"states","initialState"]],template:function(t,o){1&t&&(e.yuY(0,Mo,2,3,"ng-template",0),e.wR5(1,"vdr-order-process-graph",1)),2&t&&(e.yG2(),e.E7m("states",o.states)("initialState",o.activeState))},dependencies:[b.a,ve,p.sD],changeDetection:0})}var Be=s(3412),We=s(6644),Yo=s(7288);function Po(r,n){if(1&r){const t=e.KQA();e.I0R(0,"vdr-select-toggle",6),e.iHE("selectedChange",function(i){e.usT(t);const a=e.GaO().$implicit;return e.kNx(a.selected,i)||(a.selected=i),e.CGJ(i)}),e.qCj("selectedChange",function(i){e.usT(t);const a=e.GaO().$implicit,c=e.GaO();return e.CGJ(c.paymentSelected.emit({payment:a,selected:i}))}),e.wVc(1,"translate"),e.wVc(2,"translate"),e.C$Y()}if(2&r){const t=e.GaO().$implicit,o=e.GaO();e.E7m("title",e.kDX(1,4,"order.refund-this-payment"))("label",e.kDX(2,6,"order.refund-this-payment"))("disabled",1===o.refundablePayments.length),e.OKB("selected",t.selected)}}function Ao(r,n){if(1&r&&(e.I0R(0,"vdr-card",1),e.wVc(1,"translate"),e.yuY(2,Po,3,8,"ng-template",2),e.I0R(3,"div",3)(4,"vdr-labeled-data",4),e.wVc(5,"translate"),e.OEk(6),e.C$Y(),e.I0R(7,"vdr-labeled-data",4),e.wVc(8,"translate"),e.OEk(9),e.C$Y(),e.I0R(10,"vdr-labeled-data",4),e.wVc(11,"translate"),e.OEk(12),e.wVc(13,"localeCurrency"),e.C$Y(),e.I0R(14,"vdr-labeled-data",4),e.wVc(15,"translate"),e.OEk(16),e.wVc(17,"localeCurrency"),e.C$Y()(),e.I0R(18,"vdr-form-field",4),e.wVc(19,"translate"),e.wR5(20,"vdr-currency-input",5),e.C$Y()()),2&r){const t=n.$implicit,o=e.GaO();e.eAK("selected",t.selected)("unselected",!t.selected),e.E7m("title",e.kDX(1,17,"order.payment")),e.yG2(4),e.E7m("label",e.kDX(5,19,"order.payment-method")),e.yG2(2),e.oRS(" ",t.method," "),e.yG2(),e.E7m("label",e.kDX(8,21,"order.transaction-id")),e.yG2(2),e.oRS(" ",t.transactionId," "),e.yG2(),e.E7m("label",e.kDX(11,23,"order.payment-amount")),e.yG2(2),e.oRS(" ",e.g7$(13,25,t.amount,o.order.currencyCode)," "),e.yG2(2),e.E7m("label",e.kDX(15,28,"order.refundable-amount")),e.yG2(2),e.oRS(" ",e.g7$(17,30,t.refundableAmount,o.order.currencyCode)," "),e.yG2(2),e.E7m("label",e.kDX(19,33,"order.refund-amount")),e.yG2(2),e.E7m("readonly",!t.selected)("currencyCode",o.order.currencyCode)("formControl",t.amountToRefundControl)}}class ne{constructor(){this.paymentSelected=new e._w7}static#e=this.\u0275fac=function(t){return new(t||ne)};static#t=this.\u0275cmp=e.In1({type:ne,selectors:[["vdr-payment-for-refund-selector"]],inputs:{refundablePayments:"refundablePayments",order:"order"},outputs:{paymentSelected:"paymentSelected"},decls:1,vars:1,consts:[[3,"title","selected","unselected",4,"ngFor","ngForOf"],[3,"title"],["vdrCardControls",""],[1,"form-grid"],[3,"label"],[3,"readonly","currencyCode","formControl"],["size","small",3,"title","label","disabled","selected","selectedChange"]],template:function(t,o){1&t&&e.yuY(0,Ao,21,35,"vdr-card",0),2&t&&e.E7m("ngForOf",o.refundablePayments)},dependencies:[m.ay,l.ue,l.ug,Be.Y,P._,C.w,Yo.u,O.a,G.u,G.M,p.sD,g.u],styles:["[_nghost-%COMP%]{display:block}"]})}function Vo(r,n){1&r&&(e.OEk(0),e.wVc(1,"translate")),2&r&&e.cNF(e.kDX(1,1,"order.refund-and-cancel-order"))}function No(r,n){if(1&r&&e.OEk(0),2&r){const t=n.item;e.oRS(" ",t.id," ")}}function Xo(r,n){if(1&r&&(e.OEk(0),e.wVc(1,"localeDate")),2&r){const t=n.item;e.oRS(" ",e.g7$(1,1,t.createdAt,"short")," ")}}function Lo(r,n){if(1&r&&(e.OEk(0),e.wVc(1,"localeDate")),2&r){const t=n.item;e.oRS(" ",e.g7$(1,1,t.updatedAt,"short")," ")}}function jo(r,n){if(1&r&&(e.wR5(0,"img",26),e.wVc(1,"assetPreview")),2&r){const t=n.ngIf;e.E7m("src",e.g7$(1,1,t,"tiny"),e.K6U)}}function Qo(r,n){1&r&&(e.I0R(0,"div",27),e.wR5(1,"clr-icon",28),e.C$Y())}function Ko(r,n){if(1&r&&(e.I0R(0,"div",23),e.yuY(1,jo,2,4,"img",24)(2,Qo,2,0,"ng-template",null,25,e.gJz),e.C$Y()),2&r){const t=n.item,o=e.Gew(3);e.yG2(),e.E7m("ngIf",t.featuredAsset)("ngIfElse",o)}}function qo(r,n){if(1&r&&e.OEk(0),2&r){const t=n.item;e.oRS(" ",t.productVariant.name," ")}}function Ho(r,n){if(1&r&&e.OEk(0),2&r){const t=n.item;e.oRS(" ",t.productVariant.sku," ")}}function Jo(r,n){if(1&r&&(e.OEk(0),e.wVc(1,"localeCurrency")),2&r){const t=n.item,o=e.GaO();e.oRS(" ",e.g7$(1,1,t.unitPriceWithTax,o.order.currencyCode)," ")}}function Bo(r,n){if(1&r&&(e.I0R(0,"div",34),e.OEk(1),e.I0R(2,"div",35),e.OEk(3),e.wVc(4,"currency"),e.wVc(5,"number"),e.C$Y()()),2&r){const t=n.$implicit,o=e.GaO(3).item,i=e.GaO();e.yG2(),e.oRS(" ",t.description," "),e.yG2(2),e.oRS(" ",e.g7$(4,2,e.g7$(5,5,t.amount/100/o.quantity,"1.0-2"),i.order.currencyCode)," ")}}function Wo(r,n){if(1&r&&(e.I0R(0,"vdr-dropdown")(1,"div",30)(2,"button",31),e.wR5(3,"clr-icon",32),e.C$Y()(),e.I0R(4,"vdr-dropdown-menu"),e.yuY(5,Bo,6,8,"div",33),e.C$Y()()),2&r){const t=e.GaO().ngIf;e.yG2(5),e.E7m("ngForOf",t)}}function Uo(r,n){if(1&r&&(e.SAx(0),e.yuY(1,Wo,6,1,"vdr-dropdown",29),e.k70()),2&r){const t=n.ngIf;e.yG2(),e.E7m("ngIf",t.length)}}function zo(r,n){if(1&r&&(e.OEk(0),e.wVc(1,"localeCurrency"),e.yuY(2,Uo,2,1,"ng-container",29)),2&r){const t=n.item,o=e.GaO();e.oRS(" ",e.g7$(1,2,t.unitPriceWithTax,o.order.currencyCode)," "),e.yG2(2),e.E7m("ngIf",t.discounts)}}function Zo(r,n){if(1&r&&(e.OEk(0),e.wR5(1,"vdr-line-refunds",36)),2&r){const t=n.item,o=e.GaO();e.oRS(" ",t.quantity," "),e.yG2(),e.E7m("line",t)("payments",o.order.payments)}}function ei(r,n){if(1&r){const t=e.KQA();e.I0R(0,"input",38),e.qCj("ngModelChange",function(i){e.usT(t);const a=e.GaO().item,c=e.GaO();return e.CGJ(c.onRefundQuantityChange(a.id,i))}),e.C$Y()}if(2&r){const t=e.GaO().item,o=e.GaO();e.E7m("ngModel",o.lineQuantities[t.id].quantity)("max",t.quantity)}}function ti(r,n){if(1&r&&e.yuY(0,ei,1,2,"input",37),2&r){const t=n.item,o=e.GaO();e.E7m("ngIf",o.lineCanBeRefundedOrCancelled(t))}}function ni(r,n){if(1&r){const t=e.KQA();e.I0R(0,"input",43),e.iHE("ngModelChange",function(i){e.usT(t);const a=e.GaO().item,c=e.GaO();return e.kNx(c.lineQuantities[a.id].cancel,i)||(c.lineQuantities[a.id].cancel=i),e.CGJ(i)}),e.C$Y()}if(2&r){const t=e.GaO().item,o=e.GaO();e.E7m("disabled",0===o.lineQuantities[t.id].quantity),e.OKB("ngModel",o.lineQuantities[t.id].cancel)}}function ri(r,n){if(1&r&&(e.I0R(0,"div",39)(1,"label",40),e.yuY(2,ni,1,2,"input",41),e.I0R(3,"span",42),e.OEk(4),e.wVc(5,"translate"),e.C$Y()()()),2&r){const t=n.item,o=e.GaO();e.yG2(2),e.E7m("ngIf",o.lineCanBeRefundedOrCancelled(t)),e.yG2(2),e.cNF(e.kDX(5,2,"order.return-to-stock"))}}function oi(r,n){if(1&r){const t=e.KQA();e.I0R(0,"label",44)(1,"input",45),e.qCj("change",function(){const a=e.usT(t).$implicit,c=e.GaO();return e.CGJ(c.toggleShippingRefund(a.id))}),e.C$Y(),e.I0R(2,"div",42),e.OEk(3),e.wVc(4,"translate"),e.I0R(5,"span"),e.OEk(6),e.C$Y(),e.I0R(7,"span",42),e.OEk(8),e.wVc(9,"localeCurrency"),e.C$Y()()()}if(2&r){const t=n.$implicit,o=e.GaO();e.yG2(3),e.oRS(" ",e.kDX(4,3,"order.refund-shipping")," "),e.yG2(3),e.oRS("",t.shippingMethod.name,":"),e.yG2(2),e.oRS("",e.g7$(9,5,t.discountedPriceWithTax,o.order.currencyCode)," ")}}const ii=(r,n)=>({min:r,max:n});function ai(r,n){if(1&r&&(e.I0R(0,"clr-alert",51)(1,"clr-alert-item"),e.OEk(2),e.wVc(3,"translate"),e.wVc(4,"currency"),e.wVc(5,"localeCurrency"),e.C$Y()()),2&r){const t=e.GaO(2);e.E7m("clrAlertType","danger")("clrAlertClosable",!1),e.yG2(2),e.oRS(" ",e.g7$(3,3,"order.refund-total-error",e.IBC(12,ii,e.g7$(4,6,0,t.order.currencyCode),e.g7$(5,9,t.totalRefundableAmount,t.order.currencyCode)))," ")}}function li(r,n){1&r&&(e.I0R(0,"clr-alert",51)(1,"clr-alert-item"),e.OEk(2),e.wVc(3,"translate"),e.C$Y()()),2&r&&(e.E7m("clrAlertType","danger")("clrAlertClosable",!1),e.yG2(2),e.oRS(" ",e.kDX(3,3,"order.refund-total-warning")," "))}function di(r,n){1&r&&(e.I0R(0,"clr-alert",51)(1,"clr-alert-item"),e.OEk(2),e.wVc(3,"translate"),e.C$Y()()),2&r&&(e.E7m("clrAlertType","danger")("clrAlertClosable",!1),e.yG2(2),e.oRS(" ",e.kDX(3,3,"order.refund-cancellation-reason-required")," "))}const si=r=>({amount:r});function ci(r,n){if(1&r){const t=e.KQA();e.I0R(0,"div")(1,"div",46),e.yuY(2,ai,6,15,"clr-alert",47)(3,li,4,5,"clr-alert",47)(4,di,4,5,"clr-alert",47),e.C$Y(),e.I0R(5,"div",48)(6,"button",49),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.cancel())}),e.OEk(7),e.wVc(8,"translate"),e.C$Y(),e.I0R(9,"button",50),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.select())}),e.OEk(10),e.wVc(11,"translate"),e.wVc(12,"localeCurrency"),e.C$Y()()()}if(2&r){const t=e.GaO();e.yG2(2),e.E7m("ngIf",t.refundTotal<0||t.totalRefundableAmount<t.refundTotal),e.yG2(),e.E7m("ngIf",t.amountToRefundTotal<t.refundTotal||t.refundTotal<t.amountToRefundTotal),e.yG2(),e.E7m("ngIf",t.amountToRefundTotal&&!t.reason),e.yG2(3),e.cNF(e.kDX(8,6,"common.cancel")),e.yG2(2),e.E7m("disabled",!t.canSubmit()),e.yG2(),e.oRS(" ",e.g7$(11,8,"order.refund-with-amount",e.S45(14,si,e.g7$(12,11,t.amountToRefundTotal,t.order.currencyCode)))," ")}}class Ie{constructor(n){this.i18nService=n,this.lineQuantities={},this.refundablePayments=[],this.refundShippingLineIds=[],this.reasons=(0,d.g$r)().cancellationReasons??[(0,u.s)("order.refund-reason-customer-request"),(0,u.s)("order.refund-reason-not-available")],this.manuallySetRefundTotal=!1,this.refundTotal=0,this.reasons=this.reasons.map(t=>this.i18nService.translate(t))}get totalRefundableAmount(){return(0,h.summate)(this.refundablePayments,"refundableAmount")}get amountToRefundTotal(){return this.refundablePayments.reduce((n,t)=>n+t.amountToRefundControl.value,0)}lineCanBeRefundedOrCancelled(n){return(this.order.payments?.reduce((o,i)=>[...o,...i.refunds],[]).filter(o=>"Failed"!==o.state).reduce((o,i)=>[...o,...i.lines],[]).filter(o=>o.orderLineId===n.id).reduce((o,i)=>o+i.quantity,0)??0)<n.orderPlacedQuantity}ngOnInit(){this.lineQuantities=this.order.lines.reduce((n,t)=>({...n,[t.id]:{quantity:0,refund:!0,cancel:!1}}),{}),this.refundablePayments=Ve(this.order.payments)}updateRefundTotal(){if(!this.manuallySetRefundTotal){const o=this.order.lines.reduce((a,c)=>{const ze=this.lineQuantities[c.id].quantity||0;return a+c.proratedUnitPriceWithTax*ze},0),i=this.order.shippingLines.reduce((a,c)=>this.refundShippingLineIds.includes(c.id)?a+c.discountedPriceWithTax:a,0);this.refundTotal=o+i}const n=this.refundablePayments.filter(o=>o.selected);let t=0;for(const o of n){const i=Math.min(o.refundableAmount,this.refundTotal-t);o.amountToRefundControl.setValue(i),t+=i}}toggleShippingRefund(n){const t=this.refundShippingLineIds.indexOf(n);-1===t?this.refundShippingLineIds.push(n):this.refundShippingLineIds.splice(t,1),this.updateRefundTotal()}onRefundQuantityChange(n,t){this.manuallySetRefundTotal=!1;const o=this.lineQuantities[n];if(o){const i=o.quantity;0===t?o.cancel=!1:0===i&&t>0&&(o.cancel=!0),o.quantity=t,this.updateRefundTotal()}}onPaymentSelected(n,t){if(t){const o=this.refundTotal-this.refundablePayments.filter(i=>i.id!==n.id).reduce((i,a)=>i+a.amountToRefundControl.value,0);0<o&&n.amountToRefundControl.setValue(Math.min(o,n.refundableAmount))}else n.amountToRefundControl.setValue(0)}isRefunding(){return Object.values(this.lineQuantities).reduce((t,o)=>t||0<o.quantity,!1)}isCancelling(){return Object.values(this.lineQuantities).reduce((t,o)=>t||0<o.quantity&&o.cancel,!1)}canSubmit(){return 0<this.refundTotal&&this.amountToRefundTotal===this.refundTotal&&!!this.reason}select(){const n=this.getOrderLineInput(()=>!0),t=this.getOrderLineInput(o=>o.cancel);this.resolveWith({refunds:this.refundablePayments.filter(o=>o.selected&&0<o.amountToRefundControl.value).map(o=>({lines:n,reason:this.reason,paymentId:o.id,amount:o.amountToRefundControl.value,shipping:0,adjustment:0})),cancel:{lines:t,orderId:this.order.id,reason:this.reason,cancelShipping:this.refundShippingLineIds.length>0}})}cancel(){this.resolveWith()}getOrderLineInput(n){return Object.entries(this.lineQuantities).filter(([t,o])=>0<o.quantity&&n(o)).map(([t,o])=>({orderLineId:t,quantity:o.quantity}))}static#e=this.\u0275fac=function(t){return new(t||Ie)(e.GI1(d.WYg))};static#t=this.\u0275cmp=e.In1({type:Ie,selectors:[["vdr-refund-order-dialog"]],decls:50,vars:60,consts:[["vdrDialogTitle",""],[1,"refund-wrapper"],["id","refund-order",3,"items"],["id","id",3,"heading","hiddenByDefault"],["id","created-at",3,"heading","hiddenByDefault"],["id","updated-at",3,"heading","hiddenByDefault"],["id","image",3,"heading"],["id","product-name",3,"heading","optional"],["id","product-sku",3,"heading"],["id","unit-price",3,"heading","hiddenByDefault"],["id","prorated-unit-price",3,"heading"],["id","quantity",3,"heading"],["id","refund-quantity",3,"heading","optional"],["id","cancel",3,"heading","optional"],[1,"refund-details","mt-4"],["class","flex mb-2",4,"ngFor","ngForOf"],[1,"mb-2",3,"label"],["bindLabel","name","autofocus","","bindValue","id",3,"items","placeholder","addTag","ngModel","ngModelChange"],[3,"label","readOnlyToggle","readOnlyToggleChange"],[3,"readonly","currencyCode","ngModel","ngModelChange"],[1,""],[3,"refundablePayments","order","paymentSelected"],["vdrDialogButtons",""],[1,"image-placeholder"],[3,"src",4,"ngIf","ngIfElse"],["imagePlaceholder",""],[3,"src"],[1,"placeholder"],["shape","image","size","48"],[4,"ngIf"],["vdrDropdownTrigger","",1,"promotions-label"],[1,"icon-button"],["shape","info"],["class","line-promotion",4,"ngFor","ngForOf"],[1,"line-promotion"],[1,"promotion-amount"],[3,"line","payments"],["type","number","min","0",3,"ngModel","max","ngModelChange",4,"ngIf"],["type","number","min","0",3,"ngModel","max","ngModelChange"],[1,"cancel-checkbox-wrapper"],[1,"flex","center"],["type","checkbox","clrCheckbox","",3,"disabled","ngModel","ngModelChange",4,"ngIf"],[1,"ml-1"],["type","checkbox","clrCheckbox","",3,"disabled","ngModel","ngModelChange"],[1,"flex","mb-2"],["type","checkbox","clrCheckbox","",3,"change"],[1,"errors"],[3,"clrAlertType","clrAlertClosable",4,"ngIf"],[1,"modal-buttons"],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"disabled","click"],[3,"clrAlertType","clrAlertClosable"]],template:function(t,o){1&t&&(e.yuY(0,Vo,2,3,"ng-template",0),e.I0R(1,"div",1)(2,"vdr-data-table-2",2)(3,"vdr-dt2-column",3),e.wVc(4,"translate"),e.yuY(5,No,1,1,"ng-template"),e.C$Y(),e.I0R(6,"vdr-dt2-column",4),e.wVc(7,"translate"),e.yuY(8,Xo,2,4,"ng-template"),e.C$Y(),e.I0R(9,"vdr-dt2-column",5),e.wVc(10,"translate"),e.yuY(11,Lo,2,4,"ng-template"),e.C$Y(),e.I0R(12,"vdr-dt2-column",6),e.wVc(13,"translate"),e.yuY(14,Ko,4,2,"ng-template"),e.C$Y(),e.I0R(15,"vdr-dt2-column",7),e.wVc(16,"translate"),e.yuY(17,qo,1,1,"ng-template"),e.C$Y(),e.I0R(18,"vdr-dt2-column",8),e.wVc(19,"translate"),e.yuY(20,Ho,1,1,"ng-template"),e.C$Y(),e.I0R(21,"vdr-dt2-column",9),e.wVc(22,"translate"),e.yuY(23,Jo,2,4,"ng-template"),e.C$Y(),e.I0R(24,"vdr-dt2-column",10),e.wVc(25,"translate"),e.yuY(26,zo,3,5,"ng-template"),e.C$Y(),e.I0R(27,"vdr-dt2-column",11),e.wVc(28,"translate"),e.yuY(29,Zo,2,3,"ng-template"),e.C$Y(),e.I0R(30,"vdr-dt2-column",12),e.wVc(31,"translate"),e.yuY(32,ti,1,1,"ng-template"),e.C$Y(),e.I0R(33,"vdr-dt2-column",13),e.wVc(34,"translate"),e.yuY(35,ri,6,4,"ng-template"),e.C$Y()(),e.I0R(36,"div",14)(37,"div")(38,"vdr-card"),e.yuY(39,oi,10,8,"label",15),e.I0R(40,"vdr-form-field",16),e.wVc(41,"translate"),e.I0R(42,"ng-select",17),e.iHE("ngModelChange",function(a){return e.kNx(o.reason,a)||(o.reason=a),a}),e.wVc(43,"translate"),e.C$Y()(),e.I0R(44,"vdr-form-field",18),e.qCj("readOnlyToggleChange",function(a){return o.manuallySetRefundTotal=!a}),e.wVc(45,"translate"),e.I0R(46,"vdr-currency-input",19),e.iHE("ngModelChange",function(a){return e.kNx(o.refundTotal,a)||(o.refundTotal=a),a}),e.qCj("ngModelChange",function(){return o.updateRefundTotal()}),e.C$Y()()()(),e.I0R(47,"div",20)(48,"vdr-payment-for-refund-selector",21),e.qCj("paymentSelected",function(a){return o.onPaymentSelected(a.payment,a.selected)}),e.C$Y()()()(),e.yuY(49,ci,13,16,"ng-template",22)),2&t&&(e.yG2(2),e.E7m("items",o.order.lines),e.yG2(),e.E7m("heading",e.kDX(4,32,"common.id"))("hiddenByDefault",!0),e.yG2(3),e.E7m("heading",e.kDX(7,34,"common.created-at"))("hiddenByDefault",!0),e.yG2(3),e.E7m("heading",e.kDX(10,36,"common.updated-at"))("hiddenByDefault",!0),e.yG2(3),e.E7m("heading",e.kDX(13,38,"common.image")),e.yG2(3),e.E7m("heading",e.kDX(16,40,"order.product-name"))("optional",!1),e.yG2(3),e.E7m("heading",e.kDX(19,42,"order.product-sku")),e.yG2(3),e.E7m("heading",e.kDX(22,44,"order.unit-price"))("hiddenByDefault",!0),e.yG2(3),e.E7m("heading",e.kDX(25,46,"order.prorated-unit-price")),e.yG2(3),e.E7m("heading",e.kDX(28,48,"order.quantity")),e.yG2(3),e.E7m("heading",e.kDX(31,50,"order.refund"))("optional",!1),e.yG2(3),e.E7m("heading",e.kDX(34,52,"order.return-to-stock"))("optional",!1),e.yG2(6),e.E7m("ngForOf",o.order.shippingLines),e.yG2(),e.E7m("label",e.kDX(41,54,"order.refund-cancellation-reason")),e.yG2(2),e.E7m("items",o.reasons)("placeholder",e.kDX(43,56,"order.refund-cancellation-reason-required"))("addTag",!0),e.OKB("ngModel",o.reason),e.yG2(2),e.E7m("label",e.kDX(45,58,"order.refund-total"))("readOnlyToggle",!0),e.yG2(2),e.E7m("readonly",!o.manuallySetRefundTotal)("currencyCode",o.order.currencyCode),e.OKB("ngModel",o.refundTotal),e.yG2(2),e.E7m("refundablePayments",o.refundablePayments)("order",o.order))},dependencies:[_.c0g,_.KMj,_.o3d,_.ojz,_.y6l,m.ay,m.u_,l.ot,l.O4,l.SU,l.ue,l.Gu,l._t,l._G,S.UT,Be.Y,P._,C.w,E.E,b.a,B.i,W.m,U.q,We.q,Pe.M,G.u,V,ne,m.hl,m.cf,p.sD,j.w,A.m,g.u],styles:["[_nghost-%COMP%]{height:100%;display:flex;flex-direction:column;min-height:64vh}.refund-wrapper[_ngcontent-%COMP%]{flex:1;flex-direction:column}.refund-wrapper[_ngcontent-%COMP%] .order-table[_ngcontent-%COMP%]{flex:1;overflow-y:auto}.refund-wrapper[_ngcontent-%COMP%] .order-table[_ngcontent-%COMP%] table[_ngcontent-%COMP%]{margin-top:0}.refund-wrapper[_ngcontent-%COMP%] tr.ignore[_ngcontent-%COMP%]{color:var(--color-grey-300)} .refund-wrapper .table-wrapper{max-width:initial!important}.quantity-col[_ngcontent-%COMP%]{background-color:var(--color-warning-100)}.cancel-checkbox-wrapper[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center}clr-checkbox-wrapper[_ngcontent-%COMP%]{margin-top:12px;margin-bottom:12px;display:block}.refund-details[_ngcontent-%COMP%]{display:flex;flex-direction:column;padding-bottom:var(--space-unit);gap:calc(var(--space-unit) * 2);justify-content:space-between}@media screen and (min-width: 992px){.refund-details[_ngcontent-%COMP%]{flex-direction:row}}.refund-details[_ngcontent-%COMP%] vdr-card.unselected[_ngcontent-%COMP%]{opacity:.8}.refund-details[_ngcontent-%COMP%] > *[_ngcontent-%COMP%]{flex:1}.errors[_ngcontent-%COMP%]{display:flex;justify-content:flex-end;gap:calc(var(--space-unit) * 2);margin:calc(var(--space-unit) * 2) 0}.prorated-wrapper[_ngcontent-%COMP%]{display:flex;justify-content:center}.line-promotion[_ngcontent-%COMP%]{display:flex;justify-content:space-between;font-size:12px;padding:3px 6px}.line-promotion[_ngcontent-%COMP%] .promotion-amount[_ngcontent-%COMP%]{margin-inline-start:12px}vdr-card.faded[_ngcontent-%COMP%]{opacity:.8}.modal-buttons[_ngcontent-%COMP%]{display:flex;justify-content:flex-end;gap:.6rem;gap:var(--clr-modal-footer-gap, .6rem)}"],changeDetection:0})}function mi(r,n){1&r&&(e.OEk(0),e.wVc(1,"translate")),2&r&&e.cNF(e.kDX(1,1,"order.settle-refund"))}function ui(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",4),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.cancel())}),e.OEk(1),e.wVc(2,"translate"),e.C$Y(),e.I0R(3,"button",5),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.submit())}),e.OEk(4),e.wVc(5,"translate"),e.C$Y()}if(2&r){const t=e.GaO();e.yG2(),e.cNF(e.kDX(2,3,"common.cancel")),e.yG2(2),e.E7m("disabled",!t.transactionId),e.yG2(),e.oRS(" ",e.kDX(5,5,"order.settle-refund")," ")}}const _i=r=>({method:r});class Ge{constructor(){this.transactionId=""}submit(){this.resolveWith(this.transactionId)}cancel(){this.resolveWith()}static#e=this.\u0275fac=function(t){return new(t||Ge)};static#t=this.\u0275cmp=e.In1({type:Ge,selectors:[["vdr-settle-refund-dialog"]],decls:10,vars:10,consts:[["vdrDialogTitle",""],[1,"instruction"],["clrInput","","name","transactionId",3,"ngModel","ngModelChange"],["vdrDialogButtons",""],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"disabled","click"]],template:function(t,o){1&t&&(e.yuY(0,mi,2,3,"ng-template",0),e.I0R(1,"p",1),e.OEk(2),e.wVc(3,"translate"),e.C$Y(),e.I0R(4,"clr-input-container")(5,"label"),e.OEk(6),e.wVc(7,"translate"),e.C$Y(),e.I0R(8,"input",2),e.iHE("ngModelChange",function(a){return e.kNx(o.transactionId,a)||(o.transactionId=a),a}),e.C$Y()(),e.yuY(9,ui,6,7,"ng-template",3)),2&t&&(e.yG2(2),e.oRS(" ",e.g7$(3,3,"order.settle-refund-manual-instructions",e.S45(8,_i,o.refund.method)),"\n"),e.yG2(4),e.cNF(e.kDX(7,6,"order.transaction-id")),e.yG2(2),e.OKB("ngModel",o.transactionId))},dependencies:[_.ojz,_.Ga0,_.UJB,l.ot,l.ue,l._G,C.w,E.E,b.a,p.sD],styles:["[_nghost-%COMP%]{padding-bottom:32px}.instruction[_ngcontent-%COMP%]{margin-top:0;margin-bottom:24px}"],changeDetection:0})}var gt=s(4204);function pi(r,n){1&r&&e.wR5(0,"clr-icon",2)}class Ee{get chipColorType(){switch(this.state){case"Authorized":return"warning";case"Settled":return"success";case"Declined":case"Cancelled":return"error"}}static#e=this.\u0275fac=function(t){return new(t||Ee)};static#t=this.\u0275cmp=e.In1({type:Ee,selectors:[["vdr-payment-state-label"]],inputs:{state:"state"},decls:6,vars:10,consts:[[3,"title","colorType"],["shape","check-circle",4,"ngIf"],["shape","check-circle"]],template:function(t,o){1&t&&(e.I0R(0,"vdr-chip",0),e.wVc(1,"translate"),e.yuY(2,pi,1,0,"clr-icon",1),e.OEk(3),e.wVc(4,"translate"),e.wVc(5,"stateI18nToken"),e.C$Y()),2&t&&(e.E7m("title",e.kDX(1,4,"order.payment-state"))("colorType",o.chipColorType),e.yG2(2),e.E7m("ngIf","Settled"===o.state),e.yG2(),e.oRS(" ",e.kDX(4,6,e.kDX(5,8,o.state)),"\n"))},dependencies:[_.o3d,m.u_,D.g,p.sD,$.Q],styles:["[_nghost-%COMP%]{display:flex;font-size:14px}"],changeDetection:0})}function fi(r,n){1&r&&e.wR5(0,"clr-icon",2)}class Re{get chipColorType(){switch(this.state){case"Pending":return"warning";case"Settled":return"success";case"Failed":return"error"}}static#e=this.\u0275fac=function(t){return new(t||Re)};static#t=this.\u0275cmp=e.In1({type:Re,selectors:[["vdr-refund-state-label"]],inputs:{state:"state"},decls:6,vars:10,consts:[[3,"title","colorType"],["shape","check-circle",4,"ngIf"],["shape","check-circle"]],template:function(t,o){1&t&&(e.I0R(0,"vdr-chip",0),e.wVc(1,"translate"),e.yuY(2,fi,1,0,"clr-icon",1),e.OEk(3),e.wVc(4,"translate"),e.wVc(5,"stateI18nToken"),e.C$Y()),2&t&&(e.E7m("title",e.kDX(1,4,"order.payment-state"))("colorType",o.chipColorType),e.yG2(2),e.E7m("ngIf","Settled"===o.state),e.yG2(),e.oRS(" ",e.kDX(4,6,e.kDX(5,8,o.state)),"\n"))},dependencies:[_.o3d,m.u_,D.g,p.sD,$.Q],styles:["[_nghost-%COMP%]{display:flex;font-size:14px}"],changeDetection:0})}function gi(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",0),e.wVc(1,"translate"),e.OEk(2),e.C$Y()),2&r){const t=e.GaO();e.E7m("label",e.kDX(1,2,"order.error-message")),e.yG2(2),e.oRS(" ",t.payment.errorMessage,"\n")}}function yi(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",0),e.wVc(1,"translate"),e.OEk(2),e.C$Y()),2&r){const t=e.GaO();e.E7m("label",e.kDX(1,2,"order.transaction-id")),e.yG2(2),e.oRS(" ",t.payment.transactionId,"\n")}}class re{static#e=this.\u0275fac=function(t){return new(t||re)};static#t=this.\u0275cmp=e.In1({type:re,selectors:[["vdr-payment-detail"]],inputs:{payment:"payment",currencyCode:"currencyCode"},decls:12,vars:17,consts:[[3,"label"],[3,"label",4,"ngIf"],[3,"value"]],template:function(t,o){1&t&&(e.I0R(0,"vdr-labeled-data",0),e.wVc(1,"translate"),e.OEk(2),e.C$Y(),e.I0R(3,"vdr-labeled-data",0),e.wVc(4,"translate"),e.OEk(5),e.wVc(6,"localeCurrency"),e.C$Y(),e.yuY(7,gi,3,4,"vdr-labeled-data",1)(8,yi,3,4,"vdr-labeled-data",1),e.I0R(9,"vdr-labeled-data",0),e.wVc(10,"translate"),e.wR5(11,"vdr-object-tree",2),e.C$Y()),2&t&&(e.E7m("label",e.kDX(1,8,"order.payment-method")),e.yG2(2),e.oRS(" ",o.payment.method,"\n"),e.yG2(),e.E7m("label",e.kDX(4,10,"order.amount")),e.yG2(2),e.oRS(" ",e.g7$(6,12,o.payment.amount,o.currencyCode),"\n"),e.yG2(2),e.E7m("ngIf",o.payment.errorMessage),e.yG2(),e.E7m("ngIf",o.payment.transactionId),e.yG2(),e.E7m("label",e.kDX(10,15,"order.payment-metadata")),e.yG2(2),e.E7m("value",o.payment.metadata))},dependencies:[m.u_,O.a,ce.W,p.sD,g.u],changeDetection:0})}function Ci(r,n){if(1&r&&(e.SAx(0),e.OEk(1),e.wVc(2,"localeCurrency"),e.k70()),2&r){const t=e.GaO();e.yG2(),e.cNF(e.g7$(2,1,t.payment.amount,t.currencyCode))}}function hi(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",13),e.wVc(1,"translate"),e.OEk(2),e.C$Y()),2&r){const t=e.GaO().$implicit;e.E7m("label",e.kDX(1,2,"order.transaction-id")),e.yG2(2),e.oRS(" ",t.transactionId," ")}}function Oi(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",13),e.wVc(1,"translate"),e.OEk(2),e.C$Y()),2&r){const t=e.GaO().$implicit;e.E7m("label",e.kDX(1,2,"order.refund-reason")),e.yG2(2),e.oRS(" ",t.reason," ")}}function vi(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",13),e.wVc(1,"translate"),e.wR5(2,"vdr-object-tree",15),e.C$Y()),2&r){const t=e.GaO().$implicit;e.E7m("label",e.kDX(1,2,"order.refund-metadata")),e.yG2(2),e.E7m("value",t.metadata)}}function bi(r,n){if(1&r){const t=e.KQA();e.I0R(0,"div",16)(1,"button",17),e.qCj("click",function(){e.usT(t);const i=e.GaO().$implicit,a=e.GaO();return e.CGJ(a.settleRefund.emit(i))}),e.OEk(2),e.wVc(3,"translate"),e.C$Y()()}2&r&&(e.yG2(2),e.oRS(" ",e.kDX(3,1,"order.settle-refund")," "))}function Ii(r,n){if(1&r&&(e.SAx(0),e.I0R(1,"div",9)(2,"div",10),e.wR5(3,"clr-icon",11),e.OEk(4),e.wVc(5,"translate"),e.wR5(6,"div",12)(7,"vdr-refund-state-label",4),e.C$Y(),e.I0R(8,"div",5)(9,"vdr-labeled-data",13),e.wVc(10,"translate"),e.OEk(11),e.wVc(12,"localeDate"),e.C$Y(),e.I0R(13,"vdr-labeled-data",13),e.wVc(14,"translate"),e.OEk(15),e.wVc(16,"localeCurrency"),e.C$Y(),e.yuY(17,hi,3,4,"vdr-labeled-data",14)(18,Oi,3,4,"vdr-labeled-data",14)(19,vi,3,4,"vdr-labeled-data",14),e.C$Y(),e.yuY(20,bi,4,3,"div",8),e.C$Y(),e.k70()),2&r){const t=n.$implicit,o=e.GaO();e.yG2(4),e.CAO(" ",e.kDX(5,11,"order.refund")," #",t.id," "),e.yG2(3),e.E7m("state",t.state),e.yG2(2),e.E7m("label",e.kDX(10,13,"common.created-at")),e.yG2(2),e.oRS(" ",e.g7$(12,15,t.createdAt,"medium")," "),e.yG2(2),e.E7m("label",e.kDX(14,18,"order.refund-total")),e.yG2(2),e.oRS(" ",e.g7$(16,20,t.total,o.currencyCode)," "),e.yG2(2),e.E7m("ngIf",t.transactionId),e.yG2(),e.E7m("ngIf",t.reason),e.yG2(),e.E7m("ngIf",o.refundHasMetadata(t)),e.yG2(),e.E7m("ngIf","Pending"===t.state)}}function Gi(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",17),e.qCj("click",function(){e.usT(t);const i=e.GaO(2);return e.CGJ(i.settlePayment.emit(i.payment))}),e.OEk(1),e.wVc(2,"translate"),e.C$Y()}2&r&&(e.yG2(),e.oRS(" ",e.kDX(2,1,"order.settle-payment")," "))}const Ei=r=>({state:r});function Ri(r,n){if(1&r&&(e.SAx(0),e.wR5(1,"clr-icon",25),e.OEk(2),e.wVc(3,"translate"),e.wVc(4,"translate"),e.wVc(5,"stateI18nToken"),e.k70()),2&r){const t=e.GaO().$implicit;e.yG2(2),e.oRS(" ",e.g7$(3,1,"order.transition-to-state",e.S45(8,Ei,e.kDX(4,4,e.kDX(5,6,t))))," ")}}function ki(r,n){1&r&&(e.wR5(0,"clr-icon",26),e.OEk(1),e.wVc(2,"translate")),2&r&&(e.yG2(),e.oRS(" ",e.kDX(2,1,"order.cancel-payment")," "))}function wi(r,n){if(1&r){const t=e.KQA();e.SAx(0),e.I0R(1,"button",22),e.qCj("click",function(){const a=e.usT(t).$implicit,c=e.GaO(2);return e.CGJ(c.transitionPaymentState.emit({payment:c.payment,state:a}))}),e.yuY(2,Ri,6,10,"ng-container",23)(3,ki,3,3,"ng-template",null,24,e.gJz),e.C$Y(),e.k70()}if(2&r){const t=n.$implicit,o=e.Gew(4);e.yG2(2),e.E7m("ngIf","Cancelled"!==t)("ngIfElse",o)}}function Ti(r,n){if(1&r&&(e.I0R(0,"div",16),e.yuY(1,Gi,3,3,"button",18),e.I0R(2,"vdr-dropdown")(3,"button",19),e.wR5(4,"clr-icon",20),e.C$Y(),e.I0R(5,"vdr-dropdown-menu",21),e.yuY(6,wi,5,2,"ng-container",7),e.C$Y()()()),2&r){const t=e.GaO();e.yG2(),e.E7m("ngIf",t.payment.nextStates.includes("Settled")),e.yG2(5),e.E7m("ngForOf",t.nextOtherStates())}}class ke{constructor(){this.settlePayment=new e._w7,this.transitionPaymentState=new e._w7,this.settleRefund=new e._w7}refundHasMetadata(n){return!!n&&Object.keys(n.metadata).length>0}nextOtherStates(){return this.payment?this.payment.nextStates.filter(n=>"Settled"!==n&&"Error"!==n):[]}static#e=this.\u0275fac=function(t){return new(t||ke)};static#t=this.\u0275cmp=e.In1({type:ke,selectors:[["vdr-order-payment-card"]],inputs:{payment:"payment",currencyCode:"currencyCode"},outputs:{settlePayment:"settlePayment",transitionPaymentState:"transitionPaymentState",settleRefund:"settleRefund"},decls:12,vars:9,consts:[[1,"card"],[1,"card-header","payment-header"],[4,"ngIf"],[1,"payment-state"],[3,"state"],[1,"card-block"],[3,"payment","currencyCode"],[4,"ngFor","ngForOf"],["class","card-footer",4,"ngIf"],[1,"refund-wrapper","card-block"],[1,"card-header","payment-header","refund-header"],["shape","redo","dir","down",1,"refund-icon"],[1,"clr-flex-fill"],[3,"label"],[3,"label",4,"ngIf"],[3,"value"],[1,"card-footer"],[1,"btn","btn-sm","btn-primary",3,"click"],["class","btn btn-sm btn-primary",3,"click",4,"ngIf"],["vdrDropdownTrigger","",1,"icon-button"],["shape","ellipsis-vertical"],["vdrPosition","bottom-right"],["type","button","vdrDropdownItem","",3,"click"],[4,"ngIf","ngIfElse"],["cancel",""],["shape","step-forward-2"],["shape","error-standard",1,"is-error"]],template:function(t,o){1&t&&(e.I0R(0,"div",0)(1,"div",1)(2,"div"),e.OEk(3),e.wVc(4,"translate"),e.yuY(5,Ci,3,4,"ng-container",2),e.C$Y(),e.I0R(6,"div",3),e.wR5(7,"vdr-payment-state-label",4),e.C$Y()(),e.I0R(8,"div",5),e.wR5(9,"vdr-payment-detail",6),e.C$Y(),e.yuY(10,Ii,21,23,"ng-container",7)(11,Ti,7,2,"div",8),e.C$Y()),2&t&&(e.yG2(3),e.oRS(" ",e.kDX(4,7,"order.payment")," "),e.yG2(2),e.E7m("ngIf",o.payment.amount),e.yG2(2),e.E7m("state",o.payment.state),e.yG2(2),e.E7m("payment",o.payment)("currencyCode",o.currencyCode),e.yG2(),e.E7m("ngForOf",o.payment.refunds),e.yG2(),e.E7m("ngIf",o.payment.nextStates.length))},dependencies:[_.o3d,m.ay,m.u_,ut.CM,B.i,W.m,U.q,ue.Q,O.a,ce.W,Ee,Re,re,p.sD,$.Q,A.m,g.u],styles:["[_nghost-%COMP%]{display:block}.payment-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;line-break:anywhere}.refund-icon[_ngcontent-%COMP%]{margin-inline-end:6px;color:var(--color-grey-400)}.card-footer[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:flex-end}.refund-wrapper[_ngcontent-%COMP%]{font-size:var(--font-size-xs)}"],changeDetection:0})}var yt=s(2212),Si=s(6112);const Di=["portal"];class we{constructor(n){this.historyEntryComponentService=n,this.expandClick=new e._w7}ngOnInit(){const n=this.historyEntryComponentService.getComponent(this.entry.type),t=this.portalRef.createComponent(n);t.instance.entry=this.entry,t.instance.order=this.order,this.instance=t.instance,this.componentRef=t}ngOnDestroy(){this.componentRef?.destroy()}static#e=this.\u0275fac=function(t){return new(t||we)(e.GI1(d.gDp))};static#t=this.\u0275cmp=e.In1({type:we,selectors:[["vdr-order-history-entry-host"]],viewQuery:function(t,o){if(1&t&&e.CC$(Di,7,e.y8U),2&t){let i;e.wto(i=e.Gqi())&&(o.portalRef=i.first)}},inputs:{entry:"entry",order:"order",expanded:"expanded"},outputs:{expandClick:"expandClick"},exportAs:["historyEntry"],decls:3,vars:6,consts:[[3,"displayType","iconShape","createdAt","name","featured","collapsed","expandClick"],["portal",""]],template:function(t,o){1&t&&(e.I0R(0,"vdr-timeline-entry",0),e.qCj("expandClick",function(){return o.expandClick.emit()}),e.wR5(1,"div",null,1),e.C$Y()),2&t&&e.E7m("displayType",o.instance.getDisplayType(o.entry))("iconShape",o.instance.getIconShape&&o.instance.getIconShape(o.entry))("createdAt",o.entry.createdAt)("name",o.instance.getName&&o.instance.getName(o.entry))("featured",o.instance.isFeatured(o.entry))("collapsed",!o.expanded&&!o.instance.isFeatured(o.entry))},dependencies:[yt.Y],encapsulation:2})}var Ct=s(3040);function xi(r,n){1&r&&(e.I0R(0,"span",12),e.OEk(1),e.wVc(2,"translate"),e.C$Y()),2&r&&(e.yG2(),e.oRS(" ",e.kDX(2,1,"order.note-only-visible-to-administrators")," "))}function Fi(r,n){1&r&&(e.I0R(0,"span",13),e.OEk(1),e.wVc(2,"translate"),e.C$Y()),2&r&&(e.yG2(),e.oRS(" ",e.kDX(2,1,"order.note-visible-to-customer")," "))}function $i(r,n){if(1&r){const t=e.KQA();e.I0R(0,"vdr-order-history-entry-host",16),e.qCj("expandClick",function(){e.usT(t);const i=e.GaO(2);return e.CGJ(i.expanded=!i.expanded)}),e.C$Y()}if(2&r){const t=e.GaO().$implicit,o=e.GaO();e.E7m("order",o.order)("entry",t)("expanded",o.expanded)}}function Mi(r,n){1&r&&(e.I0R(0,"div",11),e.OEk(1),e.wVc(2,"translate"),e.C$Y()),2&r&&(e.yG2(),e.oRS(" ",e.kDX(2,1,"order.history-order-fulfilled")," "))}function Yi(r,n){1&r&&(e.I0R(0,"div",11),e.OEk(1),e.wVc(2,"translate"),e.C$Y()),2&r&&(e.yG2(),e.oRS(" ",e.kDX(2,1,"order.history-order-cancelled")," "))}const ht=(r,n)=>({from:r,to:n});function Pi(r,n){if(1&r&&(e.OEk(0),e.wVc(1,"translate")),2&r){const t=e.GaO(3).$implicit;e.oRS(" ",e.g7$(1,1,"order.history-order-transition",e.IBC(4,ht,t.data.from,t.data.to))," ")}}function Ai(r,n){if(1&r&&(e.SAx(0),e.yuY(1,Mi,3,3,"div",21)(2,Yi,3,3,"div",21)(3,Pi,2,7,"ng-template",22),e.k70()),2&r){const t=e.GaO(2).$implicit;e.yG2(),e.E7m("ngIf","Delivered"===t.data.to),e.yG2(),e.E7m("ngIf","Cancelled"===t.data.to),e.yG2(),e.E7m("ngIf","Cancelled"!==t.data.to&&"Delivered"!==t.data.to)}}function Vi(r,n){1&r&&(e.I0R(0,"vdr-chip",28),e.OEk(1),e.wVc(2,"translate"),e.C$Y()),2&r&&(e.yG2(),e.cNF(e.kDX(2,1,"order.modification-settled")))}function Ni(r,n){1&r&&(e.I0R(0,"vdr-chip",29),e.OEk(1),e.wVc(2,"translate"),e.C$Y()),2&r&&(e.yG2(),e.cNF(e.kDX(2,1,"order.modification-not-settled")))}function Xi(r,n){if(1&r&&(e.I0R(0,"div",24),e.OEk(1),e.wVc(2,"translate"),e.I0R(3,"strong"),e.OEk(4),e.wVc(5,"localeCurrency"),e.C$Y(),e.yuY(6,Vi,3,3,"vdr-chip",25)(7,Ni,3,3,"vdr-chip",26),e.I0R(8,"vdr-history-entry-detail"),e.wR5(9,"vdr-modification-detail",27),e.C$Y()()),2&r){const t=n.ngIf,o=e.GaO(4);e.yG2(),e.oRS(" ",e.kDX(2,6,"order.modify-order-price-difference"),": "),e.yG2(3),e.cNF(e.g7$(5,8,t.priceChange,o.order.currencyCode)),e.yG2(2),e.E7m("ngIf",t.isSettled),e.yG2(),e.E7m("ngIf",!t.isSettled),e.yG2(2),e.E7m("order",o.order)("modification",t)}}function Li(r,n){if(1&r&&(e.SAx(0),e.I0R(1,"div",11),e.OEk(2),e.wVc(3,"translate"),e.C$Y(),e.yuY(4,Xi,10,11,"div",23),e.k70()),2&r){const t=e.GaO(2).$implicit,o=e.GaO();e.yG2(2),e.oRS(" ",e.kDX(3,2,"order.history-order-modified")," "),e.yG2(2),e.E7m("ngIf",o.getModification(t.data.modificationId))}}function ji(r,n){if(1&r&&(e.I0R(0,"vdr-chip",34),e.OEk(1),e.wVc(2,"localeCurrency"),e.C$Y()),2&r){const t=n.ngIf,o=e.GaO(5);e.yG2(),e.cNF(e.g7$(2,1,t.amount,o.order.currencyCode))}}function Qi(r,n){if(1&r&&(e.I0R(0,"vdr-history-entry-detail"),e.wR5(1,"vdr-payment-detail",35),e.C$Y()),2&r){const t=n.ngIf,o=e.GaO(5);e.yG2(),e.E7m("payment",t)("currencyCode",o.order.currencyCode)}}function Ki(r,n){if(1&r&&(e.SAx(0),e.I0R(1,"div",11),e.OEk(2),e.wVc(3,"translate"),e.C$Y(),e.I0R(4,"div",24),e.yuY(5,ji,3,4,"vdr-chip",32)(6,Qi,2,2,"vdr-history-entry-detail",33),e.C$Y(),e.k70()),2&r){const t=e.GaO(3).$implicit,o=e.GaO();e.yG2(2),e.oRS(" ",e.kDX(3,3,"order.history-payment-settled")," "),e.yG2(3),e.E7m("ngIf",o.getPayment(t)),e.yG2(),e.E7m("ngIf",o.getPayment(t))}}const Ot=(r,n,t)=>({from:r,to:n,id:t});function qi(r,n){if(1&r&&(e.OEk(0),e.wVc(1,"translate")),2&r){const t=e.GaO(3).$implicit,o=e.GaO();let i;e.oRS(" ",e.g7$(1,1,"order.history-payment-transition",e.uAc(4,Ot,t.data.from,t.data.to,null==(i=o.getPayment(t))?null:i.transactionId))," ")}}function Hi(r,n){if(1&r&&(e.SAx(0),e.yuY(1,Ki,7,5,"ng-container",30)(2,qi,2,8,"ng-template",null,31,e.gJz),e.k70()),2&r){const t=e.Gew(3),o=e.GaO(2).$implicit;e.yG2(),e.E7m("ngIf","Settled"===o.data.to)("ngIfElse",t)}}function Ji(r,n){if(1&r&&(e.SAx(0),e.I0R(1,"div",11),e.OEk(2),e.wVc(3,"translate"),e.C$Y(),e.I0R(4,"div",24)(5,"vdr-chip",37),e.OEk(6),e.wVc(7,"localeCurrency"),e.C$Y(),e.I0R(8,"vdr-history-entry-detail")(9,"vdr-labeled-data",38),e.wVc(10,"translate"),e.OEk(11),e.C$Y(),e.I0R(12,"vdr-labeled-data",38),e.wVc(13,"translate"),e.wR5(14,"vdr-simple-item-list",39),e.C$Y()()(),e.k70()),2&r){const t=n.ngIf,o=e.GaO(4).$implicit,i=e.GaO();e.yG2(2),e.CAO("",e.kDX(3,7,"order.refund")," #",t.id,""),e.yG2(4),e.cNF(e.g7$(7,9,t.total,i.order.currencyCode)),e.yG2(3),e.E7m("label",e.kDX(10,12,"order.cancellation-reason")),e.yG2(2),e.oRS(" ",o.data.reason," "),e.yG2(),e.E7m("label",e.kDX(13,14,"order.contents")),e.yG2(2),e.E7m("items",i.getCancelledItems(t.lines))}}function Bi(r,n){if(1&r&&(e.SAx(0),e.yuY(1,Ji,15,16,"ng-container",33),e.k70()),2&r){const t=e.GaO(3).$implicit,o=e.GaO();e.yG2(),e.E7m("ngIf",o.getRefund(t))}}function Wi(r,n){if(1&r&&(e.OEk(0),e.wVc(1,"translate")),2&r){const t=e.GaO(3).$implicit;e.oRS(" ",e.g7$(1,1,"order.history-refund-transition",e.uAc(4,Ot,t.data.from,t.data.to,t.data.refundId))," ")}}function Ui(r,n){if(1&r&&(e.SAx(0),e.yuY(1,Bi,2,1,"ng-container",30)(2,Wi,2,8,"ng-template",null,36,e.gJz),e.k70()),2&r){const t=e.Gew(3),o=e.GaO(2).$implicit;e.yG2(),e.E7m("ngIf","Settled"===o.data.to)("ngIfElse",t)}}function zi(r,n){if(1&r&&(e.I0R(0,"vdr-history-entry-detail")(1,"vdr-labeled-data",38),e.wVc(2,"translate"),e.OEk(3),e.C$Y(),e.I0R(4,"vdr-labeled-data",38),e.wVc(5,"translate"),e.wR5(6,"vdr-simple-item-list",39),e.C$Y(),e.I0R(7,"vdr-labeled-data",38),e.wVc(8,"translate"),e.OEk(9),e.C$Y()()),2&r){const t=n.ngIf,o=e.GaO(3).$implicit;e.yG2(),e.E7m("label",e.kDX(2,6,"order.cancellation-reason")),e.yG2(2),e.oRS(" ",o.data.reason," "),e.yG2(),e.E7m("label",e.kDX(5,8,"order.contents")),e.yG2(2),e.E7m("items",t),e.yG2(),e.E7m("label",e.kDX(8,10,"order.shipping-cancelled")),e.yG2(2),e.oRS(" ",o.data.shippingCancelled," ")}}const Zi=r=>({count:r});function ea(r,n){if(1&r&&(e.SAx(0),e.OEk(1),e.wVc(2,"translate"),e.yuY(3,zi,10,12,"vdr-history-entry-detail",33),e.k70()),2&r){const t=e.GaO(2).$implicit,o=e.GaO();e.yG2(),e.oRS(" ",e.g7$(2,2,"order.history-items-cancelled",e.S45(5,Zi,o.getCancelledQuantity(t)))," "),e.yG2(2),e.E7m("ngIf",o.getCancelledItems(t.data.lines))}}function ta(r,n){if(1&r&&(e.I0R(0,"vdr-history-entry-detail"),e.wR5(1,"vdr-fulfillment-detail",40),e.C$Y()),2&r){const t=n.ngIf,o=e.GaO(4);e.yG2(),e.E7m("fulfillmentId",t.id)("order",o.order)}}function na(r,n){if(1&r&&(e.SAx(0),e.OEk(1),e.wVc(2,"translate"),e.yuY(3,ta,2,2,"vdr-history-entry-detail",33),e.k70()),2&r){const t=e.GaO(2).$implicit,o=e.GaO();e.yG2(),e.oRS(" ",e.kDX(2,2,"order.history-fulfillment-created")," "),e.yG2(2),e.E7m("ngIf",o.getFulfillment(t))}}function ra(r,n){if(1&r&&(e.SAx(0),e.I0R(1,"div",11),e.OEk(2),e.wVc(3,"translate"),e.C$Y(),e.OEk(4),e.wVc(5,"translate"),e.k70()),2&r){const t=e.GaO(3).$implicit,o=e.GaO();let i;e.yG2(2),e.oRS(" ",e.kDX(3,3,"order.history-fulfillment-delivered")," "),e.yG2(2),e.CAO(" ",e.kDX(5,5,"order.tracking-code"),": ",null==(i=o.getFulfillment(t))?null:i.trackingCode," ")}}function oa(r,n){if(1&r&&(e.SAx(0),e.I0R(1,"div",11),e.OEk(2),e.wVc(3,"translate"),e.C$Y(),e.OEk(4),e.wVc(5,"translate"),e.k70()),2&r){const t=e.GaO(3).$implicit,o=e.GaO();let i;e.yG2(2),e.oRS(" ",e.kDX(3,3,"order.history-fulfillment-shipped")," "),e.yG2(2),e.CAO(" ",e.kDX(5,5,"order.tracking-code"),": ",null==(i=o.getFulfillment(t))?null:i.trackingCode," ")}}function ia(r,n){if(1&r&&(e.SAx(0),e.OEk(1),e.wVc(2,"translate"),e.k70()),2&r){const t=e.GaO(3).$implicit;e.yG2(),e.oRS(" ",e.g7$(2,1,"order.history-fulfillment-transition",e.IBC(4,ht,t.data.from,t.data.to))," ")}}function aa(r,n){if(1&r&&(e.I0R(0,"vdr-history-entry-detail"),e.wR5(1,"vdr-fulfillment-detail",40),e.C$Y()),2&r){const t=n.ngIf,o=e.GaO(4);e.yG2(),e.E7m("fulfillmentId",t.id)("order",o.order)}}function la(r,n){if(1&r&&(e.SAx(0),e.yuY(1,ra,6,7,"ng-container",33)(2,oa,6,7,"ng-container",33)(3,ia,3,7,"ng-container",33)(4,aa,2,2,"vdr-history-entry-detail",33),e.k70()),2&r){const t=e.GaO(2).$implicit,o=e.GaO();e.yG2(),e.E7m("ngIf","Delivered"===t.data.to),e.yG2(),e.E7m("ngIf","Shipped"===t.data.to),e.yG2(),e.E7m("ngIf","Delivered"!==t.data.to&&"Shipped"!==t.data.to),e.yG2(),e.E7m("ngIf",o.getFulfillment(t))}}function da(r,n){1&r&&(e.I0R(0,"span",53),e.OEk(1),e.wVc(2,"translate"),e.C$Y()),2&r&&(e.yG2(),e.cNF(e.kDX(2,1,"common.public")))}function sa(r,n){1&r&&(e.I0R(0,"span",54),e.OEk(1),e.wVc(2,"translate"),e.C$Y()),2&r&&(e.yG2(),e.cNF(e.kDX(2,1,"common.private")))}function ca(r,n){if(1&r){const t=e.KQA();e.SAx(0),e.I0R(1,"div",41)(2,"div",42),e.yuY(3,da,3,3,"span",43)(4,sa,3,3,"span",44),e.OEk(5),e.C$Y(),e.wR5(6,"div",45),e.I0R(7,"vdr-dropdown")(8,"button",46),e.wR5(9,"clr-icon",47),e.C$Y(),e.I0R(10,"vdr-dropdown-menu",48)(11,"button",49),e.qCj("click",function(){e.usT(t);const i=e.GaO(2).$implicit,a=e.GaO();return e.CGJ(a.updateNote.emit(i))}),e.wVc(12,"hasPermission"),e.wR5(13,"clr-icon",50),e.OEk(14),e.wVc(15,"translate"),e.C$Y(),e.wR5(16,"div",51),e.I0R(17,"button",49),e.qCj("click",function(){e.usT(t);const i=e.GaO(2).$implicit,a=e.GaO();return e.CGJ(a.deleteNote.emit(i))}),e.wVc(18,"hasPermission"),e.wR5(19,"clr-icon",52),e.OEk(20),e.wVc(21,"translate"),e.C$Y()()()(),e.k70()}if(2&r){const t=e.GaO(2).$implicit;e.yG2(3),e.E7m("ngIf",t.isPublic),e.yG2(),e.E7m("ngIf",!t.isPublic),e.yG2(),e.oRS(" ",t.data.note," "),e.yG2(6),e.E7m("disabled",!e.kDX(12,7,"UpdateOrder")),e.yG2(3),e.oRS(" ",e.kDX(15,9,"common.edit")," "),e.yG2(3),e.E7m("disabled",!e.kDX(18,11,"UpdateOrder")),e.yG2(3),e.oRS(" ",e.kDX(21,13,"common.delete")," ")}}const ma=r=>["/marketing","promotions",r];function ua(r,n){if(1&r&&(e.SAx(0),e.OEk(1),e.wVc(2,"translate"),e.I0R(3,"vdr-chip")(4,"a",55),e.OEk(5),e.C$Y()(),e.k70()),2&r){const t=e.GaO(2).$implicit;e.yG2(),e.oRS(" ",e.kDX(2,3,"order.history-coupon-code-applied"),": "),e.yG2(3),e.E7m("routerLink",e.S45(5,ma,t.data.promotionId)),e.yG2(),e.cNF(t.data.couponCode)}}function _a(r,n){if(1&r&&(e.SAx(0),e.OEk(1),e.wVc(2,"translate"),e.I0R(3,"vdr-chip")(4,"span",56),e.OEk(5),e.C$Y()(),e.k70()),2&r){const t=e.GaO(2).$implicit;e.yG2(),e.oRS(" ",e.kDX(2,2,"order.history-coupon-code-removed"),": "),e.yG2(4),e.cNF(t.data.couponCode)}}const vt=r=>["/customer","customers",r];function pa(r,n){if(1&r&&(e.I0R(0,"a",58),e.wR5(1,"clr-icon",59),e.I0R(2,"span"),e.OEk(3),e.C$Y(),e.wR5(4,"clr-icon",60),e.C$Y()),2&r){const t=e.GaO(3).$implicit;e.E7m("routerLink",e.S45(2,vt,t.data.previousCustomerId)),e.yG2(3),e.cNF(t.data.previousCustomerName)}}function fa(r,n){if(1&r&&(e.I0R(0,"a",58),e.wR5(1,"clr-icon",59),e.I0R(2,"span"),e.OEk(3),e.C$Y(),e.wR5(4,"clr-icon",60),e.C$Y()),2&r){const t=e.GaO(3).$implicit;e.E7m("routerLink",e.S45(2,vt,t.data.newCustomerId)),e.yG2(3),e.cNF(t.data.newCustomerName)}}const ga=r=>({newCustomerName:r});function ya(r,n){if(1&r&&(e.SAx(0),e.I0R(1,"div",11),e.OEk(2),e.wVc(3,"translate"),e.C$Y(),e.I0R(4,"div",41)(5,"div",42),e.OEk(6),e.C$Y(),e.wR5(7,"div",45),e.I0R(8,"vdr-history-entry-detail")(9,"vdr-labeled-data",38),e.wVc(10,"translate"),e.yuY(11,pa,5,4,"a",57),e.C$Y(),e.I0R(12,"vdr-labeled-data",38),e.wVc(13,"translate"),e.yuY(14,fa,5,4,"a",57),e.C$Y()()(),e.k70()),2&r){const t=e.GaO(2).$implicit;e.yG2(2),e.oRS(" ",e.g7$(3,6,"order.history-customer-updated",e.S45(13,ga,t.data.newCustomerName))," "),e.yG2(4),e.oRS(" ",t.data.note," "),e.yG2(3),e.E7m("label",e.kDX(10,9,"order.previous-customer")),e.yG2(2),e.E7m("ngIf",t.data.previousCustomerId),e.yG2(),e.E7m("label",e.kDX(13,11,"order.new-customer")),e.yG2(2),e.E7m("ngIf",t.data.newCustomerId)}}function Ca(r,n){if(1&r&&(e.I0R(0,"vdr-history-entry-detail"),e.wR5(1,"vdr-object-tree",61),e.C$Y()),2&r){const t=e.GaO(3).$implicit;e.yG2(),e.E7m("value",t.data)}}function ha(r,n){if(1&r&&(e.SAx(0),e.I0R(1,"div",11),e.OEk(2),e.wVc(3,"translate"),e.C$Y(),e.yuY(4,Ca,2,1,"vdr-history-entry-detail",33),e.k70()),2&r){const t=e.GaO(2).$implicit;e.yG2(2),e.oRS(" ",e.kDX(3,2,t.type)," "),e.yG2(2),e.E7m("ngIf",t.data)}}function Oa(r,n){if(1&r){const t=e.KQA();e.I0R(0,"vdr-timeline-entry",17),e.qCj("expandClick",function(){e.usT(t);const i=e.GaO(2);return e.CGJ(i.expanded=!i.expanded)}),e.SAx(1,18),e.yuY(2,Ai,4,3,"ng-container",19)(3,Li,5,4,"ng-container",19)(4,Hi,4,2,"ng-container",19)(5,Ui,4,2,"ng-container",19)(6,ea,4,7,"ng-container",19)(7,na,4,4,"ng-container",19)(8,la,5,4,"ng-container",19)(9,ca,22,15,"ng-container",19)(10,ua,6,7,"ng-container",19)(11,_a,6,4,"ng-container",19)(12,ya,15,15,"ng-container",19)(13,ha,5,4,"ng-container",20),e.k70(),e.C$Y()}if(2&r){const t=e.GaO().$implicit,o=e.GaO();e.E7m("displayType",o.getDisplayType(t))("iconShape",o.getTimelineIcon(t))("createdAt",t.createdAt)("name",o.getName(t))("featured",o.isFeatured(t))("collapsed",!o.expanded&&!o.isFeatured(t)),e.yG2(),e.E7m("ngSwitch",t.type),e.yG2(),e.E7m("ngSwitchCase",o.type.ORDER_STATE_TRANSITION),e.yG2(),e.E7m("ngSwitchCase",o.type.ORDER_MODIFIED),e.yG2(),e.E7m("ngSwitchCase",o.type.ORDER_PAYMENT_TRANSITION),e.yG2(),e.E7m("ngSwitchCase",o.type.ORDER_REFUND_TRANSITION),e.yG2(),e.E7m("ngSwitchCase",o.type.ORDER_CANCELLATION),e.yG2(),e.E7m("ngSwitchCase",o.type.ORDER_FULFILLMENT),e.yG2(),e.E7m("ngSwitchCase",o.type.ORDER_FULFILLMENT_TRANSITION),e.yG2(),e.E7m("ngSwitchCase",o.type.ORDER_NOTE),e.yG2(),e.E7m("ngSwitchCase",o.type.ORDER_COUPON_APPLIED),e.yG2(),e.E7m("ngSwitchCase",o.type.ORDER_COUPON_REMOVED),e.yG2(),e.E7m("ngSwitchCase",o.type.ORDER_CUSTOMER_UPDATED)}}function va(r,n){if(1&r&&(e.SAx(0),e.yuY(1,$i,1,3,"vdr-order-history-entry-host",14)(2,Oa,14,18,"ng-template",null,15,e.gJz),e.k70()),2&r){const t=n.$implicit,o=e.Gew(3),i=e.GaO();e.yG2(),e.E7m("ngIf",i.hasCustomComponent(t.type))("ngIfElse",o)}}class Te{constructor(n){this.historyEntryComponentService=n,this.addNote=new e._w7,this.updateNote=new e._w7,this.deleteNote=new e._w7,this.note="",this.noteIsPrivate=!0,this.expanded=!1,this.type=d.YjR}hasCustomComponent(n){return!!this.historyEntryComponentService.getComponent(n)}getDisplayType(n){if(n.type===d.YjR.ORDER_STATE_TRANSITION){if("Delivered"===n.data.to)return"success";if("Cancelled"===n.data.to)return"error"}return n.type===d.YjR.ORDER_FULFILLMENT_TRANSITION&&"Delivered"===n.data.to?"success":n.type!==d.YjR.ORDER_PAYMENT_TRANSITION||"Declined"!==n.data.to&&"Cancelled"!==n.data.to?n.type===d.YjR.ORDER_CANCELLATION||n.type===d.YjR.ORDER_REFUND_TRANSITION?"warning":"default":"error"}getTimelineIcon(n){if(n.type===d.YjR.ORDER_STATE_TRANSITION){if("Delivered"===n.data.to)return["success-standard","is-solid"];if("Cancelled"===n.data.to)return"ban"}return n.type===d.YjR.ORDER_PAYMENT_TRANSITION&&"Settled"===n.data.to||n.type===d.YjR.ORDER_REFUND_TRANSITION&&"Settled"===n.data.to?"credit-card":n.type===d.YjR.ORDER_NOTE?"note":n.type===d.YjR.ORDER_MODIFIED?"pencil":n.type===d.YjR.ORDER_CUSTOMER_UPDATED?"switch":n.type!==d.YjR.ORDER_FULFILLMENT_TRANSITION||"Shipped"!==n.data.to&&"Delivered"!==n.data.to?void 0:"truck"}isFeatured(n){switch(n.type){case d.YjR.ORDER_STATE_TRANSITION:return"Delivered"===n.data.to||"Cancelled"===n.data.to||"Settled"===n.data.to;case d.YjR.ORDER_REFUND_TRANSITION:return"Settled"===n.data.to;case d.YjR.ORDER_PAYMENT_TRANSITION:return"Settled"===n.data.to||"Cancelled"===n.data.to;case d.YjR.ORDER_FULFILLMENT_TRANSITION:return"Delivered"===n.data.to||"Shipped"===n.data.to;case d.YjR.ORDER_NOTE:case d.YjR.ORDER_MODIFIED:case d.YjR.ORDER_CUSTOMER_UPDATED:return!0;default:return!1}}getFulfillment(n){if((n.type===d.YjR.ORDER_FULFILLMENT||n.type===d.YjR.ORDER_FULFILLMENT_TRANSITION)&&this.order.fulfillments)return this.order.fulfillments.find(t=>t.id===n.data.fulfillmentId)}getPayment(n){if(n.type===d.YjR.ORDER_PAYMENT_TRANSITION&&this.order.payments)return this.order.payments.find(t=>t.id===n.data.paymentId)}getRefund(n){if(n.type===d.YjR.ORDER_REFUND_TRANSITION&&this.order.payments)return this.order.payments.reduce((o,i)=>o.concat(i.refunds),[]).find(o=>o.id===n.data.refundId)}getCancelledQuantity(n){return n.data.lines.reduce((t,o)=>t+o.quantity,0)}getCancelledItems(n){const t=new Map;for(const o of this.order.lines){const i=n.find(a=>a.orderLineId===o.id);if(i){t.get(o.productVariant.name);t.set(o.productVariant.name,i.quantity)}}return Array.from(t.entries()).map(([o,i])=>({name:o,quantity:i}))}getModification(n){return this.order.modifications.find(t=>t.id===n)}getName(n){const{administrator:t}=n;if(t)return`${t.firstName} ${t.lastName}`;{const o=this.order.customer;if(o)return`${o.firstName} ${o.lastName}`}return""}addNoteToOrder(){this.addNote.emit({note:this.note,isPublic:!this.noteIsPrivate}),this.note="",this.noteIsPrivate=!0}static#e=this.\u0275fac=function(t){return new(t||Te)(e.GI1(d.gDp))};static#t=this.\u0275cmp=e.In1({type:Te,selectors:[["vdr-order-history"]],inputs:{order:"order",history:"history"},outputs:{addNote:"addNote",updateNote:"updateNote",deleteNote:"deleteNote"},decls:20,vars:22,consts:[[1,"entry-list"],["iconShape","note","displayType","muted",3,"featured","isFirst"],[1,"note-entry"],["name","note",1,"note",3,"ngModel","ngModelChange"],[1,"btn","btn-secondary",3,"disabled","click"],[1,"visibility-select"],["type","checkbox","clrCheckbox","",3,"ngModel","ngModelChange"],["class","private",4,"ngIf"],["class","public",4,"ngIf"],[4,"ngFor","ngForOf"],[3,"isLast","createdAt","featured"],[1,"title"],[1,"private"],[1,"public"],[3,"order","entry","expanded","expandClick",4,"ngIf","ngIfElse"],["defaultComponents",""],[3,"order","entry","expanded","expandClick"],[3,"displayType","iconShape","createdAt","name","featured","collapsed","expandClick"],[3,"ngSwitch"],[4,"ngSwitchCase"],[4,"ngSwitchDefault"],["class","title",4,"ngIf"],[3,"ngIf"],["class","flex items-center",4,"ngIf"],[1,"flex","items-center"],["colorType","success","class","mx-1",4,"ngIf"],["colorType","error","class","mx-1",4,"ngIf"],[3,"order","modification"],["colorType","success",1,"mx-1"],["colorType","error",1,"mx-1"],[4,"ngIf","ngIfElse"],["regularPaymentTransition",""],["class","mr-1",4,"ngIf"],[4,"ngIf"],[1,"mr-1"],[3,"payment","currencyCode"],["regularRefundTransition",""],["colorType","warning",1,"mr-1"],[3,"label"],[3,"items"],[3,"fulfillmentId","order"],[1,"flex"],[1,"note-text"],["class","note-visibility public",4,"ngIf"],["class","note-visibility private",4,"ngIf"],[1,"flex-spacer"],["vdrDropdownTrigger","",1,"button-small","ml-1"],["shape","ellipsis-vertical","size","12"],["vdrPosition","bottom-right"],["vdrDropdownItem","",3,"disabled","click"],["shape","edit"],[1,"dropdown-divider"],["shape","trash",1,"is-danger"],[1,"note-visibility","public"],[1,"note-visibility","private"],[3,"routerLink"],[1,"cancelled-coupon-code"],["class","button-ghost",3,"routerLink",4,"ngIf"],[1,"button-ghost",3,"routerLink"],["shape","user",1,"is-solid"],["shape","arrow right"],[3,"value"]],template:function(t,o){1&t&&(e.I0R(0,"div",0)(1,"vdr-timeline-entry",1)(2,"div",2)(3,"textarea",3),e.iHE("ngModelChange",function(a){return e.kNx(o.note,a)||(o.note=a),a}),e.C$Y(),e.I0R(4,"button",4),e.qCj("click",function(){return o.addNoteToOrder()}),e.OEk(5),e.wVc(6,"translate"),e.C$Y()(),e.I0R(7,"div",5)(8,"clr-checkbox-wrapper")(9,"input",6),e.iHE("ngModelChange",function(a){return e.kNx(o.noteIsPrivate,a)||(o.noteIsPrivate=a),a}),e.C$Y(),e.I0R(10,"label"),e.OEk(11),e.wVc(12,"translate"),e.C$Y()(),e.yuY(13,xi,3,3,"span",7)(14,Fi,3,3,"span",8),e.C$Y()(),e.yuY(15,va,4,2,"ng-container",9),e.I0R(16,"vdr-timeline-entry",10)(17,"div",11),e.OEk(18),e.wVc(19,"translate"),e.C$Y()()()),2&t&&(e.eAK("expanded",o.expanded),e.yG2(),e.E7m("featured",!0)("isFirst",!0),e.yG2(2),e.OKB("ngModel",o.note),e.yG2(),e.E7m("disabled",!o.note),e.yG2(),e.oRS(" ",e.kDX(6,16,"common.add-note")," "),e.yG2(4),e.OKB("ngModel",o.noteIsPrivate),e.yG2(2),e.cNF(e.kDX(12,18,"order.note-is-private")),e.yG2(2),e.E7m("ngIf",o.noteIsPrivate),e.yG2(),e.E7m("ngIf",!o.noteIsPrivate),e.yG2(),e.E7m("ngForOf",o.history),e.yG2(),e.E7m("isLast",!0)("createdAt",o.order.createdAt)("featured",!0),e.yG2(2),e.oRS(" ",e.kDX(19,20,"order.history-order-created")," "))},dependencies:[_.o3d,_.ojz,_.y6l,_.eiS,m.ay,m.u_,m.Ko,m.Wm,m.UZ,l.ot,l.SU,l.ue,l._G,k.ER,D.g,C.w,B.i,W.m,U.q,ue.Q,O.a,ce.W,yt.Y,Si.E,ee,re,L,he,we,p.sD,Ct.G,g.u],styles:["[_nghost-%COMP%]{display:block}.entry-list[_ngcontent-%COMP%]{margin-inline-start:calc(var(--space-unit) * 2)}.note-entry[_ngcontent-%COMP%]{display:flex;align-items:center}.note-entry[_ngcontent-%COMP%] .note[_ngcontent-%COMP%]{flex:1}.note-entry[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{margin:0}.visibility-select[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:baseline}.visibility-select[_ngcontent-%COMP%] .public[_ngcontent-%COMP%]{color:var(--color-warning-700)}.visibility-select[_ngcontent-%COMP%] .private[_ngcontent-%COMP%]{color:var(--color-success-700)}textarea.note[_ngcontent-%COMP%]{flex:1;height:36px;border-radius:3px;margin-inline-end:6px}.note-text[_ngcontent-%COMP%]{color:var(--color-grey-800);white-space:pre-wrap;max-width:580px}.cancelled-coupon-code[_ngcontent-%COMP%]{text-decoration:line-through}.note-visibility[_ngcontent-%COMP%]{text-transform:lowercase}.note-visibility.public[_ngcontent-%COMP%]{color:var(--color-warning-700)}.note-visibility.private[_ngcontent-%COMP%]{color:var(--color-success-700)}"],changeDetection:0})}var ba=s(4392);const bt=Y.Ip`
27
+ `;class K{constructor(n){this.dataService=n,this.addCouponCode=new e._w7,this.removeCouponCode=new e._w7,this.couponCodeInput$=new Q.E}ngOnInit(){this.availableCouponCodes$=(0,et.W)(this.couponCodeInput$.pipe((0,Ne.o)(200),(0,tt.a)(),(0,f.G)(n=>this.dataService.query(d.MNc,{options:{take:10,skip:0,filter:{couponCode:{contains:n}}}}).single$),(0,R.k)(({promotions:n})=>n.items.map(t=>({code:t.couponCode,promotionName:t.name}))),(0,nt.W)([]))),this.control||(this.control=new l.yM(this.couponCodes??[]))}remove(n){this.removeCouponCode.emit(n)}static#e=this.\u0275fac=function(t){return new(t||K)(e.GI1(d.Aj0))};static#t=this.\u0275cmp=e.In1({type:K,selectors:[["vdr-coupon-code-selector"]],inputs:{couponCodes:"couponCodes",control:"control"},outputs:{addCouponCode:"addCouponCode",removeCouponCode:"removeCouponCode"},decls:3,vars:9,consts:[["appendTo","body","bindLabel","code","bindValue","code","typeToSearchText","",3,"items","addTag","multiple","hideSelected","minTermLength","typeahead","formControl","add","remove"],["ng-option-tmp",""],[1,"flex","items-center"],[1,"mr-1"]],template:function(t,o){1&t&&(e.I0R(0,"ng-select",0),e.qCj("add",function(a){return o.addCouponCode.emit(a.code)})("remove",function(a){return o.remove(a.code)}),e.wVc(1,"async"),e.yuY(2,Yt,5,2,"ng-template",1),e.C$Y()),2&t&&e.E7m("items",e.kDX(1,7,o.availableCouponCodes$))("addTag",!1)("multiple",!0)("hideSelected",!0)("minTermLength",2)("typeahead",o.couponCodeInput$)("formControl",o.control)},dependencies:[l.ue,l.ug,S.UT,S.kn,D.g,m.a],changeDetection:0})}var At=s(64),x=s(9128),Vt=s(8904),v=s(7980),de=s(7616),se=s(1485),rt=s(4648),ot=s(1760),it=s(660);function Nt(r,n){1&r&&(e.OEk(0),e.wVc(1,"translate")),2&r&&e.cNF(e.kDX(1,1,"order.select-address"))}function Xt(r,n){if(1&r&&(e.I0R(0,"vdr-radio-card",7),e.wR5(1,"vdr-formatted-address",8),e.C$Y()),2&r){const t=n.$implicit;e.E7m("item",t),e.yG2(),e.E7m("address",t)}}function Lt(r,n){if(1&r){const t=e.KQA();e.I0R(0,"clr-tab-content")(1,"vdr-radio-card-fieldset",5),e.qCj("selectItem",function(i){e.usT(t);const a=e.GaO(3);return e.CGJ(a.selectedAddress=i)}),e.yuY(2,Xt,2,2,"vdr-radio-card",6),e.C$Y()()}if(2&r){const t=e.GaO(2).ngIf,o=e.GaO();e.yG2(),e.E7m("idFn",o.addressIdFn)("selectedItemId",o.selectedAddress&&o.addressIdFn(o.selectedAddress)),e.yG2(),e.E7m("ngForOf",t)}}function jt(r,n){if(1&r){const t=e.KQA();e.I0R(0,"clr-tab")(1,"button",3),e.OEk(2),e.wVc(3,"translate"),e.C$Y(),e.yuY(4,Lt,3,3,"ng-template",4),e.iHE("clrIfActiveChange",function(i){e.usT(t);const a=e.GaO(2);return e.kNx(a.useExisting,i)||(a.useExisting=i),e.CGJ(i)}),e.C$Y()}if(2&r){const t=e.GaO(2);e.yG2(2),e.cNF(e.kDX(3,2,"order.existing-address")),e.yG2(2),e.E7m("clrIfActive",t.useExisting)}}function Qt(r,n){if(1&r&&(e.I0R(0,"clr-tab-content"),e.wR5(1,"vdr-address-form",9),e.wVc(2,"async"),e.C$Y()),2&r){const t=e.GaO(2);e.yG2(),e.E7m("formGroup",t.addressForm)("availableCountries",e.kDX(2,2,t.availableCountries$))}}function Kt(r,n){if(1&r){const t=e.KQA();e.I0R(0,"clr-tabs"),e.yuY(1,jt,5,4,"clr-tab",1),e.I0R(2,"clr-tab")(3,"button",3),e.OEk(4),e.wVc(5,"translate"),e.C$Y(),e.yuY(6,Qt,3,4,"ng-template",4),e.iHE("clrIfActiveChange",function(i){e.usT(t);const a=e.GaO();return e.kNx(a.createNew,i)||(a.createNew=i),e.CGJ(i)}),e.C$Y()()}if(2&r){const t=n.ngIf,o=e.GaO();e.yG2(),e.E7m("ngIf",o.customerId&&t.length),e.yG2(3),e.cNF(e.kDX(5,3,"customer.create-new-address")),e.yG2(2),e.E7m("clrIfActive",o.createNew)}}function qt(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",10),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.cancel())}),e.OEk(1),e.wVc(2,"translate"),e.C$Y(),e.I0R(3,"button",11),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.select())}),e.OEk(4),e.wVc(5,"translate"),e.C$Y()}if(2&r){const t=e.GaO();e.yG2(),e.cNF(e.kDX(2,3,"common.cancel")),e.yG2(2),e.E7m("disabled",t.useExisting&&!t.selectedAddress||t.createNew&&t.addressForm.invalid),e.yG2(),e.oRS(" ",e.kDX(5,5,"common.okay")," ")}}class q{constructor(n,t){this.dataService=n,this.formBuilder=t,this.useExisting=!0,this.createNew=!1}ngOnInit(){this.addressForm=this.formBuilder.group({fullName:[this.currentAddress?.fullName??""],company:[this.currentAddress?.company??""],streetLine1:[this.currentAddress?.streetLine1??"",l.AQ.required],streetLine2:[this.currentAddress?.streetLine2??""],city:[this.currentAddress?.city??"",l.AQ.required],province:[this.currentAddress?.province??""],postalCode:[this.currentAddress?.postalCode??"",l.AQ.required],countryCode:[this.currentAddress?.countryCode??"",l.AQ.required],phoneNumber:[this.currentAddress?.phoneNumber??""]}),this.useExisting=!!this.customerId,this.addresses$=this.customerId?this.dataService.query(d.sTc,{customerId:this.customerId}).mapSingle(({customer:n})=>n?.addresses??[]).pipe((0,de.y)(n=>{this.currentAddress&&(this.selectedAddress=n.find(t=>t.streetLine1===this.currentAddress?.streetLine1&&t.postalCode===this.currentAddress?.postalCode)),0===n.length&&(this.createNew=!0,this.useExisting=!1)})):(0,v.of)([]),this.availableCountries$=this.dataService.settings.getAvailableCountries().mapSingle(({countries:n})=>n.items)}trackByFn(n){return n.id}addressIdFn(n){return n.streetLine1+n.postalCode}cancel(){this.resolveWith()}select(){if(this.useExisting&&this.selectedAddress&&this.resolveWith({...(0,Vt.g)(this.selectedAddress,["fullName","company","streetLine1","streetLine2","city","province","phoneNumber","postalCode"]),countryCode:this.selectedAddress.country.code}),this.createNew&&this.addressForm.valid){const n=this.addressForm.value;this.resolveWith(n)}}static#e=this.\u0275fac=function(t){return new(t||q)(e.GI1(d.Aj0),e.GI1(l.KE))};static#t=this.\u0275cmp=e.In1({type:q,selectors:[["vdr-select-address-dialog"]],decls:4,vars:3,consts:[["vdrDialogTitle",""],[4,"ngIf"],["vdrDialogButtons",""],["clrTabLink",""],[3,"clrIfActive","clrIfActiveChange"],[1,"block","mt-4",3,"idFn","selectedItemId","selectItem"],[3,"item",4,"ngFor","ngForOf"],[3,"item"],[3,"address"],[3,"formGroup","availableCountries"],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"disabled","click"]],template:function(t,o){1&t&&(e.yuY(0,Nt,2,3,"ng-template",0)(1,Kt,7,5,"clr-tabs",1),e.wVc(2,"async"),e.yuY(3,qt,6,7,"ng-template",2)),2&t&&(e.yG2(),e.E7m("ngIf",e.kDX(2,1,o.addresses$)))},dependencies:[_.gxU,_.o1y,_._IX,_.k1p,_.wfG,_.M9m,_.ULu,m.ay,m.u_,l.u,l.uW,E.E,b.a,se.o,rt.w,ot.W,it.e,m.a,p.sD],changeDetection:0})}var at=s(9923);function Ht(r,n){if(1&r&&(e.OEk(0),e.wVc(1,"translate")),2&r){const t=e.GaO();e.cNF(e.kDX(1,1,t.title))}}function Jt(r,n){1&r&&e.C_f(0)}function Bt(r,n){if(1&r){const t=e.KQA();e.I0R(0,"vdr-form-field",7),e.wVc(1,"translate"),e.I0R(2,"textarea",8),e.iHE("ngModelChange",function(i){e.usT(t);const a=e.GaO(2);return e.kNx(a.note,i)||(a.note=i),e.CGJ(i)}),e.C$Y()()}if(2&r){const t=e.GaO(2);e.E7m("label",e.kDX(1,2,"common.add-note")),e.yG2(2),e.OKB("ngModel",t.note)}}function Wt(r,n){if(1&r&&(e.SAx(0),e.yuY(1,Jt,1,0,"ng-container",5)(2,Bt,3,4,"vdr-form-field",6),e.k70()),2&r){const t=e.GaO(),o=e.Gew(4);e.yG2(),e.E7m("ngTemplateOutlet",o),e.yG2(),e.E7m("ngIf",t.includeNoteInput)}}function Ut(r,n){1&r&&e.C_f(0)}function zt(r,n){if(1&r&&(e.I0R(0,"clr-tab-content")(1,"div",12),e.yuY(2,Ut,1,0,"ng-container",5),e.C$Y()()),2&r){e.GaO(2);const t=e.Gew(4);e.yG2(2),e.E7m("ngTemplateOutlet",t)}}function Zt(r,n){if(1&r&&(e.I0R(0,"clr-tab-content")(1,"form",13)(2,"vdr-form-field",14),e.wVc(3,"translate"),e.wR5(4,"input",15),e.C$Y(),e.I0R(5,"vdr-form-field",16),e.wVc(6,"translate"),e.wR5(7,"input",17),e.C$Y(),e.I0R(8,"vdr-form-field",18),e.wVc(9,"translate"),e.wR5(10,"input",19),e.C$Y(),e.I0R(11,"vdr-form-field",20),e.wVc(12,"translate"),e.wR5(13,"input",21),e.C$Y(),e.I0R(14,"vdr-form-field",22),e.wVc(15,"translate"),e.wR5(16,"input",23),e.C$Y()()()),2&r){const t=e.GaO(3);e.yG2(),e.E7m("formGroup",t.customerForm),e.yG2(),e.E7m("label",e.kDX(3,6,"customer.title")),e.yG2(3),e.E7m("label",e.kDX(6,8,"customer.first-name")),e.yG2(3),e.E7m("label",e.kDX(9,10,"customer.last-name")),e.yG2(3),e.E7m("label",e.kDX(12,12,"customer.email-address")),e.yG2(3),e.E7m("label",e.kDX(15,14,"customer.phone-number"))}}function en(r,n){if(1&r){const t=e.KQA();e.I0R(0,"clr-tab")(1,"button",10),e.OEk(2),e.wVc(3,"translate"),e.C$Y(),e.yuY(4,Zt,17,16,"ng-template",11),e.iHE("clrIfActiveChange",function(i){e.usT(t);const a=e.GaO(2);return e.kNx(a.createNew,i)||(a.createNew=i),e.CGJ(i)}),e.C$Y()}if(2&r){const t=e.GaO(2);e.yG2(2),e.cNF(e.kDX(3,2,"customer.create-new-customer")),e.yG2(2),e.E7m("clrIfActive",t.createNew)}}function tn(r,n){if(1&r){const t=e.KQA();e.I0R(0,"clr-tabs",9)(1,"clr-tab")(2,"button",10),e.OEk(3),e.wVc(4,"translate"),e.C$Y(),e.yuY(5,zt,3,1,"ng-template",11),e.iHE("clrIfActiveChange",function(i){e.usT(t);const a=e.GaO();return e.kNx(a.useExisting,i)||(a.useExisting=i),e.CGJ(i)}),e.C$Y(),e.yuY(6,en,5,4,"clr-tab",1),e.C$Y()}if(2&r){const t=e.GaO();e.yG2(3),e.cNF(e.kDX(4,3,"order.existing-customer")),e.yG2(2),e.E7m("clrIfActive",t.useExisting),e.yG2(),e.E7m("ngIf",t.canCreateNew)}}function nn(r,n){if(1&r&&(e.I0R(0,"span",27),e.wR5(1,"clr-icon",28),e.I0R(2,"span",29),e.OEk(3),e.C$Y(),e.I0R(4,"vdr-chip"),e.OEk(5),e.C$Y()()),2&r){const t=n.item;e.yG2(3),e.CAO("",t.firstName," ",t.lastName,""),e.yG2(2),e.cNF(t.emailAddress)}}function rn(r,n){if(1&r&&(e.I0R(0,"span",27),e.wR5(1,"clr-icon",28),e.I0R(2,"span",29),e.OEk(3),e.C$Y(),e.I0R(4,"vdr-chip"),e.OEk(5),e.C$Y()()),2&r){const t=n.item;e.yG2(3),e.CAO("",t.firstName," ",t.lastName,""),e.yG2(2),e.cNF(t.emailAddress)}}function on(r,n){if(1&r){const t=e.KQA();e.I0R(0,"ng-select",24),e.iHE("ngModelChange",function(i){e.usT(t);const a=e.GaO();return e.kNx(a.selectedCustomer,i)||(a.selectedCustomer=i),e.CGJ(i)}),e.wVc(1,"async"),e.yuY(2,nn,6,3,"ng-template",25)(3,rn,6,3,"ng-template",26),e.C$Y()}if(2&r){const t=e.GaO();e.E7m("items",e.kDX(1,9,t.customers$))("addTag",!1)("multiple",!0)("hideSelected",!0)("trackByFn",t.trackByFn)("minTermLength",2)("loading",t.isLoading)("typeahead",t.input$),e.OKB("ngModel",t.selectedCustomer)}}function an(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",30),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.cancel())}),e.OEk(1),e.wVc(2,"translate"),e.C$Y(),e.I0R(3,"button",31),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.select())}),e.OEk(4),e.wVc(5,"translate"),e.C$Y()}if(2&r){const t=e.GaO();e.yG2(),e.cNF(e.kDX(2,3,"common.cancel")),e.yG2(2),e.E7m("disabled",t.useExisting&&0===t.selectedCustomer.length||t.createNew&&t.customerForm.invalid),e.yG2(),e.oRS(" ",e.kDX(5,5,"common.okay")," ")}}class H{constructor(n,t){this.dataService=n,this.formBuilder=t,this.canCreateNew=!0,this.includeNoteInput=!1,this.title=(0,u.s)("order.set-customer-for-order"),this.isLoading=!1,this.input$=new Q.E,this.selectedCustomer=[],this.useExisting=!0,this.createNew=!1,this.note="",this.customerForm=this.formBuilder.group({title:"",firstName:["",l.AQ.required],lastName:["",l.AQ.required],phoneNumber:"",emailAddress:["",[l.AQ.required,l.AQ.email]]})}ngOnInit(){this.customers$=(0,et.W)((0,v.of)([]),this.input$.pipe((0,Ne.o)(200),(0,tt.a)(),(0,de.y)(()=>this.isLoading=!0),(0,f.G)(n=>this.dataService.customer.getCustomerList(10,0,n).mapStream(({customers:t})=>t.items).pipe((0,at.a)(()=>(0,v.of)([])),(0,de.y)(()=>this.isLoading=!1)))))}trackByFn(n){return n.id}cancel(){this.resolveWith()}select(){if(this.useExisting&&1===this.selectedCustomer.length)this.resolveWith({...this.selectedCustomer[0],note:this.note});else if(this.createNew&&this.customerForm.valid){const n=this.customerForm.value;this.resolveWith({...n,note:this.note})}}static#e=this.\u0275fac=function(t){return new(t||H)(e.GI1(d.Aj0),e.GI1(l.KE))};static#t=this.\u0275cmp=e.In1({type:H,selectors:[["vdr-select-customer-dialog"]],decls:6,vars:2,consts:[["vdrDialogTitle",""],[4,"ngIf"],["class","pt-1",4,"ngIf"],["customerSelect",""],["vdrDialogButtons",""],[4,"ngTemplateOutlet"],["class","mt-4",3,"label",4,"ngIf"],[1,"mt-4",3,"label"],[3,"ngModel","ngModelChange"],[1,"pt-1"],["clrTabLink",""],[3,"clrIfActive","clrIfActiveChange"],[1,"mt-4"],[3,"formGroup"],["for","title",3,"label"],["id","title","type","text","formControlName","title"],["for","firstName",3,"label"],["id","firstName","type","text","formControlName","firstName"],["for","lastName",3,"label"],["id","lastName","type","text","formControlName","lastName"],["for","emailAddress",3,"label"],["id","emailAddress","type","text","formControlName","emailAddress"],["for","phoneNumber",3,"label"],["id","phoneNumber","type","text","formControlName","phoneNumber"],["appendTo","body","bindLabel","name",3,"items","addTag","multiple","hideSelected","trackByFn","minTermLength","loading","typeahead","ngModel","ngModelChange"],["ng-label-tmp",""],["ng-option-tmp",""],[1,"item-row"],["shape","user",1,"is-solid"],[1,"mx-1"],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"disabled","click"]],template:function(t,o){1&t&&e.yuY(0,Ht,2,3,"ng-template",0)(1,Wt,3,2,"ng-container",1)(2,tn,7,5,"clr-tabs",2)(3,on,4,11,"ng-template",null,3,e.gJz)(5,an,6,7,"ng-template",4),2&t&&(e.yG2(),e.E7m("ngIf",!o.canCreateNew),e.yG2(),e.E7m("ngIf",o.canCreateNew))},dependencies:[_.o3d,_.gxU,_.o1y,_._IX,_.k1p,_.wfG,_.M9m,_.ULu,m.u_,m.XV,l.sz,l.ot,l.ue,l.u,l._G,l.uW,l.Wo,S.UT,S.kn,S.Ar,D.g,P._,C.w,E.E,b.a,m.a,p.sD],styles:[".item-row[_ngcontent-%COMP%]{display:flex;align-items:center}clr-tabs[_ngcontent-%COMP%]{display:block}"],changeDetection:0})}var O=s(2524),ce=s(7196);function ln(r,n){1&r&&(e.OEk(0),e.wVc(1,"translate")),2&r&&e.cNF(e.kDX(1,1,"order.select-shipping-method"))}function dn(r,n){if(1&r&&e.wR5(0,"vdr-object-tree",9),2&r){const t=e.GaO().$implicit;e.E7m("value",t.metadata)}}function sn(r,n){if(1&r&&(e.I0R(0,"vdr-radio-card",4)(1,"div",5)(2,"vdr-labeled-data",6),e.wVc(3,"translate"),e.OEk(4),e.C$Y(),e.I0R(5,"div",7)(6,"vdr-labeled-data",6),e.wVc(7,"translate"),e.OEk(8),e.wVc(9,"localeCurrency"),e.C$Y(),e.I0R(10,"vdr-labeled-data",6),e.wVc(11,"translate"),e.OEk(12),e.wVc(13,"localeCurrency"),e.C$Y()(),e.yuY(14,dn,1,1,"vdr-object-tree",8),e.C$Y()()),2&r){const t=n.$implicit,o=e.GaO();e.E7m("item",t),e.yG2(2),e.E7m("label",e.kDX(3,8,"settings.shipping-method")),e.yG2(2),e.oRS(" ",t.name," "),e.yG2(2),e.E7m("label",e.kDX(7,10,"common.price")),e.yG2(2),e.oRS(" ",e.g7$(9,12,t.price,o.currencyCode)," "),e.yG2(2),e.E7m("label",e.kDX(11,15,"common.price-with-tax")),e.yG2(2),e.oRS(" ",e.g7$(13,17,t.priceWithTax,o.currencyCode)," "),e.yG2(2),e.E7m("ngIf",t.metadata)}}function cn(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",10),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.cancel())}),e.OEk(1),e.wVc(2,"translate"),e.C$Y(),e.I0R(3,"button",11),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.select())}),e.OEk(4),e.wVc(5,"translate"),e.C$Y()}if(2&r){const t=e.GaO();e.yG2(),e.cNF(e.kDX(2,3,"common.cancel")),e.yG2(2),e.E7m("disabled",!t.selectedMethod),e.yG2(),e.oRS(" ",e.kDX(5,5,"common.okay")," ")}}class J{ngOnInit(){this.currentSelectionId&&(this.selectedMethod=this.eligibleShippingMethods.find(n=>n.id===this.currentSelectionId))}methodIdFn(n){return n.id}cancel(){this.resolveWith()}select(){this.selectedMethod&&this.resolveWith(this.selectedMethod.id)}static#e=this.\u0275fac=function(t){return new(t||J)};static#t=this.\u0275cmp=e.In1({type:J,selectors:[["vdr-select-shipping-method-dialog"]],decls:4,vars:3,consts:[["vdrDialogTitle",""],[3,"idFn","selectedItemId","selectItem"],[3,"item",4,"ngFor","ngForOf"],["vdrDialogButtons",""],[3,"item"],[1,"result-details"],[3,"label"],[1,"price-row"],[3,"value",4,"ngIf"],[3,"value"],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"disabled","click"]],template:function(t,o){1&t&&(e.yuY(0,ln,2,3,"ng-template",0),e.I0R(1,"vdr-radio-card-fieldset",1),e.qCj("selectItem",function(a){return o.selectedMethod=a}),e.yuY(2,sn,15,20,"vdr-radio-card",2),e.C$Y(),e.yuY(3,cn,6,7,"ng-template",3)),2&t&&(e.yG2(),e.E7m("idFn",o.methodIdFn)("selectedItemId",null==o.selectedMethod?null:o.selectedMethod.id),e.yG2(),e.E7m("ngForOf",o.eligibleShippingMethods))},dependencies:[m.ay,m.u_,E.E,b.a,O.a,ce.W,ot.W,it.e,p.sD,g.u],changeDetection:0})}var F=s(3200),mn=s(356),un=s(8256),lt=s(7724);var pn=s(8296),$=s(5032);function fn(r,n){1&r&&(e.OEk(0),e.wVc(1,"translate")),2&r&&e.cNF(e.kDX(1,1,"order.select-state"))}function gn(r,n){if(1&r&&(e.I0R(0,"option",4),e.OEk(1),e.wVc(2,"translate"),e.wVc(3,"stateI18nToken"),e.C$Y()),2&r){const t=n.$implicit;e.E7m("value",t),e.yG2(),e.oRS(" ",e.kDX(2,2,e.kDX(3,4,t))," ")}}function yn(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",7),e.qCj("click",function(){e.usT(t);const i=e.GaO(2);return e.CGJ(i.cancel())}),e.OEk(1),e.wVc(2,"translate"),e.C$Y()}2&r&&(e.yG2(),e.oRS(" ",e.kDX(2,1,"common.cancel")," "))}const Cn=r=>({state:r});function hn(r,n){if(1&r){const t=e.KQA();e.yuY(0,yn,3,3,"button",5),e.I0R(1,"button",6),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.select())}),e.OEk(2),e.wVc(3,"translate"),e.wVc(4,"translate"),e.wVc(5,"stateI18nToken"),e.C$Y()}if(2&r){const t=e.GaO();e.E7m("ngIf",t.cancellable),e.yG2(),e.E7m("disabled",!t.selectedState),e.yG2(),e.oRS(" ",e.g7$(3,3,"order.transition-to-state",e.S45(10,Cn,e.kDX(4,6,e.kDX(5,8,t.selectedState))))," ")}}class me{constructor(){this.nextStates=[],this.message="",this.selectedState=""}select(){this.selectedState&&this.resolveWith(this.selectedState)}cancel(){this.resolveWith()}static#e=this.\u0275fac=function(t){return new(t||me)};static#t=this.\u0275cmp=e.In1({type:me,selectors:[["vdr-order-state-select-dialog"]],decls:8,vars:5,consts:[["vdrDialogTitle",""],["name","state",3,"ngModel","ngModelChange"],[3,"value",4,"ngFor","ngForOf"],["vdrDialogButtons",""],[3,"value"],["type","submit","class","btn btn-secondary",3,"click",4,"ngIf"],["type","submit",1,"btn","btn-primary",3,"disabled","click"],["type","submit",1,"btn","btn-secondary",3,"click"]],template:function(t,o){1&t&&(e.yuY(0,fn,2,3,"ng-template",0),e.I0R(1,"p"),e.OEk(2),e.wVc(3,"translate"),e.C$Y(),e.I0R(4,"vdr-form-field")(5,"select",1),e.iHE("ngModelChange",function(a){return e.kNx(o.selectedState,a)||(o.selectedState=a),a}),e.yuY(6,gn,4,6,"option",2),e.C$Y()(),e.yuY(7,hn,6,12,"ng-template",3)),2&t&&(e.yG2(2),e.cNF(e.kDX(3,3,o.message)),e.yG2(3),e.OKB("ngModel",o.selectedState),e.yG2(),e.E7m("ngForOf",o.nextStates))},dependencies:[m.ay,m.u_,l.wd,l.GO,l.GC,l.ue,l._G,P._,C.w,E.E,b.a,p.sD,$.Q],changeDetection:0})}class M{constructor(n,t,o,i){this.dataService=n,this.modalService=t,this.notificationService=o,this.i18nService=i}transitionToPreModifyingState(n,t){return this.getPreModifyingState(n).pipe((0,f.G)(o=>{const i={orderId:n,nextStates:t,message:this.i18nService.translate((0,u.s)("order.unable-to-transition-to-state-try-another"),{state:o}),cancellable:!1,retry:10};return o?this.transitionToStateOrThrow(n,o).pipe((0,at.a)(a=>this.manuallyTransitionToState(i))):this.manuallyTransitionToState(i)}))}manuallyTransitionToState(n){return this.modalService.fromComponent(me,{locals:{nextStates:n.nextStates,cancellable:n.cancellable,message:n.message},closable:!1,size:"md"}).pipe((0,f.G)(t=>{if(t)return this.transitionToStateOrThrow(n.orderId,t);if(n.cancellable)return F.k;throw new Error("An order state must be selected")}),function _n(r){return(0,un.i)((n,t)=>{let o,a,i=!1;const c=()=>{o=n.subscribe((0,lt.e)(t,void 0,void 0,y=>{a||(a=new Q.E,(0,mn.Uv)(r(a)).subscribe((0,lt.e)(t,()=>o?c():i=!0))),a&&a.next(y)})),i&&(o.unsubscribe(),o=null,i=!1,c())};c()})}(t=>t.pipe((0,pn.o)(2e3),(0,x.U)(n.retry))))}getPreModifyingState(n){return this.dataService.order.getOrderHistory(n,{filter:{type:{eq:d.YjR.ORDER_STATE_TRANSITION}},sort:{createdAt:d._8$.DESC}}).mapSingle(t=>t.order).pipe((0,R.k)(t=>{const o=t?.history.items.find(i=>"Modifying"===i.data.to);if(o)return o.data.from}))}transitionToStateOrThrow(n,t){return this.dataService.order.transitionToState(n,t).pipe((0,R.k)(({transitionOrderToState:o})=>{switch(o?.__typename){case"Order":return o?.state;case"OrderStateTransitionError":throw this.notificationService.error(o?.transitionError),new Error(o?.transitionError)}}))}static#e=this.\u0275fac=function(t){return new(t||M)(e.CoB(d.Aj0),e.CoB(d.Ajm),e.CoB(d.gnT),e.CoB(d.WYg))};static#t=this.\u0275prov=e.wxM({token:M,factory:M.\u0275fac,providedIn:"root"})}var I=s(900),Xe=s(7856),Le=s(8008),ue=s(5752),Me=s(4311),je=s(6744),dt=s(6539),Ye=s(6500),st=s(5556),Qe=s(4788),Ke=s(4956),G=s(8084),ct=s(5536);function On(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",9),e.qCj("click",function(){e.usT(t);const i=e.GaO(2);return e.CGJ(i.editable=!0)}),e.wR5(1,"clr-icon",10),e.OEk(2),e.wVc(3,"translate"),e.C$Y()}2&r&&(e.yG2(2),e.oRS(" ",e.kDX(3,1,"common.edit")," "))}function vn(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",11),e.qCj("click",function(){e.usT(t);const i=e.GaO(2);return e.CGJ(i.onUpdateClick())}),e.wR5(1,"clr-icon",12),e.OEk(2),e.wVc(3,"translate"),e.C$Y()}if(2&r){const t=e.GaO(2);e.E7m("disabled",t.customFieldForm.pristine||t.customFieldForm.invalid),e.yG2(2),e.oRS(" ",e.kDX(3,2,"common.update")," ")}}function bn(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",9),e.qCj("click",function(){e.usT(t);const i=e.GaO(2);return e.CGJ(i.onCancelClick())}),e.wR5(1,"clr-icon",13),e.OEk(2),e.wVc(3,"translate"),e.C$Y()}2&r&&(e.yG2(2),e.oRS(" ",e.kDX(3,1,"common.cancel")," "))}function In(r,n){if(1&r&&(e.I0R(0,"div",1)(1,"div",2),e.OEk(2),e.wVc(3,"translate"),e.C$Y(),e.I0R(4,"div",3)(5,"div",4),e.wR5(6,"vdr-tabbed-custom-fields",5),e.C$Y()(),e.I0R(7,"div",6),e.yuY(8,On,4,3,"button",7)(9,vn,4,4,"button",8)(10,bn,4,3,"button",7),e.C$Y()()),2&r){const t=e.GaO();e.yG2(2),e.oRS(" ",e.kDX(3,10,"common.custom-fields")," "),e.yG2(3),e.eAK("editable",t.editable),e.yG2(),e.E7m("customFields",t.customFieldsConfig)("customFieldsFormGroup",t.customFieldForm)("readonly",!t.editable)("compact",!0),e.yG2(2),e.E7m("ngIf",!t.editable),e.yG2(),e.E7m("ngIf",t.editable),e.yG2(),e.E7m("ngIf",t.editable)}}class _e{constructor(n,t){this.formBuilder=n,this.modalService=t,this.customFieldsConfig=[],this.customFieldValues={},this.updateClick=new e._w7,this.editable=!1}ngOnInit(){this.customFieldForm=this.formBuilder.group({});for(const n of this.customFieldsConfig)this.customFieldForm.addControl(n.name,this.formBuilder.control(this.customFieldValues[n.name]))}onUpdateClick(){this.updateClick.emit(this.customFieldForm.value),this.customFieldForm.markAsPristine(),this.editable=!1}onCancelClick(){this.customFieldForm.dirty?this.modalService.dialog({title:(0,u.s)("catalog.confirm-cancel"),buttons:[{type:"secondary",label:(0,u.s)("common.keep-editing")},{type:"danger",label:(0,u.s)("common.discard-changes"),returnValue:!0}]}).subscribe(n=>{n&&(this.customFieldForm.reset(),this.customFieldForm.markAsPristine(),this.editable=!1)}):this.editable=!1}static#e=this.\u0275fac=function(t){return new(t||_e)(e.GI1(l.KE),e.GI1(d.Ajm))};static#t=this.\u0275cmp=e.In1({type:_e,selectors:[["vdr-order-custom-fields-card"]],inputs:{customFieldsConfig:"customFieldsConfig",customFieldValues:"customFieldValues"},outputs:{updateClick:"updateClick"},decls:1,vars:1,consts:[["class","card",4,"ngIf"],[1,"card"],[1,"card-header"],[1,"card-block"],[1,"card-text","custom-field-form"],["entityName","Order",3,"customFields","customFieldsFormGroup","readonly","compact"],[1,"card-footer"],["class","btn btn-sm btn-secondary",3,"click",4,"ngIf"],["class","btn btn-sm btn-primary",3,"disabled","click",4,"ngIf"],[1,"btn","btn-sm","btn-secondary",3,"click"],["shape","pencil"],[1,"btn","btn-sm","btn-primary",3,"disabled","click"],["shape","check"],["shape","times"]],template:function(t,o){1&t&&e.yuY(0,In,11,12,"div",0),2&t&&e.E7m("ngIf",o.customFieldsConfig.length)},dependencies:[_.o3d,m.u_,ct.w,p.sD],styles:["vdr-custom-field-control[_ngcontent-%COMP%]{margin-bottom:6px;display:block}.custom-field-form[_ngcontent-%COMP%] .clr-control-label{color:var(--color-grey-400)}.custom-field-form.editable[_ngcontent-%COMP%] .clr-control-label{color:inherit}"],changeDetection:0})}var k=s(656),B=s(8168),W=s(3428),U=s(4024),Pe=s(7800),mt=s(4944),A=s(9604);function Gn(r,n){1&r&&e.wR5(0,"clr-icon",9)}function En(r,n){1&r&&e.wR5(0,"clr-icon",10)}function Rn(r,n){1&r&&e.wR5(0,"clr-icon",11)}function kn(r,n){1&r&&(e.I0R(0,"label",12),e.OEk(1),e.wVc(2,"translate"),e.C$Y()),2&r&&(e.yG2(),e.oRS(" ",e.kDX(2,1,"order.line-fulfillment-all")," "))}const wn=(r,n)=>({total:r,count:n});function Tn(r,n){if(1&r&&(e.I0R(0,"label",12),e.OEk(1),e.wVc(2,"translate"),e.C$Y()),2&r){const t=e.GaO(2);e.yG2(),e.oRS(" ",e.g7$(2,1,"order.line-fulfillment-partial",e.IBC(4,wn,t.line.quantity,t.fulfilledCount))," ")}}function Sn(r,n){1&r&&(e.I0R(0,"label",12),e.OEk(1),e.wVc(2,"translate"),e.C$Y()),2&r&&(e.yG2(),e.oRS(" ",e.kDX(2,1,"order.line-fulfillment-none")," "))}function Dn(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",15),e.wVc(1,"translate"),e.OEk(2),e.C$Y()),2&r){const t=e.GaO().$implicit;e.E7m("label",e.kDX(1,2,"order.tracking-code")),e.yG2(2),e.oRS(" ",t.fulfillment.trackingCode," ")}}const xn=r=>({count:r});function Fn(r,n){if(1&r&&(e.I0R(0,"div",13)(1,"div",14),e.OEk(2),e.wVc(3,"translate"),e.wVc(4,"translate"),e.C$Y(),e.I0R(5,"vdr-labeled-data",15),e.wVc(6,"translate"),e.OEk(7),e.wVc(8,"localeDate"),e.C$Y(),e.I0R(9,"vdr-labeled-data",15),e.wVc(10,"translate"),e.OEk(11),e.C$Y(),e.yuY(12,Dn,3,4,"vdr-labeled-data",16),e.C$Y()),2&r){const t=n.$implicit;e.yG2(2),e.MjK(" ",e.kDX(3,8,"order.fulfillment")," #",t.fulfillment.id," (",e.g7$(4,10,"order.item-count",e.S45(20,xn,t.count)),") "),e.yG2(3),e.E7m("label",e.kDX(6,13,"common.created-at")),e.yG2(2),e.oRS(" ",e.g7$(8,15,t.fulfillment.createdAt,"medium")," "),e.yG2(2),e.E7m("label",e.kDX(10,18,"order.fulfillment-method")),e.yG2(2),e.oRS(" ",t.fulfillment.method," "),e.yG2(),e.E7m("ngIf",t.fulfillment.trackingCode)}}function $n(r,n){if(1&r&&(e.I0R(0,"vdr-dropdown",1)(1,"button",2),e.yuY(2,Gn,1,0,"clr-icon",3)(3,En,1,0,"clr-icon",4)(4,Rn,1,0,"clr-icon",5),e.C$Y(),e.I0R(5,"vdr-dropdown-menu",6),e.yuY(6,kn,3,3,"label",7)(7,Tn,3,7,"label",7)(8,Sn,3,3,"label",7)(9,Fn,13,22,"div",8),e.C$Y()()),2&r){const t=e.GaO();e.yG2(2),e.E7m("ngIf","full"===t.fulfillmentStatus),e.yG2(),e.E7m("ngIf","partial"===t.fulfillmentStatus),e.yG2(),e.E7m("ngIf","none"===t.fulfillmentStatus),e.yG2(2),e.E7m("ngIf","full"===t.fulfillmentStatus),e.yG2(),e.E7m("ngIf","partial"===t.fulfillmentStatus),e.yG2(),e.E7m("ngIf","none"===t.fulfillmentStatus),e.yG2(),e.E7m("ngForOf",t.fulfillments)}}class z{constructor(){this.fulfilledCount=0,this.fulfillments=[]}ngOnChanges(n){this.line&&(this.fulfilledCount=this.getDeliveredCount(this.line),this.fulfillmentStatus=this.getFulfillmentStatus(this.fulfilledCount,this.line.quantity),this.fulfillments=this.getFulfillments(this.line))}getDeliveredCount(n){return n.fulfillmentLines?.reduce((t,o)=>t+o.quantity,0)??0}getFulfillmentStatus(n,t){return n===t?"full":0<n&&n<t?"partial":"none"}getFulfillments(n){return n.fulfillmentLines?.map(t=>{const o=this.allOrderFulfillments?.find(i=>i.id===t.fulfillmentId);if(o)return{count:t.quantity,fulfillment:o}}).filter(h.notNullOrUndefined)??[]}static#e=this.\u0275fac=function(t){return new(t||z)};static#t=this.\u0275cmp=e.In1({type:z,selectors:[["vdr-line-fulfillment"]],inputs:{line:"line",allOrderFulfillments:"allOrderFulfillments",orderState:"orderState"},features:[e.SYr],decls:1,vars:1,consts:[["class","search-settings-menu",4,"ngIf"],[1,"search-settings-menu"],["type","button","vdrDropdownTrigger","",1,"icon-button"],["class","item-fulfilled","shape","check-circle",4,"ngIf"],["class","item-partially-fulfilled","shape","check-circle",4,"ngIf"],["class","item-not-fulfilled","shape","exclamation-circle",4,"ngIf"],["vdrPosition","bottom-right"],["class","dropdown-header",4,"ngIf"],["class","fulfillment-detail",4,"ngFor","ngForOf"],["shape","check-circle",1,"item-fulfilled"],["shape","check-circle",1,"item-partially-fulfilled"],["shape","exclamation-circle",1,"item-not-fulfilled"],[1,"dropdown-header"],[1,"fulfillment-detail"],[1,"fulfillment-title"],[3,"label"],[3,"label",4,"ngIf"]],template:function(t,o){1&t&&e.yuY(0,$n,10,7,"vdr-dropdown",0),2&t&&e.E7m("ngIf",o.fulfilledCount||"PartiallyDelivered"===o.orderState)},dependencies:[_.o3d,_.ojz,m.ay,m.u_,B.i,W.m,U.q,O.a,p.sD,A.m],styles:[".item-fulfilled[_ngcontent-%COMP%]{color:var(--color-success-700)}.item-partially-fulfilled[_ngcontent-%COMP%]{color:var(--color-warning-700)}.item-not-fulfilled[_ngcontent-%COMP%]{color:var(--color-error-700)}.fulfillment-detail[_ngcontent-%COMP%]{margin:6px 12px}.fulfillment-detail[_ngcontent-%COMP%]:not(:last-of-type){border-bottom:1px dashed var(--color-component-border-200)}"],changeDetection:0})}var ut=s(6019);const Mn=r=>({count:r});function Yn(r,n){if(1&r&&(e.I0R(0,"span",1),e.wVc(1,"translate"),e.wR5(2,"clr-icon",2),e.C$Y()),2&r){const t=e.GaO();e.E7m("title",e.g7$(1,1,"order.refunded-count",e.S45(4,Mn,t.getRefundedCount())))}}class V{getRefundedCount(){return(this.payments?.reduce((t,o)=>[...t,...o.refunds],[]).filter(t=>"Failed"!==t.state).reduce((t,o)=>[...t,...o.lines],[])??[]).filter(t=>t.orderLineId===this.line.id).reduce((t,o)=>t+o.quantity,0)}static#e=this.\u0275fac=function(t){return new(t||V)};static#t=this.\u0275cmp=e.In1({type:V,selectors:[["vdr-line-refunds"]],inputs:{line:"line",payments:"payments"},decls:1,vars:1,consts:[[3,"title",4,"ngIf"],[3,"title"],["shape","redo","dir","down",1,"is-solid"]],template:function(t,o){1&t&&e.yuY(0,Yn,3,6,"span",0),2&t&&e.E7m("ngIf",o.getRefundedCount())},dependencies:[_.o3d,m.u_,ut.CM,p.sD],styles:["[_nghost-%COMP%]{color:var(--color-error-500)}"],changeDetection:0})}class N extends d.Mrq{constructor(){super(...arguments),this.orderable=!1}static#e=this.\u0275fac=(()=>{let n;return function(o){return(n||(n=e.otF(N)))(o||N)}})();static#t=this.\u0275cmp=e.In1({type:N,selectors:[["vdr-order-total-column"]],exportAs:["row"],features:[e.eg9],decls:0,vars:0,template:function(t,o){},encapsulation:2})}var Pn=s(3508),An=s(9508),Vn=s(6832),Nn=s(288),Xn=s(9076);function Ln(r,n){if(1&r){const t=e.KQA();e.I0R(0,"th",18)(1,"input",19),e.qCj("change",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.onToggleAllClick())}),e.C$Y()()}if(2&r){const t=e.GaO();e.yG2(),e.E7m("checked",null==t.selectionManager?null:t.selectionManager.areAllCurrentItemsSelected())}}function jn(r,n){1&r&&e.wR5(0,"clr-icon",29)}function Qn(r,n){1&r&&e.wR5(0,"clr-icon",30)}function Kn(r,n){1&r&&e.wR5(0,"clr-icon",31)}function qn(r,n){if(1&r&&(e.I0R(0,"div",32),e.OEk(1),e.C$Y()),2&r){const t=e.GaO().ngIf;e.yG2(),e.cNF(t.sortOrder)}}function Hn(r,n){if(1&r){const t=e.KQA();e.I0R(0,"div",23)(1,"button",24),e.qCj("click",function(){const a=e.usT(t).ngIf;return e.CGJ(a.toggleSortOrder())}),e.yuY(2,jn,1,0,"clr-icon",25)(3,Qn,1,0,"clr-icon",26)(4,Kn,1,0,"clr-icon",27),e.C$Y(),e.yuY(5,qn,2,1,"div",28),e.C$Y()}if(2&r){const t=n.ngIf;e.yG2(),e.eAK("active",t.sortOrder),e.yG2(),e.E7m("ngIf",!t.sortOrder),e.yG2(),e.E7m("ngIf","ASC"===t.sortOrder),e.yG2(),e.E7m("ngIf","DESC"===t.sortOrder),e.yG2(),e.E7m("ngIf",t.sortOrder)}}function Jn(r,n){if(1&r&&(e.I0R(0,"th")(1,"div",20)(2,"vdr-ui-extension-point",21)(3,"span"),e.OEk(4),e.C$Y()(),e.yuY(5,Hn,6,6,"div",22),e.C$Y()()),2&r){const t=n.$implicit,o=e.GaO();e.eAK("expand",t.expand),e.yG2(),e.E7m("ngClass",t.align),e.yG2(),e.E7m("locationId",o.id)("metadata",t.id)("topPx",-6)("leftPx",-24),e.yG2(2),e.cNF(t.heading),e.yG2(),e.E7m("ngIf",t.sort)}}function Bn(r,n){1&r&&e.C_f(0)}function Wn(r,n){1&r&&e.C_f(0)}function Un(r,n){if(1&r&&e.wR5(0,"vdr-data-table-filters",41),2&r){const t=n.$implicit,o=e.GaO(3);e.E7m("filterWithValue",t)("filters",o.filters)}}function zn(r,n){if(1&r&&e.wR5(0,"vdr-data-table-filters",42),2&r){const t=e.GaO(3);e.E7m("filters",t.filters)}}function Zn(r,n){if(1&r&&(e.SAx(0),e.I0R(1,"div",38),e.yuY(2,Un,1,2,"vdr-data-table-filters",39)(3,zn,1,1,"vdr-data-table-filters",40),e.C$Y(),e.k70()),2&r){const t=e.GaO(2);e.yG2(2),e.E7m("ngForOf",t.filters.activeFilters),e.yG2(),e.E7m("ngIf",t.filters.length)}}function er(r,n){if(1&r){const t=e.KQA();e.I0R(0,"tr")(1,"th",33)(2,"button",34),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.toggleSearchFilterRow())}),e.wVc(3,"translate"),e.wR5(4,"clr-icon",35),e.C$Y(),e.I0R(5,"div",36),e.yuY(6,Bn,1,0,"ng-container",37)(7,Wn,1,0,"ng-container",37)(8,Zn,4,2,"ng-container",8),e.C$Y()()()}if(2&r){const t=e.GaO();e.yG2(),e.eAK("active",t.showSearchFilterRow),e.e48("colspan",t.visibleSortedColumns.length+(t.selectionManager?2:1)),e.yG2(),e.eAK("active",t.showSearchFilterRow),e.E7m("title",e.kDX(3,11,"common.search-and-filter-list")),e.yG2(3),e.eAK("hidden",!t.showSearchFilterRow),e.yG2(),e.E7m("ngTemplateOutlet",null==t.searchComponent?null:t.searchComponent.template),e.yG2(),e.E7m("ngTemplateOutlet",t.customSearchTemplate),e.yG2(),e.E7m("ngIf",t.filters)}}function tr(r,n){if(1&r){const t=e.KQA();e.I0R(0,"td",18)(1,"input",45),e.qCj("click",function(i){e.usT(t);const a=e.GaO().$implicit,c=e.GaO();return e.CGJ(c.onRowClick(a,i))}),e.C$Y()()}if(2&r){const t=e.GaO(),o=t.index,i=t.$implicit,a=e.GaO();e.eAK("active",a.activeIndex===o),e.yG2(),e.E7m("checked",null==a.selectionManager?null:a.selectionManager.isSelected(i))}}function nr(r,n){1&r&&e.C_f(0)}const rr=r=>({rowItem:r});function or(r,n){if(1&r&&(e.SAx(0),e.yuY(1,nr,1,0,"ng-container",48),e.k70()),2&r){const t=n.ngIf,o=e.GaO(2).$implicit;e.yG2(),e.E7m("ngComponentOutlet",t.config.component)("ngComponentOutletInputs",e.S45(3,rr,o))("ngComponentOutletInjector",t.injector)}}function ir(r,n){1&r&&e.C_f(0)}const ar=(r,n)=>({item:r,index:n});function lr(r,n){if(1&r&&e.yuY(0,ir,1,0,"ng-container",49),2&r){const t=e.GaO().$implicit,o=e.GaO(),i=o.$implicit,a=o.index;e.E7m("ngTemplateOutlet",t.template)("ngTemplateOutletContext",e.IBC(2,ar,i,a))}}function dr(r,n){if(1&r&&(e.I0R(0,"td")(1,"div",20),e.yuY(2,or,2,5,"ng-container",46)(3,lr,1,5,"ng-template",null,47,e.gJz),e.C$Y()()),2&r){const t=n.$implicit,o=e.Gew(4),i=e.GaO().index,a=e.GaO();e.eAK("active",a.activeIndex===i),e.yG2(),e.E7m("ngClass",t.align),e.yG2(),e.E7m("ngIf",a.customComponents.get(t.id))("ngIfElse",o)}}function sr(r,n){if(1&r&&(e.I0R(0,"tr"),e.yuY(1,tr,2,3,"td",43)(2,dr,5,5,"td",44),e.wR5(3,"td"),e.C$Y()),2&r){const t=n.index,o=e.GaO();e.yG2(),e.E7m("ngIf",o.selectionManager),e.yG2(),e.E7m("ngForOf",o.visibleSortedColumns),e.yG2(),e.eAK("active",o.activeIndex===t)}}function cr(r,n){if(1&r&&(e.I0R(0,"tr")(1,"td"),e.wR5(2,"vdr-empty-placeholder",50),e.wVc(3,"translate"),e.C$Y()()),2&r){const t=e.GaO();e.yG2(),e.e48("colspan",t.visibleSortedColumns.length+(t.selectionManager?2:1)),e.yG2(),e.E7m("emptyStateLabel",e.kDX(3,2,"order.order-is-empty"))}}function mr(r,n){if(1&r&&(e.I0R(0,"tr",51)(1,"td",52),e.OEk(2),e.C$Y(),e.I0R(3,"td",53),e.OEk(4),e.C$Y(),e.wR5(5,"td",54),e.I0R(6,"td",55),e.OEk(7),e.wVc(8,"localeCurrency"),e.I0R(9,"div",14),e.wVc(10,"translate"),e.OEk(11),e.wVc(12,"localeCurrency"),e.C$Y()(),e.wR5(13,"td"),e.C$Y()),2&r){const t=n.$implicit,o=e.GaO();e.yG2(2),e.cNF(t.description),e.yG2(2),e.cNF(t.sku),e.yG2(),e.e48("colspan",o.visibleSortedColumns.length-4),e.yG2(2),e.oRS(" ",e.g7$(8,6,t.priceWithTax,o.order.currencyCode)," "),e.yG2(2),e.E7m("title",e.kDX(10,9,"order.net-price")),e.yG2(2),e.oRS(" ",e.g7$(12,11,t.price,o.order.currencyCode)," ")}}function ur(r,n){if(1&r&&(e.I0R(0,"vdr-chip"),e.OEk(1),e.C$Y()),2&r){const t=n.ngIf;e.yG2(),e.cNF(t)}}function _r(r,n){if(1&r&&(e.I0R(0,"tr",57)(1,"td",2)(2,"a",58),e.OEk(3),e.C$Y(),e.yuY(4,ur,2,1,"vdr-chip",8),e.C$Y(),e.I0R(5,"td",2),e.OEk(6),e.wVc(7,"localeCurrency"),e.I0R(8,"div",14),e.wVc(9,"translate"),e.OEk(10),e.wVc(11,"localeCurrency"),e.C$Y()(),e.wR5(12,"td"),e.C$Y()),2&r){const t=e.GaO().$implicit,o=e.GaO();e.yG2(),e.e48("colspan",o.visibleSortedColumns.length-1),e.yG2(),e.E7m("routerLink",o.getPromotionLink(t)),e.yG2(),e.cNF(t.description),e.yG2(),e.E7m("ngIf",o.getCouponCodeForAdjustment(o.order,t)),e.yG2(2),e.oRS(" ",e.g7$(7,7,t.amountWithTax,o.order.currencyCode)," "),e.yG2(2),e.E7m("title",e.kDX(9,10,"order.net-price")),e.yG2(2),e.oRS(" ",e.g7$(11,12,t.amount,o.order.currencyCode)," ")}}function pr(r,n){if(1&r&&(e.SAx(0),e.yuY(1,_r,13,15,"tr",56),e.k70()),2&r){const t=n.$implicit;e.yG2(),e.E7m("ngIf","OTHER"!==t.type)}}function fr(r,n){if(1&r&&(e.I0R(0,"vdr-chip",59),e.OEk(1),e.C$Y()),2&r){const t=n.$implicit;e.yG2(),e.oRS(" ",t.shippingMethod.name," ")}}const gr=[[["vdr-bulk-action-menu"]]],yr=(r,n,t,o)=>({id:r,itemsPerPage:n,currentPage:t,totalItems:o}),Cr=["vdr-bulk-action-menu"];class Z extends d.qu{get allColumns(){return[...this.columns??[],...this.customFieldColumns??[],...this.totalColumns??[]]}get sortedColumns(){const n=this.allColumns,t=this.getDataTableConfig();for(const[o,i]of Object.entries(t[this.id].order)){const a=n.find(y=>y.id===o),c=n.findIndex(y=>y.id===o);-1!==c&&a&&(n.splice(c,1),n.splice(i,0,a))}return n}getPromotionLink(n){return["/marketing","promotions",n.adjustmentSource.split(":")[1]]}getCouponCodeForAdjustment(n,t){const o=t.adjustmentSource.split(":")[1],i=n.promotions.find(a=>a.id===o);if(i)return i.couponCode||void 0}getShippingNames(n){return n.shippingLines.length?n.shippingLines.map(t=>t.shippingMethod.name).join(", "):""}static#e=this.\u0275fac=(()=>{let n;return function(o){return(n||(n=e.otF(Z)))(o||Z)}})();static#t=this.\u0275cmp=e.In1({type:Z,selectors:[["vdr-order-data-table"]],contentQueries:function(t,o,i){if(1&t&&e.szK(i,N,4),2&t){let a;e.wto(a=e.Gqi())&&(o.totalColumns=a)}},inputs:{order:"order"},features:[e.eg9],ngContentSelectors:Cr,decls:60,vars:70,consts:[[1,"bulk-actions"],[1,"table-wrapper"],[1,""],[1,"heading-row"],["class","selection-col",4,"ngIf"],[3,"expand",4,"ngFor","ngForOf"],[1,"column-picker"],[3,"uiLanguage","columns","reorder","resetColumns"],[4,"ngIf"],[4,"ngFor","ngForOf","ngForTrackBy"],["class","surcharge",4,"ngFor","ngForOf"],[4,"ngFor","ngForOf"],[1,"sub-total"],[1,"clr-align-middle"],[1,"net-price",3,"title"],[1,"shipping"],["class","shipping-method-name",4,"ngFor","ngForOf"],[1,"total"],[1,"selection-col"],["type","checkbox","clrCheckbox","",3,"checked","change"],[1,"cell-content",3,"ngClass"],["api","dataTable","display","block",3,"locationId","metadata","topPx","leftPx"],["class","sort-toggle",4,"ngIf"],[1,"sort-toggle"],[3,"click"],["shape","two-way-arrows left",4,"ngIf"],["shape","arrow up",4,"ngIf"],["shape","arrow down",4,"ngIf"],["class","sort-label",4,"ngIf"],["shape","two-way-arrows left"],["shape","arrow up"],["shape","arrow down"],[1,"sort-label"],[1,"filter-row"],[1,"button-ghost","toggle-search-filter-row",3,"title","click"],["shape","search"],[1,"filter-row-wrapper"],[4,"ngTemplateOutlet"],[1,"filters"],["class","mt-1",3,"filterWithValue","filters",4,"ngFor","ngForOf"],["class","mt-1",3,"filters",4,"ngIf"],[1,"mt-1",3,"filterWithValue","filters"],[1,"mt-1",3,"filters"],["class","selection-col",3,"active",4,"ngIf"],[3,"active",4,"ngFor","ngForOf"],["type","checkbox","clrCheckbox","",3,"checked","click"],[4,"ngIf","ngIfElse"],["defaultComponent",""],[4,"ngComponentOutlet","ngComponentOutletInputs","ngComponentOutletInjector"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],[3,"emptyStateLabel"],[1,"surcharge"],["colspan","2",1,"align-middle","name","left"],[1,"align-middle","sku"],[1,"align-middle"],[1,"align-middle","total"],["class","order-adjustment",4,"ngIf"],[1,"order-adjustment"],[3,"routerLink"],[1,"shipping-method-name"]],template:function(t,o){1&t&&(e.kPM(gr),e.I0R(0,"div",0),e._Xx(1),e.C$Y(),e.I0R(2,"div",1)(3,"table",2)(4,"thead")(5,"tr",3),e.yuY(6,Ln,2,1,"th",4)(7,Jn,6,9,"th",5),e.I0R(8,"th")(9,"div",6)(10,"vdr-data-table-colum-picker",7),e.qCj("reorder",function(a){return o.onColumnReorder(a)})("resetColumns",function(){return o.onColumnsReset()}),e.wVc(11,"async"),e.C$Y()()()(),e.yuY(12,er,9,13,"tr",8),e.C$Y(),e.I0R(13,"tbody"),e.yuY(14,sr,4,4,"tr",9),e.wVc(15,"paginate"),e.SAx(16),e.yuY(17,cr,4,4,"tr",8),e.k70(),e.yuY(18,mr,14,14,"tr",10)(19,pr,2,1,"ng-container",11),e.I0R(20,"tr",12)(21,"td",2),e.OEk(22),e.wVc(23,"translate"),e.C$Y(),e.wR5(24,"td"),e.I0R(25,"td",13),e.OEk(26),e.wVc(27,"localeCurrency"),e.I0R(28,"div",14),e.wVc(29,"translate"),e.OEk(30),e.wVc(31,"localeCurrency"),e.C$Y()(),e.wR5(32,"td"),e.C$Y(),e.I0R(33,"tr",15)(34,"td",2),e.OEk(35),e.wVc(36,"translate"),e.C$Y(),e.I0R(37,"td"),e.yuY(38,fr,2,1,"vdr-chip",16),e.C$Y(),e.I0R(39,"td",13),e.OEk(40),e.wVc(41,"localeCurrency"),e.I0R(42,"div",14),e.wVc(43,"translate"),e.OEk(44),e.wVc(45,"localeCurrency"),e.C$Y()(),e.wR5(46,"td"),e.C$Y(),e.I0R(47,"tr",17)(48,"td",2),e.OEk(49),e.wVc(50,"translate"),e.C$Y(),e.wR5(51,"td"),e.I0R(52,"td",13),e.OEk(53),e.wVc(54,"localeCurrency"),e.I0R(55,"div",14),e.wVc(56,"translate"),e.OEk(57),e.wVc(58,"localeCurrency"),e.C$Y()(),e.wR5(59,"td"),e.C$Y()()()()),2&t&&(e.yG2(3),e.eAK("no-select",o.disableSelect),e.yG2(),e.eAK("items-selected",null==o.selectionManager?null:o.selectionManager.selection.length),e.yG2(2),e.E7m("ngIf",o.selectionManager),e.yG2(),e.E7m("ngForOf",o.visibleSortedColumns),e.yG2(3),e.E7m("uiLanguage",e.kDX(11,30,o.uiLanguage$))("columns",o.sortedColumns),e.yG2(2),e.E7m("ngIf",o.searchComponent||o.customSearchTemplate||(null==o.filters?null:o.filters.length)),e.yG2(2),e.E7m("ngForOf",e.g7$(15,32,o.items,e.WuN(65,yr,o.id,o.itemsPerPage,o.currentPage,o.totalItems)))("ngForTrackBy",o.trackByFn),e.yG2(3),e.E7m("ngIf",!(null!=o.items&&o.items.length)),e.yG2(),e.E7m("ngForOf",o.order.surcharges),e.yG2(),e.E7m("ngForOf",o.order.discounts),e.yG2(3),e.cNF(e.kDX(23,35,"order.sub-total")),e.yG2(2),e.e48("colspan",o.visibleSortedColumns.length-2),e.yG2(2),e.oRS(" ",e.g7$(27,37,o.order.subTotalWithTax,o.order.currencyCode)," "),e.yG2(2),e.E7m("title",e.kDX(29,40,"order.net-price")),e.yG2(2),e.oRS(" ",e.g7$(31,42,o.order.subTotal,o.order.currencyCode)," "),e.yG2(5),e.cNF(e.kDX(36,45,"order.shipping")),e.yG2(2),e.e48("colspan",o.visibleSortedColumns.length-2),e.yG2(),e.E7m("ngForOf",o.order.shippingLines),e.yG2(2),e.oRS(" ",e.g7$(41,47,o.order.shippingWithTax,o.order.currencyCode)," "),e.yG2(2),e.E7m("title",e.kDX(43,50,"order.net-price")),e.yG2(2),e.oRS(" ",e.g7$(45,52,o.order.shipping,o.order.currencyCode)," "),e.yG2(5),e.cNF(e.kDX(50,55,"order.total")),e.yG2(2),e.e48("colspan",o.visibleSortedColumns.length-2),e.yG2(2),e.oRS(" ",e.g7$(54,57,o.order.totalWithTax,o.order.currencyCode)," "),e.yG2(2),e.E7m("title",e.kDX(56,60,"order.net-price")),e.yG2(2),e.oRS(" ",e.g7$(58,62,o.order.total,o.order.currencyCode)," "))},dependencies:[_.o3d,_.y6l,m.QF,m.ov,m.ay,m.u_,m.XV,k.ER,D.g,C.w,Pn.A,An.K,Vn.Q,Nn.E,m.a,Xn.as,p.sD,g.u],styles:["[_nghost-%COMP%]{display:block;max-width:100%;position:relative;margin-bottom:calc(var(--space-unit) * 4);container-type:inline-size}th[_ngcontent-%COMP%]{border-bottom:1px solid var(--color-table-header-border);color:var(--color-weight-700);font-size:var(--font-size-xs);font-weight:600;text-transform:uppercase;position:relative;white-space:nowrap;background-color:transparent}th[_ngcontent-%COMP%], td[_ngcontent-%COMP%]{padding:calc(var(--space-unit) * 1.5) calc(var(--space-unit) * 1);color:var(--color-text-100)}tr[_ngcontent-%COMP%] td[_ngcontent-%COMP%]:first-of-type, tr[_ngcontent-%COMP%] th[_ngcontent-%COMP%]:first-of-type{text-align:center}@media screen and (min-width: 992px){tr[_ngcontent-%COMP%] td[_ngcontent-%COMP%]:first-of-type, tr[_ngcontent-%COMP%] th[_ngcontent-%COMP%]:first-of-type{padding-inline-start:var(--surface-margin-left);text-align:start}}th[_ngcontent-%COMP%]:last-of-type, td[_ngcontent-%COMP%]:last-of-type{border-inline-end:1px solid var(--color-table-header-border)}tr[_ngcontent-%COMP%]:first-of-type th[_ngcontent-%COMP%]:last-of-type{border-image:linear-gradient(0deg,var(--color-table-header-border),transparent) 1}tr[_ngcontent-%COMP%]:last-of-type td[_ngcontent-%COMP%]:last-of-type{border-image:linear-gradient(180deg,var(--color-table-header-border),transparent) 1}tbody[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{border-bottom:1px solid var(--color-table-row-separator)}tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:hover{background-color:var(--color-table-row-hover-bg)}.bulk-actions[_ngcontent-%COMP%]{margin-inline-start:calc(var(--space-unit) * 5);background-color:var(--color-surface-bg);z-index:10;display:flex;position:absolute;top:5px;height:40px}@media screen and (min-width: 992px){.bulk-actions[_ngcontent-%COMP%]{margin-inline-start:calc(var(--space-unit) * 8.5)}}@media screen and (min-width: 1280px){.bulk-actions[_ngcontent-%COMP%]{margin-inline-start:calc(var(--space-unit) * 10.5)}}.table-wrapper[_ngcontent-%COMP%]{display:block;overflow-y:hidden;overflow-x:auto;position:relative;width:100%;max-width:var(--surface-width)}table[_ngcontent-%COMP%]{width:100%}table.no-select[_ngcontent-%COMP%]{-webkit-user-select:none;user-select:none}.column-picker[_ngcontent-%COMP%]{width:24px}.sort-toggle[_ngcontent-%COMP%]{display:flex;align-items:center;margin-inline-start:calc(var(--space-unit) * .5)}.sort-toggle[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{border:0;border-radius:var(--border-radius-lg);color:var(--color-weight-500);padding:0 2px;cursor:pointer;background-color:transparent}.sort-toggle[_ngcontent-%COMP%] button.active[_ngcontent-%COMP%]{color:var(--color-primary-700)}.sort-toggle[_ngcontent-%COMP%] .sort-label[_ngcontent-%COMP%]{margin-inline-start:calc(var(--space-unit) * .5);font-size:10px;color:var(--color-primary-600);font-weight:400}.toggle-search-filter-row[_ngcontent-%COMP%]{position:absolute;top:-12px;left:4px}@media screen and (min-width: 1280px){.toggle-search-filter-row[_ngcontent-%COMP%]{left:8px}}.toggle-search-filter-row.active[_ngcontent-%COMP%]{background-color:var(--color-primary-700);color:var(--color-primary-100);border-color:var(--color-primary-700)}th.filter-row[_ngcontent-%COMP%]{position:relative;font-size:var(--font-size-base);font-weight:400;background-color:var(--color-weight-100);box-shadow:var(--data-table-filter-box-shadow);border-left-width:0;border-right-width:0;text-align:initial;padding:0}th.filter-row[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{width:100%}th.filter-row.active[_ngcontent-%COMP%]{border-bottom:1px solid var(--color-table-header-border)}th.filter-row[_ngcontent-%COMP%] .filters[_ngcontent-%COMP%]{margin-top:calc(var(--space-unit) * 1);display:flex;flex-wrap:wrap;gap:calc(var(--space-unit) * .5)}.filter-row-wrapper[_ngcontent-%COMP%]{padding:calc(var(--space-unit) * 4);padding-inline-start:0;max-height:150px;transition:max-height .2s,padding .2s,opacity .2s}.filter-row-wrapper.hidden[_ngcontent-%COMP%]{max-height:0px;padding-top:0;padding-bottom:0;overflow:hidden;opacity:0}.cell-link[_ngcontent-%COMP%]{display:block;width:100%;height:100%}td.active[_ngcontent-%COMP%]{background-color:var(--color-table-row-active-bg)}.cell-content[_ngcontent-%COMP%]{display:flex;align-items:center;line-height:var(--font-size-sm);color:var(--color-weight-700)}.cell-content.left[_ngcontent-%COMP%]{justify-content:flex-start}.cell-content.center[_ngcontent-%COMP%]{justify-content:center}.cell-content.right[_ngcontent-%COMP%]{justify-content:flex-end}.selection-col[_ngcontent-%COMP%]{width:calc(var(--space-unit) * 8)}vdr-empty-placeholder[_ngcontent-%COMP%]{width:100%}.table-footer[_ngcontent-%COMP%]{display:flex;align-items:baseline;justify-content:space-between;margin-top:var(--space-unit);margin-inline-start:var(--surface-margin-left);margin-inline-end:var(--space-unit)}.total-items-count[_ngcontent-%COMP%]{font-size:var(--font-size-xs)}@container (max-width: 500px){.total-items-count[_ngcontent-%COMP%]{display:none}}","[_nghost-%COMP%] .is-cancelled[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{text-decoration:line-through;background-color:var(--color-component-bg-200)}[_nghost-%COMP%] .sub-total[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{border-top:1px dashed var(--color-component-border-200)}[_nghost-%COMP%] .total[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{font-weight:700;border-top:1px dashed var(--color-component-border-200)}[_nghost-%COMP%] td.custom-fields-row[_ngcontent-%COMP%]{border-top-style:dashed;border-top-color:var(--color-grey-200)}[_nghost-%COMP%] img[_ngcontent-%COMP%]{border-radius:var(--border-radius-img)}[_nghost-%COMP%] .order-line-custom-fields[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap}[_nghost-%COMP%] .order-line-custom-fields[_ngcontent-%COMP%] .custom-field[_ngcontent-%COMP%]{text-align:start;max-width:200px;overflow:hidden;text-overflow:ellipsis;margin-bottom:6px;margin-inline-end:18px}[_nghost-%COMP%] .draft-qty[_ngcontent-%COMP%]{max-width:48px}[_nghost-%COMP%] .order-line-custom-field[_ngcontent-%COMP%]{background-color:var(--color-component-bg-100)}[_nghost-%COMP%] .order-line-custom-field[_ngcontent-%COMP%] .custom-field-ellipsis[_ngcontent-%COMP%]{color:var(--color-text-300)}[_nghost-%COMP%] .net-price[_ngcontent-%COMP%]{font-size:11px;color:var(--color-text-300);line-height:14px}[_nghost-%COMP%] .promotions-label[_ngcontent-%COMP%]{-webkit-text-decoration:underline dotted var(--color-text-200);text-decoration:underline dotted var(--color-text-200);font-size:11px;margin-top:6px;cursor:pointer;text-transform:lowercase}[_nghost-%COMP%] .thumb[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:50px;height:50px}[_nghost-%COMP%] .shipping-method-name[_ngcontent-%COMP%]{font-size:var(--font-size-xs);margin-inline-end:2px}[_nghost-%COMP%] .order-placed-quantity[_ngcontent-%COMP%]{text-decoration:line-through;color:var(--color-text-300);margin-inline-end:2px}"],changeDetection:0})}function hr(r,n){if(1&r&&e.OEk(0),2&r){const t=n.item;e.oRS(" ",t.id," ")}}function Or(r,n){if(1&r&&(e.OEk(0),e.wVc(1,"localeDate")),2&r){const t=n.item;e.oRS(" ",e.g7$(1,1,t.createdAt,"short")," ")}}function vr(r,n){if(1&r&&(e.OEk(0),e.wVc(1,"localeDate")),2&r){const t=n.item;e.oRS(" ",e.g7$(1,1,t.updatedAt,"short")," ")}}function br(r,n){if(1&r&&(e.wR5(0,"img",14),e.wVc(1,"assetPreview")),2&r){const t=n.ngIf;e.E7m("src",e.g7$(1,1,t,"tiny"),e.K6U)}}function Ir(r,n){1&r&&(e.I0R(0,"div",15),e.wR5(1,"clr-icon",16),e.C$Y())}function Gr(r,n){if(1&r&&(e.I0R(0,"div",11),e.yuY(1,br,2,4,"img",12)(2,Ir,2,0,"ng-template",null,13,e.gJz),e.C$Y()),2&r){const t=n.item,o=e.Gew(3);e.yG2(),e.E7m("ngIf",t.featuredAsset)("ngIfElse",o)}}function Er(r,n){if(1&r&&e.OEk(0),2&r){const t=n.item;e.oRS(" ",t.productVariant.name," ")}}function Rr(r,n){if(1&r&&e.OEk(0),2&r){const t=n.item;e.oRS(" ",t.productVariant.sku," ")}}function kr(r,n){if(1&r&&(e.I0R(0,"div",17),e.OEk(1),e.wVc(2,"localeCurrency"),e.I0R(3,"div",18),e.wVc(4,"translate"),e.OEk(5),e.wVc(6,"localeCurrency"),e.C$Y()()),2&r){const t=n.item,o=e.GaO();e.yG2(),e.oRS(" ",e.g7$(2,3,t.unitPriceWithTax,o.order.currencyCode)," "),e.yG2(2),e.E7m("title",e.kDX(4,6,"order.net-price")),e.yG2(2),e.oRS(" ",e.g7$(6,8,t.unitPrice,o.order.currencyCode)," ")}}function wr(r,n){if(1&r&&(e.I0R(0,"div",25),e.wVc(1,"translate"),e.OEk(2),e.C$Y()),2&r){const t=e.GaO(2).item;e.E7m("title",e.kDX(1,2,"order.original-quantity-at-checkout")),e.yG2(2),e.oRS(" ",t.orderPlacedQuantity," ")}}function Tr(r,n){if(1&r&&(e.SAx(0),e.I0R(1,"div",23),e.yuY(2,wr,3,4,"div",24),e.I0R(3,"div"),e.OEk(4),e.C$Y()(),e.k70()),2&r){const t=e.GaO().item;e.yG2(2),e.E7m("ngIf",t.orderPlacedQuantity&&t.quantity!==t.orderPlacedQuantity),e.yG2(2),e.cNF(t.quantity)}}function Sr(r,n){if(1&r){const t=e.KQA();e.I0R(0,"div",23)(1,"input",26,27),e.qCj("blur",function(){e.usT(t);const i=e.Gew(2),a=e.GaO().item,c=e.GaO();return e.CGJ(c.draftInputBlur(a,i.valueAsNumber))}),e.C$Y(),e.I0R(3,"button",28),e.qCj("click",function(){e.usT(t);const i=e.GaO().item,a=e.GaO();return e.CGJ(a.remove.emit({lineId:i.id}))}),e.wR5(4,"clr-icon",29),e.C$Y()()}if(2&r){const t=e.GaO().item;e.yG2(),e.E7m("value",t.quantity)}}function Dr(r,n){if(1&r&&(e.yuY(0,Tr,5,2,"ng-container",19)(1,Sr,5,1,"ng-template",null,20,e.gJz),e.wR5(3,"vdr-line-refunds",21)(4,"vdr-line-fulfillment",22)),2&r){const t=n.item,o=e.Gew(2),i=e.GaO();e.E7m("ngIf",!i.isDraft)("ngIfElse",o),e.yG2(3),e.E7m("line",t)("payments",i.order.payments),e.yG2(),e.E7m("line",t)("orderState",i.order.state)("allOrderFulfillments",i.order.fulfillments)}}function xr(r,n){if(1&r&&e.wR5(0,"vdr-dt2-custom-field-column",30),2&r){const t=n.$implicit;e.E7m("customField",t)}}function Fr(r,n){if(1&r&&(e.I0R(0,"div",34)(1,"a",35),e.OEk(2),e.C$Y(),e.I0R(3,"div",36),e.OEk(4),e.wVc(5,"localeCurrency"),e.I0R(6,"div",18),e.wVc(7,"translate"),e.OEk(8),e.wVc(9,"localeCurrency"),e.C$Y()()()),2&r){const t=n.$implicit,o=e.GaO(4);e.yG2(),e.E7m("routerLink",o.getPromotionLink(t)),e.yG2(),e.cNF(t.description),e.yG2(2),e.oRS(" ",e.g7$(5,5,t.amountWithTax,o.order.currencyCode)," "),e.yG2(2),e.E7m("title",e.kDX(7,8,"order.net-price")),e.yG2(2),e.oRS(" ",e.g7$(9,10,t.amount,o.order.currencyCode)," ")}}function $r(r,n){if(1&r&&(e.I0R(0,"vdr-dropdown")(1,"div",32),e.OEk(2),e.wVc(3,"translate"),e.C$Y(),e.I0R(4,"vdr-dropdown-menu"),e.yuY(5,Fr,10,13,"div",33),e.C$Y()()),2&r){const t=e.GaO().ngIf;e.yG2(2),e.oRS(" ",e.kDX(3,2,"order.promotions-applied")," "),e.yG2(3),e.E7m("ngForOf",t)}}function Mr(r,n){if(1&r&&(e.SAx(0),e.yuY(1,$r,6,4,"vdr-dropdown",31),e.k70()),2&r){const t=n.ngIf;e.yG2(),e.E7m("ngIf",t.length)}}function Yr(r,n){if(1&r&&(e.I0R(0,"div",17),e.OEk(1),e.wVc(2,"localeCurrency"),e.I0R(3,"div",18),e.wVc(4,"translate"),e.OEk(5),e.wVc(6,"localeCurrency"),e.C$Y()(),e.yuY(7,Mr,2,1,"ng-container",31)),2&r){const t=n.item,o=e.GaO();e.yG2(),e.oRS(" ",e.g7$(2,4,t.linePriceWithTax,o.order.currencyCode)," "),e.yG2(2),e.E7m("title",e.kDX(4,7,"order.net-price")),e.yG2(2),e.oRS(" ",e.g7$(6,9,t.linePrice,o.order.currencyCode)," "),e.yG2(2),e.E7m("ngIf",o.getLineDiscounts(t))}}class X{constructor(){this.isDraft=!1,this.adjust=new e._w7,this.remove=new e._w7,this.orderLineCustomFieldsVisible=!1,this.customFieldsForLine={}}get visibleOrderLineCustomFields(){return this.orderLineCustomFieldsVisible?this.orderLineCustomFields:[]}get showElided(){return!this.orderLineCustomFieldsVisible&&0<this.orderLineCustomFields.length}ngOnInit(){this.orderLineCustomFieldsVisible=this.orderLineCustomFields.length<2,this.getLineCustomFields()}draftInputBlur(n,t){n.quantity!==t&&this.adjust.emit({lineId:n.id,quantity:t})}toggleOrderLineCustomFields(){this.orderLineCustomFieldsVisible=!this.orderLineCustomFieldsVisible}getLineDiscounts(n){return n.discounts.filter(t=>t.type===d.yKQ.PROMOTION)}getLineCustomFields(){for(const n of this.order.lines){const t=new l.k1({}),o=this.orderLineCustomFields.map(i=>{const a=n.customFields[i.name];return t.addControl(i.name,new l.yM(a)),{config:i,formGroup:t,value:a}}).filter(i=>!!this.orderLineCustomFieldsVisible||null!=i.value);this.customFieldsForLine[n.id]=o}}getPromotionLink(n){return["/marketing","promotions",n.adjustmentSource.split(":")[1]]}getCouponCodeForAdjustment(n,t){const o=t.adjustmentSource.split(":")[1],i=n.promotions.find(a=>a.id===o);if(i)return i.couponCode||void 0}getShippingNames(n){return n.shippingLines.length?n.shippingLines.map(t=>t.shippingMethod.name).join(", "):""}static#e=this.\u0275fac=function(t){return new(t||X)};static#t=this.\u0275cmp=e.In1({type:X,selectors:[["vdr-order-table"]],inputs:{order:"order",orderLineCustomFields:"orderLineCustomFields",isDraft:"isDraft"},outputs:{adjust:"adjust",remove:"remove"},decls:29,vars:36,consts:[["id","order-detail-list",3,"items","order"],["id","id",3,"heading","hiddenByDefault"],["id","created-at",3,"heading","hiddenByDefault"],["id","updated-at",3,"heading","hiddenByDefault"],["id","image",3,"heading"],["id","product-name",3,"heading"],["id","product-sku",3,"heading","optional"],["id","unit-price",3,"heading"],["id","quantity",3,"heading","optional"],[3,"customField",4,"ngFor","ngForOf"],["id","total",3,"heading","optional"],[1,"image-placeholder"],[3,"src",4,"ngIf","ngIfElse"],["imagePlaceholder",""],[3,"src"],[1,"placeholder"],["shape","image","size","48"],[1,"unit-price"],[1,"net-price",3,"title"],[4,"ngIf","ngIfElse"],["draft",""],[3,"line","payments"],[3,"line","orderState","allOrderFulfillments"],[1,"flex"],["class","order-placed-quantity",3,"title",4,"ngIf"],[1,"order-placed-quantity",3,"title"],["type","number","min","0",1,"draft-qty",3,"value","blur"],["qtyInput",""],[1,"icon-button",3,"click"],["shape","trash"],[3,"customField"],[4,"ngIf"],["vdrDropdownTrigger","",1,"promotions-label"],["class","line-promotion",4,"ngFor","ngForOf"],[1,"line-promotion"],[1,"promotion-name",3,"routerLink"],[1,"promotion-amount"]],template:function(t,o){1&t&&(e.I0R(0,"vdr-order-data-table",0)(1,"vdr-dt2-column",1),e.wVc(2,"translate"),e.yuY(3,hr,1,1,"ng-template"),e.C$Y(),e.I0R(4,"vdr-dt2-column",2),e.wVc(5,"translate"),e.yuY(6,Or,2,4,"ng-template"),e.C$Y(),e.I0R(7,"vdr-dt2-column",3),e.wVc(8,"translate"),e.yuY(9,vr,2,4,"ng-template"),e.C$Y(),e.I0R(10,"vdr-dt2-column",4),e.wVc(11,"translate"),e.yuY(12,Gr,4,2,"ng-template"),e.C$Y(),e.I0R(13,"vdr-dt2-column",5),e.wVc(14,"translate"),e.yuY(15,Er,1,1,"ng-template"),e.C$Y(),e.I0R(16,"vdr-dt2-column",6),e.wVc(17,"translate"),e.yuY(18,Rr,1,1,"ng-template"),e.C$Y(),e.I0R(19,"vdr-dt2-column",7),e.wVc(20,"translate"),e.yuY(21,kr,7,11,"ng-template"),e.C$Y(),e.I0R(22,"vdr-dt2-column",8),e.wVc(23,"translate"),e.yuY(24,Dr,5,7,"ng-template"),e.C$Y(),e.yuY(25,xr,1,1,"vdr-dt2-custom-field-column",9),e.I0R(26,"vdr-order-total-column",10),e.wVc(27,"translate"),e.yuY(28,Yr,8,12,"ng-template"),e.C$Y()()),2&t&&(e.E7m("items",o.order.lines)("order",o.order),e.yG2(),e.E7m("heading",e.kDX(2,18,"common.id"))("hiddenByDefault",!0),e.yG2(3),e.E7m("heading",e.kDX(5,20,"common.created-at"))("hiddenByDefault",!0),e.yG2(3),e.E7m("heading",e.kDX(8,22,"common.updated-at"))("hiddenByDefault",!0),e.yG2(3),e.E7m("heading",e.kDX(11,24,"common.image")),e.yG2(3),e.E7m("heading",e.kDX(14,26,"order.product-name")),e.yG2(3),e.E7m("heading",e.kDX(17,28,"order.product-sku"))("optional",!1),e.yG2(3),e.E7m("heading",e.kDX(20,30,"order.unit-price")),e.yG2(3),e.E7m("heading",e.kDX(23,32,"order.quantity"))("optional",!1),e.yG2(3),e.E7m("ngForOf",o.orderLineCustomFields),e.yG2(),e.E7m("heading",e.kDX(27,34,"order.total"))("optional",!1))},dependencies:[_.o3d,m.ay,m.u_,k.ER,C.w,B.i,W.m,U.q,Pe.M,mt.K,z,V,Z,N,p.sD,j.w,A.m,g.u],styles:["[_nghost-%COMP%] .is-cancelled[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{text-decoration:line-through;background-color:var(--color-component-bg-200)}[_nghost-%COMP%] .sub-total[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{border-top:1px dashed var(--color-component-border-200)}[_nghost-%COMP%] .total[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{font-weight:700;border-top:1px dashed var(--color-component-border-200)}[_nghost-%COMP%] td.custom-fields-row[_ngcontent-%COMP%]{border-top-style:dashed;border-top-color:var(--color-grey-200)}[_nghost-%COMP%] img[_ngcontent-%COMP%]{border-radius:var(--border-radius-img)}[_nghost-%COMP%] .order-line-custom-fields[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap}[_nghost-%COMP%] .order-line-custom-fields[_ngcontent-%COMP%] .custom-field[_ngcontent-%COMP%]{text-align:start;max-width:200px;overflow:hidden;text-overflow:ellipsis;margin-bottom:6px;margin-inline-end:18px}[_nghost-%COMP%] .draft-qty[_ngcontent-%COMP%]{max-width:48px}[_nghost-%COMP%] .order-line-custom-field[_ngcontent-%COMP%]{background-color:var(--color-component-bg-100)}[_nghost-%COMP%] .order-line-custom-field[_ngcontent-%COMP%] .custom-field-ellipsis[_ngcontent-%COMP%]{color:var(--color-text-300)}[_nghost-%COMP%] .net-price[_ngcontent-%COMP%]{font-size:11px;color:var(--color-text-300);line-height:14px}[_nghost-%COMP%] .promotions-label[_ngcontent-%COMP%]{-webkit-text-decoration:underline dotted var(--color-text-200);text-decoration:underline dotted var(--color-text-200);font-size:11px;margin-top:6px;cursor:pointer;text-transform:lowercase}[_nghost-%COMP%] .thumb[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:50px;height:50px}[_nghost-%COMP%] .shipping-method-name[_ngcontent-%COMP%]{font-size:var(--font-size-xs);margin-inline-end:2px}[_nghost-%COMP%] .order-placed-quantity[_ngcontent-%COMP%]{text-decoration:line-through;color:var(--color-text-300);margin-inline-end:2px} .line-promotion{display:flex;justify-content:space-between;padding:6px 12px} .line-promotion .promotion-amount{margin-inline-start:12px} .line-promotion .net-price{font-size:11px;color:var(--color-text-300)}"],changeDetection:0})}var qe=s(1488),_t=s(5388);function Pr(r,n){if(1&r&&(e.I0R(0,"div",16),e.wR5(1,"vdr-custom-field-control",17),e.C$Y()),2&r){const t=n.$implicit,o=e.GaO(3);e.yG2(),e.E7m("compact",!0)("readonly",!1)("customField",t)("customFieldsFormGroup",o.customFieldsFormGroup)}}function Ar(r,n){if(1&r&&(e.SAx(0),e.yuY(1,Pr,2,4,"div",15),e.k70()),2&r){const t=e.GaO(2);e.yG2(),e.E7m("ngForOf",t.orderLineCustomFields)}}function Vr(r,n){if(1&r){const t=e.KQA();e.I0R(0,"div",1)(1,"div",5),e.wR5(2,"img",6),e.wVc(3,"assetPreview"),e.I0R(4,"div",7)(5,"div"),e.OEk(6),e.C$Y(),e.I0R(7,"div",8),e.OEk(8),e.C$Y()(),e.I0R(9,"div",9)(10,"div",8),e.OEk(11),e.wVc(12,"translate"),e.C$Y(),e.I0R(13,"div",8),e.OEk(14),e.wVc(15,"translate"),e.C$Y()(),e.wR5(16,"div",10),e.I0R(17,"div",7)(18,"div"),e.OEk(19),e.wVc(20,"localeCurrency"),e.C$Y(),e.I0R(21,"div",11),e.wVc(22,"translate"),e.OEk(23),e.wVc(24,"localeCurrency"),e.C$Y()(),e.I0R(25,"div")(26,"input",12),e.iHE("ngModelChange",function(i){e.usT(t);const a=e.GaO();return e.kNx(a.quantity,i)||(a.quantity=i),e.CGJ(i)}),e.C$Y()(),e.I0R(27,"button",13),e.qCj("click",function(){const a=e.usT(t).ngIf,c=e.GaO();return e.CGJ(c.addItemClick(a))}),e.OEk(28),e.wVc(29,"translate"),e.C$Y()(),e.yuY(30,Ar,2,1,"ng-container",14),e.C$Y()}if(2&r){const t=n.ngIf,o=e.GaO();e.yG2(2),e.E7m("src",e.g7$(3,15,t.featuredAsset||t.product.featuredAsset,32),e.K6U),e.yG2(4),e.cNF(null==t?null:t.name),e.yG2(2),e.cNF(null==t?null:t.sku),e.yG2(3),e.CAO(" ",e.kDX(12,18,"catalog.stock-on-hand"),": ",t.stockOnHand," "),e.yG2(3),e.CAO(" ",e.kDX(15,20,"catalog.stock-allocated"),": ",t.stockAllocated," "),e.yG2(5),e.cNF(e.g7$(20,22,null==t?null:t.priceWithTax,o.currencyCode)),e.yG2(2),e.E7m("title",e.kDX(22,25,"order.net-price")),e.yG2(2),e.oRS(" ",e.g7$(24,27,null==t?null:t.price,o.currencyCode)," "),e.yG2(3),e.E7m("disabled",!t),e.OKB("ngModel",o.quantity),e.yG2(),e.E7m("disabled",!t),e.yG2(),e.oRS(" ",e.kDX(29,30,"order.add-item-to-order")," "),e.yG2(2),e.E7m("ngIf",o.orderLineCustomFields.length)}}class pe{constructor(n){this.dataService=n,this.addItem=new e._w7,this.customFieldsFormGroup=new l.k1({}),this.selectedVariantId$=new Q.E,this.quantity=1}ngOnInit(){this.selectedVariant$=this.selectedVariantId$.pipe((0,f.G)(n=>n?this.dataService.product.getProductVariant(n).mapSingle(({productVariant:t})=>t):[void 0]));for(const n of this.orderLineCustomFields)this.customFieldsFormGroup.addControl(n.name,new l.yM(""))}addItemClick(n){n&&(this.addItem.emit({productVariantId:n.id,quantity:this.quantity,customFields:this.orderLineCustomFields.length?this.customFieldsFormGroup.value:void 0}),this.selectedVariantId$.next(void 0),this.customFieldsFormGroup.reset())}static#e=this.\u0275fac=function(t){return new(t||pe)(e.GI1(d.Aj0))};static#t=this.\u0275cmp=e.In1({type:pe,selectors:[["vdr-draft-order-variant-selector"]],inputs:{currencyCode:"currencyCode",orderLineCustomFields:"orderLineCustomFields"},outputs:{addItem:"addItem"},decls:8,vars:6,consts:[[1,"card"],[1,"card-block"],[1,"card-title"],[3,"productSelected"],["class","card-block",4,"ngIf"],[1,"variant-details"],[1,"mr-2",3,"src"],[1,"details"],[1,"small"],[1,"details","ml-4"],[1,"flex-spacer"],[1,"small",3,"title"],["type","number","min","0",3,"disabled","ngModel","ngModelChange"],[1,"btn","btn-small","btn-primary",3,"disabled","click"],[4,"ngIf"],["class","custom-field",4,"ngFor","ngForOf"],[1,"custom-field"],[3,"compact","readonly","customField","customFieldsFormGroup"]],template:function(t,o){1&t&&(e.I0R(0,"div",0)(1,"div",1)(2,"h4",2),e.OEk(3),e.wVc(4,"translate"),e.C$Y(),e.I0R(5,"vdr-product-variant-selector",3),e.qCj("productSelected",function(a){return o.selectedVariantId$.next(a.productVariantId)}),e.C$Y()(),e.yuY(6,Vr,31,32,"div",4),e.wVc(7,"async"),e.C$Y()),2&t&&(e.yG2(3),e.cNF(e.kDX(4,2,"order.add-item-to-order")),e.yG2(3),e.E7m("ngIf",e.kDX(7,4,o.selectedVariant$)))},dependencies:[m.ay,m.u_,l.ot,l.O4,l.ue,l.Gu,l._G,qe.E,C.w,_t.k,m.a,p.sD,j.w,g.u],styles:[".variant-details[_ngcontent-%COMP%]{display:flex;align-items:center}.variant-details[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{border-radius:var(--border-radius-img);width:32px;height:32px}.variant-details[_ngcontent-%COMP%] .details[_ngcontent-%COMP%]{font-size:.65rem;line-height:.7rem}.variant-details[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{width:48px;margin:0 6px}.variant-details[_ngcontent-%COMP%] .small[_ngcontent-%COMP%]{font-size:11px;color:var(--color-text-300)}"],changeDetection:0})}function Nr(r,n){if(1&r){const t=e.KQA();e.I0R(0,"vdr-action-bar")(1,"vdr-ab-left")(2,"div",1),e.wR5(3,"vdr-order-state-label",2),e.C$Y()(),e.I0R(4,"vdr-ab-right"),e.wR5(5,"vdr-action-bar-items",3),e.I0R(6,"button",4),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.completeOrder())}),e.wR5(7,"clr-icon",5),e.OEk(8),e.wVc(9,"translate"),e.C$Y(),e.I0R(10,"vdr-action-bar-dropdown-menu",6)(11,"button",7),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.deleteOrder())}),e.wR5(12,"clr-icon",8),e.OEk(13),e.wVc(14,"translate"),e.C$Y()()()()}if(2&r){const t=n.ngIf;e.yG2(3),e.E7m("state",t.state),e.yG2(3),e.E7m("disabled",!t.customer||!t.lines.length||!t.shippingLines.length),e.yG2(2),e.oRS(" ",e.kDX(9,5,"order.complete-draft-order")," "),e.yG2(2),e.E7m("alwaysShow",!0),e.yG2(3),e.oRS(" ",e.kDX(14,7,"order.delete-draft-order")," ")}}function Xr(r,n){1&r&&e.wR5(0,"clr-icon",24)}function Lr(r,n){1&r&&e.wR5(0,"clr-icon",25)}function jr(r,n){if(1&r&&e.yuY(0,Xr,1,0,"clr-icon",22)(1,Lr,1,0,"clr-icon",23),2&r){const t=e.GaO().ngIf;e.E7m("ngIf",!t.customer),e.yG2(),e.E7m("ngIf",t.customer)}}function Qr(r,n){if(1&r&&e.wR5(0,"vdr-customer-label",26),2&r){const t=e.GaO().ngIf;e.E7m("customer",t.customer)}}function Kr(r,n){1&r&&e.wR5(0,"clr-icon",24)}function qr(r,n){1&r&&e.wR5(0,"clr-icon",25)}function Hr(r,n){if(1&r&&e.yuY(0,Kr,1,0,"clr-icon",22)(1,qr,1,0,"clr-icon",23),2&r){const t=e.GaO().ngIf;e.E7m("ngIf",!t.billingAddress.streetLine1),e.yG2(),e.E7m("ngIf",t.billingAddress.streetLine1)}}function Jr(r,n){if(1&r&&e.wR5(0,"vdr-formatted-address",27),2&r){const t=e.GaO().ngIf;e.E7m("address",t.billingAddress)}}function Br(r,n){1&r&&e.wR5(0,"clr-icon",24)}function Wr(r,n){1&r&&e.wR5(0,"clr-icon",25)}function Ur(r,n){if(1&r&&e.yuY(0,Br,1,0,"clr-icon",22)(1,Wr,1,0,"clr-icon",23),2&r){const t=e.GaO().ngIf;e.E7m("ngIf",!t.shippingAddress.streetLine1||!t.shippingLines.length),e.yG2(),e.E7m("ngIf",t.shippingAddress.streetLine1&&t.shippingLines.length)}}function zr(r,n){if(1&r&&e.wR5(0,"vdr-formatted-address",27),2&r){const t=e.GaO().ngIf;e.E7m("address",t.shippingAddress)}}function Zr(r,n){if(1&r&&(e.I0R(0,"div"),e.OEk(1),e.C$Y()),2&r){const t=n.$implicit;e.yG2(),e.oRS(" ",t.shippingMethod.name," ")}}function eo(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",12),e.qCj("click",function(){e.usT(t);const i=e.GaO(2);return e.CGJ(i.displayCouponCodeInput=!i.displayCouponCodeInput)}),e.OEk(1),e.wVc(2,"translate"),e.C$Y()}2&r&&(e.yG2(),e.oRS(" ",e.kDX(2,1,"order.set-coupon-codes")," "))}function to(r,n){if(1&r){const t=e.KQA();e.I0R(0,"div")(1,"label"),e.OEk(2),e.wVc(3,"translate"),e.C$Y(),e.I0R(4,"vdr-coupon-code-selector",28),e.qCj("addCouponCode",function(i){e.usT(t);const a=e.GaO(2);return e.CGJ(a.applyCouponCode(i))})("removeCouponCode",function(i){e.usT(t);const a=e.GaO(2);return e.CGJ(a.removeCouponCode(i))}),e.C$Y()()}if(2&r){const t=e.GaO().ngIf;e.yG2(2),e.cNF(e.kDX(3,2,"order.set-coupon-codes")),e.yG2(2),e.E7m("couponCodes",t.couponCodes)}}function no(r,n){if(1&r&&e.wR5(0,"vdr-page-entity-info",29),2&r){const t=n.ngIf;e.E7m("entity",t)}}function ro(r,n){if(1&r&&(e.I0R(0,"tr")(1,"td"),e.OEk(2),e.C$Y(),e.I0R(3,"td"),e.OEk(4),e.wVc(5,"percent"),e.C$Y(),e.I0R(6,"td"),e.OEk(7),e.wVc(8,"localeCurrency"),e.C$Y(),e.I0R(9,"td"),e.OEk(10),e.wVc(11,"localeCurrency"),e.C$Y()()),2&r){const t=n.$implicit,o=e.GaO(2).ngIf;e.yG2(2),e.cNF(t.description),e.yG2(2),e.cNF(e.kDX(5,4,t.taxRate/100)),e.yG2(3),e.cNF(e.g7$(8,6,t.taxBase,o.currencyCode)),e.yG2(3),e.cNF(e.g7$(11,9,t.taxTotal,o.currencyCode))}}function oo(r,n){if(1&r&&(e.SAx(0),e.I0R(1,"table",30)(2,"thead")(3,"tr")(4,"th"),e.OEk(5),e.wVc(6,"translate"),e.C$Y(),e.I0R(7,"th"),e.OEk(8),e.wVc(9,"translate"),e.C$Y(),e.I0R(10,"th"),e.OEk(11),e.wVc(12,"translate"),e.C$Y(),e.I0R(13,"th"),e.OEk(14),e.wVc(15,"translate"),e.C$Y()()(),e.I0R(16,"tbody"),e.yuY(17,ro,12,12,"tr",15),e.C$Y()(),e.k70()),2&r){const t=e.GaO().ngIf;e.yG2(5),e.cNF(e.kDX(6,5,"common.description")),e.yG2(3),e.cNF(e.kDX(9,7,"order.tax-rate")),e.yG2(3),e.cNF(e.kDX(12,9,"order.tax-base")),e.yG2(3),e.cNF(e.kDX(15,11,"order.tax-total")),e.yG2(3),e.E7m("ngForOf",t.taxSummary)}}function io(r,n){if(1&r){const t=e.KQA();e.I0R(0,"vdr-page-detail-layout")(1,"vdr-page-detail-sidebar")(2,"vdr-card",9),e.wVc(3,"translate"),e.yuY(4,jr,2,2,"ng-template",10)(5,Qr,1,1,"vdr-customer-label",11),e.I0R(6,"button",12),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.setCustomer())}),e.OEk(7),e.wVc(8,"translate"),e.C$Y()(),e.I0R(9,"vdr-card",9),e.wVc(10,"translate"),e.yuY(11,Hr,2,2,"ng-template",10)(12,Jr,1,1,"vdr-formatted-address",13),e.I0R(13,"button",12),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.setBillingAddress())}),e.OEk(14),e.wVc(15,"translate"),e.C$Y()(),e.I0R(16,"vdr-card",9),e.wVc(17,"translate"),e.yuY(18,Ur,2,2,"ng-template",10)(19,zr,1,1,"vdr-formatted-address",13),e.I0R(20,"button",14),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.setShippingAddress())}),e.OEk(21),e.wVc(22,"translate"),e.C$Y(),e.yuY(23,Zr,2,1,"div",15),e.I0R(24,"button",12),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.setShippingMethod())}),e.OEk(25),e.wVc(26,"translate"),e.C$Y()(),e.I0R(27,"vdr-card"),e.yuY(28,eo,3,3,"button",16)(29,to,5,4,"div",0),e.C$Y(),e.I0R(30,"vdr-card"),e.yuY(31,no,1,1,"vdr-page-entity-info",17),e.wVc(32,"async"),e.C$Y()(),e.I0R(33,"vdr-page-block")(34,"vdr-card")(35,"vdr-draft-order-variant-selector",18),e.qCj("addItem",function(i){e.usT(t);const a=e.GaO();return e.CGJ(a.addItemToOrder(i))}),e.C$Y(),e.I0R(36,"vdr-order-table",19),e.qCj("adjust",function(i){e.usT(t);const a=e.GaO();return e.CGJ(a.adjustOrderLine(i))})("remove",function(i){e.usT(t);const a=e.GaO();return e.CGJ(a.removeOrderLine(i))}),e.C$Y()(),e.I0R(37,"vdr-card",9),e.wVc(38,"translate"),e.yuY(39,oo,18,13,"ng-container",0),e.C$Y(),e.wR5(40,"vdr-custom-detail-component-host",20),e.I0R(41,"vdr-order-custom-fields-card",21),e.qCj("updateClick",function(i){e.usT(t);const a=e.GaO();return e.CGJ(a.updateCustomFields(i))}),e.C$Y()()()}if(2&r){const t=n.ngIf,o=e.GaO();e.yG2(2),e.E7m("title",e.kDX(3,25,"order.customer")),e.yG2(3),e.E7m("ngIf",t.customer),e.yG2(2),e.oRS(" ",e.kDX(8,27,"order.set-customer-for-order")," "),e.yG2(2),e.E7m("title",e.kDX(10,29,"order.billing-address")),e.yG2(3),e.E7m("ngIf",t.billingAddress),e.yG2(2),e.oRS(" ",e.kDX(15,31,"order.set-billing-address")," "),e.yG2(2),e.E7m("title",e.kDX(17,33,"order.shipping")),e.yG2(3),e.E7m("ngIf",t.shippingAddress),e.yG2(2),e.oRS(" ",e.kDX(22,35,"order.set-shipping-address")," "),e.yG2(2),e.E7m("ngForOf",t.shippingLines),e.yG2(2),e.oRS(" ",e.kDX(26,37,"order.set-shipping-method")," "),e.yG2(3),e.E7m("ngIf",0===t.couponCodes.length&&!o.displayCouponCodeInput),e.yG2(),e.E7m("ngIf",t.couponCodes.length||o.displayCouponCodeInput),e.yG2(2),e.E7m("ngIf",e.kDX(32,39,o.entity$)),e.yG2(4),e.E7m("orderLineCustomFields",o.orderLineCustomFields)("currencyCode",t.currencyCode),e.yG2(),e.E7m("order",t)("orderLineCustomFields",o.orderLineCustomFields)("isDraft",!0),e.yG2(),e.E7m("title",e.kDX(38,41,"order.tax-summary")),e.yG2(2),e.E7m("ngIf",t.taxSummary.length),e.yG2(),e.E7m("entity$",o.entity$)("detailForm",o.detailForm),e.yG2(),e.E7m("customFieldsConfig",o.customFields)("customFieldValues",t.customFields)}}class fe extends d.uJQ{constructor(n,t,o,i,a){super(),this.changeDetector=n,this.dataService=t,this.notificationService=o,this.modalService=i,this.orderTransitionService=a,this.customFields=this.getCustomFieldConfig("Order"),this.orderLineCustomFields=this.getCustomFieldConfig("OrderLine"),this.detailForm=new l.k1({}),this.fetchHistory=new Q.E,this.displayCouponCodeInput=!1}ngOnInit(){this.init(),this.orderLineCustomFields=this.getCustomFieldConfig("OrderLine"),this.eligibleShippingMethods$=this.entity$.pipe((0,f.G)(n=>this.dataService.order.getDraftOrderEligibleShippingMethods(n.id).mapSingle(({eligibleShippingMethodsForDraftOrder:t})=>t)))}ngOnDestroy(){this.destroy()}addItemToOrder(n){this.dataService.order.addItemToDraftOrder(this.id,n).subscribe(t=>{"Order"!==t.addItemToDraftOrder.__typename&&this.notificationService.error(t.addItemToDraftOrder.message)})}adjustOrderLine(n){this.dataService.order.adjustDraftOrderLine(this.id,{orderLineId:n.lineId,quantity:n.quantity}).subscribe(t=>{"Order"!==t.adjustDraftOrderLine.__typename&&this.notificationService.error(t.adjustDraftOrderLine.message)})}removeOrderLine(n){this.dataService.order.removeDraftOrderLine(this.id,n.lineId).subscribe(t=>{"Order"!==t.removeDraftOrderLine.__typename&&this.notificationService.error(t.removeDraftOrderLine.message)})}getOrderAddressLines(n){return n?Object.values(n).filter(t=>"OrderAddress"!==t).filter(t=>!!t):[]}setCustomer(){this.modalService.fromComponent(H).subscribe(n=>{if(this.hasId(n))this.dataService.order.setCustomerForDraftOrder(this.id,{customerId:n.id}).subscribe();else if(n){const{note:t,...o}=n;this.dataService.order.setCustomerForDraftOrder(this.id,{input:o}).subscribe()}})}setShippingAddress(){this.entity$.pipe((0,x.U)(1),(0,f.G)(n=>this.modalService.fromComponent(q,{locals:{customerId:n.customer?.id,currentAddress:n.shippingAddress??void 0}}))).subscribe(n=>{n&&this.dataService.order.setDraftOrderShippingAddress(this.id,n).subscribe()})}setBillingAddress(){this.entity$.pipe((0,x.U)(1),(0,f.G)(n=>this.modalService.fromComponent(q,{locals:{customerId:n.customer?.id,currentAddress:n.billingAddress??void 0}}))).subscribe(n=>{n&&this.dataService.order.setDraftOrderBillingAddress(this.id,n).subscribe()})}applyCouponCode(n){this.dataService.order.applyCouponCodeToDraftOrder(this.id,n).subscribe()}removeCouponCode(n){this.dataService.order.removeCouponCodeFromDraftOrder(this.id,n).subscribe()}setShippingMethod(){(0,At.E)(this.entity$,this.eligibleShippingMethods$).pipe((0,x.U)(1),(0,f.G)(([n,t])=>this.modalService.fromComponent(J,{locals:{eligibleShippingMethods:t,currencyCode:n.currencyCode,currentSelectionId:n.shippingLines?.[0]?.shippingMethod.id}}))).subscribe(n=>{n&&this.dataService.order.setDraftOrderShippingMethod(this.id,n).subscribe()})}updateCustomFields(n){this.dataService.order.updateOrderCustomFields({id:this.id,customFields:n}).subscribe()}deleteOrder(){this.dataService.order.deleteDraftOrder(this.id).subscribe(({deleteDraftOrder:n})=>{n.result===d.yuD.DELETED?(this.notificationService.success((0,u.s)("common.notify-delete-success"),{entity:"Order"}),this.router.navigate(["/orders"])):n.message&&this.notificationService.error(n.message)})}completeOrder(){this.dataService.order.transitionToState(this.id,"ArrangingPayment").subscribe(({transitionOrderToState:n})=>{"Order"===n?.__typename?this.router.navigate(["/orders",this.id]):"OrderStateTransitionError"===n?.__typename&&this.notificationService.error(n.transitionError)})}hasId(n){return"object"==typeof n&&!!n.id}setFormValues(n){}static#e=this.\u0275fac=function(t){return new(t||fe)(e.GI1(e.kD9),e.GI1(d.Aj0),e.GI1(d.gnT),e.GI1(d.Ajm),e.GI1(M))};static#t=this.\u0275cmp=e.In1({type:fe,selectors:[["vdr-draft-order-detail"]],features:[e.eg9],decls:5,vars:6,consts:[[4,"ngIf"],[1,"flex","clr-align-items-center"],[3,"state"],["locationId","draft-order-detail"],[1,"btn","btn-primary",3,"disabled","click"],["shape","check"],["locationId","draft-order-detail",3,"alwaysShow"],["type","button","vdrDropdownItem","",3,"click"],["shape","trash",1,"is-danger"],[3,"title"],["vdrCardControls",""],["class","block mb-2",3,"customer",4,"ngIf"],[1,"button-small",3,"click"],["class","block mb-2",3,"address",4,"ngIf"],[1,"button-small","mr-2",3,"click"],[4,"ngFor","ngForOf"],["class","button-small",3,"click",4,"ngIf"],[3,"entity",4,"ngIf"],[3,"orderLineCustomFields","currencyCode","addItem"],[3,"order","orderLineCustomFields","isDraft","adjust","remove"],["locationId","draft-order-detail",3,"entity$","detailForm"],[3,"customFieldsConfig","customFieldValues","updateClick"],["shape","unknown-status","class","is-warning",4,"ngIf"],["shape","check","class","is-success",4,"ngIf"],["shape","unknown-status",1,"is-warning"],["shape","check",1,"is-success"],[1,"block","mb-2",3,"customer"],[1,"block","mb-2",3,"address"],[3,"couponCodes","addCouponCode","removeCouponCode"],[3,"entity"],[1,"table"]],template:function(t,o){1&t&&(e.I0R(0,"vdr-page-block"),e.yuY(1,Nr,15,9,"vdr-action-bar",0),e.wVc(2,"async"),e.C$Y(),e.yuY(3,io,42,43,"vdr-page-detail-layout",0),e.wVc(4,"async")),2&t&&(e.yG2(),e.E7m("ngIf",e.kDX(2,2,o.entity$)),e.yG2(2),e.E7m("ngIf",e.kDX(4,4,o.entity$)))},dependencies:[_.o3d,_.ojz,m.ay,m.u_,I.iK,I.Ix,I.eu,Xe.O,Le.G,ue.Q,Me.a,se.o,je.o,dt.K,Ye.m,st.k,Qe.g,Ke.e,G.u,G.M,_e,X,pe,K,m.a,m.Bz,p.sD,g.u],changeDetection:0})}var ao=s(204);function lo(r,n){1&r&&(e.OEk(0),e.wVc(1,"translate")),2&r&&e.cNF(e.kDX(1,1,"order.fulfill-order"))}function so(r,n){if(1&r&&(e.wR5(0,"img",17),e.wVc(1,"assetPreview")),2&r){const t=e.GaO().$implicit;e.E7m("src",e.g7$(1,1,t.featuredAsset,"tiny"),e.K6U)}}function co(r,n){if(1&r){const t=e.KQA();e.I0R(0,"input",18),e.iHE("ngModelChange",function(i){e.usT(t);const a=e.GaO().$implicit,c=e.GaO();return e.kNx(c.fulfillmentQuantities[a.id].fulfillCount,i)||(c.fulfillmentQuantities[a.id].fulfillCount=i),e.CGJ(i)}),e.C$Y()}if(2&r){const t=e.GaO().$implicit,o=e.GaO();e.E7m("disabled",0===o.getUnfulfilledCount(t)),e.OKB("ngModel",o.fulfillmentQuantities[t.id].fulfillCount),e.E7m("max",o.fulfillmentQuantities[t.id].max)}}function mo(r,n){if(1&r&&(e.I0R(0,"tr",9)(1,"td",10),e.yuY(2,so,2,4,"img",11),e.C$Y(),e.I0R(3,"td",12),e.OEk(4),e.C$Y(),e.I0R(5,"td",13),e.OEk(6),e.C$Y(),e.I0R(7,"td",14),e.OEk(8),e.C$Y(),e.I0R(9,"td",14),e.OEk(10),e.C$Y(),e.I0R(11,"td",15),e.yuY(12,co,1,3,"input",16),e.C$Y()()),2&r){const t=n.$implicit,o=e.GaO();e.eAK("ignore",0===o.getUnfulfilledCount(t)),e.yG2(2),e.E7m("ngIf",t.featuredAsset),e.yG2(2),e.cNF(t.productVariant.name),e.yG2(2),e.cNF(t.productVariant.sku),e.yG2(2),e.cNF(o.getUnfulfilledCount(t)),e.yG2(2),e.cNF(t.productVariant.stockOnHand),e.yG2(2),e.E7m("ngIf",o.fulfillmentQuantities[t.id])}}function uo(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",19),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.cancel())}),e.OEk(1),e.wVc(2,"translate"),e.C$Y(),e.I0R(3,"button",20),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.select())}),e.OEk(4),e.wVc(5,"translate"),e.C$Y()}if(2&r){const t=e.GaO();e.yG2(),e.cNF(e.kDX(2,3,"common.cancel")),e.yG2(2),e.E7m("disabled",!t.canSubmit()),e.yG2(),e.oRS(" ",e.kDX(5,5,"order.create-fulfillment")," ")}}class ge{constructor(n,t){this.dataService=n,this.changeDetector=t,this.fulfillmentHandlerControl=new l.yM,this.fulfillmentQuantities={}}ngOnInit(){this.dataService.settings.getGlobalSettings().single$.subscribe(({globalSettings:n})=>{this.fulfillmentQuantities=this.order.lines.reduce((t,o)=>{const i=this.getFulfillableCount(o,n.trackInventory);return{...t,[o.id]:{fulfillCount:i,max:i}}},{}),this.changeDetector.markForCheck()}),this.dataService.shippingMethod.getShippingMethodOperations().mapSingle(n=>n.fulfillmentHandlers).subscribe(n=>{this.fulfillmentHandlerDef=n.find(t=>t.code===this.order.shippingLines[0]?.shippingMethod?.fulfillmentHandlerCode)||n[0],this.fulfillmentHandler=(0,d.kt8)(this.fulfillmentHandlerDef),this.fulfillmentHandlerControl.patchValue(this.fulfillmentHandler),this.changeDetector.markForCheck()})}getFulfillableCount(n,t){const{trackInventory:o,stockOnHand:i}=n.productVariant,a=o===d.w1i.INHERIT?t:o===d.w1i.TRUE,c=this.getUnfulfilledCount(n);return a?Math.min(c,i):c}getUnfulfilledCount(n){const t=this.order.fulfillments?.filter(o=>"Cancelled"!==o.state).map(o=>o.lines).flat().filter(o=>o.orderLineId===n.id).reduce((o,i)=>o+i.quantity,0)??0;return n.quantity-t}canSubmit(){const n=Object.values(this.fulfillmentQuantities).reduce((i,{fulfillCount:a})=>i+a,0),t=Object.values(this.fulfillmentQuantities).every(({fulfillCount:i,max:a})=>i<=a);return(0,d.W2F)(this.fulfillmentHandlerDef,this.fulfillmentHandlerControl.value)&&this.fulfillmentHandlerControl.valid&&0<n&&t}select(){const n=Object.entries(this.fulfillmentQuantities).map(([t,{fulfillCount:o}])=>({orderLineId:t,quantity:o}));this.resolveWith({lines:n,handler:(0,d.iMd)(this.fulfillmentHandler,this.fulfillmentHandlerControl.value)})}cancel(){this.resolveWith()}static#e=this.\u0275fac=function(t){return new(t||ge)(e.GI1(d.Aj0),e.GI1(e.kD9))};static#t=this.\u0275cmp=e.In1({type:ge,selectors:[["vdr-fulfill-order-dialog"]],decls:34,vars:29,consts:[["vdrDialogTitle",""],[1,"fulfillment-wrapper"],[1,"order-table"],[1,"table"],["class","order-line",3,"ignore",4,"ngFor","ngForOf"],[1,"shipping-details"],[3,"address"],[3,"operationDefinition","operation","formControl","removable"],["vdrDialogButtons",""],[1,"order-line"],[1,"align-middle","thumb"],[3,"src",4,"ngIf"],[1,"align-middle","name"],[1,"align-middle","sku"],[1,"align-middle","quantity"],[1,"align-middle","fulfil"],["type","number","min","0",3,"disabled","ngModel","max","ngModelChange",4,"ngIf"],[3,"src"],["type","number","min","0",3,"disabled","ngModel","max","ngModelChange"],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"disabled","click"]],template:function(t,o){1&t&&(e.yuY(0,lo,2,3,"ng-template",0),e.I0R(1,"div",1)(2,"div",2)(3,"table",3)(4,"thead")(5,"tr"),e.wR5(6,"th"),e.I0R(7,"th"),e.OEk(8),e.wVc(9,"translate"),e.C$Y(),e.I0R(10,"th"),e.OEk(11),e.wVc(12,"translate"),e.C$Y(),e.I0R(13,"th"),e.OEk(14),e.wVc(15,"translate"),e.C$Y(),e.I0R(16,"th"),e.OEk(17),e.wVc(18,"translate"),e.C$Y(),e.I0R(19,"th"),e.OEk(20),e.wVc(21,"translate"),e.C$Y()()(),e.yuY(22,mo,13,8,"tr",4),e.C$Y()(),e.I0R(23,"div",5),e.wR5(24,"vdr-formatted-address",6),e.I0R(25,"h6"),e.OEk(26),e.wVc(27,"translate"),e.C$Y(),e.OEk(28),e.I0R(29,"strong"),e.OEk(30),e.wVc(31,"localeCurrency"),e.C$Y(),e.wR5(32,"vdr-configurable-input",7),e.C$Y()(),e.yuY(33,uo,6,7,"ng-template",8)),2&t&&(e.yG2(8),e.cNF(e.kDX(9,14,"order.product-name")),e.yG2(3),e.cNF(e.kDX(12,16,"order.product-sku")),e.yG2(3),e.cNF(e.kDX(15,18,"order.unfulfilled")),e.yG2(3),e.cNF(e.kDX(18,20,"catalog.stock-on-hand")),e.yG2(3),e.cNF(e.kDX(21,22,"order.fulfill")),e.yG2(2),e.E7m("ngForOf",o.order.lines),e.yG2(2),e.E7m("address",o.order.shippingAddress),e.yG2(2),e.cNF(e.kDX(27,24,"order.shipping-method")),e.yG2(2),e.oRS(" ",null==o.order.shippingLines[0]||null==o.order.shippingLines[0].shippingMethod?null:o.order.shippingLines[0].shippingMethod.name," "),e.yG2(2),e.cNF(e.g7$(31,26,o.order.shipping,o.order.currencyCode)),e.yG2(2),e.E7m("operationDefinition",o.fulfillmentHandlerDef)("operation",o.fulfillmentHandler)("formControl",o.fulfillmentHandlerControl)("removable",!1))},dependencies:[m.ay,m.u_,l.ot,l.O4,l.ue,l.Gu,l._t,l._G,l.ug,ao.K,C.w,E.E,b.a,se.o,p.sD,j.w,g.u],styles:["[_nghost-%COMP%]{height:100%;display:flex;min-height:64vh}[_nghost-%COMP%] .is-cancelled[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{text-decoration:line-through;background-color:var(--color-component-bg-200)}[_nghost-%COMP%] .sub-total[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{border-top:1px dashed var(--color-component-border-200)}[_nghost-%COMP%] .total[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{font-weight:700;border-top:1px dashed var(--color-component-border-200)}[_nghost-%COMP%] td.custom-fields-row[_ngcontent-%COMP%]{border-top-style:dashed;border-top-color:var(--color-grey-200)}[_nghost-%COMP%] img[_ngcontent-%COMP%]{border-radius:var(--border-radius-img)}[_nghost-%COMP%] .order-line-custom-fields[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap}[_nghost-%COMP%] .order-line-custom-fields[_ngcontent-%COMP%] .custom-field[_ngcontent-%COMP%]{text-align:start;max-width:200px;overflow:hidden;text-overflow:ellipsis;margin-bottom:6px;margin-inline-end:18px}[_nghost-%COMP%] .draft-qty[_ngcontent-%COMP%]{max-width:48px}[_nghost-%COMP%] .order-line-custom-field[_ngcontent-%COMP%]{background-color:var(--color-component-bg-100)}[_nghost-%COMP%] .order-line-custom-field[_ngcontent-%COMP%] .custom-field-ellipsis[_ngcontent-%COMP%]{color:var(--color-text-300)}[_nghost-%COMP%] .net-price[_ngcontent-%COMP%]{font-size:11px;color:var(--color-text-300);line-height:14px}[_nghost-%COMP%] .promotions-label[_ngcontent-%COMP%]{-webkit-text-decoration:underline dotted var(--color-text-200);text-decoration:underline dotted var(--color-text-200);font-size:11px;margin-top:6px;cursor:pointer;text-transform:lowercase}[_nghost-%COMP%] .thumb[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:50px;height:50px}[_nghost-%COMP%] .shipping-method-name[_ngcontent-%COMP%]{font-size:var(--font-size-xs);margin-inline-end:2px}[_nghost-%COMP%] .order-placed-quantity[_ngcontent-%COMP%]{text-decoration:line-through;color:var(--color-text-300);margin-inline-end:2px}.fulfillment-wrapper[_ngcontent-%COMP%]{flex:1}@media screen and (min-width: 768px){.fulfillment-wrapper[_ngcontent-%COMP%]{display:flex;flex-direction:row}}.fulfillment-wrapper[_ngcontent-%COMP%] .shipping-details[_ngcontent-%COMP%]{margin-top:24px}@media screen and (min-width: 768px){.fulfillment-wrapper[_ngcontent-%COMP%] .shipping-details[_ngcontent-%COMP%]{margin-top:0;margin-inline-start:24px;width:250px}}.fulfillment-wrapper[_ngcontent-%COMP%] .shipping-details[_ngcontent-%COMP%] clr-input-container[_ngcontent-%COMP%]{margin-top:24px}.fulfillment-wrapper[_ngcontent-%COMP%] .order-table[_ngcontent-%COMP%]{flex:1;overflow-y:auto}.fulfillment-wrapper[_ngcontent-%COMP%] .order-table[_ngcontent-%COMP%] table[_ngcontent-%COMP%]{margin-top:0}.fulfillment-wrapper[_ngcontent-%COMP%] tr.ignore[_ngcontent-%COMP%]{color:var(--color-grey-300)}"],changeDetection:0})}function _o(r,n){if(1&r&&(e.I0R(0,"div",5),e.OEk(1),e.C$Y()),2&r){const t=e.GaO().$implicit;e.yG2(),e.cNF(t.quantity)}}function po(r,n){1&r&&e.wR5(0,"clr-icon",6)}function fo(r,n){if(1&r&&(e.I0R(0,"li",2),e.yuY(1,_o,2,1,"div",3)(2,po,1,0,"clr-icon",4),e.OEk(3),e.C$Y()),2&r){const t=n.$implicit;e.E7m("title",t.name),e.yG2(),e.E7m("ngIf",null!=t.quantity),e.yG2(),e.E7m("ngIf",null!=t.quantity),e.yG2(),e.oRS(" ",t.name," ")}}class L{static#e=this.\u0275fac=function(t){return new(t||L)};static#t=this.\u0275cmp=e.In1({type:L,selectors:[["vdr-simple-item-list"]],inputs:{items:"items"},decls:3,vars:1,consts:[[1,"items-list"],[3,"title",4,"ngFor","ngForOf"],[3,"title"],["class","quantity",4,"ngIf"],["shape","times","size","12",4,"ngIf"],[1,"quantity"],["shape","times","size","12"]],template:function(t,o){1&t&&(e.I0R(0,"div",0)(1,"ul"),e.yuY(2,fo,4,4,"li",1),e.C$Y()()),2&t&&(e.yG2(2),e.E7m("ngForOf",o.items))},dependencies:[_.o3d,m.ay,m.u_],styles:[".items-list[_ngcontent-%COMP%]{font-size:12px}.items-list[_ngcontent-%COMP%] ul[_ngcontent-%COMP%]{margin-top:6px;list-style-type:none;margin-inline-start:2px}.items-list[_ngcontent-%COMP%] ul[_ngcontent-%COMP%] li[_ngcontent-%COMP%]{line-height:14px;text-overflow:ellipsis;overflow:hidden}.items-list[_ngcontent-%COMP%] .quantity[_ngcontent-%COMP%]{min-width:16px;display:inline-block}"],changeDetection:0})}function go(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",0),e.wVc(1,"translate"),e.OEk(2),e.C$Y()),2&r){const t=e.GaO();e.E7m("label",e.kDX(1,2,"order.tracking-code")),e.yG2(2),e.oRS(" ",null==t.fulfillment?null:t.fulfillment.trackingCode,"\n")}}function yo(r,n){if(1&r&&e.wR5(0,"vdr-custom-field-control",5),2&r){const t=e.GaO().$implicit,o=e.GaO();e.E7m("readonly",!0)("compact",!0)("customField",t)("customFieldsFormGroup",o.customFieldFormGroup)}}function Co(r,n){if(1&r&&(e.SAx(0),e.yuY(1,yo,1,4,"vdr-custom-field-control",4),e.k70()),2&r){const t=n.$implicit,o=e.GaO();e.yG2(),e.E7m("ngIf",o.customFieldFormGroup.get(t.name))}}class ee{constructor(n){this.serverConfigService=n,this.customFieldConfig=[],this.customFieldFormGroup=new l.k1({})}ngOnInit(){this.customFieldConfig=this.serverConfigService.getCustomFieldsFor("Fulfillment")}ngOnChanges(n){this.buildCustomFieldsFormGroup()}get fulfillment(){return this.order.fulfillments&&this.order.fulfillments.find(n=>n.id===this.fulfillmentId)}get items(){return this.fulfillment?.lines.map(n=>({name:this.order.lines.find(t=>t.id===n.orderLineId)?.productVariant.name??"",quantity:n.quantity}))??[]}buildCustomFieldsFormGroup(){const n=this.fulfillment.customFields;for(const t of this.serverConfigService.getCustomFieldsFor("Fulfillment"))this.customFieldFormGroup.addControl(t.name,new l.yM(n[t.name]))}customFieldIsObject(n){return Array.isArray(n)||(0,h.isObject)(n)}static#e=this.\u0275fac=function(t){return new(t||ee)(e.GI1(d.ctz))};static#t=this.\u0275cmp=e.In1({type:ee,selectors:[["vdr-fulfillment-detail"]],inputs:{fulfillmentId:"fulfillmentId",order:"order"},features:[e.SYr],decls:12,vars:17,consts:[[3,"label"],[3,"label",4,"ngIf"],[3,"items"],[4,"ngFor","ngForOf"],[3,"readonly","compact","customField","customFieldsFormGroup",4,"ngIf"],[3,"readonly","compact","customField","customFieldsFormGroup"]],template:function(t,o){1&t&&(e.I0R(0,"vdr-labeled-data",0),e.wVc(1,"translate"),e.OEk(2),e.wVc(3,"localeDate"),e.C$Y(),e.I0R(4,"vdr-labeled-data",0),e.wVc(5,"translate"),e.OEk(6),e.C$Y(),e.yuY(7,go,3,4,"vdr-labeled-data",1),e.I0R(8,"vdr-labeled-data",0),e.wVc(9,"translate"),e.wR5(10,"vdr-simple-item-list",2),e.C$Y(),e.yuY(11,Co,2,1,"ng-container",3)),2&t&&(e.E7m("label",e.kDX(1,8,"common.created-at")),e.yG2(2),e.oRS(" ",e.g7$(3,10,null==o.fulfillment?null:o.fulfillment.createdAt,"medium"),"\n"),e.yG2(2),e.E7m("label",e.kDX(5,13,"order.fulfillment-method")),e.yG2(2),e.oRS(" ",null==o.fulfillment?null:o.fulfillment.method,"\n"),e.yG2(),e.E7m("ngIf",null==o.fulfillment?null:o.fulfillment.trackingCode),e.yG2(),e.E7m("label",e.kDX(9,15,"order.contents")),e.yG2(2),e.E7m("items",o.items),e.yG2(),e.E7m("ngForOf",o.customFieldConfig))},dependencies:[m.ay,m.u_,qe.E,O.a,L,p.sD,A.m],changeDetection:0})}function ho(r,n){1&r&&e.wR5(0,"clr-icon",2)}class ye{get chipColorType(){switch(this.state){case"Pending":case"Shipped":return"warning";case"Delivered":return"success";case"Cancelled":return"error"}}static#e=this.\u0275fac=function(t){return new(t||ye)};static#t=this.\u0275cmp=e.In1({type:ye,selectors:[["vdr-fulfillment-state-label"]],inputs:{state:"state"},decls:6,vars:10,consts:[[3,"title","colorType"],["shape","check-circle",4,"ngIf"],["shape","check-circle"]],template:function(t,o){1&t&&(e.I0R(0,"vdr-chip",0),e.wVc(1,"translate"),e.yuY(2,ho,1,0,"clr-icon",1),e.OEk(3),e.wVc(4,"translate"),e.wVc(5,"stateI18nToken"),e.C$Y()),2&t&&(e.E7m("title",e.kDX(1,4,"order.payment-state"))("colorType",o.chipColorType),e.yG2(2),e.E7m("ngIf","Delivered"===o.state),e.yG2(),e.oRS(" ",e.kDX(4,6,e.kDX(5,8,o.state)),"\n"))},dependencies:[_.o3d,m.u_,D.g,p.sD,$.Q],styles:["[_nghost-%COMP%]{font-size:14px}"],changeDetection:0})}function Oo(r,n){if(1&r&&e.wR5(0,"vdr-fulfillment-detail",7),2&r){const t=e.GaO();e.E7m("fulfillmentId",null==t.fulfillment?null:t.fulfillment.id)("order",t.order)}}const pt=r=>({state:r});function vo(r,n){if(1&r){const t=e.KQA();e.SAx(0),e.I0R(1,"button",14),e.qCj("click",function(){const a=e.usT(t).ngIf,c=e.GaO(2);return e.CGJ(c.transitionState.emit(a))}),e.OEk(2),e.wVc(3,"translate"),e.wVc(4,"translate"),e.wVc(5,"stateI18nToken"),e.C$Y(),e.k70()}if(2&r){const t=n.ngIf;e.yG2(2),e.oRS(" ",e.g7$(3,1,"order.set-fulfillment-state",e.S45(8,pt,e.kDX(4,4,e.kDX(5,6,t))))," ")}}function bo(r,n){if(1&r&&(e.SAx(0),e.wR5(1,"clr-icon",18),e.OEk(2),e.wVc(3,"translate"),e.wVc(4,"translate"),e.wVc(5,"stateI18nToken"),e.k70()),2&r){const t=e.GaO().$implicit;e.yG2(2),e.oRS(" ",e.g7$(3,1,"order.transition-to-state",e.S45(8,pt,e.kDX(4,4,e.kDX(5,6,t))))," ")}}function Io(r,n){1&r&&(e.wR5(0,"clr-icon",19),e.OEk(1),e.wVc(2,"translate")),2&r&&(e.yG2(),e.oRS(" ",e.kDX(2,1,"order.cancel-fulfillment")," "))}function Go(r,n){if(1&r){const t=e.KQA();e.SAx(0),e.I0R(1,"button",15),e.qCj("click",function(){const a=e.usT(t).$implicit,c=e.GaO(2);return e.CGJ(c.transitionState.emit(a))}),e.yuY(2,bo,6,10,"ng-container",16)(3,Io,3,3,"ng-template",null,17,e.gJz),e.C$Y(),e.k70()}if(2&r){const t=n.$implicit,o=e.Gew(4);e.yG2(2),e.E7m("ngIf","Cancelled"!==t)("ngIfElse",o)}}function Eo(r,n){if(1&r&&(e.I0R(0,"div",8),e.yuY(1,vo,6,10,"ng-container",9),e.I0R(2,"vdr-dropdown")(3,"button",10),e.wR5(4,"clr-icon",11),e.C$Y(),e.I0R(5,"vdr-dropdown-menu",12),e.yuY(6,Go,5,2,"ng-container",13),e.C$Y()()()),2&r){const t=e.GaO();e.yG2(),e.E7m("ngIf",t.nextSuggestedState()),e.yG2(5),e.E7m("ngForOf",t.nextOtherStates())}}class Ce{constructor(){this.transitionState=new e._w7}nextSuggestedState(){if(!this.fulfillment)return;const{nextStates:n}=this.fulfillment,t=o=>n.includes(o)?o:n[0];switch(this.fulfillment?.state){case"Pending":return t("Shipped");case"Shipped":return t("Delivered");default:return n.find(o=>"Cancelled"!==o)}}nextOtherStates(){if(!this.fulfillment)return[];const n=this.nextSuggestedState();return this.fulfillment.nextStates.filter(t=>t!==n)}static#e=this.\u0275fac=function(t){return new(t||Ce)};static#t=this.\u0275cmp=e.In1({type:Ce,selectors:[["vdr-fulfillment-card"]],inputs:{fulfillment:"fulfillment",order:"order"},outputs:{transitionState:"transitionState"},decls:10,vars:6,consts:[[1,"card"],[1,"card-header","fulfillment-header"],[1,"fulfillment-state"],[3,"state"],[1,"card-block"],[3,"fulfillmentId","order",4,"ngIf"],["class","card-footer",4,"ngIf"],[3,"fulfillmentId","order"],[1,"card-footer"],[4,"ngIf"],["vdrDropdownTrigger","",1,"icon-button"],["shape","ellipsis-vertical"],["vdrPosition","bottom-right"],[4,"ngFor","ngForOf"],[1,"btn","btn-sm","btn-primary",3,"click"],["type","button","vdrDropdownItem","",3,"click"],[4,"ngIf","ngIfElse"],["cancel",""],["shape","step-forward-2"],["shape","error-standard",1,"is-error"]],template:function(t,o){1&t&&(e.I0R(0,"div",0)(1,"div",1)(2,"div"),e.OEk(3),e.wVc(4,"translate"),e.C$Y(),e.I0R(5,"div",2),e.wR5(6,"vdr-fulfillment-state-label",3),e.C$Y()(),e.I0R(7,"div",4),e.yuY(8,Oo,1,2,"vdr-fulfillment-detail",5),e.C$Y(),e.yuY(9,Eo,7,2,"div",6),e.C$Y()),2&t&&(e.yG2(3),e.cNF(e.kDX(4,4,"order.fulfillment")),e.yG2(3),e.E7m("state",null==o.fulfillment?null:o.fulfillment.state),e.yG2(2),e.E7m("ngIf",!!o.fulfillment),e.yG2(),e.E7m("ngIf",null==o.fulfillment?null:o.fulfillment.nextStates.length))},dependencies:[_.o3d,m.ay,m.u_,B.i,W.m,U.q,ue.Q,ee,ye,p.sD,$.Q],styles:[".fulfillment-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center}.card-footer[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:flex-end}"],changeDetection:0})}function Ro(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",0),e.wVc(1,"translate"),e.OEk(2),e.C$Y()),2&r){const t=e.GaO();e.E7m("label",e.kDX(1,2,"order.note")),e.yG2(2),e.cNF(t.modification.note)}}function ko(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",0),e.wVc(1,"translate"),e.OEk(2),e.wVc(3,"localeCurrency"),e.C$Y()),2&r){const t=n.$implicit,o=e.GaO();let i;e.E7m("label",e.kDX(1,3,"order.surcharges")),e.yG2(2),e.CAO(" ",null==(i=o.getSurcharge(t.id))?null:i.description," ",e.g7$(3,5,null==(i=o.getSurcharge(t.id))?null:i.priceWithTax,o.order.currencyCode),"")}}function wo(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",0),e.wVc(1,"translate"),e.wR5(2,"vdr-simple-item-list",3),e.C$Y()),2&r){const t=e.GaO();e.E7m("label",e.kDX(1,2,"order.added-items")),e.yG2(2),e.E7m("items",t.getAddedItems())}}function To(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",0),e.wVc(1,"translate"),e.wR5(2,"vdr-simple-item-list",3),e.C$Y()),2&r){const t=e.GaO();e.E7m("label",e.kDX(1,2,"order.removed-items")),e.yG2(2),e.E7m("items",t.getRemovedItems())}}function So(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",0),e.wVc(1,"translate"),e.wR5(2,"vdr-simple-item-list",3),e.C$Y()),2&r){const t=e.GaO();e.E7m("label",e.kDX(1,2,"order.modified-items")),e.yG2(2),e.E7m("items",t.getModifiedItems())}}class he{constructor(){this.addedItems=new Map,this.removedItems=new Map,this.modifiedItems=new Set}ngOnChanges(){const{added:n,removed:t,modified:o}=this.getModifiedLines();this.addedItems=n,this.removedItems=t,this.modifiedItems=o}getSurcharge(n){return this.order.surcharges.find(t=>t.id===n)}getAddedItems(){return[...this.addedItems.entries()].map(([n,t])=>({name:n.productVariant.name,quantity:t}))}getRemovedItems(){return[...this.removedItems.entries()].map(([n,t])=>({name:n.productVariant.name,quantity:t}))}getModifiedItems(){return[...this.modifiedItems].map(n=>({name:n.productVariant.name}))}getModifiedLines(){const n=new Map,t=new Map,o=new Set;for(const i of this.modification.lines||[]){const a=this.order.lines.find(c=>c.id===i.orderLineId);a&&(0===i.quantity?o.add(a):i.quantity<0?t.set(a,-i.quantity):n.set(a,i.quantity))}return{added:n,removed:t,modified:o}}static#e=this.\u0275fac=function(t){return new(t||he)};static#t=this.\u0275cmp=e.In1({type:he,selectors:[["vdr-modification-detail"]],inputs:{order:"order",modification:"modification"},features:[e.SYr],decls:8,vars:9,consts:[[3,"label"],[3,"label",4,"ngIf"],[3,"label",4,"ngFor","ngForOf"],[3,"items"]],template:function(t,o){1&t&&(e.I0R(0,"vdr-labeled-data",0),e.wVc(1,"translate"),e.OEk(2),e.C$Y(),e.yuY(3,Ro,3,4,"vdr-labeled-data",1)(4,ko,4,8,"vdr-labeled-data",2)(5,wo,3,4,"vdr-labeled-data",1)(6,To,3,4,"vdr-labeled-data",1)(7,So,3,4,"vdr-labeled-data",1)),2&t&&(e.E7m("label",e.kDX(1,7,"common.ID")),e.yG2(2),e.cNF(o.modification.id),e.yG2(),e.E7m("ngIf",o.modification.note),e.yG2(),e.E7m("ngForOf",o.modification.surcharges),e.yG2(),e.E7m("ngIf",o.getAddedItems().length),e.yG2(),e.E7m("ngIf",o.getRemovedItems().length),e.yG2(),e.E7m("ngIf",o.getModifiedItems().length))},dependencies:[m.ay,m.u_,O.a,L,p.sD,g.u],changeDetection:0})}var Do=s(80),ft=s(5172),He=s(5623);const Je=72;function xo(r,n){if(1&r&&(e.I0R(0,"div",3),e.wR5(1,"div",4)(2,"clr-icon",5),e.I0R(3,"div",6),e.OEk(4),e.wVc(5,"translate"),e.wVc(6,"stateI18nToken"),e.C$Y()()),2&r){const t=e.GaO();e.yG2(4),e.oRS(" ",e.kDX(5,1,e.kDX(6,3,t.cancelledState))," ")}}class te{constructor(n){this.elementRef=n,this.active$=new He.g(!1),this.activeTarget$=new He.g(!1),this.isCancellable=!1,this.cancelledState="Cancelled"}ngOnChanges(n){this.isCancellable=!!this.node.to.find(t=>"Cancelled"===t.name),n.active&&this.active$.next(this.active)}getPos(n="top"){this.elementRef.nativeElement.getBoundingClientRect();const o=this.elementRef.nativeElement.querySelector(".node")?.getBoundingClientRect().height??0;return{x:10,y:this.index*Je+("bottom"===n?o:0)}}getStyle(){const n=this.getPos();return{"top.px":n.y,"left.px":n.x}}static#e=this.\u0275fac=function(t){return new(t||te)(e.GI1(e.GMv))};static#t=this.\u0275cmp=e.In1({type:te,selectors:[["vdr-order-process-node"]],inputs:{node:"node",index:"index",active:"active"},features:[e.SYr],decls:8,vars:15,consts:[[1,"node-wrapper",3,"ngStyle"],[1,"node"],["class","cancelled-wrapper",4,"ngIf"],[1,"cancelled-wrapper"],[1,"cancelled-edge"],["shape","dot-circle"],[1,"cancelled-node"]],template:function(t,o){1&t&&(e.I0R(0,"div",0),e.wVc(1,"async"),e.I0R(2,"div",1),e.wVc(3,"async"),e.OEk(4),e.wVc(5,"translate"),e.wVc(6,"stateI18nToken"),e.C$Y(),e.yuY(7,xo,7,5,"div",2),e.C$Y()),2&t&&(e.eAK("active",e.kDX(1,7,o.active$)),e.E7m("ngStyle",o.getStyle()),e.yG2(2),e.eAK("active-target",e.kDX(3,9,o.activeTarget$)),e.yG2(2),e.oRS(" ",e.kDX(5,11,e.kDX(6,13,o.node.name))," "),e.yG2(3),e.E7m("ngIf",o.isCancellable))},dependencies:[_.o3d,m.u_,m.Qt,m.a,p.sD,$.Q],styles:["[_nghost-%COMP%]{display:block}.node-wrapper[_ngcontent-%COMP%]{position:absolute;z-index:1;display:flex;align-items:center}.node[_ngcontent-%COMP%]{display:inline-block;border:2px solid var(--color-component-border-200);border-radius:3px;padding:3px 6px;z-index:1;background-color:var(--color-component-bg-100);opacity:.7;transition:opacity .2s,background-color .2s,color .2s;cursor:default}.node.active-target[_ngcontent-%COMP%]{border-color:var(--color-primary-500);opacity:.9}.cancelled-wrapper[_ngcontent-%COMP%]{display:flex;align-items:center;color:var(--color-grey-300);transition:color .2s,opacity .2s;opacity:.7}.cancelled-edge[_ngcontent-%COMP%]{width:48px;height:2px;background-color:var(--color-component-bg-300);transition:background-color .2s}clr-icon[_ngcontent-%COMP%]{margin-inline-start:-1px}.cancelled-node[_ngcontent-%COMP%]{margin-inline-start:6px}.active[_ngcontent-%COMP%] .cancelled-wrapper[_ngcontent-%COMP%]{opacity:1}.active[_ngcontent-%COMP%] .node[_ngcontent-%COMP%]{opacity:1;background-color:var(--color-primary-600);border-color:var(--color-primary-600);color:var(--color-primary-100)}.active[_ngcontent-%COMP%] .cancelled-wrapper[_ngcontent-%COMP%]{color:var(--color-error-500)}.active[_ngcontent-%COMP%] .cancelled-edge[_ngcontent-%COMP%]{background-color:var(--color-error-500)}"],changeDetection:0})}class Oe{ngOnInit(){this.active$=this.from.active$.asObservable().pipe((0,de.y)(n=>this.to.activeTarget$.next(n)))}getStyle(){const n=this.from.index<this.to.index?"down":"up",t=this.from.getPos("down"===n?"bottom":"top"),o=this.to.getPos("down"===n?"top":"bottom"),i=Math.abs(t.x-o.x),a=Math.abs(t.y-o.y),c=Math.sqrt(i**2+a**2);return{"top.px":t.y,"left.px":t.x+("down"===n?10:40)+12*this.index,"height.px":c,"width.px":1,..."up"===n?{transform:"rotateZ(180deg)","transform-origin":"top"}:{}}}static#e=this.\u0275fac=function(t){return new(t||Oe)};static#t=this.\u0275cmp=e.In1({type:Oe,selectors:[["vdr-order-process-edge"]],inputs:{from:"from",to:"to",index:"index"},decls:3,vars:7,consts:[[1,"edge",3,"ngStyle"],["shape","arrow","flip","vertical",1,"arrow"]],template:function(t,o){1&t&&(e.I0R(0,"div",0),e.wVc(1,"async"),e.wR5(2,"clr-icon",1),e.C$Y()),2&t&&(e.eAK("active",e.kDX(1,5,o.active$)),e.E7m("ngStyle",o.getStyle()),e.e48("data-from",o.from.node.name)("data-to",o.to.node.name))},dependencies:[_.o3d,m.Qt,m.a],styles:[".edge[_ngcontent-%COMP%]{position:absolute;border:1px solid var(--color-component-border-200);background-color:var(--color-component-bg-300);opacity:.3;transition:border .2s,opacity .2s,background-color .2s}.edge.active[_ngcontent-%COMP%]{border-color:var(--color-primary-500);background-color:var(--color-primary-500);opacity:1}.edge.active[_ngcontent-%COMP%] .arrow[_ngcontent-%COMP%]{color:var(--color-primary-500)}.edge[_ngcontent-%COMP%] .arrow[_ngcontent-%COMP%]{position:absolute;bottom:-4px;left:-8px;color:var(--color-grey-300)}"],changeDetection:0})}function Fo(r,n){if(1&r){const t=e.KQA();e.SAx(0),e.I0R(1,"vdr-order-process-node",1),e.qCj("mouseenter",function(){const a=e.usT(t).$implicit,c=e.GaO();return e.CGJ(c.onMouseOver(a.name))})("mouseleave",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.onMouseOut())}),e.wVc(2,"async"),e.C$Y(),e.k70()}if(2&r){const t=n.$implicit,o=n.index,i=e.GaO();e.yG2(),e.E7m("node",t)("index",o)("active",e.kDX(2,3,i.activeState$)===t.name)}}function $o(r,n){if(1&r&&(e.SAx(0),e.wR5(1,"vdr-order-process-edge",2),e.k70()),2&r){const t=n.$implicit;e.yG2(),e.E7m("from",t.from)("to",t.to)("index",t.index)}}class ve{constructor(n){this.changeDetector=n,this.setActiveState$=new He.g(void 0),this.nodes=[],this.edges=[]}get outerHeight(){return this.nodes.length*Je}ngOnInit(){this.setActiveState$.next(this.initialState),this.activeState$=this.setActiveState$.pipe((0,Ne.o)(150))}ngOnChanges(n){this.populateNodes()}ngAfterViewInit(){setTimeout(()=>this.populateEdges())}onMouseOver(n){this.setActiveState$.next(n)}onMouseOut(){this.setActiveState$.next(this.initialState)}getNodeFor(n){if(this.nodeComponents)return this.nodeComponents.find(t=>t.node.name===n)}populateNodes(){const n=new Map;for(const t of this.states)n.set(t.name,{name:t.name,to:[]});for(const[t,o]of n.entries()){const i=this.states.find(a=>a.name===t)?.to??[];for(const a of i){const c=n.get(a);c&&o.to.push(c)}}this.nodes=[...n.values()].filter(t=>"Cancelled"!==t.name)}populateEdges(){for(const n of this.nodes){const t=this.getNodeFor(n.name);let o=0;for(const i of n.to){const a=this.getNodeFor(i.name);t&&a&&t!==a&&(this.edges.push({to:a,from:t,index:o}),o++)}}this.edges=[...this.edges],this.changeDetector.markForCheck()}static#e=this.\u0275fac=function(t){return new(t||ve)(e.GI1(e.kD9))};static#t=this.\u0275cmp=e.In1({type:ve,selectors:[["vdr-order-process-graph"]],viewQuery:function(t,o){if(1&t&&e.CC$(te,5),2&t){let i;e.wto(i=e.Gqi())&&(o.nodeComponents=i)}},hostVars:2,hostBindings:function(t,o){2&t&&e.m4B("height",o.outerHeight,"px")},inputs:{states:"states",initialState:"initialState"},features:[e.SYr],decls:2,vars:2,consts:[[4,"ngFor","ngForOf"],[3,"node","index","active","mouseenter","mouseleave"],[3,"from","to","index"]],template:function(t,o){1&t&&e.yuY(0,Fo,3,5,"ng-container",0)(1,$o,2,3,"ng-container",0),2&t&&(e.E7m("ngForOf",o.nodes),e.yG2(),e.E7m("ngForOf",o.edges))},dependencies:[m.ay,te,Oe,m.a],styles:["[_nghost-%COMP%]{display:block;border:1px hotpink;margin:20px;padding:12px;position:relative}.state-row[_ngcontent-%COMP%]{display:flex}"],changeDetection:0})}function Mo(r,n){1&r&&(e.OEk(0),e.wVc(1,"translate")),2&r&&e.cNF(e.kDX(1,1,"order.order-state-diagram"))}class be{constructor(n){this.serverConfigService=n,this.states=[]}ngOnInit(){this.states=this.serverConfigService.getOrderProcessStates()}static#e=this.\u0275fac=function(t){return new(t||be)(e.GI1(d.ctz))};static#t=this.\u0275cmp=e.In1({type:be,selectors:[["vdr-order-process-graph-dialog"]],decls:2,vars:2,consts:[["vdrDialogTitle",""],[3,"states","initialState"]],template:function(t,o){1&t&&(e.yuY(0,Mo,2,3,"ng-template",0),e.wR5(1,"vdr-order-process-graph",1)),2&t&&(e.yG2(),e.E7m("states",o.states)("initialState",o.activeState))},dependencies:[b.a,ve,p.sD],changeDetection:0})}var Be=s(3412),We=s(6644),Yo=s(7288);function Po(r,n){if(1&r){const t=e.KQA();e.I0R(0,"vdr-select-toggle",6),e.iHE("selectedChange",function(i){e.usT(t);const a=e.GaO().$implicit;return e.kNx(a.selected,i)||(a.selected=i),e.CGJ(i)}),e.qCj("selectedChange",function(i){e.usT(t);const a=e.GaO().$implicit,c=e.GaO();return e.CGJ(c.paymentSelected.emit({payment:a,selected:i}))}),e.wVc(1,"translate"),e.wVc(2,"translate"),e.C$Y()}if(2&r){const t=e.GaO().$implicit,o=e.GaO();e.E7m("title",e.kDX(1,4,"order.refund-this-payment"))("label",e.kDX(2,6,"order.refund-this-payment"))("disabled",1===o.refundablePayments.length),e.OKB("selected",t.selected)}}function Ao(r,n){if(1&r&&(e.I0R(0,"vdr-card",1),e.wVc(1,"translate"),e.yuY(2,Po,3,8,"ng-template",2),e.I0R(3,"div",3)(4,"vdr-labeled-data",4),e.wVc(5,"translate"),e.OEk(6),e.C$Y(),e.I0R(7,"vdr-labeled-data",4),e.wVc(8,"translate"),e.OEk(9),e.C$Y(),e.I0R(10,"vdr-labeled-data",4),e.wVc(11,"translate"),e.OEk(12),e.wVc(13,"localeCurrency"),e.C$Y(),e.I0R(14,"vdr-labeled-data",4),e.wVc(15,"translate"),e.OEk(16),e.wVc(17,"localeCurrency"),e.C$Y()(),e.I0R(18,"vdr-form-field",4),e.wVc(19,"translate"),e.wR5(20,"vdr-currency-input",5),e.C$Y()()),2&r){const t=n.$implicit,o=e.GaO();e.eAK("selected",t.selected)("unselected",!t.selected),e.E7m("title",e.kDX(1,17,"order.payment")),e.yG2(4),e.E7m("label",e.kDX(5,19,"order.payment-method")),e.yG2(2),e.oRS(" ",t.method," "),e.yG2(),e.E7m("label",e.kDX(8,21,"order.transaction-id")),e.yG2(2),e.oRS(" ",t.transactionId," "),e.yG2(),e.E7m("label",e.kDX(11,23,"order.payment-amount")),e.yG2(2),e.oRS(" ",e.g7$(13,25,t.amount,o.order.currencyCode)," "),e.yG2(2),e.E7m("label",e.kDX(15,28,"order.refundable-amount")),e.yG2(2),e.oRS(" ",e.g7$(17,30,t.refundableAmount,o.order.currencyCode)," "),e.yG2(2),e.E7m("label",e.kDX(19,33,"order.refund-amount")),e.yG2(2),e.E7m("readonly",!t.selected)("currencyCode",o.order.currencyCode)("formControl",t.amountToRefundControl)}}class ne{constructor(){this.paymentSelected=new e._w7}static#e=this.\u0275fac=function(t){return new(t||ne)};static#t=this.\u0275cmp=e.In1({type:ne,selectors:[["vdr-payment-for-refund-selector"]],inputs:{refundablePayments:"refundablePayments",order:"order"},outputs:{paymentSelected:"paymentSelected"},decls:1,vars:1,consts:[[3,"title","selected","unselected",4,"ngFor","ngForOf"],[3,"title"],["vdrCardControls",""],[1,"form-grid"],[3,"label"],[3,"readonly","currencyCode","formControl"],["size","small",3,"title","label","disabled","selected","selectedChange"]],template:function(t,o){1&t&&e.yuY(0,Ao,21,35,"vdr-card",0),2&t&&e.E7m("ngForOf",o.refundablePayments)},dependencies:[m.ay,l.ue,l.ug,Be.Y,P._,C.w,Yo.u,O.a,G.u,G.M,p.sD,g.u],styles:["[_nghost-%COMP%]{display:block}"]})}function Vo(r,n){1&r&&(e.OEk(0),e.wVc(1,"translate")),2&r&&e.cNF(e.kDX(1,1,"order.refund-and-cancel-order"))}function No(r,n){if(1&r&&e.OEk(0),2&r){const t=n.item;e.oRS(" ",t.id," ")}}function Xo(r,n){if(1&r&&(e.OEk(0),e.wVc(1,"localeDate")),2&r){const t=n.item;e.oRS(" ",e.g7$(1,1,t.createdAt,"short")," ")}}function Lo(r,n){if(1&r&&(e.OEk(0),e.wVc(1,"localeDate")),2&r){const t=n.item;e.oRS(" ",e.g7$(1,1,t.updatedAt,"short")," ")}}function jo(r,n){if(1&r&&(e.wR5(0,"img",26),e.wVc(1,"assetPreview")),2&r){const t=n.ngIf;e.E7m("src",e.g7$(1,1,t,"tiny"),e.K6U)}}function Qo(r,n){1&r&&(e.I0R(0,"div",27),e.wR5(1,"clr-icon",28),e.C$Y())}function Ko(r,n){if(1&r&&(e.I0R(0,"div",23),e.yuY(1,jo,2,4,"img",24)(2,Qo,2,0,"ng-template",null,25,e.gJz),e.C$Y()),2&r){const t=n.item,o=e.Gew(3);e.yG2(),e.E7m("ngIf",t.featuredAsset)("ngIfElse",o)}}function qo(r,n){if(1&r&&e.OEk(0),2&r){const t=n.item;e.oRS(" ",t.productVariant.name," ")}}function Ho(r,n){if(1&r&&e.OEk(0),2&r){const t=n.item;e.oRS(" ",t.productVariant.sku," ")}}function Jo(r,n){if(1&r&&(e.OEk(0),e.wVc(1,"localeCurrency")),2&r){const t=n.item,o=e.GaO();e.oRS(" ",e.g7$(1,1,t.unitPriceWithTax,o.order.currencyCode)," ")}}function Bo(r,n){if(1&r&&(e.I0R(0,"div",34),e.OEk(1),e.I0R(2,"div",35),e.OEk(3),e.wVc(4,"currency"),e.wVc(5,"number"),e.C$Y()()),2&r){const t=n.$implicit,o=e.GaO(3).item,i=e.GaO();e.yG2(),e.oRS(" ",t.description," "),e.yG2(2),e.oRS(" ",e.g7$(4,2,e.g7$(5,5,t.amount/100/o.quantity,"1.0-2"),i.order.currencyCode)," ")}}function Wo(r,n){if(1&r&&(e.I0R(0,"vdr-dropdown")(1,"div",30)(2,"button",31),e.wR5(3,"clr-icon",32),e.C$Y()(),e.I0R(4,"vdr-dropdown-menu"),e.yuY(5,Bo,6,8,"div",33),e.C$Y()()),2&r){const t=e.GaO().ngIf;e.yG2(5),e.E7m("ngForOf",t)}}function Uo(r,n){if(1&r&&(e.SAx(0),e.yuY(1,Wo,6,1,"vdr-dropdown",29),e.k70()),2&r){const t=n.ngIf;e.yG2(),e.E7m("ngIf",t.length)}}function zo(r,n){if(1&r&&(e.OEk(0),e.wVc(1,"localeCurrency"),e.yuY(2,Uo,2,1,"ng-container",29)),2&r){const t=n.item,o=e.GaO();e.oRS(" ",e.g7$(1,2,t.unitPriceWithTax,o.order.currencyCode)," "),e.yG2(2),e.E7m("ngIf",t.discounts)}}function Zo(r,n){if(1&r&&(e.OEk(0),e.wR5(1,"vdr-line-refunds",36)),2&r){const t=n.item,o=e.GaO();e.oRS(" ",t.quantity," "),e.yG2(),e.E7m("line",t)("payments",o.order.payments)}}function ei(r,n){if(1&r){const t=e.KQA();e.I0R(0,"input",38),e.qCj("ngModelChange",function(i){e.usT(t);const a=e.GaO().item,c=e.GaO();return e.CGJ(c.onRefundQuantityChange(a.id,i))}),e.C$Y()}if(2&r){const t=e.GaO().item,o=e.GaO();e.E7m("ngModel",o.lineQuantities[t.id].quantity)("max",t.quantity)}}function ti(r,n){if(1&r&&e.yuY(0,ei,1,2,"input",37),2&r){const t=n.item,o=e.GaO();e.E7m("ngIf",o.lineCanBeRefundedOrCancelled(t))}}function ni(r,n){if(1&r){const t=e.KQA();e.I0R(0,"input",43),e.iHE("ngModelChange",function(i){e.usT(t);const a=e.GaO().item,c=e.GaO();return e.kNx(c.lineQuantities[a.id].cancel,i)||(c.lineQuantities[a.id].cancel=i),e.CGJ(i)}),e.C$Y()}if(2&r){const t=e.GaO().item,o=e.GaO();e.E7m("disabled",0===o.lineQuantities[t.id].quantity),e.OKB("ngModel",o.lineQuantities[t.id].cancel)}}function ri(r,n){if(1&r&&(e.I0R(0,"div",39)(1,"label",40),e.yuY(2,ni,1,2,"input",41),e.I0R(3,"span",42),e.OEk(4),e.wVc(5,"translate"),e.C$Y()()()),2&r){const t=n.item,o=e.GaO();e.yG2(2),e.E7m("ngIf",o.lineCanBeRefundedOrCancelled(t)),e.yG2(2),e.cNF(e.kDX(5,2,"order.return-to-stock"))}}function oi(r,n){if(1&r){const t=e.KQA();e.I0R(0,"label",44)(1,"input",45),e.qCj("change",function(){const a=e.usT(t).$implicit,c=e.GaO();return e.CGJ(c.toggleShippingRefund(a.id))}),e.C$Y(),e.I0R(2,"div",42),e.OEk(3),e.wVc(4,"translate"),e.I0R(5,"span"),e.OEk(6),e.C$Y(),e.I0R(7,"span",42),e.OEk(8),e.wVc(9,"localeCurrency"),e.C$Y()()()}if(2&r){const t=n.$implicit,o=e.GaO();e.yG2(3),e.oRS(" ",e.kDX(4,3,"order.refund-shipping")," "),e.yG2(3),e.oRS("",t.shippingMethod.name,":"),e.yG2(2),e.oRS("",e.g7$(9,5,t.discountedPriceWithTax,o.order.currencyCode)," ")}}const ii=(r,n)=>({min:r,max:n});function ai(r,n){if(1&r&&(e.I0R(0,"clr-alert",51)(1,"clr-alert-item"),e.OEk(2),e.wVc(3,"translate"),e.wVc(4,"currency"),e.wVc(5,"localeCurrency"),e.C$Y()()),2&r){const t=e.GaO(2);e.E7m("clrAlertType","danger")("clrAlertClosable",!1),e.yG2(2),e.oRS(" ",e.g7$(3,3,"order.refund-total-error",e.IBC(12,ii,e.g7$(4,6,0,t.order.currencyCode),e.g7$(5,9,t.totalRefundableAmount,t.order.currencyCode)))," ")}}function li(r,n){1&r&&(e.I0R(0,"clr-alert",51)(1,"clr-alert-item"),e.OEk(2),e.wVc(3,"translate"),e.C$Y()()),2&r&&(e.E7m("clrAlertType","danger")("clrAlertClosable",!1),e.yG2(2),e.oRS(" ",e.kDX(3,3,"order.refund-total-warning")," "))}function di(r,n){1&r&&(e.I0R(0,"clr-alert",51)(1,"clr-alert-item"),e.OEk(2),e.wVc(3,"translate"),e.C$Y()()),2&r&&(e.E7m("clrAlertType","danger")("clrAlertClosable",!1),e.yG2(2),e.oRS(" ",e.kDX(3,3,"order.refund-cancellation-reason-required")," "))}const si=r=>({amount:r});function ci(r,n){if(1&r){const t=e.KQA();e.I0R(0,"div")(1,"div",46),e.yuY(2,ai,6,15,"clr-alert",47)(3,li,4,5,"clr-alert",47)(4,di,4,5,"clr-alert",47),e.C$Y(),e.I0R(5,"div",48)(6,"button",49),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.cancel())}),e.OEk(7),e.wVc(8,"translate"),e.C$Y(),e.I0R(9,"button",50),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.select())}),e.OEk(10),e.wVc(11,"translate"),e.wVc(12,"localeCurrency"),e.C$Y()()()}if(2&r){const t=e.GaO();e.yG2(2),e.E7m("ngIf",t.refundTotal<0||t.totalRefundableAmount<t.refundTotal),e.yG2(),e.E7m("ngIf",t.amountToRefundTotal<t.refundTotal||t.refundTotal<t.amountToRefundTotal),e.yG2(),e.E7m("ngIf",t.amountToRefundTotal&&!t.reason),e.yG2(3),e.cNF(e.kDX(8,6,"common.cancel")),e.yG2(2),e.E7m("disabled",!t.canSubmit()),e.yG2(),e.oRS(" ",e.g7$(11,8,"order.refund-with-amount",e.S45(14,si,e.g7$(12,11,t.amountToRefundTotal,t.order.currencyCode)))," ")}}class Ie{constructor(n){this.i18nService=n,this.lineQuantities={},this.refundablePayments=[],this.refundShippingLineIds=[],this.reasons=(0,d.g$r)().cancellationReasons??[(0,u.s)("order.refund-reason-customer-request"),(0,u.s)("order.refund-reason-not-available")],this.manuallySetRefundTotal=!1,this.refundTotal=0,this.reasons=this.reasons.map(t=>this.i18nService.translate(t))}get totalRefundableAmount(){return(0,h.summate)(this.refundablePayments,"refundableAmount")}get amountToRefundTotal(){return this.refundablePayments.reduce((n,t)=>n+t.amountToRefundControl.value,0)}lineCanBeRefundedOrCancelled(n){return(this.order.payments?.reduce((o,i)=>[...o,...i.refunds],[]).filter(o=>"Failed"!==o.state).reduce((o,i)=>[...o,...i.lines],[]).filter(o=>o.orderLineId===n.id).reduce((o,i)=>o+i.quantity,0)??0)<n.orderPlacedQuantity}ngOnInit(){this.lineQuantities=this.order.lines.reduce((n,t)=>({...n,[t.id]:{quantity:0,refund:!0,cancel:!1}}),{}),this.refundablePayments=Ve(this.order.payments)}updateRefundTotal(){if(!this.manuallySetRefundTotal){const o=this.order.lines.reduce((a,c)=>{const ze=this.lineQuantities[c.id].quantity||0;return a+c.proratedUnitPriceWithTax*ze},0),i=this.order.shippingLines.reduce((a,c)=>this.refundShippingLineIds.includes(c.id)?a+c.discountedPriceWithTax:a,0);this.refundTotal=o+i}const n=this.refundablePayments.filter(o=>o.selected);let t=0;for(const o of n){const i=Math.min(o.refundableAmount,this.refundTotal-t);o.amountToRefundControl.setValue(i),t+=i}}toggleShippingRefund(n){const t=this.refundShippingLineIds.indexOf(n);-1===t?this.refundShippingLineIds.push(n):this.refundShippingLineIds.splice(t,1),this.updateRefundTotal()}onRefundQuantityChange(n,t){this.manuallySetRefundTotal=!1;const o=this.lineQuantities[n];if(o){const i=o.quantity;0===t?o.cancel=!1:0===i&&t>0&&(o.cancel=!0),o.quantity=t,this.updateRefundTotal()}}onPaymentSelected(n,t){if(t){const o=this.refundTotal-this.refundablePayments.filter(i=>i.id!==n.id).reduce((i,a)=>i+a.amountToRefundControl.value,0);0<o&&n.amountToRefundControl.setValue(Math.min(o,n.refundableAmount))}else n.amountToRefundControl.setValue(0)}isRefunding(){return Object.values(this.lineQuantities).reduce((t,o)=>t||0<o.quantity,!1)}isCancelling(){return Object.values(this.lineQuantities).reduce((t,o)=>t||0<o.quantity&&o.cancel,!1)}canSubmit(){return 0<this.refundTotal&&this.amountToRefundTotal===this.refundTotal&&!!this.reason}select(){const n=this.getOrderLineInput(()=>!0),t=this.getOrderLineInput(o=>o.cancel);this.resolveWith({refunds:this.refundablePayments.filter(o=>o.selected&&0<o.amountToRefundControl.value).map(o=>({lines:n,reason:this.reason,paymentId:o.id,amount:o.amountToRefundControl.value,shipping:0,adjustment:0})),cancel:{lines:t,orderId:this.order.id,reason:this.reason,cancelShipping:this.refundShippingLineIds.length>0}})}cancel(){this.resolveWith()}getOrderLineInput(n){return Object.entries(this.lineQuantities).filter(([t,o])=>0<o.quantity&&n(o)).map(([t,o])=>({orderLineId:t,quantity:o.quantity}))}static#e=this.\u0275fac=function(t){return new(t||Ie)(e.GI1(d.WYg))};static#t=this.\u0275cmp=e.In1({type:Ie,selectors:[["vdr-refund-order-dialog"]],decls:50,vars:60,consts:[["vdrDialogTitle",""],[1,"refund-wrapper"],["id","refund-order",3,"items"],["id","id",3,"heading","hiddenByDefault"],["id","created-at",3,"heading","hiddenByDefault"],["id","updated-at",3,"heading","hiddenByDefault"],["id","image",3,"heading"],["id","product-name",3,"heading","optional"],["id","product-sku",3,"heading"],["id","unit-price",3,"heading","hiddenByDefault"],["id","prorated-unit-price",3,"heading"],["id","quantity",3,"heading"],["id","refund-quantity",3,"heading","optional"],["id","cancel",3,"heading","optional"],[1,"refund-details","mt-4"],["class","flex mb-2",4,"ngFor","ngForOf"],[1,"mb-2",3,"label"],["bindLabel","name","autofocus","","bindValue","id",3,"items","placeholder","addTag","ngModel","ngModelChange"],[3,"label","readOnlyToggle","readOnlyToggleChange"],[3,"readonly","currencyCode","ngModel","ngModelChange"],[1,""],[3,"refundablePayments","order","paymentSelected"],["vdrDialogButtons",""],[1,"image-placeholder"],[3,"src",4,"ngIf","ngIfElse"],["imagePlaceholder",""],[3,"src"],[1,"placeholder"],["shape","image","size","48"],[4,"ngIf"],["vdrDropdownTrigger","",1,"promotions-label"],[1,"icon-button"],["shape","info"],["class","line-promotion",4,"ngFor","ngForOf"],[1,"line-promotion"],[1,"promotion-amount"],[3,"line","payments"],["type","number","min","0",3,"ngModel","max","ngModelChange",4,"ngIf"],["type","number","min","0",3,"ngModel","max","ngModelChange"],[1,"cancel-checkbox-wrapper"],[1,"flex","center"],["type","checkbox","clrCheckbox","",3,"disabled","ngModel","ngModelChange",4,"ngIf"],[1,"ml-1"],["type","checkbox","clrCheckbox","",3,"disabled","ngModel","ngModelChange"],[1,"flex","mb-2"],["type","checkbox","clrCheckbox","",3,"change"],[1,"errors"],[3,"clrAlertType","clrAlertClosable",4,"ngIf"],[1,"modal-buttons"],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"disabled","click"],[3,"clrAlertType","clrAlertClosable"]],template:function(t,o){1&t&&(e.yuY(0,Vo,2,3,"ng-template",0),e.I0R(1,"div",1)(2,"vdr-data-table-2",2)(3,"vdr-dt2-column",3),e.wVc(4,"translate"),e.yuY(5,No,1,1,"ng-template"),e.C$Y(),e.I0R(6,"vdr-dt2-column",4),e.wVc(7,"translate"),e.yuY(8,Xo,2,4,"ng-template"),e.C$Y(),e.I0R(9,"vdr-dt2-column",5),e.wVc(10,"translate"),e.yuY(11,Lo,2,4,"ng-template"),e.C$Y(),e.I0R(12,"vdr-dt2-column",6),e.wVc(13,"translate"),e.yuY(14,Ko,4,2,"ng-template"),e.C$Y(),e.I0R(15,"vdr-dt2-column",7),e.wVc(16,"translate"),e.yuY(17,qo,1,1,"ng-template"),e.C$Y(),e.I0R(18,"vdr-dt2-column",8),e.wVc(19,"translate"),e.yuY(20,Ho,1,1,"ng-template"),e.C$Y(),e.I0R(21,"vdr-dt2-column",9),e.wVc(22,"translate"),e.yuY(23,Jo,2,4,"ng-template"),e.C$Y(),e.I0R(24,"vdr-dt2-column",10),e.wVc(25,"translate"),e.yuY(26,zo,3,5,"ng-template"),e.C$Y(),e.I0R(27,"vdr-dt2-column",11),e.wVc(28,"translate"),e.yuY(29,Zo,2,3,"ng-template"),e.C$Y(),e.I0R(30,"vdr-dt2-column",12),e.wVc(31,"translate"),e.yuY(32,ti,1,1,"ng-template"),e.C$Y(),e.I0R(33,"vdr-dt2-column",13),e.wVc(34,"translate"),e.yuY(35,ri,6,4,"ng-template"),e.C$Y()(),e.I0R(36,"div",14)(37,"div")(38,"vdr-card"),e.yuY(39,oi,10,8,"label",15),e.I0R(40,"vdr-form-field",16),e.wVc(41,"translate"),e.I0R(42,"ng-select",17),e.iHE("ngModelChange",function(a){return e.kNx(o.reason,a)||(o.reason=a),a}),e.wVc(43,"translate"),e.C$Y()(),e.I0R(44,"vdr-form-field",18),e.qCj("readOnlyToggleChange",function(a){return o.manuallySetRefundTotal=!a}),e.wVc(45,"translate"),e.I0R(46,"vdr-currency-input",19),e.iHE("ngModelChange",function(a){return e.kNx(o.refundTotal,a)||(o.refundTotal=a),a}),e.qCj("ngModelChange",function(){return o.updateRefundTotal()}),e.C$Y()()()(),e.I0R(47,"div",20)(48,"vdr-payment-for-refund-selector",21),e.qCj("paymentSelected",function(a){return o.onPaymentSelected(a.payment,a.selected)}),e.C$Y()()()(),e.yuY(49,ci,13,16,"ng-template",22)),2&t&&(e.yG2(2),e.E7m("items",o.order.lines),e.yG2(),e.E7m("heading",e.kDX(4,32,"common.id"))("hiddenByDefault",!0),e.yG2(3),e.E7m("heading",e.kDX(7,34,"common.created-at"))("hiddenByDefault",!0),e.yG2(3),e.E7m("heading",e.kDX(10,36,"common.updated-at"))("hiddenByDefault",!0),e.yG2(3),e.E7m("heading",e.kDX(13,38,"common.image")),e.yG2(3),e.E7m("heading",e.kDX(16,40,"order.product-name"))("optional",!1),e.yG2(3),e.E7m("heading",e.kDX(19,42,"order.product-sku")),e.yG2(3),e.E7m("heading",e.kDX(22,44,"order.unit-price"))("hiddenByDefault",!0),e.yG2(3),e.E7m("heading",e.kDX(25,46,"order.prorated-unit-price")),e.yG2(3),e.E7m("heading",e.kDX(28,48,"order.quantity")),e.yG2(3),e.E7m("heading",e.kDX(31,50,"order.refund"))("optional",!1),e.yG2(3),e.E7m("heading",e.kDX(34,52,"order.return-to-stock"))("optional",!1),e.yG2(6),e.E7m("ngForOf",o.order.shippingLines),e.yG2(),e.E7m("label",e.kDX(41,54,"order.refund-cancellation-reason")),e.yG2(2),e.E7m("items",o.reasons)("placeholder",e.kDX(43,56,"order.refund-cancellation-reason-required"))("addTag",!0),e.OKB("ngModel",o.reason),e.yG2(2),e.E7m("label",e.kDX(45,58,"order.refund-total"))("readOnlyToggle",!0),e.yG2(2),e.E7m("readonly",!o.manuallySetRefundTotal)("currencyCode",o.order.currencyCode),e.OKB("ngModel",o.refundTotal),e.yG2(2),e.E7m("refundablePayments",o.refundablePayments)("order",o.order))},dependencies:[_.c0g,_.KMj,_.o3d,_.ojz,_.y6l,m.ay,m.u_,l.ot,l.O4,l.SU,l.ue,l.Gu,l._t,l._G,S.UT,Be.Y,P._,C.w,E.E,b.a,B.i,W.m,U.q,We.q,Pe.M,G.u,V,ne,m.hl,m.cf,p.sD,j.w,A.m,g.u],styles:["[_nghost-%COMP%]{height:100%;display:flex;flex-direction:column;min-height:64vh}.refund-wrapper[_ngcontent-%COMP%]{flex:1;flex-direction:column}.refund-wrapper[_ngcontent-%COMP%] .order-table[_ngcontent-%COMP%]{flex:1;overflow-y:auto}.refund-wrapper[_ngcontent-%COMP%] .order-table[_ngcontent-%COMP%] table[_ngcontent-%COMP%]{margin-top:0}.refund-wrapper[_ngcontent-%COMP%] tr.ignore[_ngcontent-%COMP%]{color:var(--color-grey-300)} .refund-wrapper .table-wrapper{max-width:initial!important}.quantity-col[_ngcontent-%COMP%]{background-color:var(--color-warning-100)}.cancel-checkbox-wrapper[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center}clr-checkbox-wrapper[_ngcontent-%COMP%]{margin-top:12px;margin-bottom:12px;display:block}.refund-details[_ngcontent-%COMP%]{display:flex;flex-direction:column;padding-bottom:var(--space-unit);gap:calc(var(--space-unit) * 2);justify-content:space-between}@media screen and (min-width: 992px){.refund-details[_ngcontent-%COMP%]{flex-direction:row}}.refund-details[_ngcontent-%COMP%] vdr-card.unselected[_ngcontent-%COMP%]{opacity:.8}.refund-details[_ngcontent-%COMP%] > *[_ngcontent-%COMP%]{flex:1}.errors[_ngcontent-%COMP%]{display:flex;justify-content:flex-end;gap:calc(var(--space-unit) * 2);margin:calc(var(--space-unit) * 2) 0}.prorated-wrapper[_ngcontent-%COMP%]{display:flex;justify-content:center}.line-promotion[_ngcontent-%COMP%]{display:flex;justify-content:space-between;font-size:12px;padding:3px 6px}.line-promotion[_ngcontent-%COMP%] .promotion-amount[_ngcontent-%COMP%]{margin-inline-start:12px}vdr-card.faded[_ngcontent-%COMP%]{opacity:.8}.modal-buttons[_ngcontent-%COMP%]{display:flex;justify-content:flex-end;gap:.6rem;gap:var(--clr-modal-footer-gap, .6rem)}"],changeDetection:0})}function mi(r,n){1&r&&(e.OEk(0),e.wVc(1,"translate")),2&r&&e.cNF(e.kDX(1,1,"order.settle-refund"))}function ui(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",4),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.cancel())}),e.OEk(1),e.wVc(2,"translate"),e.C$Y(),e.I0R(3,"button",5),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.submit())}),e.OEk(4),e.wVc(5,"translate"),e.C$Y()}if(2&r){const t=e.GaO();e.yG2(),e.cNF(e.kDX(2,3,"common.cancel")),e.yG2(2),e.E7m("disabled",!t.transactionId),e.yG2(),e.oRS(" ",e.kDX(5,5,"order.settle-refund")," ")}}const _i=r=>({method:r});class Ge{constructor(){this.transactionId=""}submit(){this.resolveWith(this.transactionId)}cancel(){this.resolveWith()}static#e=this.\u0275fac=function(t){return new(t||Ge)};static#t=this.\u0275cmp=e.In1({type:Ge,selectors:[["vdr-settle-refund-dialog"]],decls:10,vars:10,consts:[["vdrDialogTitle",""],[1,"instruction"],["clrInput","","name","transactionId",3,"ngModel","ngModelChange"],["vdrDialogButtons",""],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"disabled","click"]],template:function(t,o){1&t&&(e.yuY(0,mi,2,3,"ng-template",0),e.I0R(1,"p",1),e.OEk(2),e.wVc(3,"translate"),e.C$Y(),e.I0R(4,"clr-input-container")(5,"label"),e.OEk(6),e.wVc(7,"translate"),e.C$Y(),e.I0R(8,"input",2),e.iHE("ngModelChange",function(a){return e.kNx(o.transactionId,a)||(o.transactionId=a),a}),e.C$Y()(),e.yuY(9,ui,6,7,"ng-template",3)),2&t&&(e.yG2(2),e.oRS(" ",e.g7$(3,3,"order.settle-refund-manual-instructions",e.S45(8,_i,o.refund.method)),"\n"),e.yG2(4),e.cNF(e.kDX(7,6,"order.transaction-id")),e.yG2(2),e.OKB("ngModel",o.transactionId))},dependencies:[_.ojz,_.Ga0,_.UJB,l.ot,l.ue,l._G,C.w,E.E,b.a,p.sD],styles:["[_nghost-%COMP%]{padding-bottom:32px}.instruction[_ngcontent-%COMP%]{margin-top:0;margin-bottom:24px}"],changeDetection:0})}var gt=s(4204);function pi(r,n){1&r&&e.wR5(0,"clr-icon",2)}class Ee{get chipColorType(){switch(this.state){case"Authorized":return"warning";case"Settled":return"success";case"Declined":case"Cancelled":return"error"}}static#e=this.\u0275fac=function(t){return new(t||Ee)};static#t=this.\u0275cmp=e.In1({type:Ee,selectors:[["vdr-payment-state-label"]],inputs:{state:"state"},decls:6,vars:10,consts:[[3,"title","colorType"],["shape","check-circle",4,"ngIf"],["shape","check-circle"]],template:function(t,o){1&t&&(e.I0R(0,"vdr-chip",0),e.wVc(1,"translate"),e.yuY(2,pi,1,0,"clr-icon",1),e.OEk(3),e.wVc(4,"translate"),e.wVc(5,"stateI18nToken"),e.C$Y()),2&t&&(e.E7m("title",e.kDX(1,4,"order.payment-state"))("colorType",o.chipColorType),e.yG2(2),e.E7m("ngIf","Settled"===o.state),e.yG2(),e.oRS(" ",e.kDX(4,6,e.kDX(5,8,o.state)),"\n"))},dependencies:[_.o3d,m.u_,D.g,p.sD,$.Q],styles:["[_nghost-%COMP%]{display:flex;font-size:14px}"],changeDetection:0})}function fi(r,n){1&r&&e.wR5(0,"clr-icon",2)}class Re{get chipColorType(){switch(this.state){case"Pending":return"warning";case"Settled":return"success";case"Failed":return"error"}}static#e=this.\u0275fac=function(t){return new(t||Re)};static#t=this.\u0275cmp=e.In1({type:Re,selectors:[["vdr-refund-state-label"]],inputs:{state:"state"},decls:6,vars:10,consts:[[3,"title","colorType"],["shape","check-circle",4,"ngIf"],["shape","check-circle"]],template:function(t,o){1&t&&(e.I0R(0,"vdr-chip",0),e.wVc(1,"translate"),e.yuY(2,fi,1,0,"clr-icon",1),e.OEk(3),e.wVc(4,"translate"),e.wVc(5,"stateI18nToken"),e.C$Y()),2&t&&(e.E7m("title",e.kDX(1,4,"order.payment-state"))("colorType",o.chipColorType),e.yG2(2),e.E7m("ngIf","Settled"===o.state),e.yG2(),e.oRS(" ",e.kDX(4,6,e.kDX(5,8,o.state)),"\n"))},dependencies:[_.o3d,m.u_,D.g,p.sD,$.Q],styles:["[_nghost-%COMP%]{display:flex;font-size:14px}"],changeDetection:0})}function gi(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",0),e.wVc(1,"translate"),e.OEk(2),e.C$Y()),2&r){const t=e.GaO();e.E7m("label",e.kDX(1,2,"order.error-message")),e.yG2(2),e.oRS(" ",t.payment.errorMessage,"\n")}}function yi(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",0),e.wVc(1,"translate"),e.OEk(2),e.C$Y()),2&r){const t=e.GaO();e.E7m("label",e.kDX(1,2,"order.transaction-id")),e.yG2(2),e.oRS(" ",t.payment.transactionId,"\n")}}class re{static#e=this.\u0275fac=function(t){return new(t||re)};static#t=this.\u0275cmp=e.In1({type:re,selectors:[["vdr-payment-detail"]],inputs:{payment:"payment",currencyCode:"currencyCode"},decls:12,vars:17,consts:[[3,"label"],[3,"label",4,"ngIf"],[3,"value"]],template:function(t,o){1&t&&(e.I0R(0,"vdr-labeled-data",0),e.wVc(1,"translate"),e.OEk(2),e.C$Y(),e.I0R(3,"vdr-labeled-data",0),e.wVc(4,"translate"),e.OEk(5),e.wVc(6,"localeCurrency"),e.C$Y(),e.yuY(7,gi,3,4,"vdr-labeled-data",1)(8,yi,3,4,"vdr-labeled-data",1),e.I0R(9,"vdr-labeled-data",0),e.wVc(10,"translate"),e.wR5(11,"vdr-object-tree",2),e.C$Y()),2&t&&(e.E7m("label",e.kDX(1,8,"order.payment-method")),e.yG2(2),e.oRS(" ",o.payment.method,"\n"),e.yG2(),e.E7m("label",e.kDX(4,10,"order.amount")),e.yG2(2),e.oRS(" ",e.g7$(6,12,o.payment.amount,o.currencyCode),"\n"),e.yG2(2),e.E7m("ngIf",o.payment.errorMessage),e.yG2(),e.E7m("ngIf",o.payment.transactionId),e.yG2(),e.E7m("label",e.kDX(10,15,"order.payment-metadata")),e.yG2(2),e.E7m("value",o.payment.metadata))},dependencies:[m.u_,O.a,ce.W,p.sD,g.u],changeDetection:0})}function Ci(r,n){if(1&r&&(e.SAx(0),e.OEk(1),e.wVc(2,"localeCurrency"),e.k70()),2&r){const t=e.GaO();e.yG2(),e.cNF(e.g7$(2,1,t.payment.amount,t.currencyCode))}}function hi(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",13),e.wVc(1,"translate"),e.OEk(2),e.C$Y()),2&r){const t=e.GaO().$implicit;e.E7m("label",e.kDX(1,2,"order.transaction-id")),e.yG2(2),e.oRS(" ",t.transactionId," ")}}function Oi(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",13),e.wVc(1,"translate"),e.OEk(2),e.C$Y()),2&r){const t=e.GaO().$implicit;e.E7m("label",e.kDX(1,2,"order.refund-reason")),e.yG2(2),e.oRS(" ",t.reason," ")}}function vi(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",13),e.wVc(1,"translate"),e.wR5(2,"vdr-object-tree",15),e.C$Y()),2&r){const t=e.GaO().$implicit;e.E7m("label",e.kDX(1,2,"order.refund-metadata")),e.yG2(2),e.E7m("value",t.metadata)}}function bi(r,n){if(1&r){const t=e.KQA();e.I0R(0,"div",16)(1,"button",17),e.qCj("click",function(){e.usT(t);const i=e.GaO().$implicit,a=e.GaO();return e.CGJ(a.settleRefund.emit(i))}),e.OEk(2),e.wVc(3,"translate"),e.C$Y()()}2&r&&(e.yG2(2),e.oRS(" ",e.kDX(3,1,"order.settle-refund")," "))}function Ii(r,n){if(1&r&&(e.SAx(0),e.I0R(1,"div",9)(2,"div",10),e.wR5(3,"clr-icon",11),e.OEk(4),e.wVc(5,"translate"),e.wR5(6,"div",12)(7,"vdr-refund-state-label",4),e.C$Y(),e.I0R(8,"div",5)(9,"vdr-labeled-data",13),e.wVc(10,"translate"),e.OEk(11),e.wVc(12,"localeDate"),e.C$Y(),e.I0R(13,"vdr-labeled-data",13),e.wVc(14,"translate"),e.OEk(15),e.wVc(16,"localeCurrency"),e.C$Y(),e.yuY(17,hi,3,4,"vdr-labeled-data",14)(18,Oi,3,4,"vdr-labeled-data",14)(19,vi,3,4,"vdr-labeled-data",14),e.C$Y(),e.yuY(20,bi,4,3,"div",8),e.C$Y(),e.k70()),2&r){const t=n.$implicit,o=e.GaO();e.yG2(4),e.CAO(" ",e.kDX(5,11,"order.refund")," #",t.id," "),e.yG2(3),e.E7m("state",t.state),e.yG2(2),e.E7m("label",e.kDX(10,13,"common.created-at")),e.yG2(2),e.oRS(" ",e.g7$(12,15,t.createdAt,"medium")," "),e.yG2(2),e.E7m("label",e.kDX(14,18,"order.refund-total")),e.yG2(2),e.oRS(" ",e.g7$(16,20,t.total,o.currencyCode)," "),e.yG2(2),e.E7m("ngIf",t.transactionId),e.yG2(),e.E7m("ngIf",t.reason),e.yG2(),e.E7m("ngIf",o.refundHasMetadata(t)),e.yG2(),e.E7m("ngIf","Pending"===t.state)}}function Gi(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",17),e.qCj("click",function(){e.usT(t);const i=e.GaO(2);return e.CGJ(i.settlePayment.emit(i.payment))}),e.OEk(1),e.wVc(2,"translate"),e.C$Y()}2&r&&(e.yG2(),e.oRS(" ",e.kDX(2,1,"order.settle-payment")," "))}const Ei=r=>({state:r});function Ri(r,n){if(1&r&&(e.SAx(0),e.wR5(1,"clr-icon",25),e.OEk(2),e.wVc(3,"translate"),e.wVc(4,"translate"),e.wVc(5,"stateI18nToken"),e.k70()),2&r){const t=e.GaO().$implicit;e.yG2(2),e.oRS(" ",e.g7$(3,1,"order.transition-to-state",e.S45(8,Ei,e.kDX(4,4,e.kDX(5,6,t))))," ")}}function ki(r,n){1&r&&(e.wR5(0,"clr-icon",26),e.OEk(1),e.wVc(2,"translate")),2&r&&(e.yG2(),e.oRS(" ",e.kDX(2,1,"order.cancel-payment")," "))}function wi(r,n){if(1&r){const t=e.KQA();e.SAx(0),e.I0R(1,"button",22),e.qCj("click",function(){const a=e.usT(t).$implicit,c=e.GaO(2);return e.CGJ(c.transitionPaymentState.emit({payment:c.payment,state:a}))}),e.yuY(2,Ri,6,10,"ng-container",23)(3,ki,3,3,"ng-template",null,24,e.gJz),e.C$Y(),e.k70()}if(2&r){const t=n.$implicit,o=e.Gew(4);e.yG2(2),e.E7m("ngIf","Cancelled"!==t)("ngIfElse",o)}}function Ti(r,n){if(1&r&&(e.I0R(0,"div",16),e.yuY(1,Gi,3,3,"button",18),e.I0R(2,"vdr-dropdown")(3,"button",19),e.wR5(4,"clr-icon",20),e.C$Y(),e.I0R(5,"vdr-dropdown-menu",21),e.yuY(6,wi,5,2,"ng-container",7),e.C$Y()()()),2&r){const t=e.GaO();e.yG2(),e.E7m("ngIf",t.payment.nextStates.includes("Settled")),e.yG2(5),e.E7m("ngForOf",t.nextOtherStates())}}class ke{constructor(){this.settlePayment=new e._w7,this.transitionPaymentState=new e._w7,this.settleRefund=new e._w7}refundHasMetadata(n){return!!n&&Object.keys(n.metadata).length>0}nextOtherStates(){return this.payment?this.payment.nextStates.filter(n=>"Settled"!==n&&"Error"!==n):[]}static#e=this.\u0275fac=function(t){return new(t||ke)};static#t=this.\u0275cmp=e.In1({type:ke,selectors:[["vdr-order-payment-card"]],inputs:{payment:"payment",currencyCode:"currencyCode"},outputs:{settlePayment:"settlePayment",transitionPaymentState:"transitionPaymentState",settleRefund:"settleRefund"},decls:12,vars:9,consts:[[1,"card"],[1,"card-header","payment-header"],[4,"ngIf"],[1,"payment-state"],[3,"state"],[1,"card-block"],[3,"payment","currencyCode"],[4,"ngFor","ngForOf"],["class","card-footer",4,"ngIf"],[1,"refund-wrapper","card-block"],[1,"card-header","payment-header","refund-header"],["shape","redo","dir","down",1,"refund-icon"],[1,"clr-flex-fill"],[3,"label"],[3,"label",4,"ngIf"],[3,"value"],[1,"card-footer"],[1,"btn","btn-sm","btn-primary",3,"click"],["class","btn btn-sm btn-primary",3,"click",4,"ngIf"],["vdrDropdownTrigger","",1,"icon-button"],["shape","ellipsis-vertical"],["vdrPosition","bottom-right"],["type","button","vdrDropdownItem","",3,"click"],[4,"ngIf","ngIfElse"],["cancel",""],["shape","step-forward-2"],["shape","error-standard",1,"is-error"]],template:function(t,o){1&t&&(e.I0R(0,"div",0)(1,"div",1)(2,"div"),e.OEk(3),e.wVc(4,"translate"),e.yuY(5,Ci,3,4,"ng-container",2),e.C$Y(),e.I0R(6,"div",3),e.wR5(7,"vdr-payment-state-label",4),e.C$Y()(),e.I0R(8,"div",5),e.wR5(9,"vdr-payment-detail",6),e.C$Y(),e.yuY(10,Ii,21,23,"ng-container",7)(11,Ti,7,2,"div",8),e.C$Y()),2&t&&(e.yG2(3),e.oRS(" ",e.kDX(4,7,"order.payment")," "),e.yG2(2),e.E7m("ngIf",o.payment.amount),e.yG2(2),e.E7m("state",o.payment.state),e.yG2(2),e.E7m("payment",o.payment)("currencyCode",o.currencyCode),e.yG2(),e.E7m("ngForOf",o.payment.refunds),e.yG2(),e.E7m("ngIf",o.payment.nextStates.length))},dependencies:[_.o3d,m.ay,m.u_,ut.CM,B.i,W.m,U.q,ue.Q,O.a,ce.W,Ee,Re,re,p.sD,$.Q,A.m,g.u],styles:["[_nghost-%COMP%]{display:block}.payment-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;line-break:anywhere}.refund-icon[_ngcontent-%COMP%]{margin-inline-end:6px;color:var(--color-grey-400)}.card-footer[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:flex-end}.refund-wrapper[_ngcontent-%COMP%]{font-size:var(--font-size-xs)}"],changeDetection:0})}var yt=s(2212),Si=s(6112);const Di=["portal"];class we{constructor(n){this.historyEntryComponentService=n,this.expandClick=new e._w7}ngOnInit(){const n=this.historyEntryComponentService.getComponent(this.entry.type),t=this.portalRef.createComponent(n);t.instance.entry=this.entry,t.instance.order=this.order,this.instance=t.instance,this.componentRef=t}ngOnDestroy(){this.componentRef?.destroy()}static#e=this.\u0275fac=function(t){return new(t||we)(e.GI1(d.gDp))};static#t=this.\u0275cmp=e.In1({type:we,selectors:[["vdr-order-history-entry-host"]],viewQuery:function(t,o){if(1&t&&e.CC$(Di,7,e.y8U),2&t){let i;e.wto(i=e.Gqi())&&(o.portalRef=i.first)}},inputs:{entry:"entry",order:"order",expanded:"expanded"},outputs:{expandClick:"expandClick"},exportAs:["historyEntry"],decls:3,vars:6,consts:[[3,"displayType","iconShape","createdAt","name","featured","collapsed","expandClick"],["portal",""]],template:function(t,o){1&t&&(e.I0R(0,"vdr-timeline-entry",0),e.qCj("expandClick",function(){return o.expandClick.emit()}),e.wR5(1,"div",null,1),e.C$Y()),2&t&&e.E7m("displayType",o.instance.getDisplayType(o.entry))("iconShape",o.instance.getIconShape&&o.instance.getIconShape(o.entry))("createdAt",o.entry.createdAt)("name",o.instance.getName&&o.instance.getName(o.entry))("featured",o.instance.isFeatured(o.entry))("collapsed",!o.expanded&&!o.instance.isFeatured(o.entry))},dependencies:[yt.Y],encapsulation:2})}var Ct=s(3040);function xi(r,n){1&r&&(e.I0R(0,"span",12),e.OEk(1),e.wVc(2,"translate"),e.C$Y()),2&r&&(e.yG2(),e.oRS(" ",e.kDX(2,1,"order.note-only-visible-to-administrators")," "))}function Fi(r,n){1&r&&(e.I0R(0,"span",13),e.OEk(1),e.wVc(2,"translate"),e.C$Y()),2&r&&(e.yG2(),e.oRS(" ",e.kDX(2,1,"order.note-visible-to-customer")," "))}function $i(r,n){if(1&r){const t=e.KQA();e.I0R(0,"vdr-order-history-entry-host",16),e.qCj("expandClick",function(){e.usT(t);const i=e.GaO(2);return e.CGJ(i.expanded=!i.expanded)}),e.C$Y()}if(2&r){const t=e.GaO().$implicit,o=e.GaO();e.E7m("order",o.order)("entry",t)("expanded",o.expanded)}}function Mi(r,n){1&r&&(e.I0R(0,"div",11),e.OEk(1),e.wVc(2,"translate"),e.C$Y()),2&r&&(e.yG2(),e.oRS(" ",e.kDX(2,1,"order.history-order-fulfilled")," "))}function Yi(r,n){1&r&&(e.I0R(0,"div",11),e.OEk(1),e.wVc(2,"translate"),e.C$Y()),2&r&&(e.yG2(),e.oRS(" ",e.kDX(2,1,"order.history-order-cancelled")," "))}const ht=(r,n)=>({from:r,to:n});function Pi(r,n){if(1&r&&(e.OEk(0),e.wVc(1,"translate")),2&r){const t=e.GaO(3).$implicit;e.oRS(" ",e.g7$(1,1,"order.history-order-transition",e.IBC(4,ht,t.data.from,t.data.to))," ")}}function Ai(r,n){if(1&r&&(e.SAx(0),e.yuY(1,Mi,3,3,"div",21)(2,Yi,3,3,"div",21)(3,Pi,2,7,"ng-template",22),e.k70()),2&r){const t=e.GaO(2).$implicit;e.yG2(),e.E7m("ngIf","Delivered"===t.data.to),e.yG2(),e.E7m("ngIf","Cancelled"===t.data.to),e.yG2(),e.E7m("ngIf","Cancelled"!==t.data.to&&"Delivered"!==t.data.to)}}function Vi(r,n){1&r&&(e.I0R(0,"vdr-chip",28),e.OEk(1),e.wVc(2,"translate"),e.C$Y()),2&r&&(e.yG2(),e.cNF(e.kDX(2,1,"order.modification-settled")))}function Ni(r,n){1&r&&(e.I0R(0,"vdr-chip",29),e.OEk(1),e.wVc(2,"translate"),e.C$Y()),2&r&&(e.yG2(),e.cNF(e.kDX(2,1,"order.modification-not-settled")))}function Xi(r,n){if(1&r&&(e.I0R(0,"div",24),e.OEk(1),e.wVc(2,"translate"),e.I0R(3,"strong"),e.OEk(4),e.wVc(5,"localeCurrency"),e.C$Y(),e.yuY(6,Vi,3,3,"vdr-chip",25)(7,Ni,3,3,"vdr-chip",26),e.I0R(8,"vdr-history-entry-detail"),e.wR5(9,"vdr-modification-detail",27),e.C$Y()()),2&r){const t=n.ngIf,o=e.GaO(4);e.yG2(),e.oRS(" ",e.kDX(2,6,"order.modify-order-price-difference"),": "),e.yG2(3),e.cNF(e.g7$(5,8,t.priceChange,o.order.currencyCode)),e.yG2(2),e.E7m("ngIf",t.isSettled),e.yG2(),e.E7m("ngIf",!t.isSettled),e.yG2(2),e.E7m("order",o.order)("modification",t)}}function Li(r,n){if(1&r&&(e.SAx(0),e.I0R(1,"div",11),e.OEk(2),e.wVc(3,"translate"),e.C$Y(),e.yuY(4,Xi,10,11,"div",23),e.k70()),2&r){const t=e.GaO(2).$implicit,o=e.GaO();e.yG2(2),e.oRS(" ",e.kDX(3,2,"order.history-order-modified")," "),e.yG2(2),e.E7m("ngIf",o.getModification(t.data.modificationId))}}function ji(r,n){if(1&r&&(e.I0R(0,"vdr-chip",34),e.OEk(1),e.wVc(2,"localeCurrency"),e.C$Y()),2&r){const t=n.ngIf,o=e.GaO(5);e.yG2(),e.cNF(e.g7$(2,1,t.amount,o.order.currencyCode))}}function Qi(r,n){if(1&r&&(e.I0R(0,"vdr-history-entry-detail"),e.wR5(1,"vdr-payment-detail",35),e.C$Y()),2&r){const t=n.ngIf,o=e.GaO(5);e.yG2(),e.E7m("payment",t)("currencyCode",o.order.currencyCode)}}function Ki(r,n){if(1&r&&(e.SAx(0),e.I0R(1,"div",11),e.OEk(2),e.wVc(3,"translate"),e.C$Y(),e.I0R(4,"div",24),e.yuY(5,ji,3,4,"vdr-chip",32)(6,Qi,2,2,"vdr-history-entry-detail",33),e.C$Y(),e.k70()),2&r){const t=e.GaO(3).$implicit,o=e.GaO();e.yG2(2),e.oRS(" ",e.kDX(3,3,"order.history-payment-settled")," "),e.yG2(3),e.E7m("ngIf",o.getPayment(t)),e.yG2(),e.E7m("ngIf",o.getPayment(t))}}const Ot=(r,n,t)=>({from:r,to:n,id:t});function qi(r,n){if(1&r&&(e.OEk(0),e.wVc(1,"translate")),2&r){const t=e.GaO(3).$implicit,o=e.GaO();let i;e.oRS(" ",e.g7$(1,1,"order.history-payment-transition",e.uAc(4,Ot,t.data.from,t.data.to,null==(i=o.getPayment(t))?null:i.transactionId))," ")}}function Hi(r,n){if(1&r&&(e.SAx(0),e.yuY(1,Ki,7,5,"ng-container",30)(2,qi,2,8,"ng-template",null,31,e.gJz),e.k70()),2&r){const t=e.Gew(3),o=e.GaO(2).$implicit;e.yG2(),e.E7m("ngIf","Settled"===o.data.to)("ngIfElse",t)}}function Ji(r,n){if(1&r&&(e.SAx(0),e.I0R(1,"div",11),e.OEk(2),e.wVc(3,"translate"),e.C$Y(),e.I0R(4,"div",24)(5,"vdr-chip",37),e.OEk(6),e.wVc(7,"localeCurrency"),e.C$Y(),e.I0R(8,"vdr-history-entry-detail")(9,"vdr-labeled-data",38),e.wVc(10,"translate"),e.OEk(11),e.C$Y(),e.I0R(12,"vdr-labeled-data",38),e.wVc(13,"translate"),e.wR5(14,"vdr-simple-item-list",39),e.C$Y()()(),e.k70()),2&r){const t=n.ngIf,o=e.GaO(4).$implicit,i=e.GaO();e.yG2(2),e.CAO("",e.kDX(3,7,"order.refund")," #",t.id,""),e.yG2(4),e.cNF(e.g7$(7,9,t.total,i.order.currencyCode)),e.yG2(3),e.E7m("label",e.kDX(10,12,"order.cancellation-reason")),e.yG2(2),e.oRS(" ",o.data.reason," "),e.yG2(),e.E7m("label",e.kDX(13,14,"order.contents")),e.yG2(2),e.E7m("items",i.getCancelledItems(t.lines))}}function Bi(r,n){if(1&r&&(e.SAx(0),e.yuY(1,Ji,15,16,"ng-container",33),e.k70()),2&r){const t=e.GaO(3).$implicit,o=e.GaO();e.yG2(),e.E7m("ngIf",o.getRefund(t))}}function Wi(r,n){if(1&r&&(e.OEk(0),e.wVc(1,"translate")),2&r){const t=e.GaO(3).$implicit;e.oRS(" ",e.g7$(1,1,"order.history-refund-transition",e.uAc(4,Ot,t.data.from,t.data.to,t.data.refundId))," ")}}function Ui(r,n){if(1&r&&(e.SAx(0),e.yuY(1,Bi,2,1,"ng-container",30)(2,Wi,2,8,"ng-template",null,36,e.gJz),e.k70()),2&r){const t=e.Gew(3),o=e.GaO(2).$implicit;e.yG2(),e.E7m("ngIf","Settled"===o.data.to)("ngIfElse",t)}}function zi(r,n){if(1&r&&(e.I0R(0,"vdr-history-entry-detail")(1,"vdr-labeled-data",38),e.wVc(2,"translate"),e.OEk(3),e.C$Y(),e.I0R(4,"vdr-labeled-data",38),e.wVc(5,"translate"),e.wR5(6,"vdr-simple-item-list",39),e.C$Y(),e.I0R(7,"vdr-labeled-data",38),e.wVc(8,"translate"),e.OEk(9),e.C$Y()()),2&r){const t=n.ngIf,o=e.GaO(3).$implicit;e.yG2(),e.E7m("label",e.kDX(2,6,"order.cancellation-reason")),e.yG2(2),e.oRS(" ",o.data.reason," "),e.yG2(),e.E7m("label",e.kDX(5,8,"order.contents")),e.yG2(2),e.E7m("items",t),e.yG2(),e.E7m("label",e.kDX(8,10,"order.shipping-cancelled")),e.yG2(2),e.oRS(" ",o.data.shippingCancelled," ")}}const Zi=r=>({count:r});function ea(r,n){if(1&r&&(e.SAx(0),e.OEk(1),e.wVc(2,"translate"),e.yuY(3,zi,10,12,"vdr-history-entry-detail",33),e.k70()),2&r){const t=e.GaO(2).$implicit,o=e.GaO();e.yG2(),e.oRS(" ",e.g7$(2,2,"order.history-items-cancelled",e.S45(5,Zi,o.getCancelledQuantity(t)))," "),e.yG2(2),e.E7m("ngIf",o.getCancelledItems(t.data.lines))}}function ta(r,n){if(1&r&&(e.I0R(0,"vdr-history-entry-detail"),e.wR5(1,"vdr-fulfillment-detail",40),e.C$Y()),2&r){const t=n.ngIf,o=e.GaO(4);e.yG2(),e.E7m("fulfillmentId",t.id)("order",o.order)}}function na(r,n){if(1&r&&(e.SAx(0),e.OEk(1),e.wVc(2,"translate"),e.yuY(3,ta,2,2,"vdr-history-entry-detail",33),e.k70()),2&r){const t=e.GaO(2).$implicit,o=e.GaO();e.yG2(),e.oRS(" ",e.kDX(2,2,"order.history-fulfillment-created")," "),e.yG2(2),e.E7m("ngIf",o.getFulfillment(t))}}function ra(r,n){if(1&r&&(e.SAx(0),e.I0R(1,"div",11),e.OEk(2),e.wVc(3,"translate"),e.C$Y(),e.OEk(4),e.wVc(5,"translate"),e.k70()),2&r){const t=e.GaO(3).$implicit,o=e.GaO();let i;e.yG2(2),e.oRS(" ",e.kDX(3,3,"order.history-fulfillment-delivered")," "),e.yG2(2),e.CAO(" ",e.kDX(5,5,"order.tracking-code"),": ",null==(i=o.getFulfillment(t))?null:i.trackingCode," ")}}function oa(r,n){if(1&r&&(e.SAx(0),e.I0R(1,"div",11),e.OEk(2),e.wVc(3,"translate"),e.C$Y(),e.OEk(4),e.wVc(5,"translate"),e.k70()),2&r){const t=e.GaO(3).$implicit,o=e.GaO();let i;e.yG2(2),e.oRS(" ",e.kDX(3,3,"order.history-fulfillment-shipped")," "),e.yG2(2),e.CAO(" ",e.kDX(5,5,"order.tracking-code"),": ",null==(i=o.getFulfillment(t))?null:i.trackingCode," ")}}function ia(r,n){if(1&r&&(e.SAx(0),e.OEk(1),e.wVc(2,"translate"),e.k70()),2&r){const t=e.GaO(3).$implicit;e.yG2(),e.oRS(" ",e.g7$(2,1,"order.history-fulfillment-transition",e.IBC(4,ht,t.data.from,t.data.to))," ")}}function aa(r,n){if(1&r&&(e.I0R(0,"vdr-history-entry-detail"),e.wR5(1,"vdr-fulfillment-detail",40),e.C$Y()),2&r){const t=n.ngIf,o=e.GaO(4);e.yG2(),e.E7m("fulfillmentId",t.id)("order",o.order)}}function la(r,n){if(1&r&&(e.SAx(0),e.yuY(1,ra,6,7,"ng-container",33)(2,oa,6,7,"ng-container",33)(3,ia,3,7,"ng-container",33)(4,aa,2,2,"vdr-history-entry-detail",33),e.k70()),2&r){const t=e.GaO(2).$implicit,o=e.GaO();e.yG2(),e.E7m("ngIf","Delivered"===t.data.to),e.yG2(),e.E7m("ngIf","Shipped"===t.data.to),e.yG2(),e.E7m("ngIf","Delivered"!==t.data.to&&"Shipped"!==t.data.to),e.yG2(),e.E7m("ngIf",o.getFulfillment(t))}}function da(r,n){1&r&&(e.I0R(0,"span",53),e.OEk(1),e.wVc(2,"translate"),e.C$Y()),2&r&&(e.yG2(),e.cNF(e.kDX(2,1,"common.public")))}function sa(r,n){1&r&&(e.I0R(0,"span",54),e.OEk(1),e.wVc(2,"translate"),e.C$Y()),2&r&&(e.yG2(),e.cNF(e.kDX(2,1,"common.private")))}function ca(r,n){if(1&r){const t=e.KQA();e.SAx(0),e.I0R(1,"div",41)(2,"div",42),e.yuY(3,da,3,3,"span",43)(4,sa,3,3,"span",44),e.OEk(5),e.C$Y(),e.wR5(6,"div",45),e.I0R(7,"vdr-dropdown")(8,"button",46),e.wR5(9,"clr-icon",47),e.C$Y(),e.I0R(10,"vdr-dropdown-menu",48)(11,"button",49),e.qCj("click",function(){e.usT(t);const i=e.GaO(2).$implicit,a=e.GaO();return e.CGJ(a.updateNote.emit(i))}),e.wVc(12,"hasPermission"),e.wR5(13,"clr-icon",50),e.OEk(14),e.wVc(15,"translate"),e.C$Y(),e.wR5(16,"div",51),e.I0R(17,"button",49),e.qCj("click",function(){e.usT(t);const i=e.GaO(2).$implicit,a=e.GaO();return e.CGJ(a.deleteNote.emit(i))}),e.wVc(18,"hasPermission"),e.wR5(19,"clr-icon",52),e.OEk(20),e.wVc(21,"translate"),e.C$Y()()()(),e.k70()}if(2&r){const t=e.GaO(2).$implicit;e.yG2(3),e.E7m("ngIf",t.isPublic),e.yG2(),e.E7m("ngIf",!t.isPublic),e.yG2(),e.oRS(" ",t.data.note," "),e.yG2(6),e.E7m("disabled",!e.kDX(12,7,"UpdateOrder")),e.yG2(3),e.oRS(" ",e.kDX(15,9,"common.edit")," "),e.yG2(3),e.E7m("disabled",!e.kDX(18,11,"UpdateOrder")),e.yG2(3),e.oRS(" ",e.kDX(21,13,"common.delete")," ")}}const ma=r=>["/marketing","promotions",r];function ua(r,n){if(1&r&&(e.SAx(0),e.OEk(1),e.wVc(2,"translate"),e.I0R(3,"vdr-chip")(4,"a",55),e.OEk(5),e.C$Y()(),e.k70()),2&r){const t=e.GaO(2).$implicit;e.yG2(),e.oRS(" ",e.kDX(2,3,"order.history-coupon-code-applied"),": "),e.yG2(3),e.E7m("routerLink",e.S45(5,ma,t.data.promotionId)),e.yG2(),e.cNF(t.data.couponCode)}}function _a(r,n){if(1&r&&(e.SAx(0),e.OEk(1),e.wVc(2,"translate"),e.I0R(3,"vdr-chip")(4,"span",56),e.OEk(5),e.C$Y()(),e.k70()),2&r){const t=e.GaO(2).$implicit;e.yG2(),e.oRS(" ",e.kDX(2,2,"order.history-coupon-code-removed"),": "),e.yG2(4),e.cNF(t.data.couponCode)}}const vt=r=>["/customer","customers",r];function pa(r,n){if(1&r&&(e.I0R(0,"a",58),e.wR5(1,"clr-icon",59),e.I0R(2,"span"),e.OEk(3),e.C$Y(),e.wR5(4,"clr-icon",60),e.C$Y()),2&r){const t=e.GaO(3).$implicit;e.E7m("routerLink",e.S45(2,vt,t.data.previousCustomerId)),e.yG2(3),e.cNF(t.data.previousCustomerName)}}function fa(r,n){if(1&r&&(e.I0R(0,"a",58),e.wR5(1,"clr-icon",59),e.I0R(2,"span"),e.OEk(3),e.C$Y(),e.wR5(4,"clr-icon",60),e.C$Y()),2&r){const t=e.GaO(3).$implicit;e.E7m("routerLink",e.S45(2,vt,t.data.newCustomerId)),e.yG2(3),e.cNF(t.data.newCustomerName)}}const ga=r=>({newCustomerName:r});function ya(r,n){if(1&r&&(e.SAx(0),e.I0R(1,"div",11),e.OEk(2),e.wVc(3,"translate"),e.C$Y(),e.I0R(4,"div",41)(5,"div",42),e.OEk(6),e.C$Y(),e.wR5(7,"div",45),e.I0R(8,"vdr-history-entry-detail")(9,"vdr-labeled-data",38),e.wVc(10,"translate"),e.yuY(11,pa,5,4,"a",57),e.C$Y(),e.I0R(12,"vdr-labeled-data",38),e.wVc(13,"translate"),e.yuY(14,fa,5,4,"a",57),e.C$Y()()(),e.k70()),2&r){const t=e.GaO(2).$implicit;e.yG2(2),e.oRS(" ",e.g7$(3,6,"order.history-customer-updated",e.S45(13,ga,t.data.newCustomerName))," "),e.yG2(4),e.oRS(" ",t.data.note," "),e.yG2(3),e.E7m("label",e.kDX(10,9,"order.previous-customer")),e.yG2(2),e.E7m("ngIf",t.data.previousCustomerId),e.yG2(),e.E7m("label",e.kDX(13,11,"order.new-customer")),e.yG2(2),e.E7m("ngIf",t.data.newCustomerId)}}function Ca(r,n){if(1&r&&(e.I0R(0,"vdr-history-entry-detail"),e.wR5(1,"vdr-object-tree",61),e.C$Y()),2&r){const t=e.GaO(3).$implicit;e.yG2(),e.E7m("value",t.data)}}function ha(r,n){if(1&r&&(e.SAx(0),e.I0R(1,"div",11),e.OEk(2),e.wVc(3,"translate"),e.C$Y(),e.yuY(4,Ca,2,1,"vdr-history-entry-detail",33),e.k70()),2&r){const t=e.GaO(2).$implicit;e.yG2(2),e.oRS(" ",e.kDX(3,2,t.type)," "),e.yG2(2),e.E7m("ngIf",t.data)}}function Oa(r,n){if(1&r){const t=e.KQA();e.I0R(0,"vdr-timeline-entry",17),e.qCj("expandClick",function(){e.usT(t);const i=e.GaO(2);return e.CGJ(i.expanded=!i.expanded)}),e.SAx(1,18),e.yuY(2,Ai,4,3,"ng-container",19)(3,Li,5,4,"ng-container",19)(4,Hi,4,2,"ng-container",19)(5,Ui,4,2,"ng-container",19)(6,ea,4,7,"ng-container",19)(7,na,4,4,"ng-container",19)(8,la,5,4,"ng-container",19)(9,ca,22,15,"ng-container",19)(10,ua,6,7,"ng-container",19)(11,_a,6,4,"ng-container",19)(12,ya,15,15,"ng-container",19)(13,ha,5,4,"ng-container",20),e.k70(),e.C$Y()}if(2&r){const t=e.GaO().$implicit,o=e.GaO();e.E7m("displayType",o.getDisplayType(t))("iconShape",o.getTimelineIcon(t))("createdAt",t.createdAt)("name",o.getName(t))("featured",o.isFeatured(t))("collapsed",!o.expanded&&!o.isFeatured(t)),e.yG2(),e.E7m("ngSwitch",t.type),e.yG2(),e.E7m("ngSwitchCase",o.type.ORDER_STATE_TRANSITION),e.yG2(),e.E7m("ngSwitchCase",o.type.ORDER_MODIFIED),e.yG2(),e.E7m("ngSwitchCase",o.type.ORDER_PAYMENT_TRANSITION),e.yG2(),e.E7m("ngSwitchCase",o.type.ORDER_REFUND_TRANSITION),e.yG2(),e.E7m("ngSwitchCase",o.type.ORDER_CANCELLATION),e.yG2(),e.E7m("ngSwitchCase",o.type.ORDER_FULFILLMENT),e.yG2(),e.E7m("ngSwitchCase",o.type.ORDER_FULFILLMENT_TRANSITION),e.yG2(),e.E7m("ngSwitchCase",o.type.ORDER_NOTE),e.yG2(),e.E7m("ngSwitchCase",o.type.ORDER_COUPON_APPLIED),e.yG2(),e.E7m("ngSwitchCase",o.type.ORDER_COUPON_REMOVED),e.yG2(),e.E7m("ngSwitchCase",o.type.ORDER_CUSTOMER_UPDATED)}}function va(r,n){if(1&r&&(e.SAx(0),e.yuY(1,$i,1,3,"vdr-order-history-entry-host",14)(2,Oa,14,18,"ng-template",null,15,e.gJz),e.k70()),2&r){const t=n.$implicit,o=e.Gew(3),i=e.GaO();e.yG2(),e.E7m("ngIf",i.hasCustomComponent(t.type))("ngIfElse",o)}}class Te{constructor(n){this.historyEntryComponentService=n,this.addNote=new e._w7,this.updateNote=new e._w7,this.deleteNote=new e._w7,this.note="",this.noteIsPrivate=!0,this.expanded=!1,this.type=d.YjR}hasCustomComponent(n){return!!this.historyEntryComponentService.getComponent(n)}getDisplayType(n){if(n.type===d.YjR.ORDER_STATE_TRANSITION){if("Delivered"===n.data.to)return"success";if("Cancelled"===n.data.to)return"error"}return n.type===d.YjR.ORDER_FULFILLMENT_TRANSITION&&"Delivered"===n.data.to?"success":n.type!==d.YjR.ORDER_PAYMENT_TRANSITION||"Declined"!==n.data.to&&"Cancelled"!==n.data.to?n.type===d.YjR.ORDER_CANCELLATION||n.type===d.YjR.ORDER_REFUND_TRANSITION?"warning":"default":"error"}getTimelineIcon(n){if(n.type===d.YjR.ORDER_STATE_TRANSITION){if("Delivered"===n.data.to)return["success-standard","is-solid"];if("Cancelled"===n.data.to)return"ban"}return n.type===d.YjR.ORDER_PAYMENT_TRANSITION&&"Settled"===n.data.to||n.type===d.YjR.ORDER_REFUND_TRANSITION&&"Settled"===n.data.to?"credit-card":n.type===d.YjR.ORDER_NOTE?"note":n.type===d.YjR.ORDER_MODIFIED?"pencil":n.type===d.YjR.ORDER_CUSTOMER_UPDATED?"switch":n.type!==d.YjR.ORDER_FULFILLMENT_TRANSITION||"Shipped"!==n.data.to&&"Delivered"!==n.data.to?void 0:"truck"}isFeatured(n){switch(n.type){case d.YjR.ORDER_STATE_TRANSITION:return"Delivered"===n.data.to||"Cancelled"===n.data.to||"Settled"===n.data.to;case d.YjR.ORDER_REFUND_TRANSITION:return"Settled"===n.data.to;case d.YjR.ORDER_PAYMENT_TRANSITION:return"Settled"===n.data.to||"Cancelled"===n.data.to;case d.YjR.ORDER_FULFILLMENT_TRANSITION:return"Delivered"===n.data.to||"Shipped"===n.data.to;case d.YjR.ORDER_NOTE:case d.YjR.ORDER_MODIFIED:case d.YjR.ORDER_CUSTOMER_UPDATED:return!0;default:return!1}}getFulfillment(n){if((n.type===d.YjR.ORDER_FULFILLMENT||n.type===d.YjR.ORDER_FULFILLMENT_TRANSITION)&&this.order.fulfillments)return this.order.fulfillments.find(t=>t.id===n.data.fulfillmentId)}getPayment(n){if(n.type===d.YjR.ORDER_PAYMENT_TRANSITION&&this.order.payments)return this.order.payments.find(t=>t.id===n.data.paymentId)}getRefund(n){if(n.type===d.YjR.ORDER_REFUND_TRANSITION&&this.order.payments)return this.order.payments.reduce((o,i)=>o.concat(i.refunds),[]).find(o=>o.id===n.data.refundId)}getCancelledQuantity(n){return n.data.lines.reduce((t,o)=>t+o.quantity,0)}getCancelledItems(n){const t=new Map;for(const o of this.order.lines){const i=n.find(a=>a.orderLineId===o.id);if(i){t.get(o.productVariant.name);t.set(o.productVariant.name,i.quantity)}}return Array.from(t.entries()).map(([o,i])=>({name:o,quantity:i}))}getModification(n){return this.order.modifications.find(t=>t.id===n)}getName(n){const{administrator:t}=n;if(t)return`${t.firstName} ${t.lastName}`;{const o=this.order.customer;if(o)return`${o.firstName} ${o.lastName}`}return""}addNoteToOrder(){this.addNote.emit({note:this.note,isPublic:!this.noteIsPrivate}),this.note="",this.noteIsPrivate=!0}static#e=this.\u0275fac=function(t){return new(t||Te)(e.GI1(d.gDp))};static#t=this.\u0275cmp=e.In1({type:Te,selectors:[["vdr-order-history"]],inputs:{order:"order",history:"history"},outputs:{addNote:"addNote",updateNote:"updateNote",deleteNote:"deleteNote"},decls:20,vars:22,consts:[[1,"entry-list"],["iconShape","note","displayType","muted",3,"featured","isFirst"],[1,"note-entry"],["name","note",1,"note",3,"ngModel","ngModelChange"],[1,"btn","btn-secondary",3,"disabled","click"],[1,"visibility-select"],["type","checkbox","clrCheckbox","",3,"ngModel","ngModelChange"],["class","private",4,"ngIf"],["class","public",4,"ngIf"],[4,"ngFor","ngForOf"],[3,"isLast","createdAt","featured"],[1,"title"],[1,"private"],[1,"public"],[3,"order","entry","expanded","expandClick",4,"ngIf","ngIfElse"],["defaultComponents",""],[3,"order","entry","expanded","expandClick"],[3,"displayType","iconShape","createdAt","name","featured","collapsed","expandClick"],[3,"ngSwitch"],[4,"ngSwitchCase"],[4,"ngSwitchDefault"],["class","title",4,"ngIf"],[3,"ngIf"],["class","flex items-center",4,"ngIf"],[1,"flex","items-center"],["colorType","success","class","mx-1",4,"ngIf"],["colorType","error","class","mx-1",4,"ngIf"],[3,"order","modification"],["colorType","success",1,"mx-1"],["colorType","error",1,"mx-1"],[4,"ngIf","ngIfElse"],["regularPaymentTransition",""],["class","mr-1",4,"ngIf"],[4,"ngIf"],[1,"mr-1"],[3,"payment","currencyCode"],["regularRefundTransition",""],["colorType","warning",1,"mr-1"],[3,"label"],[3,"items"],[3,"fulfillmentId","order"],[1,"flex"],[1,"note-text"],["class","note-visibility public",4,"ngIf"],["class","note-visibility private",4,"ngIf"],[1,"flex-spacer"],["vdrDropdownTrigger","",1,"button-small","ml-1"],["shape","ellipsis-vertical","size","12"],["vdrPosition","bottom-right"],["vdrDropdownItem","",3,"disabled","click"],["shape","edit"],[1,"dropdown-divider"],["shape","trash",1,"is-danger"],[1,"note-visibility","public"],[1,"note-visibility","private"],[3,"routerLink"],[1,"cancelled-coupon-code"],["class","button-ghost",3,"routerLink",4,"ngIf"],[1,"button-ghost",3,"routerLink"],["shape","user",1,"is-solid"],["shape","arrow right"],[3,"value"]],template:function(t,o){1&t&&(e.I0R(0,"div",0)(1,"vdr-timeline-entry",1)(2,"div",2)(3,"textarea",3),e.iHE("ngModelChange",function(a){return e.kNx(o.note,a)||(o.note=a),a}),e.C$Y(),e.I0R(4,"button",4),e.qCj("click",function(){return o.addNoteToOrder()}),e.OEk(5),e.wVc(6,"translate"),e.C$Y()(),e.I0R(7,"div",5)(8,"clr-checkbox-wrapper")(9,"input",6),e.iHE("ngModelChange",function(a){return e.kNx(o.noteIsPrivate,a)||(o.noteIsPrivate=a),a}),e.C$Y(),e.I0R(10,"label"),e.OEk(11),e.wVc(12,"translate"),e.C$Y()(),e.yuY(13,xi,3,3,"span",7)(14,Fi,3,3,"span",8),e.C$Y()(),e.yuY(15,va,4,2,"ng-container",9),e.I0R(16,"vdr-timeline-entry",10)(17,"div",11),e.OEk(18),e.wVc(19,"translate"),e.C$Y()()()),2&t&&(e.eAK("expanded",o.expanded),e.yG2(),e.E7m("featured",!0)("isFirst",!0),e.yG2(2),e.OKB("ngModel",o.note),e.yG2(),e.E7m("disabled",!o.note),e.yG2(),e.oRS(" ",e.kDX(6,16,"common.add-note")," "),e.yG2(4),e.OKB("ngModel",o.noteIsPrivate),e.yG2(2),e.cNF(e.kDX(12,18,"order.note-is-private")),e.yG2(2),e.E7m("ngIf",o.noteIsPrivate),e.yG2(),e.E7m("ngIf",!o.noteIsPrivate),e.yG2(),e.E7m("ngForOf",o.history),e.yG2(),e.E7m("isLast",!0)("createdAt",o.order.createdAt)("featured",!0),e.yG2(2),e.oRS(" ",e.kDX(19,20,"order.history-order-created")," "))},dependencies:[_.o3d,_.ojz,_.y6l,_.eiS,m.ay,m.u_,m.Ko,m.Wm,m.UZ,l.ot,l.SU,l.ue,l._G,k.ER,D.g,C.w,B.i,W.m,U.q,ue.Q,O.a,ce.W,yt.Y,Si.E,ee,re,L,he,we,p.sD,Ct.G,g.u],styles:["[_nghost-%COMP%]{display:block}.entry-list[_ngcontent-%COMP%]{margin-inline-start:calc(var(--space-unit) * 2)}.note-entry[_ngcontent-%COMP%]{display:flex;align-items:center}.note-entry[_ngcontent-%COMP%] .note[_ngcontent-%COMP%]{flex:1}.note-entry[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{margin:0}.visibility-select[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:baseline}.visibility-select[_ngcontent-%COMP%] .public[_ngcontent-%COMP%]{color:var(--color-warning-700)}.visibility-select[_ngcontent-%COMP%] .private[_ngcontent-%COMP%]{color:var(--color-success-700)}textarea.note[_ngcontent-%COMP%]{flex:1;height:36px;border-radius:3px;margin-inline-end:6px}.note-text[_ngcontent-%COMP%]{color:var(--color-grey-800);white-space:pre-wrap;max-width:580px}.cancelled-coupon-code[_ngcontent-%COMP%]{text-decoration:line-through}.note-visibility[_ngcontent-%COMP%]{text-transform:lowercase}.note-visibility.public[_ngcontent-%COMP%]{color:var(--color-warning-700)}.note-visibility.private[_ngcontent-%COMP%]{color:var(--color-success-700)}"],changeDetection:0})}var ba=s(4392);const bt=Y.Ip`
28
28
  query GetSellerOrders($orderId: ID!) {
29
29
  order(id: $orderId) {
30
30
  id
@@ -46,7 +46,7 @@
46
46
  }
47
47
  }
48
48
  }
49
- `;function Ia(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",5),e.wVc(1,"translate"),e.OEk(2),e.C$Y()),2&r){const t=n.ngIf;e.E7m("label",e.kDX(1,2,"common.seller")),e.yG2(2),e.oRS(" ",t.name," ")}}function Ga(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",5),e.wVc(1,"translate"),e.OEk(2),e.wVc(3,"localeCurrency"),e.C$Y()),2&r){const t=e.GaO().$implicit;e.E7m("label",e.kDX(1,2,"order.total")),e.yG2(2),e.oRS(" ",e.g7$(3,4,t.totalWithTax,t.currencyCode)," ")}}const Ea=r=>["seller-orders",r];function Ra(r,n){if(1&r&&(e.I0R(0,"div")(1,"a",3),e.OEk(2),e.wR5(3,"clr-icon",4),e.C$Y(),e.I0R(4,"vdr-labeled-data",5),e.wVc(5,"translate"),e.wR5(6,"vdr-order-state-label",6),e.C$Y(),e.yuY(7,Ia,3,4,"vdr-labeled-data",7)(8,Ga,4,7,"vdr-labeled-data",7),e.C$Y()),2&r){const t=n.$implicit,o=e.GaO();e.yG2(),e.E7m("routerLink",e.S45(8,Ea,t.id)),e.yG2(),e.oRS("",t.code," "),e.yG2(2),e.E7m("label",e.kDX(5,6,"order.state")),e.yG2(2),e.E7m("state",t.state),e.yG2(),e.E7m("ngIf",o.getSeller(t)),e.yG2(),e.E7m("ngIf",o.getSeller(t))}}class Se{constructor(n,t,o){this.router=n,this.dataService=t,this.channelService=o}ngOnInit(){this.sellerOrders$=this.dataService.query(bt,{orderId:this.orderId}).mapSingle(({order:n})=>n?.sellerOrders??[])}getSeller(n){return n.channels.find(o=>o.code!==ba.G8)?.seller}navigateToSellerOrder(n){this.router.navigate(["/orders",n.id])}static#e=this.\u0275fac=function(t){return new(t||Se)(e.GI1(k.E5),e.GI1(d.Aj0),e.GI1(d.mMI))};static#t=this.\u0275cmp=e.In1({type:Se,selectors:[["vdr-seller-orders-card"]],inputs:{orderId:"orderId"},decls:5,vars:6,consts:[[3,"title"],[1,"form-grid"],[4,"ngFor","ngForOf"],[1,"button-ghost","mb-1",3,"routerLink"],["shape","arrow right"],[3,"label"],[3,"state"],[3,"label",4,"ngIf"]],template:function(t,o){1&t&&(e.I0R(0,"vdr-card",0),e.wVc(1,"translate"),e.I0R(2,"div",1),e.yuY(3,Ra,9,10,"div",2),e.wVc(4,"async"),e.C$Y()()),2&t&&(e.E7m("title",e.kDX(1,2,"order.seller-orders")),e.yG2(3),e.E7m("ngForOf",e.kDX(4,4,o.sellerOrders$)))},dependencies:[_.o3d,m.ay,m.u_,k.ER,Me.a,O.a,G.u,m.a,p.sD,g.u],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}function ka(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",9),e.qCj("click",function(){e.usT(t);const i=e.GaO().ngIf,a=e.GaO();return e.CGJ(a.addManualPayment(i))}),e.OEk(1),e.wVc(2,"translate"),e.wVc(3,"localeCurrency"),e.C$Y()}if(2&r){const t=e.GaO().ngIf,o=e.GaO();e.yG2(),e.CAO(" ",e.kDX(2,2,"order.add-payment-to-order")," (",e.g7$(3,4,o.outstandingPaymentAmount(t),t.currencyCode),") ")}}function wa(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",9),e.qCj("click",function(){e.usT(t);const i=e.GaO(2);return e.CGJ(i.transitionToState("ArrangingAdditionalPayment"))}),e.OEk(1),e.wVc(2,"translate"),e.C$Y()}2&r&&(e.yG2(),e.oRS(" ",e.kDX(2,1,"order.arrange-additional-payment")," "))}function Ta(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",10),e.qCj("click",function(){e.usT(t);const i=e.GaO(2);return e.CGJ(i.fulfillOrder())}),e.OEk(1),e.wVc(2,"translate"),e.C$Y()}if(2&r){const t=e.GaO().ngIf,o=e.GaO();e.E7m("disabled",!o.canAddFulfillment(t)),e.yG2(),e.oRS(" ",e.kDX(2,2,"order.fulfill-order")," ")}}function Sa(r,n){if(1&r){const t=e.KQA();e.SAx(0),e.I0R(1,"button",7),e.qCj("click",function(){e.usT(t);const i=e.GaO(2);return e.CGJ(i.transitionToModifying())}),e.wR5(2,"clr-icon",11),e.OEk(3),e.wVc(4,"translate"),e.C$Y(),e.wR5(5,"div",6),e.k70()}2&r&&(e.yG2(3),e.oRS(" ",e.kDX(4,1,"order.modify-order")," "))}function Da(r,n){1&r&&(e.SAx(0),e.OEk(1),e.wVc(2,"translate"),e.k70()),2&r&&(e.yG2(),e.oRS(" ",e.kDX(2,1,"order.refund-and-cancel-order")," "))}function xa(r,n){1&r&&(e.OEk(0),e.wVc(1,"translate")),2&r&&e.oRS(" ",e.kDX(1,1,"order.cancel-order")," ")}function Fa(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",7),e.qCj("click",function(){e.usT(t);const i=e.GaO().ngIf,a=e.GaO();return e.CGJ(a.cancelOrRefund(i))}),e.wR5(1,"clr-icon",12),e.yuY(2,Da,3,3,"ng-container",13)(3,xa,2,3,"ng-template",null,14,e.gJz),e.C$Y()}if(2&r){const t=e.Gew(4),o=e.GaO().ngIf,i=e.GaO();e.yG2(2),e.E7m("ngIf",i.orderHasSettledPayments(o))("ngIfElse",t)}}const $a=r=>({state:r});function Ma(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",7),e.qCj("click",function(){const a=e.usT(t).$implicit,c=e.GaO(3);return e.CGJ(c.transitionToState(a))}),e.wR5(1,"clr-icon",16),e.OEk(2),e.wVc(3,"translate"),e.wVc(4,"translate"),e.wVc(5,"stateI18nToken"),e.C$Y()}if(2&r){const t=n.$implicit;e.yG2(2),e.oRS(" ",e.g7$(3,1,"order.transition-to-state",e.S45(8,$a,e.kDX(4,4,e.kDX(5,6,t))))," ")}}function Ya(r,n){if(1&r&&(e.SAx(0),e.wR5(1,"div",6),e.yuY(2,Ma,6,10,"button",15),e.wVc(3,"async"),e.k70()),2&r){const t=e.GaO(2);e.yG2(2),e.E7m("ngForOf",e.kDX(3,1,t.nextStates$))}}function Pa(r,n){if(1&r){const t=e.KQA();e.I0R(0,"vdr-action-bar"),e.wR5(1,"vdr-ab-left"),e.I0R(2,"vdr-ab-right"),e.wR5(3,"vdr-action-bar-items",1),e.yuY(4,ka,4,7,"button",2)(5,wa,3,3,"button",2)(6,Ta,3,4,"button",3),e.I0R(7,"vdr-action-bar-dropdown-menu",4),e.yuY(8,Sa,6,3,"ng-container",0)(9,Fa,5,2,"button",5)(10,Ya,4,3,"ng-container",0),e.wVc(11,"async"),e.wR5(12,"div",6),e.I0R(13,"button",7),e.qCj("click",function(){const a=e.usT(t).ngIf,c=e.GaO();return e.CGJ(c.manuallyTransitionToState(a))}),e.wR5(14,"clr-icon",8),e.OEk(15),e.wVc(16,"translate"),e.C$Y()()()()}if(2&r){const t=n.ngIf,o=e.GaO();let i;e.yG2(4),e.E7m("ngIf","Aggregate"!==t.type&&("ArrangingPayment"===t.state||"ArrangingAdditionalPayment"===t.state)&&(o.hasUnsettledModifications(t)||0<o.outstandingPaymentAmount(t))),e.yG2(),e.E7m("ngIf","Aggregate"!==t.type&&!1===t.active&&"ArrangingAdditionalPayment"!==t.state&&"ArrangingPayment"!==t.state&&0<o.outstandingPaymentAmount(t)),e.yG2(),e.E7m("ngIf","Aggregate"!==t.type),e.yG2(),e.E7m("alwaysShow",!0),e.yG2(),e.E7m("ngIf","Aggregate"!==t.type&&t.nextStates.includes("Modifying")),e.yG2(),e.E7m("ngIf","Aggregate"!==t.type&&t.nextStates.includes("Cancelled")),e.yG2(),e.E7m("ngIf",null==(i=e.kDX(11,8,o.nextStates$))?null:i.length),e.yG2(5),e.oRS(" ",e.kDX(16,10,"order.manually-transition-to-state")," ")}}function Aa(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",33),e.qCj("click",function(){e.usT(t);const i=e.GaO(2);return e.CGJ(i.openStateDiagram())}),e.wVc(1,"translate"),e.wR5(2,"clr-icon",34),e.C$Y()}2&r&&e.E7m("title",e.kDX(1,1,"order.order-state-diagram"))}function Va(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",33),e.qCj("click",function(){e.usT(t);const i=e.GaO(3);return e.CGJ(i.setOrderCustomer())}),e.wVc(1,"translate"),e.wR5(2,"clr-icon",36),e.C$Y()}2&r&&e.E7m("title",e.kDX(1,1,"order.assign-order-to-another-customer"))}const Na=()=>["UpdateOrder","ReadCustomer"];function Xa(r,n){1&r&&e.yuY(0,Va,3,3,"button",35),2&r&&e.E7m("vdrIfPermissions",e.q4q(1,Na))}function La(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",37),e.wVc(1,"translate"),e.wR5(2,"vdr-formatted-address",38),e.C$Y()),2&r){const t=e.GaO().ngIf;e.E7m("label",e.kDX(1,2,"order.shipping-address")),e.yG2(2),e.E7m("address",t.shippingAddress)}}function ja(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",39),e.wVc(1,"translate"),e.wR5(2,"vdr-formatted-address",38),e.C$Y()),2&r){const t=e.GaO().ngIf;e.E7m("label",e.kDX(1,2,"order.billing-address")),e.yG2(2),e.E7m("address",t.billingAddress)}}function Qa(r,n){if(1&r){const t=e.KQA();e.I0R(0,"vdr-order-payment-card",41),e.qCj("settlePayment",function(i){e.usT(t);const a=e.GaO(3);return e.CGJ(a.settlePayment(i))})("transitionPaymentState",function(i){e.usT(t);const a=e.GaO(3);return e.CGJ(a.transitionPaymentState(i))})("settleRefund",function(i){e.usT(t);const a=e.GaO(3);return e.CGJ(a.settleRefund(i))}),e.C$Y()}if(2&r){const t=n.$implicit,o=e.GaO(2).ngIf;e.E7m("currencyCode",o.currencyCode)("payment",t)}}function Ka(r,n){if(1&r&&(e.I0R(0,"vdr-card",17),e.wVc(1,"translate"),e.yuY(2,Qa,1,2,"vdr-order-payment-card",40),e.C$Y()),2&r){const t=e.GaO().ngIf;e.E7m("title",e.kDX(1,2,"order.payments")),e.yG2(2),e.E7m("ngForOf",t.payments)}}function qa(r,n){if(1&r){const t=e.KQA();e.I0R(0,"vdr-fulfillment-card",43),e.qCj("transitionState",function(i){const c=e.usT(t).$implicit,y=e.GaO(3);return e.CGJ(y.transitionFulfillment(c.id,i))}),e.C$Y()}if(2&r){const t=n.$implicit,o=e.GaO(2).ngIf;e.E7m("fulfillment",t)("order",o)}}function Ha(r,n){if(1&r&&(e.I0R(0,"vdr-card"),e.yuY(1,qa,1,2,"vdr-fulfillment-card",42),e.C$Y()),2&r){const t=e.GaO().ngIf;e.yG2(),e.E7m("ngForOf",t.fulfillments)}}function Ja(r,n){if(1&r&&e.wR5(0,"vdr-page-entity-info",44),2&r){const t=n.ngIf;e.E7m("entity",t)}}function Ba(r,n){if(1&r&&e.wR5(0,"vdr-seller-orders-card",45),2&r){const t=e.GaO().ngIf;e.E7m("orderId",t.id)}}function Wa(r,n){if(1&r&&(e.I0R(0,"tr")(1,"td"),e.OEk(2),e.C$Y(),e.I0R(3,"td"),e.OEk(4),e.wVc(5,"percent"),e.C$Y(),e.I0R(6,"td"),e.OEk(7),e.wVc(8,"localeCurrency"),e.C$Y(),e.I0R(9,"td"),e.OEk(10),e.wVc(11,"localeCurrency"),e.C$Y()()),2&r){const t=n.$implicit,o=e.GaO().ngIf;e.yG2(2),e.cNF(t.description),e.yG2(2),e.cNF(e.g7$(5,4,t.taxRate/100,"0.0-2")),e.yG2(3),e.cNF(e.g7$(8,7,t.taxBase,o.currencyCode)),e.yG2(3),e.cNF(e.g7$(11,10,t.taxTotal,o.currencyCode))}}function Ua(r,n){if(1&r){const t=e.KQA();e.I0R(0,"vdr-card",17),e.wVc(1,"translate"),e.wR5(2,"vdr-tabbed-custom-fields",46),e.wVc(3,"hasPermission"),e.I0R(4,"button",47),e.qCj("click",function(){e.usT(t);const i=e.GaO(2);return e.CGJ(i.updateCustomFields())}),e.OEk(5),e.wVc(6,"translate"),e.C$Y()()}if(2&r){const t=e.GaO(2);let o;e.E7m("title",e.kDX(1,6,"common.custom-fields")),e.yG2(2),e.E7m("customFields",t.customFields)("customFieldsFormGroup",t.detailForm.get("customFields"))("readonly",!e.kDX(3,8,"UpdateOrder")),e.yG2(2),e.E7m("disabled",(null==(o=t.detailForm.get("customFields"))?null:o.pristine)||(null==(o=t.detailForm.get("customFields"))?null:o.invalid)),e.yG2(),e.oRS(" ",e.kDX(6,10,"common.update")," ")}}function za(r,n){if(1&r){const t=e.KQA();e.I0R(0,"vdr-page-detail-layout")(1,"vdr-page-detail-sidebar")(2,"vdr-card",17),e.wVc(3,"translate"),e.yuY(4,Aa,3,3,"ng-template",18),e.wR5(5,"vdr-order-state-label",19),e.C$Y(),e.I0R(6,"vdr-card",17),e.wVc(7,"translate"),e.yuY(8,Xa,1,2,"ng-template",18),e.wR5(9,"vdr-customer-label",20),e.yuY(10,La,3,4,"vdr-labeled-data",21)(11,ja,3,4,"vdr-labeled-data",22),e.C$Y(),e.yuY(12,Ka,3,4,"vdr-card",23)(13,Ha,2,1,"vdr-card",0),e.I0R(14,"vdr-card"),e.yuY(15,Ja,1,1,"vdr-page-entity-info",24),e.wVc(16,"async"),e.C$Y()(),e.I0R(17,"vdr-page-block"),e.yuY(18,Ba,1,1,"vdr-seller-orders-card",25),e.I0R(19,"vdr-card",26),e.wR5(20,"vdr-order-table",27),e.C$Y(),e.I0R(21,"vdr-card",28),e.wVc(22,"translate"),e.I0R(23,"table",29)(24,"thead")(25,"tr")(26,"th"),e.OEk(27),e.wVc(28,"translate"),e.C$Y(),e.I0R(29,"th"),e.OEk(30),e.wVc(31,"translate"),e.C$Y(),e.I0R(32,"th"),e.OEk(33),e.wVc(34,"translate"),e.C$Y(),e.I0R(35,"th"),e.OEk(36),e.wVc(37,"translate"),e.C$Y()()(),e.I0R(38,"tbody"),e.yuY(39,Wa,12,13,"tr",30),e.C$Y()()(),e.yuY(40,Ua,7,12,"vdr-card",23),e.wR5(41,"vdr-custom-detail-component-host",31),e.I0R(42,"vdr-card",17),e.wVc(43,"translate"),e.I0R(44,"vdr-order-history",32),e.qCj("addNote",function(i){e.usT(t);const a=e.GaO();return e.CGJ(a.addNote(i))})("updateNote",function(i){e.usT(t);const a=e.GaO();return e.CGJ(a.updateNote(i))})("deleteNote",function(i){e.usT(t);const a=e.GaO();return e.CGJ(a.deleteNote(i))}),e.wVc(45,"async"),e.C$Y()()()()}if(2&r){const t=n.ngIf,o=e.GaO();e.yG2(2),e.E7m("title",e.kDX(3,26,"order.state")),e.yG2(3),e.E7m("state",t.state),e.yG2(),e.E7m("title",e.kDX(7,28,"order.customer")),e.yG2(3),e.E7m("customer",t.customer),e.yG2(),e.E7m("ngIf",o.getOrderAddressLines(t.shippingAddress).length),e.yG2(),e.E7m("ngIf",o.getOrderAddressLines(t.billingAddress).length),e.yG2(),e.E7m("ngIf",null==t.payments?null:t.payments.length),e.yG2(),e.E7m("ngIf",null==t.fulfillments?null:t.fulfillments.length),e.yG2(2),e.E7m("ngIf",e.kDX(16,30,o.entity$)),e.yG2(3),e.E7m("ngIf",t.sellerOrders.length),e.yG2(),e.E7m("paddingX",!1),e.yG2(),e.E7m("order",t)("orderLineCustomFields",o.orderLineCustomFields),e.yG2(),e.E7m("title",e.kDX(22,32,"order.tax-summary"))("paddingX",!1),e.yG2(6),e.cNF(e.kDX(28,34,"common.description")),e.yG2(3),e.cNF(e.kDX(31,36,"order.tax-rate")),e.yG2(3),e.cNF(e.kDX(34,38,"order.tax-base")),e.yG2(3),e.cNF(e.kDX(37,40,"order.tax-total")),e.yG2(3),e.E7m("ngForOf",t.taxSummary),e.yG2(),e.E7m("ngIf",o.customFields.length),e.yG2(),e.E7m("entity$",o.entity$)("detailForm",o.detailForm),e.yG2(),e.E7m("title",e.kDX(43,42,"order.order-history")),e.yG2(2),e.E7m("order",t)("history",e.kDX(45,44,o.history$))}}const Za=Y.Ip`
49
+ `;function Ia(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",5),e.wVc(1,"translate"),e.OEk(2),e.C$Y()),2&r){const t=n.ngIf;e.E7m("label",e.kDX(1,2,"common.seller")),e.yG2(2),e.oRS(" ",t.name," ")}}function Ga(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",5),e.wVc(1,"translate"),e.OEk(2),e.wVc(3,"localeCurrency"),e.C$Y()),2&r){const t=e.GaO().$implicit;e.E7m("label",e.kDX(1,2,"order.total")),e.yG2(2),e.oRS(" ",e.g7$(3,4,t.totalWithTax,t.currencyCode)," ")}}const Ea=r=>["seller-orders",r];function Ra(r,n){if(1&r&&(e.I0R(0,"div")(1,"a",3),e.OEk(2),e.wR5(3,"clr-icon",4),e.C$Y(),e.I0R(4,"vdr-labeled-data",5),e.wVc(5,"translate"),e.wR5(6,"vdr-order-state-label",6),e.C$Y(),e.yuY(7,Ia,3,4,"vdr-labeled-data",7)(8,Ga,4,7,"vdr-labeled-data",7),e.C$Y()),2&r){const t=n.$implicit,o=e.GaO();e.yG2(),e.E7m("routerLink",e.S45(8,Ea,t.id)),e.yG2(),e.oRS("",t.code," "),e.yG2(2),e.E7m("label",e.kDX(5,6,"order.state")),e.yG2(2),e.E7m("state",t.state),e.yG2(),e.E7m("ngIf",o.getSeller(t)),e.yG2(),e.E7m("ngIf",o.getSeller(t))}}class Se{constructor(n,t,o){this.router=n,this.dataService=t,this.channelService=o}ngOnInit(){this.sellerOrders$=this.dataService.query(bt,{orderId:this.orderId}).mapSingle(({order:n})=>n?.sellerOrders??[])}getSeller(n){return n.channels.find(o=>o.code!==ba.G8)?.seller}navigateToSellerOrder(n){this.router.navigate(["/orders",n.id])}static#e=this.\u0275fac=function(t){return new(t||Se)(e.GI1(k.E5),e.GI1(d.Aj0),e.GI1(d.mMI))};static#t=this.\u0275cmp=e.In1({type:Se,selectors:[["vdr-seller-orders-card"]],inputs:{orderId:"orderId"},decls:5,vars:6,consts:[[3,"title"],[1,"form-grid"],[4,"ngFor","ngForOf"],[1,"button-ghost","mb-1",3,"routerLink"],["shape","arrow right"],[3,"label"],[3,"state"],[3,"label",4,"ngIf"]],template:function(t,o){1&t&&(e.I0R(0,"vdr-card",0),e.wVc(1,"translate"),e.I0R(2,"div",1),e.yuY(3,Ra,9,10,"div",2),e.wVc(4,"async"),e.C$Y()()),2&t&&(e.E7m("title",e.kDX(1,2,"order.seller-orders")),e.yG2(3),e.E7m("ngForOf",e.kDX(4,4,o.sellerOrders$)))},dependencies:[_.o3d,m.ay,m.u_,k.ER,Me.a,O.a,G.u,m.a,p.sD,g.u],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}function ka(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",9),e.qCj("click",function(){e.usT(t);const i=e.GaO().ngIf,a=e.GaO();return e.CGJ(a.addManualPayment(i))}),e.OEk(1),e.wVc(2,"translate"),e.wVc(3,"localeCurrency"),e.C$Y()}if(2&r){const t=e.GaO().ngIf,o=e.GaO();e.yG2(),e.CAO(" ",e.kDX(2,2,"order.add-payment-to-order")," (",e.g7$(3,4,o.outstandingPaymentAmount(t),t.currencyCode),") ")}}function wa(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",9),e.qCj("click",function(){e.usT(t);const i=e.GaO(2);return e.CGJ(i.transitionToState("ArrangingAdditionalPayment"))}),e.OEk(1),e.wVc(2,"translate"),e.C$Y()}2&r&&(e.yG2(),e.oRS(" ",e.kDX(2,1,"order.arrange-additional-payment")," "))}function Ta(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",10),e.qCj("click",function(){e.usT(t);const i=e.GaO(2);return e.CGJ(i.fulfillOrder())}),e.OEk(1),e.wVc(2,"translate"),e.C$Y()}if(2&r){const t=e.GaO().ngIf,o=e.GaO();e.E7m("disabled",!o.canAddFulfillment(t)),e.yG2(),e.oRS(" ",e.kDX(2,2,"order.fulfill-order")," ")}}function Sa(r,n){if(1&r){const t=e.KQA();e.SAx(0),e.I0R(1,"button",7),e.qCj("click",function(){e.usT(t);const i=e.GaO(2);return e.CGJ(i.transitionToModifying())}),e.wR5(2,"clr-icon",11),e.OEk(3),e.wVc(4,"translate"),e.C$Y(),e.wR5(5,"div",6),e.k70()}2&r&&(e.yG2(3),e.oRS(" ",e.kDX(4,1,"order.modify-order")," "))}function Da(r,n){1&r&&(e.SAx(0),e.OEk(1),e.wVc(2,"translate"),e.k70()),2&r&&(e.yG2(),e.oRS(" ",e.kDX(2,1,"order.refund-and-cancel-order")," "))}function xa(r,n){1&r&&(e.OEk(0),e.wVc(1,"translate")),2&r&&e.oRS(" ",e.kDX(1,1,"order.cancel-order")," ")}function Fa(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",7),e.qCj("click",function(){e.usT(t);const i=e.GaO().ngIf,a=e.GaO();return e.CGJ(a.cancelOrRefund(i))}),e.wR5(1,"clr-icon",12),e.yuY(2,Da,3,3,"ng-container",13)(3,xa,2,3,"ng-template",null,14,e.gJz),e.C$Y()}if(2&r){const t=e.Gew(4),o=e.GaO().ngIf,i=e.GaO();e.yG2(2),e.E7m("ngIf",i.orderHasSettledPayments(o))("ngIfElse",t)}}const $a=r=>({state:r});function Ma(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",7),e.qCj("click",function(){const a=e.usT(t).$implicit,c=e.GaO(3);return e.CGJ(c.transitionToState(a))}),e.wR5(1,"clr-icon",16),e.OEk(2),e.wVc(3,"translate"),e.wVc(4,"translate"),e.wVc(5,"stateI18nToken"),e.C$Y()}if(2&r){const t=n.$implicit;e.yG2(2),e.oRS(" ",e.g7$(3,1,"order.transition-to-state",e.S45(8,$a,e.kDX(4,4,e.kDX(5,6,t))))," ")}}function Ya(r,n){if(1&r&&(e.SAx(0),e.wR5(1,"div",6),e.yuY(2,Ma,6,10,"button",15),e.wVc(3,"async"),e.k70()),2&r){const t=e.GaO(2);e.yG2(2),e.E7m("ngForOf",e.kDX(3,1,t.nextStates$))}}function Pa(r,n){if(1&r){const t=e.KQA();e.I0R(0,"vdr-action-bar"),e.wR5(1,"vdr-ab-left"),e.I0R(2,"vdr-ab-right"),e.wR5(3,"vdr-action-bar-items",1),e.yuY(4,ka,4,7,"button",2)(5,wa,3,3,"button",2)(6,Ta,3,4,"button",3),e.I0R(7,"vdr-action-bar-dropdown-menu",4),e.yuY(8,Sa,6,3,"ng-container",0)(9,Fa,5,2,"button",5)(10,Ya,4,3,"ng-container",0),e.wVc(11,"async"),e.wR5(12,"div",6),e.I0R(13,"button",7),e.qCj("click",function(){const a=e.usT(t).ngIf,c=e.GaO();return e.CGJ(c.manuallyTransitionToState(a))}),e.wR5(14,"clr-icon",8),e.OEk(15),e.wVc(16,"translate"),e.C$Y()()()()}if(2&r){const t=n.ngIf,o=e.GaO();let i;e.yG2(4),e.E7m("ngIf","Aggregate"!==t.type&&("ArrangingPayment"===t.state||"ArrangingAdditionalPayment"===t.state)&&(o.hasUnsettledModifications(t)||0<o.outstandingPaymentAmount(t))),e.yG2(),e.E7m("ngIf","Aggregate"!==t.type&&!1===t.active&&"ArrangingAdditionalPayment"!==t.state&&"ArrangingPayment"!==t.state&&0<o.outstandingPaymentAmount(t)),e.yG2(),e.E7m("ngIf","Aggregate"!==t.type),e.yG2(),e.E7m("alwaysShow",!0),e.yG2(),e.E7m("ngIf","Aggregate"!==t.type&&t.nextStates.includes("Modifying")),e.yG2(),e.E7m("ngIf","Aggregate"!==t.type&&t.nextStates.includes("Cancelled")),e.yG2(),e.E7m("ngIf",null==(i=e.kDX(11,8,o.nextStates$))?null:i.length),e.yG2(5),e.oRS(" ",e.kDX(16,10,"order.manually-transition-to-state")," ")}}function Aa(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",33),e.qCj("click",function(){e.usT(t);const i=e.GaO(2);return e.CGJ(i.openStateDiagram())}),e.wVc(1,"translate"),e.wR5(2,"clr-icon",34),e.C$Y()}2&r&&e.E7m("title",e.kDX(1,1,"order.order-state-diagram"))}function Va(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",33),e.qCj("click",function(){e.usT(t);const i=e.GaO(3);return e.CGJ(i.setOrderCustomer())}),e.wVc(1,"translate"),e.wR5(2,"clr-icon",36),e.C$Y()}2&r&&e.E7m("title",e.kDX(1,1,"order.assign-order-to-another-customer"))}const Na=()=>["UpdateOrder","ReadCustomer"];function Xa(r,n){1&r&&e.yuY(0,Va,3,3,"button",35),2&r&&e.E7m("vdrIfPermissions",e.q4q(1,Na))}function La(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",37),e.wVc(1,"translate"),e.wR5(2,"vdr-formatted-address",38),e.C$Y()),2&r){const t=e.GaO().ngIf;e.E7m("label",e.kDX(1,2,"order.shipping-address")),e.yG2(2),e.E7m("address",t.shippingAddress)}}function ja(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",39),e.wVc(1,"translate"),e.wR5(2,"vdr-formatted-address",38),e.C$Y()),2&r){const t=e.GaO().ngIf;e.E7m("label",e.kDX(1,2,"order.billing-address")),e.yG2(2),e.E7m("address",t.billingAddress)}}function Qa(r,n){if(1&r){const t=e.KQA();e.I0R(0,"vdr-order-payment-card",41),e.qCj("settlePayment",function(i){e.usT(t);const a=e.GaO(3);return e.CGJ(a.settlePayment(i))})("transitionPaymentState",function(i){e.usT(t);const a=e.GaO(3);return e.CGJ(a.transitionPaymentState(i))})("settleRefund",function(i){e.usT(t);const a=e.GaO(3);return e.CGJ(a.settleRefund(i))}),e.C$Y()}if(2&r){const t=n.$implicit,o=e.GaO(2).ngIf;e.E7m("currencyCode",o.currencyCode)("payment",t)}}function Ka(r,n){if(1&r&&(e.I0R(0,"vdr-card",17),e.wVc(1,"translate"),e.yuY(2,Qa,1,2,"vdr-order-payment-card",40),e.C$Y()),2&r){const t=e.GaO().ngIf;e.E7m("title",e.kDX(1,2,"order.payments")),e.yG2(2),e.E7m("ngForOf",t.payments)}}function qa(r,n){if(1&r){const t=e.KQA();e.I0R(0,"vdr-fulfillment-card",43),e.qCj("transitionState",function(i){const c=e.usT(t).$implicit,y=e.GaO(3);return e.CGJ(y.transitionFulfillment(c.id,i))}),e.C$Y()}if(2&r){const t=n.$implicit,o=e.GaO(2).ngIf;e.E7m("fulfillment",t)("order",o)}}function Ha(r,n){if(1&r&&(e.I0R(0,"vdr-card"),e.yuY(1,qa,1,2,"vdr-fulfillment-card",42),e.C$Y()),2&r){const t=e.GaO().ngIf;e.yG2(),e.E7m("ngForOf",t.fulfillments)}}function Ja(r,n){if(1&r&&e.wR5(0,"vdr-page-entity-info",44),2&r){const t=n.ngIf;e.E7m("entity",t)}}function Ba(r,n){if(1&r&&e.wR5(0,"vdr-seller-orders-card",45),2&r){const t=e.GaO().ngIf;e.E7m("orderId",t.id)}}function Wa(r,n){if(1&r&&(e.I0R(0,"tr")(1,"td"),e.OEk(2),e.C$Y(),e.I0R(3,"td"),e.OEk(4),e.wVc(5,"percent"),e.C$Y(),e.I0R(6,"td"),e.OEk(7),e.wVc(8,"localeCurrency"),e.C$Y(),e.I0R(9,"td"),e.OEk(10),e.wVc(11,"localeCurrency"),e.C$Y()()),2&r){const t=n.$implicit,o=e.GaO().ngIf;e.yG2(2),e.cNF(t.description),e.yG2(2),e.cNF(e.g7$(5,4,t.taxRate/100,"0.0-3")),e.yG2(3),e.cNF(e.g7$(8,7,t.taxBase,o.currencyCode)),e.yG2(3),e.cNF(e.g7$(11,10,t.taxTotal,o.currencyCode))}}function Ua(r,n){if(1&r){const t=e.KQA();e.I0R(0,"vdr-card",17),e.wVc(1,"translate"),e.wR5(2,"vdr-tabbed-custom-fields",46),e.wVc(3,"hasPermission"),e.I0R(4,"button",47),e.qCj("click",function(){e.usT(t);const i=e.GaO(2);return e.CGJ(i.updateCustomFields())}),e.OEk(5),e.wVc(6,"translate"),e.C$Y()()}if(2&r){const t=e.GaO(2);let o;e.E7m("title",e.kDX(1,6,"common.custom-fields")),e.yG2(2),e.E7m("customFields",t.customFields)("customFieldsFormGroup",t.detailForm.get("customFields"))("readonly",!e.kDX(3,8,"UpdateOrder")),e.yG2(2),e.E7m("disabled",(null==(o=t.detailForm.get("customFields"))?null:o.pristine)||(null==(o=t.detailForm.get("customFields"))?null:o.invalid)),e.yG2(),e.oRS(" ",e.kDX(6,10,"common.update")," ")}}function za(r,n){if(1&r){const t=e.KQA();e.I0R(0,"vdr-page-detail-layout")(1,"vdr-page-detail-sidebar")(2,"vdr-card",17),e.wVc(3,"translate"),e.yuY(4,Aa,3,3,"ng-template",18),e.wR5(5,"vdr-order-state-label",19),e.C$Y(),e.I0R(6,"vdr-card",17),e.wVc(7,"translate"),e.yuY(8,Xa,1,2,"ng-template",18),e.wR5(9,"vdr-customer-label",20),e.yuY(10,La,3,4,"vdr-labeled-data",21)(11,ja,3,4,"vdr-labeled-data",22),e.C$Y(),e.yuY(12,Ka,3,4,"vdr-card",23)(13,Ha,2,1,"vdr-card",0),e.I0R(14,"vdr-card"),e.yuY(15,Ja,1,1,"vdr-page-entity-info",24),e.wVc(16,"async"),e.C$Y()(),e.I0R(17,"vdr-page-block"),e.yuY(18,Ba,1,1,"vdr-seller-orders-card",25),e.I0R(19,"vdr-card",26),e.wR5(20,"vdr-order-table",27),e.C$Y(),e.I0R(21,"vdr-card",28),e.wVc(22,"translate"),e.I0R(23,"table",29)(24,"thead")(25,"tr")(26,"th"),e.OEk(27),e.wVc(28,"translate"),e.C$Y(),e.I0R(29,"th"),e.OEk(30),e.wVc(31,"translate"),e.C$Y(),e.I0R(32,"th"),e.OEk(33),e.wVc(34,"translate"),e.C$Y(),e.I0R(35,"th"),e.OEk(36),e.wVc(37,"translate"),e.C$Y()()(),e.I0R(38,"tbody"),e.yuY(39,Wa,12,13,"tr",30),e.C$Y()()(),e.yuY(40,Ua,7,12,"vdr-card",23),e.wR5(41,"vdr-custom-detail-component-host",31),e.I0R(42,"vdr-card",17),e.wVc(43,"translate"),e.I0R(44,"vdr-order-history",32),e.qCj("addNote",function(i){e.usT(t);const a=e.GaO();return e.CGJ(a.addNote(i))})("updateNote",function(i){e.usT(t);const a=e.GaO();return e.CGJ(a.updateNote(i))})("deleteNote",function(i){e.usT(t);const a=e.GaO();return e.CGJ(a.deleteNote(i))}),e.wVc(45,"async"),e.C$Y()()()()}if(2&r){const t=n.ngIf,o=e.GaO();e.yG2(2),e.E7m("title",e.kDX(3,26,"order.state")),e.yG2(3),e.E7m("state",t.state),e.yG2(),e.E7m("title",e.kDX(7,28,"order.customer")),e.yG2(3),e.E7m("customer",t.customer),e.yG2(),e.E7m("ngIf",o.getOrderAddressLines(t.shippingAddress).length),e.yG2(),e.E7m("ngIf",o.getOrderAddressLines(t.billingAddress).length),e.yG2(),e.E7m("ngIf",null==t.payments?null:t.payments.length),e.yG2(),e.E7m("ngIf",null==t.fulfillments?null:t.fulfillments.length),e.yG2(2),e.E7m("ngIf",e.kDX(16,30,o.entity$)),e.yG2(3),e.E7m("ngIf",t.sellerOrders.length),e.yG2(),e.E7m("paddingX",!1),e.yG2(),e.E7m("order",t)("orderLineCustomFields",o.orderLineCustomFields),e.yG2(),e.E7m("title",e.kDX(22,32,"order.tax-summary"))("paddingX",!1),e.yG2(6),e.cNF(e.kDX(28,34,"common.description")),e.yG2(3),e.cNF(e.kDX(31,36,"order.tax-rate")),e.yG2(3),e.cNF(e.kDX(34,38,"order.tax-base")),e.yG2(3),e.cNF(e.kDX(37,40,"order.tax-total")),e.yG2(3),e.E7m("ngForOf",t.taxSummary),e.yG2(),e.E7m("ngIf",o.customFields.length),e.yG2(),e.E7m("entity$",o.entity$)("detailForm",o.detailForm),e.yG2(),e.E7m("title",e.kDX(43,42,"order.order-history")),e.yG2(2),e.E7m("order",t)("history",e.kDX(45,44,o.history$))}}const Za=Y.Ip`
50
50
  query OrderDetailQuery($id: ID!) {
51
51
  order(id: $id) {
52
52
  ...OrderDetail
@@ -83,4 +83,4 @@
83
83
  }
84
84
  }
85
85
  `;class T{constructor(n,t){this.dataService=n,this.router=t}canActivate(n,t){const o=t.url.includes("orders/draft"),i=t.url.includes("/modify"),a=n.paramMap.get("id");return o?"create"!==a||this.dataService.order.createDraftOrder().pipe((0,R.k)(({createDraftOrder:c})=>this.router.parseUrl(`/orders/draft/${c.id}`))):this.dataService.query(Gt,{id:a}).single$.pipe((0,R.k)(({order:c})=>!("Modifying"===c?.state&&!i)||this.router.parseUrl(`/orders/${a}/modify`)))}static#e=this.\u0275fac=function(t){return new(t||T)(e.CoB(d.Aj0),e.CoB(k.E5))};static#t=this.\u0275prov=e.wxM({token:T,factory:T.\u0275fac,providedIn:"root"})}const Et=r=>[{path:"",component:d.Y3i,pathMatch:"full",data:{locationId:"order-list",breadcrumb:(0,u.s)("breadcrumb.orders")},children:r.getPageTabRoutes("order-list")},{path:"draft/:id",component:d.Y3i,canActivate:[T],data:{locationId:"draft-order-detail",breadcrumb:{label:(0,u.s)("breadcrumb.orders"),link:["../"]}},children:r.getPageTabRoutes("draft-order-detail")},{path:":id",component:d.Y3i,canActivate:[T],data:{locationId:"order-detail",breadcrumb:{label:(0,u.s)("breadcrumb.orders"),link:["../"]}},children:r.getPageTabRoutes("order-detail")},{path:":aggregateOrderId/seller-orders/:id",component:d.Y3i,canActivate:[T],data:{locationId:"order-detail",breadcrumb:{label:(0,u.s)("breadcrumb.orders"),link:["../"]}},children:r.getPageTabRoutes("order-detail")},{path:":id/modify",component:d.Y3i,canActivate:[T],data:{locationId:"modify-order",breadcrumb:{label:(0,u.s)("breadcrumb.orders"),link:["../"]}},children:r.getPageTabRoutes("modify-order")}];class ie{static#e=this.hasRegisteredTabsAndBulkActions=!1;constructor(n){ie.hasRegisteredTabsAndBulkActions||(n.registerPageTab({priority:0,location:"order-list",tab:(0,u.s)("order.orders"),route:"",component:$e}),n.registerPageTab({priority:0,location:"order-detail",tab:(0,u.s)("order.order"),route:"",component:(0,d.AtG)({component:De,query:d.Mru,entityKey:"order",getBreadcrumbs:t=>t?.type===d.aOe.Seller&&t?.aggregateOrder?[{label:`${t?.aggregateOrder?.code}`,link:["/orders/",t?.aggregateOrder?.id]},{label:(0,u.s)("breadcrumb.seller-orders"),link:["/orders/",t?.aggregateOrder?.id]},{label:`${t?.code}`,link:[t?.id]}]:[{label:`${t?.code}`,link:[t?.id]}]})}),n.registerPageTab({priority:0,location:"draft-order-detail",tab:(0,u.s)("order.order"),route:"",component:(0,d.AtG)({component:fe,query:d.Mru,entityKey:"order",getBreadcrumbs:t=>[{label:(0,u.s)("order.draft-order"),link:[t?.id]}]})}),n.registerPageTab({priority:0,location:"modify-order",tab:(0,u.s)("order.order"),route:"",component:(0,d.AtG)({component:Fe,query:d.Mru,entityKey:"order",getBreadcrumbs:t=>[{label:t?.code||"order",link:["/orders/",t?.id]},{label:(0,u.s)("breadcrumb.modifying-order"),link:[t?.id]}]})}),ie.hasRegisteredTabsAndBulkActions=!0)}static#t=this.\u0275fac=function(t){return new(t||ie)(e.CoB(d.ucf))};static#n=this.\u0275mod=e.a4G({type:ie});static#r=this.\u0275inj=e.s3X({providers:[{provide:k.w9,useFactory:n=>Et(n),multi:!0,deps:[d.ucf]}],imports:[d.kTg,k.qQ.forChild([])]})}}}]);
86
- //# sourceMappingURL=72.964f57cc3fd4bbf8.js.map
86
+ //# sourceMappingURL=72.5fce13053e59d31b.js.map