HOME


Mini Shell 1.0
Redirecting to https://devs.lapieza.net/iniciar-sesion Redirecting to https://devs.lapieza.net/iniciar-sesion.
DIR: /var/www/lapieza.do/
Upload File :
Current File : /var/www/lapieza.do/796.1460d961a74fef03.js
"use strict";(self.webpackChunkapp_lapieza=self.webpackChunkapp_lapieza||[]).push([[796],{2796:(Me,T,d)=>{d.r(T),d.d(T,{CheckoutComponent:()=>Pe});var u=d(8834),m=d(9417),e=d(8457),$=d(2289),b=d(8240),S=d(3443),v=d(8041),y=d(7673),E=d(7468),O=d(8810),x=d(6354),k=d(9437),P=d(5558),F=d(5312);let D=(()=>{class s{http;apiUrl="https://courier-api.pedidosya.com/v3/";apiKeyToken="7424-311502-acb0b8c5-1d7b-4db8-61b9-6a2a8ecf70b8";availableAreas=["Santo Domingo","Santo Domingo Este","Santo Domingo Norte","Santo Domingo Oeste","Distrito Nacional","Pedro Brand","Los Alcarrizos","San Antonio de Guerra","Boca Chica"];defaultVolume=10.01;defaultWeight=.3;skuPriceMap={"SKU-49":1250.6,"SKU-33":250};constructor(t){this.http=t}getShippingEstimatesForCart(t,i){const n=t.data.map(o=>{const a={name:o.name,address:o.address||"Direcci\xf3n no especificada",city:o.city||"Ciudad no especificada",delivery_pickup_latitude:o.delivery_pickup_latitude||18.482,delivery_pickup_longitude:o.delivery_pickup_longitude||-69.91,phone:o.phone||"Tel\xe9fono no especificado"},c=o.cart_items.map(l=>({product_id:l.product_id,product_name:l.product_name,quantity:l.quantity,weight:l.weight||.3,volume:10.01,price:l.price,tax:l.tax}));return this.getShippingEstimate(a,i,c).pipe((0,x.T)(l=>({storeId:o.id,storeName:o.name,storeAddress:o.address,storeCity:o.city||"Ciudad no especificada",storePhone:o.phone||"Tel\xe9fono no especificado",storeLatitude:o.delivery_pickup_latitude,storeLongitude:o.delivery_pickup_longitude,storeSubTotal:o.sub_total,cartItems:c,result:l})),(0,k.W)(l=>(0,y.of)({storeId:o.id,storeName:o.name,error:l.message||"Error en la estimaci\xf3n del env\xedo."})))});return(0,E.p)(n)}getShippingEstimate(t,i,n){const o=[{type:"PICK_UP",addressStreet:t.address,addressAdditional:t.addressAdditional||"",city:t.city||"Santo Domingo",latitude:parseFloat(t.delivery_pickup_latitude)||18.489,longitude:parseFloat(t.delivery_pickup_longitude)||-69.933,phone:t.phone||"",name:t.name||"",instructions:t.instructions||""},{type:"DROP_OFF",addressStreet:i.address,addressAdditional:i.addressAdditional||"",city:i.city||"Santo Domingo",latitude:parseFloat(i.latitude)||18.501846,longitude:parseFloat(i.longitude)||-69.948723,phone:i.phone||"",name:i.name||i.full_name||"Customer",instructions:i.instructions||"",collectMoney:i.collectMoney||null}];return this.checkCoverageZone(o).pipe((0,P.n)(a=>{if(200===a.status&&"OK"===a.message){const c={referenceId:String(i.id||"REF-UNKNOWN"),deliveryTime:new Date((new Date).getTime()+18e5).toISOString(),isTest:!1,notificationMail:i.email||"lexquirox@gmail.com",items:n.map(p=>({type:"STANDARD",value:200,description:p.product_name?.substring(0,255)||"Unnamed Item",sku:p.product_id?`SKU-${p.product_id}`:"SKU-UNKNOWN",quantity:p.quantity||1,volume:p.volume||0,weight:p.weight||0})),waypoints:o},l=this.formatPayloadForPedidosYa(c),g=F.c.production?"https://courier-api.pedidosya.com/v3/shippings/estimates":"http://localhost:4201/pedidosya/v3/shippings/estimates",f=new v.b({Accept:"application/json","Content-Type":"application/json",Authorization:`Bearer ${this.apiKeyToken}`,skipInterceptor:"true"});return this.http.post(g,l,{headers:f,withCredentials:!1}).pipe((0,x.T)(p=>({status:"success",data:this.processShippingEstimate(p),rawData:p,message:"El estimado de env\xedo fue obtenido correctamente."})),(0,k.W)(p=>(0,y.of)({status:"error",message:p.message||"Error al obtener el estimado del env\xedo.",code:p.error?.code||"UNKNOWN_ERROR",details:p.error,payload:l})))}return(0,y.of)({status:"error",message:"Cobertura no v\xe1lida o fallo inesperado en la validaci\xf3n.",details:a})}),(0,k.W)(a=>(0,y.of)({status:"error",message:a.message||"Error al validar la cobertura.",code:a.code||"UNKNOWN_COVERAGE_ERROR",details:a})))}formatPayloadForPedidosYa(t){const i=JSON.parse(JSON.stringify(t));return i.items&&Array.isArray(i.items)&&(i.items=i.items.map(n=>{const o=n.sku||"SKU-UNKNOWN",a=null!=n.value?n.value:this.getPriceForSku(o);return{...n,value:a,volume:n.volume&&n.volume>0?n.volume:this.getVolumeForSku(o),weight:n.weight&&n.weight>0?n.weight:this.getWeightForSku(o)}})),i.waypoints&&Array.isArray(i.waypoints)&&(i.waypoints=i.waypoints.map(n=>{if("DROP_OFF"===n.type)if(void 0===n.collectMoney)n.collectMoney=null;else if("string"==typeof n.collectMoney){const o=parseFloat(n.collectMoney);n.collectMoney=isNaN(o)?null:o}return n})),i}getPriceForSku(t){const i=t.match(/SKU-(\d+)/),n=i?i[1]:null;return this.skuPriceMap[t]?this.skuPriceMap[t]:n?200+10*parseInt(n,10):100}getVolumeForSku(t){return this.defaultVolume}getWeightForSku(t){return t.includes("SKU-49")?.5:this.defaultWeight}normalizeCity(t){return t?t.normalize("NFD").replace(/[\u0300-\u036f]/g,"").trim().toLowerCase():""}isCityValid(t){if(!t)return console.error("City is undefined or null."),!1;const i=this.normalizeCity(t),n=this.availableAreas.map(this.normalizeCity).includes(i);return n||console.error(`City "${t}" (normalized: "${i}") is not supported.`),n}checkCoverageZone(t){const i={waypoints:t.map(a=>({type:a.type,addressStreet:a.addressStreet,addressAdditional:a.addressAdditional,city:a.city||"Santo Domingo",latitude:a.latitude||null,longitude:a.longitude||null,instructions:a.instructions,...void 0!==a.collectMoney&&{collectMoney:a.collectMoney}}))},n=F.c.production?"https://courier-api.pedidosya.com/v3/estimates/coverage":"http://localhost:4201/pedidosya/v3/estimates/coverage",o=new v.b({Accept:"application/json","Content-Type":"application/json",Authorization:`${this.apiKeyToken}`,skipInterceptor:"true"});return this.http.post(n,i,{headers:o,withCredentials:!1}).pipe((0,x.T)(a=>{if(a&&a.code){let c;switch(a.code){case"PICK_UP_OUT_OF_ZONE":c="Waypoint in pick-up is out of the zone.";break;case"WAYPOINTS_OUT_OF_ZONE":c="Some waypoints are out of the zone.";break;case"WAYPOINTS_NOT_FOUND":c="We were not able to find lat/long for some waypoints.";break;case"MAX_DISTANCE_EXCEEDED":c="The maximum distance has been exceeded.";break;case"MAX_WAYPOINTS_EXCEEDED":c="The number of waypoints allowed has been exceeded.";break;case"JSON_INVALID":c="The provided JSON is invalid.";break;default:c=a.message||"An unknown error occurred."}throw console.error("Logical error in coverage response:",a.code),{status:400,code:a.code,message:c}}return{status:200,message:"OK",coverageInfo:a}}),(0,k.W)(a=>{let c;if(console.error("HTTP error during coverage check:",a),a.error&&a.error.code)switch(a.error.code){case"PICK_UP_OUT_OF_ZONE":c="Waypoint in pick-up is out of the zone.";break;case"WAYPOINTS_OUT_OF_ZONE":c="Some waypoints are out of the zone.";break;case"WAYPOINTS_NOT_FOUND":c="We were not able to find lat/long for some waypoints.";break;case"MAX_DISTANCE_EXCEEDED":c="The maximum distance has been exceeded.";break;case"MAX_WAYPOINTS_EXCEEDED":c="The number of waypoints allowed has been exceeded.";break;case"JSON_INVALID":c="The provided JSON is invalid.";break;default:c=a.error.message||"An unknown error occurred."}else c=a.message||"An unknown error occurred during the request.";return(0,O.$)(()=>({status:a.status||500,code:a.error?.code||"UNKNOWN_ERROR",message:c}))}))}processShippingEstimate(t){if(!t.deliveryOffers||0===t.deliveryOffers.length)return{available:!1,deliveryName:"PedidosYa",deliveryLogo:"https://images.seeklogo.com/logo-png/36/1/pedidosya-logo-png_seeklogo-363652.png",estimateId:t.estimateId||null,referenceId:t.referenceId||null,message:"No hay ofertas de env\xedo disponibles en este momento",distance:t.route?.distance?this.formatDistance(t.route.distance):null,distanceRaw:t.route?.distance||null,isTest:t.isTest||!1};const i=t.deliveryOffers[0],n=t.route?.distance?(t.route.distance/1e3).toFixed(1):null;return{available:!0,deliveryName:"PedidosYa",deliveryLogo:"https://images.seeklogo.com/logo-png/36/1/pedidosya-logo-png_seeklogo-363652.png",estimateId:t.estimateId,referenceId:t.referenceId,offerId:i.deliveryOfferId,mode:i.deliveryMode,price:{currency:i.pricing.currency,total:i.pricing.total,subTotal:i.pricing.subTotal,taxes:i.pricing.taxes,formattedTotal:this.formatCurrency(i.pricing.total,i.pricing.currency)},timeLimit:i.confirmationTimeLimit,formattedTimeLimit:this.formatDate(new Date(i.confirmationTimeLimit)),distance:this.formatDistance(t.route?.distance),distanceRaw:t.route?.distance,distanceKm:n,isTest:t.isTest,items:t.items.map(o=>({description:o.description,quantity:o.quantity,sku:o.sku,type:o.type,value:o.value,volume:o.volume,weight:o.weight})),waypoints:t.waypoints.map(o=>({type:o.type,addressStreet:o.addressStreet,city:o.city,latitude:o.latitude,longitude:o.longitude,name:o.name,phone:o.phone,instructions:o.instructions||null,collectMoney:o.collectMoney||null})),notificationMail:t.notificationMail||null}}formatDistance(t){return null==t?"Distancia desconocida":t<1e3?`${t} metros`:`${(t/1e3).toFixed(1)} km`}formatCurrency(t,i){return new Intl.NumberFormat("es-DO",{style:"currency",currency:i||"DOP",minimumFractionDigits:2}).format(t)}formatDate(t){return t.toLocaleString("es-DO",{year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit"})}static \u0275fac=function(i){return new(i||s)(e.KVO(v.a))};static \u0275prov=e.jDH({token:s,factory:s.\u0275fac,providedIn:"root"})}return s})();var I=d(3108);function G(s,r){if(1&s){const t=e.RV6();e.j41(0,"div",8)(1,"div")(2,"div",9),e.nrm(3,"input",10),e.k0s(),e.j41(4,"ul",11)(5,"li")(6,"label",12),e.EFF(7),e.k0s()(),e.j41(8,"li")(9,"b"),e.EFF(10),e.k0s()(),e.j41(11,"li")(12,"b"),e.EFF(13,"City:"),e.k0s(),e.EFF(14),e.k0s(),e.j41(15,"li")(16,"b"),e.EFF(17,"State:"),e.k0s(),e.EFF(18),e.k0s(),e.j41(19,"li")(20,"b"),e.EFF(21,"Country:"),e.k0s(),e.EFF(22),e.k0s(),e.j41(23,"li")(24,"b"),e.EFF(25,"Postal Code:"),e.k0s(),e.EFF(26),e.k0s(),e.j41(27,"li")(28,"b"),e.EFF(29,"Phone:"),e.k0s(),e.EFF(30),e.k0s()(),e.j41(31,"button",13),e.bIt("click",function(){e.eBV(t);const n=e.XpG().$implicit,o=e.XpG();return e.Njj(o.removeShippingAddress(n.id))}),e.nrm(32,"i",14),e.k0s()()()}if(2&s){const t=e.XpG().$implicit,i=e.XpG();e.AVh("selected",i.selectedAddress===t)("border-default",1===t.set_default),e.R7$(3),e.Y8G("value",t.id)("checked",i.selectedAddress===t||1===t.set_default),e.R7$(3),e.xc7("background",1===t.set_default?"#007bff":""),e.R7$(),e.SpI(" ",1===t.set_default?"Default":"Address"," "),e.R7$(3),e.JRh(t.address),e.R7$(4),e.SpI(" ",t.city," "),e.R7$(4),e.SpI(" ",t.state," "),e.R7$(4),e.SpI(" ",t.country," "),e.R7$(4),e.SpI(" ",t.postalCode||"N/A"," "),e.R7$(4),e.SpI(" ",t.phone," ")}}function M(s,r){if(1&s){const t=e.RV6();e.j41(0,"div",6),e.bIt("click",function(){const n=e.eBV(t).$implicit,o=e.XpG();return e.Njj(o.selectAddress(n))}),e.DNE(1,G,33,15,"div",7),e.k0s()}if(2&s){const t=r.$implicit,i=e.XpG();e.R7$(),e.Y8G("ngIf",i.showAllAddresses||1===t.set_default)}}let w=(()=>{class s{mainMenuService;cartService;userService;pedidosYaService;shopService;addressUpdated=new e.bkB;addresses=[];selectedAddress=null;shippingAddresses=[];shopDetails=null;showAllAddresses=!0;constructor(t,i,n,o,a){this.mainMenuService=t,this.cartService=i,this.userService=n,this.pedidosYaService=o,this.shopService=a}ngOnInit(){if(this.initializeComponent(),this.addresses?.length>0){const t=this.addresses.find(i=>1===i.set_default)||this.addresses[0];t&&this.selectAddress(t)}}initializeComponent(){this.getShippingAddresses(),this.setDefaultAddress(),this.loadShopDetails()}setDefaultAddress(){this.addresses?.length>0?(this.selectedAddress=this.addresses.find(t=>1===t.set_default)||this.addresses[0],this.emitSelectedAddress()):console.warn("[CheckoutAddressComponent] No addresses available to set as default.")}toggleAddressVisibility(){this.showAllAddresses=!this.showAllAddresses}getShippingAddresses(){this.userService.getUserShippingAddress().subscribe({next:t=>{if(this.addresses=t,this.setDefaultAddress(),this.addresses?.length>0){const i=this.addresses.find(o=>1===o.set_default)||this.addresses[0],n=t[0]?.user_id;this.userService.getUserGeneralDetails(n).subscribe({next:o=>{const a=t.find(c=>1===c.set_default)||t[0];this.selectedAddress={...a,userDetails:o.data}},error:o=>console.error("Error al obtener detalles del usuario",o)}),i&&this.selectAddress(i)}},error:t=>{console.error("[CheckoutAddressComponent] Failed to fetch shipping addresses:",t)}})}loadShopDetails(){this.shopService.getShopInfo(1).subscribe({next:i=>{i&&(this.shopDetails=i)},error:i=>{console.error("[CheckoutAddressComponent] Error fetching shop details:",i)}})}selectAddress(t){t?.id?this.selectedAddress?.id!==t.id?(this.selectedAddress=t,1!==t.set_default?this.updateDefaultAddress(t):this.emitSelectedAddress()):this.emitSelectedAddress():console.warn("[CheckoutAddressComponent] Address ID is undefined or null!")}updateDefaultAddress(t){this.userService.setDefaultUserShippingAddress(t.id).subscribe({next:i=>{this.addresses=this.addresses.map(n=>n.id===t.id?{...n,set_default:1}:{...n,set_default:0}),this.emitSelectedAddress()},error:i=>{console.error("[CheckoutAddressComponent] API call failed:",i)}})}removeShippingAddress(t){this.userService.removeUserShippingAddress(t).subscribe({next:i=>{this.handleAddressRemoval(t)},error:i=>{console.error("[CheckoutAddressComponent] Failed to remove shipping address:",i)}})}handleAddressRemoval(t){const i=1===this.addresses.find(n=>n.id===t)?.set_default;this.addresses=this.addresses.filter(n=>n.id!==t),(i||this.selectedAddress?.id===t)&&(this.addresses.length>0?(this.addresses[0].set_default=i?1:this.addresses[0].set_default,this.selectedAddress=this.addresses[0]):this.selectedAddress=null),this.emitSelectedAddress()}emitSelectedAddress(){this.selectedAddress?(console.log("[CheckoutAddressComponent] Emitting selected address:",this.selectedAddress),this.addressUpdated.emit(this.selectedAddress)):console.warn("[CheckoutAddressComponent] No address to emit.")}static \u0275fac=function(i){return new(i||s)(e.rXU($.Y),e.rXU(b.m),e.rXU(S.D),e.rXU(D),e.rXU(I.s))};static \u0275cmp=e.VBU({type:s,selectors:[["app-checkout-address"]],outputs:{addressUpdated:"addressUpdated"},decls:10,vars:4,consts:[[1,"checkout-box"],[1,"checkout-title"],[1,"checkout-detail"],["type","button",1,"btn","btn-primary","theme-bg-color","text-white","btn-sm","fw-bold","mt-lg-0","mt-3",2,"border","1px solid #007bff",3,"click"],[1,"row","g-4"],["class","col-xxl-6 col-lg-12 col-md-6",3,"click",4,"ngFor","ngForOf"],[1,"col-xxl-6","col-lg-12","col-md-6",3,"click"],["class","delivery-address-box",3,"selected","border-default",4,"ngIf"],[1,"delivery-address-box"],[1,"form-check"],["type","radio","name","selectedAddress",1,"form-check-input",3,"value","checked"],[1,"delivery-address-detail",2,"line-height","15px"],[1,"label",2,"position","relative"],["type","button",1,"btn","btn-danger",2,"height","40px",3,"click"],[1,"fa","fa-trash"]],template:function(i,n){1&i&&(e.j41(0,"div",0)(1,"div",1)(2,"h4"),e.EFF(3,"Delivery Address"),e.k0s()(),e.j41(4,"div",2)(5,"button",3),e.bIt("click",function(){return n.toggleAddressVisibility()}),e.EFF(6),e.k0s(),e.nrm(7,"br"),e.j41(8,"div",4),e.DNE(9,M,2,1,"div",5),e.k0s()()()),2&i&&(e.R7$(5),e.xc7("background",n.showAllAddresses?"#28a745 !important":"#007bff !important"),e.R7$(),e.SpI(" ",n.showAllAddresses?"Show Only Default Address":"Change Addresses"," "),e.R7$(3),e.Y8G("ngForOf",n.addresses))},dependencies:[u.D,u.G,u.I,m.YN],styles:[".delivery-address-box.selected[_ngcontent-%COMP%]{border:2px solid #007bff;background-color:#f8f9fa;padding:10px;border-radius:5px}.delivery-address-box[_ngcontent-%COMP%]{cursor:pointer;background-color:#fff;padding:10px;border:1px solid #dee2e6;border-radius:5px;transition:border .2s ease-in-out,background-color .2s ease-in-out}.delivery-address-box.border-default[_ngcontent-%COMP%]{border:2px solid #28a745;background-color:#e9fbe9}.default-label[_ngcontent-%COMP%]{color:#28a745;font-weight:700;font-size:.85rem}"]})}return s})();var U=d(5205),Y=d(8359),A=d(980),j=d(99);const B=(s,r,t)=>({"alert-info":s,"alert-warning":r,"alert-danger":t}),X=(s,r,t)=>({"fa-info-circle":s,"fa-exclamation-triangle":r,"fa-times-circle":t});function V(s,r){1&s&&(e.j41(0,"div",5),e.nrm(1,"div",6),e.j41(2,"p",7),e.EFF(3,"Cargando opciones de env\xedo..."),e.k0s()())}function L(s,r){if(1&s&&(e.j41(0,"div",8)(1,"div",9),e.nrm(2,"i",10),e.j41(3,"div"),e.EFF(4),e.k0s()()()),2&s){const t=e.XpG();e.R7$(),e.Y8G("ngClass",e.sMw(3,B,"info"===t.alertType,"warning"===t.alertType,"error"===t.alertType)),e.R7$(),e.Y8G("ngClass",e.sMw(7,X,"info"===t.alertType,"warning"===t.alertType,"error"===t.alertType)),e.R7$(2),e.JRh(t.alertMesa)}}function W(s,r){if(1&s&&(e.j41(0,"small",40),e.EFF(1),e.nI1(2,"currency"),e.k0s()),2&s){const t=e.XpG().$implicit;e.R7$(),e.SpI(" Incluye impuestos: ",e.i5U(2,1,t.details.taxes,"DOP")," ")}}function z(s,r){1&s&&(e.j41(0,"small",41),e.EFF(1," basado en la distancia "),e.k0s())}function K(s,r){if(1&s&&(e.j41(0,"div",42),e.nrm(1,"i",43),e.EFF(2),e.k0s()),2&s){const t=e.XpG().$implicit;e.R7$(2),e.SpI(" Distancia: ",(t.details.distance/1e3).toFixed(1)," km ")}}function J(s,r){if(1&s){const t=e.RV6();e.j41(0,"div",8)(1,"div",15)(2,"div",16)(3,"h5",17),e.EFF(4),e.nI1(5,"number"),e.k0s()(),e.j41(6,"div",18)(7,"div",19)(8,"input",20),e.bIt("change",function(){const n=e.eBV(t).$implicit,o=e.XpG(2);return e.Njj(o.onSelectShipping(n))}),e.k0s(),e.j41(9,"label",21)(10,"div",22)(11,"div",23)(12,"div",24)(13,"h5"),e.nrm(14,"img",25),e.EFF(15),e.k0s()(),e.j41(16,"div",26)(17,"div",27)(18,"h6",28),e.EFF(19,"Precio total"),e.k0s(),e.j41(20,"div",29)(21,"span",30),e.EFF(22),e.k0s()(),e.DNE(23,W,3,4,"small",31),e.k0s()(),e.j41(24,"div",26)(25,"div",32)(26,"h6",28),e.EFF(27,"Tiempo de entrega"),e.k0s(),e.j41(28,"div",29),e.nrm(29,"i",33),e.j41(30,"div",34)(31,"span",35),e.EFF(32),e.k0s(),e.DNE(33,z,2,0,"small",36),e.k0s()(),e.DNE(34,K,3,1,"div",37),e.k0s()(),e.j41(35,"div",26)(36,"div",38)(37,"h6",28),e.EFF(38,"Comercio"),e.k0s(),e.j41(39,"div",29),e.nrm(40,"i",39),e.j41(41,"span",35),e.EFF(42),e.k0s()()()()()()()()()()()}if(2&s){const t=r.$implicit,i=e.XpG(2);e.R7$(4),e.Lme(" ",t.name||"Tienda desconocida"," \u2013 RD$",e.i5U(5,14,t.cost,"1.2-2")," "),e.R7$(4),e.Y8G("id","shipping_option_"+t.id)("checked",i.isShippingSelected(t)),e.R7$(),e.Mz_("for","shipping_option_",t.id,""),e.R7$(5),e.FS9("src",t.deliveryLogo,e.B4B),e.R7$(),e.SpI(" ",t.deliveryName,""),e.R7$(7),e.SpI(" ",t.details.formattedTotal," "),e.R7$(),e.Y8G("ngIf",t.details.taxes>0),e.R7$(9),e.SpI(" ",t.details.estimatedTime," "),e.R7$(),e.Y8G("ngIf","N/A"!==t.details.estimatedTime),e.R7$(),e.Y8G("ngIf",t.details.distance),e.R7$(8),e.JRh(t.name)}}function q(s,r){if(1&s&&(e.qex(0),e.j41(1,"div",11)(2,"h4",12),e.nrm(3,"i",13),e.j41(4,"span"),e.EFF(5),e.k0s()()(),e.DNE(6,J,43,17,"div",14),e.bVm()),2&s){const t=e.XpG();e.R7$(5),e.SpI("M\xe9todos de env\xedo disponibles \u2013 ",t.shippingOptions.length," opciones"),e.R7$(),e.Y8G("ngForOf",t.shippingOptions)}}function H(s,r){if(1&s&&(e.j41(0,"div",8)(1,"div",44)(2,"div",45),e.nrm(3,"i",46),e.j41(4,"h5",47),e.EFF(5,"No hay opciones de env\xedo disponibles"),e.k0s()(),e.j41(6,"p"),e.EFF(7),e.k0s(),e.j41(8,"div",48)(9,"button",49),e.nrm(10,"i",50),e.EFF(11," Cambiar direcci\xf3n "),e.k0s(),e.j41(12,"button",51),e.nrm(13,"i",52),e.EFF(14," Contactar soporte "),e.k0s()()()()),2&s){const t=e.XpG(2);e.R7$(7),e.SpI(" ",(null==t.pedidosYaResponse?null:t.pedidosYaResponse.message)||"No se encontraron m\xe9todos de env\xedo disponibles para su ubicaci\xf3n actual."," Por favor, intente con otra direcci\xf3n o contacte con nuestro servicio al cliente. ")}}function Q(s,r){if(1&s&&e.DNE(0,H,15,1,"div",3),2&s){const t=e.XpG();e.Y8G("ngIf",!(t.isLoading||t.shippingOptions&&0!==t.shippingOptions.length))}}let N=(()=>{class s{pedidosYaService;cartServices;shopService;userService;router;cartGroups=[];validateShopDetailsFn;shippingUpdated=new e.bkB;shippingAddress;selectedShippings=[];totalShippingCost=0;userAddress=null;changeStep=new e.bkB;subscriptions=new Y.yU;alertType="warning";updateShippingTimeout=null;updateShippingInProgress=!1;pedidosYaResponse=null;shippingOptions=[];selectedShipping=null;isLoading=!1;alertMesa=null;constructor(t,i,n,o,a){this.pedidosYaService=t,this.cartServices=i,this.shopService=n,this.userService=o,this.router=a}ngOnChanges(t){t.shippingAddress&&!t.shippingAddress.firstChange&&this.shippingAddress&&(this.userAddress=this.shippingAddress,this.updateShipping(this.shippingAddress)),t.cartGroups&&this.cartGroups.length>0&&this.tryCalculateShipping()}ngOnInit(){this.loadSavedSelections(),this.getUserDefaultAddress(),this.tryCalculateShipping(),this.shippingOptions?.length>0&&0===this.selectedShippings.length&&(this.applySavedSelections(),this.onSelectShipping(this.shippingOptions[0]))}applySavedSelections(){const t=sessionStorage.getItem("selectedShippings");if(t){const i=JSON.parse(t);Array.isArray(i.selections)&&i.selections.length>0&&(this.selectedShippings=i.selections,this.selectedShippings.forEach(n=>{const o=this.shippingOptions.find(a=>a.id===n.id);o&&this.onSelectShipping(o)}))}else this.shippingOptions&&this.shippingOptions.length&&this.onSelectShipping(this.shippingOptions[0])}tryCalculateShipping(){this.userAddress&&this.cartGroups.length>0?(this.updateShipping(this.userAddress),this.setAlert("info","Calculando costos de env\xedo...")):this.setAlert("warning","No se puede calcular el env\xedo - falta direcci\xf3n o el carrito est\xe1 vac\xedo")}ngAfterViewInit(){this.calculateTotalShipping(),document.querySelectorAll('[data-bs-toggle="tooltip"]').forEach(i=>new U.m_(i))}calculateTotalShipping(){this.totalShippingCost=this.selectedShippings.reduce((t,i)=>t+("number"==typeof i.cost?i.cost:parseFloat(i.cost)),0),this.shippingUpdated.emit({id:this.selectedShippings[0]?.id||0,name:this.selectedShippings.map(t=>t.name).join(", "),cost:this.totalShippingCost,formattedTotal:new Intl.NumberFormat("es-DO",{style:"currency",currency:"DOP"}).format(this.totalShippingCost)})}ngOnDestroy(){this.updateShippingTimeout&&clearTimeout(this.updateShippingTimeout),this.subscriptions.unsubscribe()}setAlert(t,i){console.log(`[CheckoutDeliveryComponent] Setting alert: ${t} - ${i}`),this.alertType=t,this.alertMesa=i,"success"===t&&i&&!i.includes("Entrega disponible")&&setTimeout(()=>{"success"===this.alertType&&this.alertMesa===i&&(this.alertType="",this.alertMesa=null)},5e3)}getUserDefaultAddress(){this.userService.getUserShippingAddress().pipe((0,A.j)(()=>this.isLoading=!1)).subscribe({next:t=>{t?.length>0?(this.userAddress=t.find(i=>1===i.set_default)||t[0],this.tryCalculateShipping()):this.setAlert("warning","No se encontr\xf3 ninguna direcci\xf3n. Por favor, a\xf1ade una direcci\xf3n para proceder.")}})}set externalShippingOptions(t){t&&t.length?(this.shippingOptions=t,this.applySavedSelections(),0===this.selectedShippings.length?(this.selectedShipping=this.shippingOptions[0],this.onSelectShipping(this.selectedShipping[0])):this.applySavedSelections(),this.calculateTotalShipping()):(this.shippingOptions=[],this.selectedShippings=[],this.totalShippingCost=0)}updateShipping(t){if(t&&t.latitude&&t.longitude)return this.selectedShippings=[],this.totalShippingCost=0,this.cartGroups?.length?(this.isLoading=!0,this.setAlert("info","Calculando opciones de env\xedo..."),void this.pedidosYaService.getShippingEstimatesForCart({data:this.cartGroups},t).pipe((0,A.j)(()=>{this.isLoading=!1,this.updateShippingInProgress=!1})).subscribe({next:i=>{this.handleSuccessfulCartEstimates(i),0===this.selectedShippings.length&&this.shippingUpdated.emit({id:0,name:"",cost:0,formattedTotal:"0"})},error:i=>{console.error("[CheckoutDeliveryComponent] Shipping calculation error:",i),this.setAlert("error","Error al calcular costos de env\xedo."),this.shippingUpdated.emit({id:0,name:"",cost:0,formattedTotal:"0"})}})):(console.warn("[CheckoutDeliveryComponent] No cart groups found."),void this.setAlert("warning","No hay productos en el carrito para calcular env\xedo."));this.resetShippingState()}resetShippingState(){this.isLoading=!1,this.updateShippingInProgress=!1,this.updateShippingTimeout&&(clearTimeout(this.updateShippingTimeout),this.updateShippingTimeout=null)}handleSuccessfulCartEstimates(t){console.log("[CheckoutDeliveryComponent] Procesando respuestas exitosas del carrito:",t),this.shippingOptions=t.map(i=>{const n=i?.result?.data;if(!n||typeof n.price>"u")return console.warn("[CheckoutDeliveryComponent] Respuesta inv\xe1lida:",i),null;const c=Math.ceil(n.distanceRaw/1e3/30*60);return{id:n.deliveryOfferId||i.storeId,name:`Env\xedo desde ${i.storeName||"Tienda desconocida"}`,deliveryName:n.deliveryName,deliveryLogo:n.deliveryLogo,cost:n.price.total||0,details:{deliveryCharge:n.price.subTotal||0,totalCost:n.price.total||0,taxes:n.price.taxes||0,formattedTotal:n.price.formattedTotal||"N/A",estimatedTime:c>0?`${n.distance}, ${c} minutos aproximadamente`:"N/A"}}}).filter(i=>null!==i),this.shippingOptions.length>0?(this.selectFirstOption(),this.shippingUpdated.emit({id:this.selectedShipping.id,name:this.selectedShipping.name,cost:this.selectedShipping.cost,formattedTotal:this.selectedShipping.details.formattedTotal}),sessionStorage.setItem("selectedShipping",JSON.stringify(this.selectedShipping)),this.setAlert("success",`Opciones de env\xedo calculadas para ${this.shippingOptions.length} tienda(s).`)):this.setAlert("warning","No se encontraron opciones de env\xedo disponibles.")}isShippingSelected(t){return this.selectedShippings.some(i=>i.id===t.id)}selectFirstOption(){this.shippingOptions&&this.shippingOptions.length>0?(this.selectedShipping=this.shippingOptions[0],sessionStorage.setItem("selectedShipping",JSON.stringify(this.selectedShipping)),console.log("[CheckoutDeliveryComponent] Auto-selected first shipping option:",this.selectedShipping)):(console.warn("[CheckoutDeliveryComponent] No shipping options available to select"),this.selectedShipping=null)}onSelectShipping(t){const i=this.selectedShippings.findIndex(n=>n.id===t.id);-1===i?this.selectedShippings.push(t):this.selectedShippings.splice(i,1),this.totalShippingCost=this.selectedShippings.reduce((n,o)=>n+("number"==typeof o.cost?o.cost:parseFloat(o.cost)),0),this.shippingUpdated.emit({id:this.selectedShippings[0]?.id||0,name:this.selectedShippings.map(n=>n.name).join(", "),cost:this.totalShippingCost,formattedTotal:new Intl.NumberFormat("es-DO",{style:"currency",currency:"DOP"}).format(this.totalShippingCost)}),sessionStorage.setItem("selectedShippings",JSON.stringify({selections:this.selectedShippings,totalCost:this.totalShippingCost})),console.log("[CheckoutDeliveryComponent] Opciones seleccionadas:",this.selectedShippings),console.log("[CheckoutDeliveryComponent] Costo total de env\xedos:",this.totalShippingCost)}loadSavedSelections(){const t=sessionStorage.getItem("selectedShippings");if(t){const i=JSON.parse(t);this.selectedShippings=Array.isArray(i.selections)?i.selections:[],this.totalShippingCost="number"==typeof i.totalCost?i.totalCost:0,this.shippingOptions&&this.shippingOptions.length>0&&this.selectedShippings.forEach(n=>{const o=this.shippingOptions.find(a=>a.id===n.id);o&&this.onSelectShipping(o)}),this.selectedShippings.length>0&&this.calculateTotalShipping()}else this.selectedShippings=[],this.totalShippingCost=0}static \u0275fac=function(i){return new(i||s)(e.rXU(D),e.rXU(b.m),e.rXU(I.s),e.rXU(S.D),e.rXU(j.t))};static \u0275cmp=e.VBU({type:s,selectors:[["app-checkout-delivery"]],inputs:{cartGroups:"cartGroups",validateShopDetailsFn:"validateShopDetailsFn",shippingAddress:"shippingAddress",externalShippingOptions:"externalShippingOptions"},outputs:{shippingUpdated:"shippingUpdated",changeStep:"changeStep"},features:[e.OA$],decls:6,vars:4,consts:[["noOptionsTemplate",""],[1,"row","g-4"],["class","col-12 text-center my-4","aria-live","polite",4,"ngIf"],["class","col-12",4,"ngIf"],[4,"ngIf","ngIfElse"],["aria-live","polite",1,"col-12","text-center","my-4"],["role","status","aria-hidden","true",1,"spinner-border","text-primary"],[1,"mt-2","text-muted"],[1,"col-12"],["role","alert",1,"alert","d-flex","align-items-center",3,"ngClass"],[1,"fa-solid","me-2",3,"ngClass"],[1,"col-12","mb-4"],[1,"fw-bold","d-flex","align-items-center"],[1,"fa-solid","fa-truck","me-2","text-primary"],["class","col-12",4,"ngFor","ngForOf"],[1,"card","mb-4","shipping-option-card","border-primary","shadow-sm"],[1,"card-header","bg-primary","text-white"],[1,"mb-0"],[1,"card-body","p-4"],[1,"form-check","d-flex","align-items-start","gap-2"],["type","checkbox",1,"form-check-input","mt-2",3,"change","id","checked"],[1,"form-check-label","w-100",3,"for"],[1,"shipping-details"],[1,"row","g-3","mb-4"],[1,"col-md-12"],[2,"width","60px","border-radius","5px",3,"src"],[1,"col-md-4"],[1,"pricing-card","p-3","bg-light","rounded","h-100"],[1,"text-muted","mb-2"],[1,"d-flex","align-items-center"],[1,"h3","mb-0","text-primary","fw-bold"],["class","text-muted d-block mt-2",4,"ngIf"],[1,"time-card","p-3","bg-light","rounded","h-100"],[1,"fa-solid","fa-clock","text-primary","fs-4","me-2"],[1,"d-flex","flex-column"],[1,"fw-medium"],["class","text-muted",4,"ngIf"],["class","mt-2 small text-muted",4,"ngIf"],[1,"store-card","p-3","bg-light","rounded","h-100"],[1,"fa-solid","fa-store","text-primary","fs-4","me-2"],[1,"text-muted","d-block","mt-2"],[1,"text-muted"],[1,"mt-2","small","text-muted"],[1,"fa-solid","fa-route","me-1"],["role","alert",1,"alert","alert-warning","d-flex","flex-column","p-4"],[1,"d-flex","align-items-center","mb-3"],[1,"fa-solid","fa-exclamation-triangle","fs-4","me-3","text-warning"],[1,"mb-0","fw-bold"],[1,"d-grid","gap-2","d-md-flex","justify-content-md-end","mt-2"],["type","button",1,"btn","btn-outline-primary"],[1,"fa-solid","fa-map-marker-alt","me-1"],["type","button",1,"btn","btn-outline-secondary"],[1,"fa-solid","fa-headset","me-1"]],template:function(i,n){if(1&i&&(e.j41(0,"div",1),e.DNE(1,V,4,0,"div",2)(2,L,5,11,"div",3)(3,q,7,2,"ng-container",4)(4,Q,1,1,"ng-template",null,0,e.C5r),e.k0s()),2&i){const o=e.sdS(5);e.R7$(),e.Y8G("ngIf",n.isLoading),e.R7$(),e.Y8G("ngIf",n.alertMesa),e.R7$(),e.Y8G("ngIf",!n.isLoading&&n.shippingOptions.length>0)("ngIfElse",o)}},dependencies:[u.D,u.E,u.G,u.I,u.a3,u.a2,m.YN],styles:[".shipping-option-card[_ngcontent-%COMP%]{transition:all .2s ease-in-out}.shipping-option-card[_ngcontent-%COMP%]:hover{transform:translateY(-3px);box-shadow:0 .5rem 1rem #00000026!important}.transition-effect[_ngcontent-%COMP%]{transition:all .3s ease}.card-header[_ngcontent-%COMP%]{border-bottom:0;border-top-left-radius:var(--bs-card-border-radius);border-top-right-radius:var(--bs-card-border-radius)}"]})}return s})(),Z=(()=>{class s{http;apiUrl=F.c.apiUrl;constructor(t){this.http=t}getPaymentTypes(t="",i=""){const n=this.getToken();if(!n)return(0,O.$)(()=>new Error("No authentication token found."));const o=new v.b({"Content-Type":"application/json",Authorization:"Bearer "+n});return(new v.c).set("mode",t).set("list",i),this.http.get(this.apiUrl+"payment-types",{headers:o})}getToken(){return typeof window>"u"?null:localStorage.getItem("authToken")}static \u0275fac=function(i){return new(i||s)(e.KVO(v.a))};static \u0275prov=e.jDH({token:s,factory:s.\u0275fac,providedIn:"root"})}return s})();const ee=()=>[];function te(s,r){if(1&s&&e.nrm(0,"img",16),2&s){const t=e.XpG().$implicit;e.FS9("alt",t.name),e.Y8G("src",t.image,e.B4B)}}function ie(s,r){if(1&s&&e.nrm(0,"p",18),2&s){const t=e.XpG(2).$implicit;e.Y8G("innerHTML",t.details,e.npT)}}function ne(s,r){if(1&s&&(e.j41(0,"div")(1,"h5"),e.EFF(2),e.k0s(),e.DNE(3,ie,1,1,"p",17),e.k0s()),2&s){const t=e.XpG().$implicit;e.R7$(2),e.JRh(t.title),e.R7$(),e.Y8G("ngIf",t.details)}}function se(s,r){if(1&s){const t=e.RV6();e.j41(0,"div",24)(1,"div",25)(2,"input",26),e.mxI("ngModelChange",function(n){e.eBV(t);const o=e.XpG(3);return e.DH7(o.selectedBank,n)||(o.selectedBank=n),e.Njj(n)}),e.k0s(),e.j41(3,"label",9),e.EFF(4),e.nrm(5,"br"),e.j41(6,"small"),e.EFF(7),e.k0s()()()()}if(2&s){const t=r.$implicit,i=e.XpG(3);e.R7$(2),e.Y8G("id",t.bankName),e.R50("ngModel",i.selectedBank),e.Y8G("value",t.bankName),e.R7$(),e.Y8G("for",t.bankName),e.R7$(),e.Lme(" ",t.bankName," - ",t.accountType,""),e.R7$(3),e.SpI("Account Number: ",t.accountNumber,"")}}function oe(s,r){1&s&&(e.j41(0,"option",32),e.EFF(1," Select Other Bank "),e.k0s())}function ae(s,r){if(1&s&&(e.j41(0,"option",33),e.EFF(1),e.k0s()),2&s){const t=r.$implicit;e.Y8G("value",t.value),e.R7$(),e.SpI(" ",t.name," ")}}function re(s,r){if(1&s){const t=e.RV6();e.j41(0,"div",27)(1,"div",28)(2,"select",29),e.mxI("ngModelChange",function(n){e.eBV(t);const o=e.XpG(3);return e.DH7(o.selectedOtherBank,n)||(o.selectedOtherBank=n),e.Njj(n)}),e.DNE(3,oe,2,0,"option",30)(4,ae,2,2,"option",31),e.k0s(),e.j41(5,"label"),e.EFF(6,"Select Other Bank"),e.k0s()()()}if(2&s){const t=e.XpG(3);e.R7$(2),e.R50("ngModel",t.selectedOtherBank),e.R7$(),e.Y8G("ngIf",!t.selectedOtherBank),e.R7$(),e.Y8G("ngForOf",t.otherBankOptions)}}function ce(s,r){if(1&s&&(e.j41(0,"div")(1,"h5",19),e.EFF(2,"Select Your Bank"),e.k0s(),e.j41(3,"div",20),e.DNE(4,se,8,7,"div",21),e.k0s(),e.j41(5,"div",22),e.DNE(6,re,7,3,"div",23),e.k0s()()),2&s){const t=e.XpG().$implicit,i=e.XpG();e.R7$(4),e.Y8G("ngForOf",t.banks),e.R7$(2),e.Y8G("ngIf",i.otherBankOptions.length>0)}}function le(s,r){if(1&s){const t=e.RV6();e.j41(0,"div",24)(1,"div",25)(2,"input",34),e.mxI("ngModelChange",function(n){e.eBV(t);const o=e.XpG(3);return e.DH7(o.selectedWallet,n)||(o.selectedWallet=n),e.Njj(n)}),e.k0s(),e.j41(3,"label",9),e.EFF(4),e.k0s()()()}if(2&s){const t=r.$implicit,i=e.XpG(3);e.R7$(2),e.Y8G("id",t.id),e.R50("ngModel",i.selectedWallet),e.Y8G("value",t.name),e.R7$(),e.Y8G("for",t.id),e.R7$(),e.SpI(" ",t.name," ")}}function de(s,r){if(1&s&&(e.j41(0,"div")(1,"h5",19),e.EFF(2,"Select Your Wallet"),e.k0s(),e.j41(3,"div",20),e.DNE(4,le,5,5,"div",21),e.k0s()()),2&s){const t=e.XpG(2);e.R7$(4),e.Y8G("ngForOf",t.walletOptions)}}function pe(s,r){1&s&&(e.j41(0,"div")(1,"div",35)(2,"div",22)(3,"div",36)(4,"div",37),e.nrm(5,"input",38),e.j41(6,"label",39),e.EFF(7,"Enter Credit & Debit Card Number"),e.k0s()()()(),e.j41(8,"div",40)(9,"div",37),e.nrm(10,"input",41),e.j41(11,"label",42),e.EFF(12,"Expiry Date"),e.k0s()()(),e.j41(13,"div",40)(14,"div",37),e.nrm(15,"input",43),e.j41(16,"label",44),e.EFF(17,"CVV Number"),e.k0s()()()()())}function ue(s,r){if(1&s){const t=e.RV6();e.j41(0,"div",5)(1,"h2",6)(2,"button",7),e.bIt("click",function(){const n=e.eBV(t).$implicit,o=e.XpG();return e.Njj(o.selectPaymentMethod(n.id))}),e.j41(3,"div",8)(4,"label",9),e.nrm(5,"input",10),e.DNE(6,te,1,2,"img",11),e.j41(7,"b",12),e.EFF(8),e.k0s()()()()(),e.j41(9,"div",13)(10,"div",14),e.DNE(11,ne,4,2,"div",15)(12,ce,7,2,"div",15)(13,de,5,1,"div",15)(14,pe,18,0,"div",15),e.k0s()()()}if(2&s){const t=r.$implicit,i=e.XpG();e.R7$(),e.Y8G("id","heading"+t.id),e.R7$(),e.AVh("collapsed",i.selectedPaymentMethod!==t.id),e.BMQ("aria-expanded",i.selectedPaymentMethod===t.id)("aria-controls","collapse"+t.id),e.R7$(2),e.Y8G("for",t.id),e.R7$(),e.Y8G("id",t.id)("checked",i.selectedPaymentMethod===t.id||"azul"===t.id),e.R7$(),e.Y8G("ngIf",t.image),e.R7$(2),e.JRh(t.name),e.R7$(),e.AVh("show",i.selectedPaymentMethod===t.id),e.Y8G("id","collapse"+t.id),e.BMQ("aria-labelledby","heading"+t.id),e.R7$(2),e.Y8G("ngIf",t.title||t.image||t.details),e.R7$(),e.Y8G("ngIf",((null==t?null:t.banks)||e.lJ4(18,ee)).length>0),e.R7$(),e.Y8G("ngIf","wallet"===t.id&&i.walletOptions.length>0),e.R7$(),e.Y8G("ngIf","credit"===t.id)}}let he=(()=>{class s{paymentsService;paymentUpdated=new e.bkB;selectedBank="";selectedOtherBank="";selectedWallet="";paymentMethods=[];selectedPaymentMethod="cash";selectedPayment=null;otherBankOptions=[];bankOptions=[];walletOptions=[];constructor(t){this.paymentsService=t}ngOnInit(){this.loadPaymentMethodsFromService(),this.setInitialSelections()}loadPaymentMethodsFromService(){this.paymentsService.getPaymentTypes("","").pipe((0,k.W)(t=>(console.error("Error loading payment methods:",t),(0,y.of)([])))).subscribe(t=>{this.paymentMethods=this.mapPaymentMethods(t),this.paymentMethods.length>0&&this.selectPaymentMethod(this.paymentMethods[0].id)})}mapPaymentMethods(t){return t.map(i=>({id:i.payment_type_key,name:i.name,title:i.title,image:i.image,details:i.details,banks:this.mapBanks(i.banks_details||[])}))}mapBanks(t){return t.map(i=>({bankName:i.bank_name,accountNumber:i.account_number,accountType:i.account_name}))}setInitialSelections(){this.updateSelectedBank(this.selectedBank),this.updateSelectedWallet(this.selectedWallet),this.emitPaymentUpdate()}selectPaymentMethod(t){this.selectedPaymentMethod=t,this.selectedPayment=this.paymentMethods.find(i=>i.id===t)||null,this.bankOptions=this.selectedPayment?.banks||[],sessionStorage.setItem("selectedPayment",JSON.stringify(this.selectedPayment)),this.emitPaymentUpdate()}updateSelectedBank(t){t&&(this.selectedBank=t,this.emitPaymentUpdate())}updateSelectedWallet(t){t&&(this.selectedWallet=t,this.emitPaymentUpdate())}emitPaymentUpdate(){this.paymentUpdated.emit({method:this.selectedPaymentMethod,bank:this.selectedBank,wallet:this.selectedWallet})}static \u0275fac=function(i){return new(i||s)(e.rXU(Z))};static \u0275cmp=e.VBU({type:s,selectors:[["app-checkout-payment"]],inputs:{selectedBank:"selectedBank",selectedOtherBank:"selectedOtherBank",selectedWallet:"selectedWallet"},outputs:{paymentUpdated:"paymentUpdated"},decls:7,vars:1,consts:[[1,"checkout-box"],[1,"checkout-title"],[1,"checkout-detail"],["id","paymentAccordion",1,"accordion","accordion-flush","custom-accordion"],["class","accordion-item",4,"ngFor","ngForOf"],[1,"accordion-item"],[1,"accordion-header",3,"id"],[1,"accordion-button",3,"click"],[1,"custom-form-check","form-check","mb-0"],[1,"form-check-label",3,"for"],["type","radio","name","paymentMethod",1,"form-check-input","mt-0",3,"id","checked"],["style","height:40px","class","img-fluid mb-2",3,"src","alt",4,"ngIf"],[2,"padding-left","15px"],["data-bs-parent","#paymentAccordion",1,"accordion-collapse","collapse",2,"padding","15px","background-color","rgba(221, 221, 221, 0.71)",3,"id"],[1,"accordion-body"],[4,"ngIf"],[1,"img-fluid","mb-2",2,"height","40px",3,"src","alt"],[3,"innerHTML",4,"ngIf"],[3,"innerHTML"],[1,"text-uppercase","mb-4"],[1,"row","g-2"],["class","col-md-6",4,"ngFor","ngForOf"],[1,"col-12"],["class","select-option",4,"ngIf"],[1,"col-md-6"],[1,"custom-form-check","form-check"],["type","radio","name","bank",1,"form-check-input","mt-0",3,"ngModelChange","id","ngModel","value"],[1,"select-option"],[1,"form-floating","theme-form-floating"],[1,"form-select","theme-form-select",3,"ngModelChange","ngModel"],["value","","selected","",4,"ngIf"],[3,"value",4,"ngFor","ngForOf"],["value","","selected",""],[3,"value"],["type","radio","name","wallet",1,"form-check-input","mt-0",3,"ngModelChange","id","ngModel","value"],[1,"row","g-2","mt-4"],[1,"payment-method"],[1,"form-floating","mb-lg-3","mb-2","theme-form-floating"],["type","text","id","creditCard","placeholder","Enter Credit Card Number",1,"form-control"],["for","creditCard"],[1,"col-xxl-4"],["type","text","id","expiry","placeholder","Enter Expiry Date",1,"form-control"],["for","expiry"],["type","text","id","cvv","placeholder","Enter CVV Number",1,"form-control"],["for","cvv"]],template:function(i,n){1&i&&(e.j41(0,"div",0)(1,"div",1)(2,"h4"),e.EFF(3,"Payment Option"),e.k0s()(),e.j41(4,"div",2)(5,"div",3),e.DNE(6,ue,15,19,"div",4),e.k0s()()()),2&i&&(e.R7$(6),e.Y8G("ngForOf",n.paymentMethods))},dependencies:[u.D,u.G,u.I,m.YN,m.xH,m.y7,m.me,m.wz,m.Fm,m.BC,m.vS],encapsulation:2})}return s})();var me=d(5528),ge=d(3789),fe=d(8982),_e=d.n(fe),ve=d(3137),ye=d(5499);const R=s=>["/product",s];function ke(s,r){1&s&&(e.j41(0,"tr",52),e.nrm(1,"td",53),e.k0s())}function Ce(s,r){if(1&s&&e.nrm(0,"img",60),2&s){const t=e.XpG().ngIf;e.Y8G("src",t.logo,e.B4B)}}function be(s,r){if(1&s&&e.nrm(0,"img",61),2&s){const t=e.XpG().ngIf;e.Y8G("src",t.verified_img,e.B4B)}}function Se(s,r){if(1&s&&(e.qex(0),e.j41(1,"table",54)(2,"tr")(3,"td",55),e.DNE(4,Ce,1,1,"img",56),e.k0s(),e.j41(5,"td",57)(6,"h4",58),e.EFF(7),e.k0s(),e.j41(8,"p"),e.DNE(9,be,1,1,"img",59),e.k0s()()()(),e.bVm()),2&s){const t=r.ngIf;e.R7$(4),e.Y8G("ngIf",null==t?null:t.logo),e.R7$(3),e.SpI(" ",t.name," "),e.R7$(2),e.Y8G("ngIf",null==t?null:t.verified_img)}}function xe(s,r){if(1&s&&(e.j41(0,"span")(1,"span",83),e.EFF(2),e.nI1(3,"number"),e.k0s(),e.EFF(4," / "),e.j41(5,"del",84),e.EFF(6),e.nI1(7,"number"),e.k0s()()),2&s){const t=e.XpG().$implicit,i=e.XpG(2);e.R7$(2),e.SpI("RD$",e.i5U(3,2,i.ensureNumber(t.price)-i.ensureNumber(t.discount),"1.2-2"),""),e.R7$(4),e.SpI("RD$",e.i5U(7,5,i.ensureNumber(t.price),"1.2-2"),"")}}function Fe(s,r){if(1&s&&(e.j41(0,"span"),e.EFF(1),e.nI1(2,"number"),e.k0s()),2&s){const t=e.XpG().$implicit,i=e.XpG(2);e.R7$(),e.SpI(" RD$",e.i5U(2,1,i.ensureNumber(t.price),"1.2-2")," ")}}function Ie(s,r){if(1&s&&(e.j41(0,"h6",85),e.EFF(1),e.nI1(2,"number"),e.k0s()),2&s){const t=e.XpG().$implicit,i=e.XpG(2);e.R7$(),e.SpI(" Discount Applied: -RD$",e.i5U(2,1,i.ensureNumber(t.discount),"1.2-2")," ")}}function Te(s,r){if(1&s&&(e.j41(0,"h6"),e.EFF(1),e.nI1(2,"number"),e.k0s()),2&s){const t=e.XpG().$implicit,i=e.XpG(2);e.R7$(),e.SpI(" Tax: +RD$",e.i5U(2,1,i.ensureNumber(t.tax),"1.2-2")," ")}}function Ee(s,r){if(1&s&&(e.j41(0,"span"),e.EFF(1),e.nI1(2,"number"),e.j41(3,"del",84),e.EFF(4),e.nI1(5,"number"),e.k0s()()),2&s){const t=e.XpG().$implicit,i=e.XpG(2);e.R7$(),e.SpI(" RD$",e.i5U(2,2,(i.ensureNumber(t.price)-i.ensureNumber(t.discount))*i.ensureNumber(t.quantity)+i.ensureNumber(t.tax)+i.ensureNumber(t.shipping_cost),"1.2-2")," / "),e.R7$(3),e.SpI(" RD$",e.i5U(5,5,i.ensureNumber(t.price)*i.ensureNumber(t.quantity)+i.ensureNumber(t.tax)+i.ensureNumber(t.shipping_cost),"1.2-2")," ")}}function Oe(s,r){if(1&s&&(e.j41(0,"span"),e.EFF(1),e.nI1(2,"number"),e.k0s()),2&s){const t=e.XpG().$implicit,i=e.XpG(2);e.R7$(),e.SpI(" RD$",e.i5U(2,1,i.ensureNumber(t.price)*i.ensureNumber(t.quantity)+i.ensureNumber(t.tax)+i.ensureNumber(t.shipping_cost),"1.2-2")," ")}}function De(s,r){if(1&s){const t=e.RV6();e.j41(0,"tr",62)(1,"td",63)(2,"div",64)(3,"a",65),e.nrm(4,"img",66),e.k0s(),e.j41(5,"div",67)(6,"ul",68)(7,"li")(8,"span",69),e.EFF(9),e.k0s(),e.nrm(10,"br"),e.j41(11,"span",70),e.EFF(12,"Dimension:"),e.k0s(),e.EFF(13),e.j41(14,"h5",71),e.EFF(15," Price: "),e.DNE(16,xe,8,8,"span",27)(17,Fe,3,4,"span",27),e.k0s(),e.DNE(18,Ie,3,4,"h6",72)(19,Te,3,4,"h6",27),e.j41(20,"h5"),e.EFF(21," Total: "),e.DNE(22,Ee,6,8,"span",27)(23,Oe,3,4,"span",27),e.k0s()()()()()(),e.j41(24,"td",73)(25,"small"),e.EFF(26,"Quantity"),e.k0s(),e.j41(27,"div",74)(28,"button",75),e.bIt("click",function(){const n=e.eBV(t).$implicit,o=e.XpG(2);return e.Njj(o.updateQuantityAutomatically(n,n.quantity-1))}),e.nrm(29,"i",76),e.k0s(),e.j41(30,"input",77),e.bIt("input",function(n){const o=e.eBV(t).$implicit,a=e.XpG(2);return e.Njj(a.updateQuantityAutomatically(o,n))}),e.k0s(),e.j41(31,"button",78),e.bIt("click",function(){const n=e.eBV(t).$implicit,o=e.XpG(2);return e.Njj(o.updateQuantityAutomatically(n,n.quantity+1))}),e.nrm(32,"i",79),e.k0s()()(),e.j41(33,"td",80)(34,"small"),e.EFF(35,"Delete"),e.k0s(),e.j41(36,"button",81),e.bIt("click",function(){const n=e.eBV(t).index,o=e.XpG().index,a=e.XpG();return e.Njj(a.removeItemCheckCoutCart(o,n))}),e.nrm(37,"i",82),e.k0s()()()}if(2&s){const t=r.$implicit;e.R7$(3),e.Y8G("routerLink",e.eq3(12,R,t.slug)),e.R7$(),e.Y8G("src",t.product_thumbnail_image||"assets/images/default-product.png",e.B4B),e.R7$(4),e.Y8G("routerLink",e.eq3(14,R,t.slug)),e.R7$(),e.SpI(" ",t.product_name," "),e.R7$(4),e.SpI(" ",t.variation," "),e.R7$(3),e.Y8G("ngIf",t.discount>0),e.R7$(),e.Y8G("ngIf",0===t.discount),e.R7$(),e.Y8G("ngIf",t.discount>0),e.R7$(),e.Y8G("ngIf",t.tax),e.R7$(3),e.Y8G("ngIf",t.discount>0),e.R7$(),e.Y8G("ngIf",0===t.discount),e.R7$(7),e.Y8G("value",t.quantity)}}function Ae(s,r){if(1&s&&(e.qex(0),e.DNE(1,ke,2,0,"tr",45),e.j41(2,"tr",46)(3,"td",47),e.DNE(4,Se,10,3,"ng-container",27),e.k0s(),e.j41(5,"td",48)(6,"h4",49)(7,"b",50),e.EFF(8,"Subtotal:"),e.k0s(),e.EFF(9),e.nI1(10,"number"),e.k0s()()(),e.DNE(11,De,38,16,"tr",51),e.bVm()),2&s){const t=r.$implicit,i=r.index,n=e.XpG();e.R7$(),e.Y8G("ngIf",i>=1),e.R7$(3),e.Y8G("ngIf",n.shopDetails[i]),e.R7$(5),e.SpI(" $",e.i5U(10,4,t.sub_total,"1.2-2"),""),e.R7$(2),e.Y8G("ngForOf",t.cart_items)}}function je(s,r){if(1&s){const t=e.RV6();e.j41(0,"div")(1,"h6",86),e.EFF(2,"Coupon Apply"),e.k0s(),e.j41(3,"div",87),e.nrm(4,"input",88,0),e.j41(6,"button",89),e.bIt("click",function(){e.eBV(t);const n=e.sdS(5),o=e.XpG();return e.Njj(o.applyCoupon(n.value))}),e.EFF(7,"Apply"),e.k0s()()()}}function Ne(s,r){if(1&s&&(e.j41(0,"div",92),e.nrm(1,"img",93)(2,"br"),e.EFF(3),e.k0s()),2&s){const t=e.XpG(2);e.R7$(3),e.SpI(" ",t.alertCouponMessage," ")}}function Re(s,r){if(1&s&&(e.j41(0,"div",94),e.EFF(1),e.k0s()),2&s){const t=e.XpG(2);e.R7$(),e.SpI(" ",t.alertCouponMessage," ")}}function $e(s,r){if(1&s&&(e.j41(0,"div"),e.DNE(1,Ne,4,1,"div",90)(2,Re,2,1,"div",91),e.k0s()),2&s){const t=e.XpG();e.R7$(),e.Y8G("ngIf",t.isCouponApplied),e.R7$(),e.Y8G("ngIf",!t.isCouponApplied)}}let Pe=(()=>{class s{cartService;userService;shopService;elementRef;couponsService;snackBar;router;ngZone;cdr;checkoutDeliveryComponent;_pendingAddressUpdate=null;selectedShippingOption=null;cartTotal=0;cartGroups=[];selectedAddress=null;shippingCost=0;paymentMethods=[];selectedPayment=null;subtotal=0;tax=0;couponDiscount=0;total=0;shippingEstimateError=null;shippingStatus=null;shippingMessage=null;cartItemsList=[];grandTotal=0;totalItems=0;taxTotal=0;finalTotal=0;shopDetails=[];alertCouponMessage="";isCouponApplied=!1;selectedBank="";selectedOtherBank="";selectedWallet="";addresses;hideCouponInput;constructor(t,i,n,o,a,c,l,g,f){this.cartService=t,this.userService=i,this.shopService=n,this.elementRef=o,this.couponsService=a,this.snackBar=c,this.router=l,this.ngZone=g,this.cdr=f}ngAfterViewInit(){this._pendingAddressUpdate&&(this.checkoutDeliveryComponent.updateShipping(this._pendingAddressUpdate),this._pendingAddressUpdate=null)}ngOnInit(){this.loadUserAddresses(),this.loadCartData(),this.loadCartItems(),(0,ge.eV)(_e().loadAnimation)}handlePaymentUpdate(t){t&&(this.selectedBank=t.bank||"",this.selectedOtherBank=t.otherBank||"",this.selectedWallet=t.wallet||"")}loadCartData(){this.cartService.getUserCart().subscribe({next:t=>{if(!t||!t.data)return console.error("[CheckoutComponent] Invalid response structure:",t),void(this.cartGroups=[]);this.cartGroups=(t.data||[]).map(i=>({...i,cart_items:(i.cart_items||[]).map(n=>({...n,price:this.parseCurrency(n.price),discount:this.parseCurrency(n.discount),tax:this.parseCurrency(n.tax),shipping_cost:this.parseCurrency(n.shipping_cost),quantity:Number(n.quantity)||0}))})),console.log("[CheckoutComponent] Parsed cart groups:",this.cartGroups),this.calculateCartTotals(),this.cartGroups.length>0?this.cartGroups.forEach(i=>{const n=i.id;n?this.loadShopDetails(n):console.warn("[CheckoutComponent] Missing shop ID in group:",i)}):console.warn("[CheckoutComponent] No cart groups found.")},error:t=>{console.error("[CheckoutComponent] Error while loading cart data:",t),this.cartGroups=[]},complete:()=>{console.log("[CheckoutComponent] Cart data loading completed")}})}parseCurrency(t){return"string"==typeof t?parseFloat(t.replace(/[^\d.-]/g,""))||0:t?Number(t):0}loadShopDetails(t){t?this.shopService.getShopInfo(t).subscribe({next:i=>{const n=i?.data||{},o={id:n.id,name:n.name,address:n.address,delivery_pickup_latitude:n.delivery_pickup_latitude,delivery_pickup_longitude:n.delivery_pickup_longitude,phone:n.phone,verified:n.verified||!1},a=this.cartGroups.find(c=>c.id===t);a?a.shopDetails=o:console.warn(`[CheckoutComponent] Could not find target group for shop ID: ${t}`)},error:i=>{console.error(`[CheckoutComponent] Failed to fetch shop details for shop ID ${t}:`,i)}}):console.error("[CheckoutComponent] Invalid shop ID provided.")}handleShipping(t){this.cdr.detectChanges(),this.ngZone.run(()=>{if(this.cartGroups&&0!==this.cartGroups.length)if(this.selectedAddress=t,t&&"object"==typeof t)if(void 0!==t.cost&&(this.selectedShippingOption=t,this.calculateCartTotals()),this.cartGroups&&0!==this.cartGroups.length)for(const i of this.cartGroups)!this.validateShopDetails(i.shopDetails||null,i.id)||Array.isArray(i.cart_items);else console.error("[CheckoutComponent] No cart groups available for shipping estimation.");else console.error("[CheckoutComponent] Invalid shipping details:",t);else console.warn("[CheckoutComponent] No cart groups available for shipping estimation.")})}updateCartTotal(){let t=0;if(this.cartGroups&&this.cartGroups.length>0)for(const n of this.cartGroups)for(const o of n.cart_items||[])t+=o.price*o.quantity;this.cartTotal=t+(this.selectedShippingOption?.cost||0)}validateShopDetails=(t,i)=>!!t;calculateCartTotals(){const{subtotal:t,tax:i,discountTotal:n}=this.cartGroups.reduce((a,c)=>(c.cart_items.forEach(l=>{const g=C=>"string"==typeof C?parseFloat(C.replace(/[^\d.-]/g,""))||0:C?Number(C):0,f=g(l.price),p=g(l.discount),_=g(l.tax),h=l.quantity||0,Ge=Math.max(f-p,0);a.subtotal+=Ge*h,a.tax+=_,a.discountTotal+=p*h}),a),{subtotal:0,tax:0,discountTotal:0}),o=this.selectedShippingOption?.cost?parseFloat(this.selectedShippingOption.cost.toString()):0;this.subtotal=t,this.tax=i,this.shippingCost=o,this.couponDiscount=n,this.total=this.subtotal+this.tax+this.shippingCost}loadPaymentMethods(){this.paymentMethods=[{id:1,name:"Cash on Delivery"},{id:2,name:"Credit or Debit Card"},{id:3,name:"Bank Transfer"},{id:4,name:"Wallet"}],this.selectedPayment=this.paymentMethods[0]}applyCoupon(t){t?this.couponsService.applyCouponCode(t).subscribe(i=>{i.result?(this.isCouponApplied=!0,this.alertCouponMessage=i.message||"Coupon applied successfully!",this.hideCouponInput=!0,"product_base"===i.coupon_type?this.applyDiscountToProducts(i.data.discount,i.coupon_discount_type,i.coupon_details):console.warn("Unexpected coupon type:",i.coupon_type),this.loadCartItems()):(this.alertCouponMessage=i.message||"Invalid coupon code!",this.isCouponApplied=!1,console.warn("Failed to apply coupon:",i.message))},i=>{console.error("Error applying coupon:",i),this.alertCouponMessage="Failed to apply coupon. Please try again later.",this.isCouponApplied=!1}):this.alertCouponMessage="Please enter a valid coupon code."}applyDiscountToProducts(t,i,n){if(isNaN(t)||t<=0)return void console.error("Invalid discount value:",t);if(!["percent","fixed"].includes(i))return void console.error("Invalid discount type:",i);const o=n.map(c=>c.product_id);let a=0;this.cartItemsList.forEach(c=>{o.includes(c.product_id)&&(a++,"percent"===i?c.total=parseFloat((c.total-c.total*(t/100)).toFixed(2)):"fixed"===i&&(c.total=Math.max(c.total-t,0)))}),0===a&&console.warn("No eligible products for this discount."),this.calculateTotals()}loadUserAddresses(){this.userService.getUserShippingAddress().subscribe({next:t=>{t?.length||console.error("Sin direcciones disponibles al cargar p\xe1gina.")},error:t=>console.error("Error al cargar direcciones",t)})}updateQuantityAutomatically(t,i){let n;if("number"==typeof i)n=i;else{const h=i.target;n=h&&h.value?parseInt(h.value,10):t.quantity}if(n=Math.max(1,Math.min(n,9)),n===t.quantity)return;const o=t.quantity;t.quantity=n;const a=this.ensureNumber(t.price),c=this.ensureNumber(t.discount),f=Math.max(0,a-c)*n,p=.18*a*n,_=f+p;t.totalDiscount=c*n,t.totalTax=p,t.subtotal=f,t.total=_,this.cartService.changeQuantity(t.id,n).subscribe({next:h=>{h.result?(this.processCartItems(),this.calculateTotals(),this.notifyUser("Item quantity updated successfully")):(console.warn(`[CartComponent] Change quantity response: ${h.message}`),this.notifyUser(h.message||"Could not update item quantity",!1),t.quantity=o)},error:h=>{console.error(`[CartComponent] Failed to update quantity for item ID ${t.id}:`,h),t.quantity=o,alert("An error occurred while updating the quantity. Please try again.")}})}notifyUser(t,i=!0){i?this.snackBar.open(t,"Close",{duration:3e3}):alert(t)}processCartItems(){this.cartItemsList.forEach(t=>{let i=0,n=0;t.cart_items.forEach(o=>{const a=this.ensureNumber(o.price),c=this.ensureNumber(o.discount),l=o.quantity||1,p=Math.max(0,a-c)*l,_=.18*a*l;o.subtotal=p,o.totalTax=_,o.total=p+_,i+=p,n+=_}),t.sub_total=i,t.tax_total=n})}calculateTotals(){let t=0,i=0;this.cartItemsList.forEach(a=>{t+=a.sub_total||0,i+=a.tax_total||0}),t=Math.max(0,t),i=Math.max(0,i);const n=this.shippingCost||0,o=this.couponDiscount||0;this.grandTotal=t,this.taxTotal=i,this.finalTotal=Math.max(0,t+i+n-o),this.calculateTotalItems()}calculateTotalItems(){this.totalItems=this.cartItemsList.reduce((t,i)=>t+i.cart_items.reduce((n,o)=>n+(o.quantity||1),0),0)}removeItemCheckCoutCart(t,i){const n=this.cartItemsList[t];if(n&&n.cart_items[i]){const o=n.cart_items[i].id;this.cartService.deleteProductUserCart(o).subscribe({next:a=>{sessionStorage.removeItem("selectedShipping"),n.cart_items.splice(i,1),0===n.cart_items.length&&this.cartItemsList.splice(t,1),this.processCartItems(),this.calculateTotals()},error:a=>{console.error(`[CheckoutComponent] Failed to remove product with ID ${o} from server:`,a)}})}}loadCartItems(){this.cartService.getUserCart().subscribe({next:t=>{this.cartItemsList=t.data||[];const i=this.cartItemsList.map(n=>this.shopService.getShopInfo(n.id));(0,E.p)(i).subscribe({next:n=>{this.shopDetails=n.map(o=>o.data)},error:n=>{console.error("Failed to fetch shop details:",n)}}),this.processCartItems(),this.calculateTotals()},error:t=>{console.error("Failed to fetch cart items:",t)}})}ensureNumber(t){return"string"==typeof t?parseFloat(t.replace(/[^\d.-]/g,""))||0:t?Number(t):0}parseFloat=parseFloat;continueToPayment(){null==sessionStorage.getItem("selectedPayment")?this.snackBar.open("Por favor seleccion un metodo de pago","Cerrar",{duration:3e3}):null==sessionStorage.getItem("selectedShipping")&&this.snackBar.open("Por favor seleccion una metodo de envio","Cerrar",{duration:3e3})}static \u0275fac=function(i){return new(i||s)(e.rXU(b.m),e.rXU(S.D),e.rXU(I.s),e.rXU(e.aKT),e.rXU(ve.r),e.rXU(ye.UG),e.rXU(j.t),e.rXU(e.SKi),e.rXU(e.gRc))};static \u0275cmp=e.VBU({type:s,selectors:[["app-checkout"]],viewQuery:function(i,n){if(1&i&&e.GBs(N,5),2&i){let o;e.mGM(o=e.lsd())&&(n.checkoutDeliveryComponent=o.first)}},decls:107,vars:30,consts:[["couponCode",""],[1,"checkout-section-2","section-b-space"],[1,"container-fluid-lg"],[1,"row","g-sm-4","g-3"],[1,"col-lg-8"],[1,"left-sidebar-checkout"],[1,"checkout-detail-box"],[1,"checkout-icon"],["target",".nav-item","src","https://cdn.lordicon.com/ggihhudh.json","trigger","loop-on-hover","colors","primary:#121331,secondary:#646e78,tertiary:#0baf9a",1,"lord-icon"],[1,"checkout-box"],[1,"checkout-title"],[1,"checkout-detail"],[1,"table-responsive-xl",2,"overflow-x","auto","width","100%"],[1,"table","table-bordered","text-center"],[4,"ngFor","ngForOf"],["target",".nav-item","src","https://cdn.lordicon.com/oaflahpk.json","trigger","loop-on-hover","colors","primary:#0baf9a",1,"lord-icon"],[3,"addressUpdated"],["target",".nav-item","src","https://cdn.lordicon.com/zthozvfn.json","trigger","loop-on-hover","colors","primary:#121331,secondary:#646e78,tertiary:#f4c542",1,"lord-icon",2,"width","48px","height","48px"],[3,"shippingUpdated","cartGroups","validateShopDetailsFn","shippingAddress"],["target",".nav-item","src","https://cdn.lordicon.com/qmcsqnle.json","trigger","loop-on-hover","colors","primary:#0baf9a,secondary:#0baf9a",1,"lord-icon"],[3,"paymentUpdated","selectedBank","selectedOtherBank","selectedWallet"],[1,"col-lg-4"],[1,"right-side-summery-box"],[1,"summery-box-2"],[1,"summery-header"],[1,"summery-contain"],[1,"col-12","coupon-cart"],[4,"ngIf"],[1,"summery-total"],[1,"price"],[1,"list-total"],[1,"price","theme-color"],[1,"col-12","mt-4"],[1,"btn","btn-theme-outline","theme-bg-color","btn-lg","w-100","py-3","d-flex","justify-content-center","align-items-center",3,"click"],[2,"color","#fff"],[1,"fa-solid","fa-arrow-right","ms-2"],[1,"text-muted","small","text-center","mt-2"],["type","checkbox","name","agree-terms","checked",""],[1,"fa-solid","fa-shield-alt","me-1"],[1,"payment-box"],["src","assets/images/icon/paymant/visa.png","alt","",2,"width","50px"],["src","assets/images/icon/paymant/discover.png","alt","",2,"width","50px"],["src","assets/images/icon/paymant/american.png","alt","",2,"width","50px"],["src","assets/images/icon/paymant/master-card.png","alt","",2,"width","50px"],["src","assets/images/icon/paymant/giro-pay.png","alt","",2,"width","50px"],["style","border:unset",4,"ngIf"],[1,"shop-header",2,"margin-top","15px","border","1px solid #ddd","background","transparent","border-top","unset","border-right","unset","border-left","unset"],["colspan","2",2,"text-align","left","border","unset"],["colspan","1",2,"text-align","center","border","unset","line-height","80px"],[2,"margin-top","30px"],[1,"shop-subtotal"],["class","product-box-contain",4,"ngFor","ngForOf"],[2,"border","unset"],["colspan","3",2,"border","unset"],[2,"margin-top","15px"],[2,"width","60px"],["alt","Shop Logo","style","width:100%; max-width: 60px;border-radius:10px",3,"src",4,"ngIf"],[2,"padding-left","10px"],[1,"text-truncate",2,"max-width","100%","overflow","hidden","white-space","nowrap","font-weight","bold"],["alt","Verify Image","style","width:100%; max-width: 80px; margin-top:5px",3,"src",4,"ngIf"],["alt","Shop Logo",2,"width","100%","max-width","60px","border-radius","10px",3,"src"],["alt","Verify Image",2,"width","100%","max-width","80px","margin-top","5px",3,"src"],[1,"product-box-contain"],[1,"product-detail",2,"width","100%","max-width","300px"],[1,"product","border-0","d-flex","align-items-center"],[1,"product-image","me-2",3,"routerLink"],["alt","Product Image",1,"img-fluid","blur-up","lazyload",2,"max-width","60px",3,"src"],[1,"product-detail","text-start"],[1,"list-unstyled","mb-0"],[1,"name",2,"cursor","pointer","color","red",3,"routerLink"],[1,"text-title"],[1,"text-content","d-inline-block"],["class","text-danger",4,"ngIf"],[1,"quantity",2,"width","80px"],[1,"counter"],[1,"qty-left-minus",3,"click"],[1,"fa-solid","fa-minus"],["readonly","","type","number","min","1","max","9",1,"form-control","qty-input",3,"input","value"],[1,"qty-right-plus",3,"click"],[1,"fa-solid","fa-plus"],[1,"save-remove",2,"width","30px"],["type","button",1,"btn","btn-danger","btn-sm",2,"width","100%",3,"click"],[1,"fa","fa-trash"],[1,"discounted-price"],[1,"text-muted"],[1,"text-danger"],[1,"text-content","mb-2"],[1,"mb-3","coupon-box","input-group"],["type","text","placeholder","Enter Code Here...",1,"form-control"],[1,"btn-apply",3,"click"],["class","col-12","style","text-align: center",4,"ngIf"],["class","alert alert-danger mt-3",4,"ngIf"],[1,"col-12",2,"text-align","center"],["src","https://cdn-icons-png.flaticon.com/512/2689/2689901.png","alt","Success Icon",1,"img-fluid",2,"width","100%","max-width","120px"],[1,"alert","alert-danger","mt-3"]],template:function(i,n){1&i&&(e.j41(0,"section",1)(1,"div",2)(2,"div",3)(3,"div",4)(4,"div",5)(5,"div",6)(6,"ul")(7,"li")(8,"div",7),e.nrm(9,"lord-icon",8),e.k0s(),e.j41(10,"div",9)(11,"div",10)(12,"h4"),e.EFF(13,"Items Cart"),e.k0s()(),e.j41(14,"div",11)(15,"div",12)(16,"table",13)(17,"tbody"),e.DNE(18,Ae,12,7,"ng-container",14),e.k0s()()()()()(),e.j41(19,"li")(20,"div",7),e.nrm(21,"lord-icon",15),e.k0s(),e.j41(22,"app-checkout-address",16),e.bIt("addressUpdated",function(a){return n.handleShipping(a)}),e.k0s()(),e.j41(23,"li")(24,"div",7),e.nrm(25,"lord-icon",17),e.k0s(),e.j41(26,"div",9)(27,"div",10)(28,"h4"),e.EFF(29,"Delivery Option"),e.k0s()(),e.j41(30,"div",11)(31,"app-checkout-delivery",18),e.bIt("shippingUpdated",function(a){return n.handleShipping(a)}),e.k0s()()()(),e.j41(32,"li")(33,"div",7),e.nrm(34,"lord-icon",19),e.k0s(),e.j41(35,"app-checkout-payment",20),e.bIt("paymentUpdated",function(a){return n.handlePaymentUpdate(a)}),e.k0s()()()()()(),e.j41(36,"div",21)(37,"div",22)(38,"div",23)(39,"div",24)(40,"h3"),e.EFF(41,"Order Summary"),e.k0s()(),e.j41(42,"ul",25)(43,"li")(44,"div",26),e.DNE(45,je,8,0,"div",27)(46,$e,3,2,"div",27),e.k0s()()(),e.j41(47,"ul",28)(48,"li")(49,"h4"),e.EFF(50,"Items"),e.k0s(),e.j41(51,"h4",29)(52,"b"),e.EFF(53),e.k0s()()(),e.j41(54,"li")(55,"h4"),e.EFF(56,"Subtotal"),e.k0s(),e.j41(57,"h4",29),e.EFF(58),e.nI1(59,"number"),e.k0s()(),e.j41(60,"li")(61,"h4"),e.EFF(62,"Coupon/Code"),e.k0s(),e.j41(63,"h4",29),e.EFF(64),e.nI1(65,"number"),e.k0s()(),e.j41(66,"li")(67,"h4"),e.EFF(68,"Shipping"),e.k0s(),e.j41(69,"h4",29),e.EFF(70),e.nI1(71,"number"),e.k0s()(),e.j41(72,"li")(73,"h4"),e.EFF(74,"Tax"),e.k0s(),e.j41(75,"h4",29),e.EFF(76),e.nI1(77,"number"),e.k0s()(),e.j41(78,"li",30)(79,"h4"),e.EFF(80,"Total (RD$)"),e.k0s(),e.j41(81,"h4",31),e.EFF(82),e.nI1(83,"number"),e.k0s()()(),e.nrm(84,"br"),e.j41(85,"div",32)(86,"button",33),e.bIt("click",function(){return n.continueToPayment()}),e.j41(87,"span",34),e.EFF(88,"Continuar al Pago"),e.k0s(),e.nrm(89,"i",35),e.k0s(),e.nrm(90,"p"),e.j41(91,"p",36),e.nrm(92,"input",37)(93,"i",38),e.EFF(94," Al continuar acepta los t\xe9rminos del servicio de entrega, y los terminos y condiciones de uso de la plataforma"),e.k0s()(),e.nrm(95,"br"),e.j41(96,"ul",39)(97,"li"),e.nrm(98,"img",40),e.k0s(),e.j41(99,"li"),e.nrm(100,"img",41),e.k0s(),e.j41(101,"li"),e.nrm(102,"img",42),e.k0s(),e.j41(103,"li"),e.nrm(104,"img",43),e.k0s(),e.j41(105,"li"),e.nrm(106,"img",44),e.k0s()()()()()()()()),2&i&&(e.R7$(18),e.Y8G("ngForOf",n.cartItemsList),e.R7$(13),e.Y8G("cartGroups",n.cartGroups)("validateShopDetailsFn",n.validateShopDetails.bind(n))("shippingAddress",n.selectedAddress),e.R7$(4),e.Y8G("selectedBank",n.selectedBank)("selectedOtherBank",n.selectedOtherBank)("selectedWallet",n.selectedWallet),e.R7$(10),e.Y8G("ngIf",!n.hideCouponInput),e.R7$(),e.Y8G("ngIf",n.alertCouponMessage),e.R7$(7),e.SpI("(",n.totalItems,")"),e.R7$(5),e.SpI(" RD$",e.i5U(59,15,n.subtotal,"1.2-2"),""),e.R7$(6),e.SpI("(-) RD$ ",e.i5U(65,18,n.couponDiscount,"1.2-2"),""),e.R7$(6),e.SpI("+ $",e.i5U(71,21,n.shippingCost,"1.2-2"),""),e.R7$(6),e.SpI("(+) RD$ ",e.i5U(77,24,n.taxTotal,"1.2-2")," "),e.R7$(6),e.SpI("",e.i5U(83,27,n.total,"1.2-2")," "))},dependencies:[u.D,u.G,u.I,u.a3,m.YN,w,N,he,me.R],styles:[".summery-contain[_ngcontent-%COMP%]{list-style:none;padding:0;margin:0}.summery-contain[_ngcontent-%COMP%]   li[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;margin-bottom:1rem;padding:.5rem 0;border-bottom:1px solid #ddd}.summery-contain[_ngcontent-%COMP%]   li[_ngcontent-%COMP%]   img.checkout-image[_ngcontent-%COMP%]{width:50px;height:50px;object-fit:cover;margin-right:1rem}.summery-contain[_ngcontent-%COMP%]   li[_ngcontent-%COMP%]   h4[_ngcontent-%COMP%]{margin:0;font-size:14px}.summery-contain[_ngcontent-%COMP%]   li[_ngcontent-%COMP%]   h4.price[_ngcontent-%COMP%]{font-weight:700;white-space:nowrap;margin-left:auto}.accordion-button[_ngcontent-%COMP%]{font-size:16px;font-weight:600}.custom-form-check[_ngcontent-%COMP%]   .form-check-label[_ngcontent-%COMP%]{font-size:14px;font-weight:500}.custom-form-check[_ngcontent-%COMP%]   .form-check-input[_ngcontent-%COMP%]{margin-right:10px}select.theme-form-select[_ngcontent-%COMP%]{appearance:auto}.select-option[_ngcontent-%COMP%]   .theme-form-floating[_ngcontent-%COMP%]{margin-top:10px}.accordion-body[_ngcontent-%COMP%]   h5[_ngcontent-%COMP%]{font-size:14px;margin-bottom:20px;font-weight:700}.checkout-icon[_ngcontent-%COMP%]{display:flex;justify-content:center;align-items:center}.alert-success[_ngcontent-%COMP%]{color:#155724;background-color:#d4edda;border-color:#c3e6cb;padding:10px;border-radius:5px;margin-top:10px}.alert-danger[_ngcontent-%COMP%]{color:#721c24;background-color:#f8d7da;border-color:#f5c6cb;padding:10px;border-radius:5px;margin-top:10px}.discounted-price[_ngcontent-%COMP%]{color:green;font-weight:700}.text-muted[_ngcontent-%COMP%]{color:#6c757d}.text-danger[_ngcontent-%COMP%]{font-weight:700;color:#dc3545}"]})}return s})()}}]);