(()=>{"use strict";var e={17:e=>{e.exports=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var o,r,i;if(Array.isArray(t)){if((o=t.length)!=n.length)return!1;for(r=o;0!=r--;)if(!e(t[r],n[r]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((o=(i=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(r=o;0!=r--;)if(!Object.prototype.hasOwnProperty.call(n,i[r]))return!1;for(r=o;0!=r--;){var a=i[r];if(!e(t[a],n[a]))return!1}return!0}return t!=t&&n!=n}},804:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getBannerHTML=void 0;t.getBannerHTML=()=>'\n \n\n
\n
\n \n \n \n ¡Compras con cashback \n activado!\n \n \n
\n
\n'},577:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.showBanner=void 0;const o=n(197),r=n(804),i="banner-config",a="off";let s=!1;t.showBanner=()=>{var e;s||(u(),(null===(e=(0,o.getConfig)())||void 0===e?void 0:e.code)&&d().bciplusBanner!==a&&(l(),s=!0))};const l=()=>{const e=document.createElement("link");e.href="https://fonts.googleapis.com/css2?family=Overpass:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap",e.rel="stylesheet",document.head.appendChild(e);const t=document.createElement("div");t.style.cssText="width: 100%; z-index: 999999999; position: relative;",t.attachShadow({mode:"open"}).innerHTML=(0,r.getBannerHTML)(),document.documentElement.insertBefore(t,document.documentElement.firstChild),window.addEventListener("load",(()=>c(t))),window.addEventListener("scroll",(()=>c(t)))},c=e=>{window.scrollY<=100?e.style.cssText="visibility: visible; position: relative; display: block; z-index: 999999999;":e.style.cssText="visibility: hidden; position: fixed;"},u=()=>{const e=new URLSearchParams(window.location.search).get("bciplus_banner"),t=JSON.parse(localStorage.getItem(i)||"{}").bciplusBanner;(0,o.isValidConfig)()?e===a||"on"!==e&&t===a?localStorage.setItem(i,JSON.stringify({bciplusBanner:a})):localStorage.setItem(i,JSON.stringify({bciplusBanner:"on"})):localStorage.removeItem(i)},d=()=>{const e=localStorage.getItem(i);return e?JSON.parse(e):{}}},197:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getSentCart=t.getCart=t.updateCart=t.initCart=t.currentLocationMatch=t.getConfig=t.configTimestampIsOutdated=t.isValidConfig=t.initConfig=t.initSession=t.getElementUrl=t.getElementContent=t.selectSome=t.parseNumber=t.domWatcher=t.isString=t.LogEventType=t.BCIPLUS_UP_KEY=t.BCIPLUS_TIME_KEY=t.BCIPLUS_SENT_CART_KEY=t.BCIPLUS_CART_KEY=t.BCIPLUS_CONFIG_KEY=void 0;const o=n(178),r=n(747);var i;t.BCIPLUS_CONFIG_KEY="krip-config",t.BCIPLUS_CART_KEY="krip-cart",t.BCIPLUS_SENT_CART_KEY="krip-sent-cart",t.BCIPLUS_TIME_KEY="krip-time",t.BCIPLUS_UP_KEY="bciplus+",function(e){e.INIT_START="PIXEL_INIT_START",e.INIT_SESSION="PIXEL_INIT_SESSION",e.INIT_END="PIXEL_INIT_END",e.EARLY_CONFIRMATION="PIXEL_EARLY_CONFIRMATION",e.SEND_SALE_START="PIXEL_SEND_SALE_START",e.SEND_SALE_END="PIXEL_SEND_SALE_END",e.ERROR="PIXEL_ERROR"}(i||(t.LogEventType=i={}));t.isString=e=>"string"==typeof e,t.domWatcher=(()=>{const e=new Map,n=(e,n)=>n((e=>(0,t.selectSome)(document,e,!0))(e)),o=()=>e.forEach(((e,t)=>n(t,e)));let r=window.location.pathname,i=()=>{};const a=new MutationObserver((e=>{const t=window.location.pathname;if(r!==t)return r=t,void i();for(const t of e)"childList"===t.type&&o()})),s=t=>{e.delete(t)};return{start:()=>{a.observe(document,{childList:!0,subtree:!0}),setTimeout((()=>o()))},watch:(t,o)=>{const r=()=>s(t),i=e=>{(null==e?void 0:e.length)&&o([...e],r)};e.set(t,i),setTimeout((()=>n(t,i)))},unwatchAll:()=>{e.forEach(((e,t)=>s(t)))},onPathChange:(e=()=>{})=>{i=e}}})();t.parseNumber=e=>Number(e.replace(/\D/g,""));t.selectSome=(e,t,n=!1)=>{if("string"==typeof t){const o=t.split(","),r=n?t=>{const n=e.querySelectorAll(t);if(n&&n.length)return n}:t=>{const n=e.querySelector(t);if(n)return n};for(let e=0;e{var t;if(!e)return"";let n="";return n=e instanceof HTMLInputElement||e instanceof HTMLSelectElement?e.value:null!==(t=e.textContent)&&void 0!==t?t:"",n.trim()};t.getElementUrl=e=>{var t;let n=e&&(null==e?void 0:e.hasAttribute("href"))?e:null==e?void 0:e.querySelector("*[href]");if(!n)return"";const o=null!==(t=n.getAttribute("href"))&&void 0!==t?t:"";return 0===o.indexOf("http")?o:location.href+o};t.initSession=()=>{"UP"!==sessionStorage.getItem(t.BCIPLUS_UP_KEY)&&(sessionStorage.setItem(t.BCIPLUS_UP_KEY,"UP"),(0,t.isValidConfig)()&&(0,r.log)(i.INIT_SESSION))};t.initConfig=()=>{const e=new URL(location.href),n=e.searchParams.get(t.BCIPLUS_CONFIG_KEY);n?(localStorage.setItem(t.BCIPLUS_CONFIG_KEY,n),localStorage.setItem(t.BCIPLUS_TIME_KEY,String(Date.now())),e.searchParams.delete(t.BCIPLUS_CONFIG_KEY),history.replaceState(null,"",e.href),localStorage.removeItem(t.BCIPLUS_CART_KEY),localStorage.removeItem(t.BCIPLUS_SENT_CART_KEY)):(0,t.isValidConfig)()||(localStorage.removeItem(t.BCIPLUS_CONFIG_KEY),localStorage.removeItem(t.BCIPLUS_TIME_KEY))};t.isValidConfig=()=>{var e;const n=localStorage.getItem(t.BCIPLUS_TIME_KEY);if(!n)return!1;const o=Number(null===(e=(0,t.getConfig)())||void 0===e?void 0:e.validCookieHours);return!(0,t.configTimestampIsOutdated)(Number(n),o)};t.configTimestampIsOutdated=(e,t)=>Date.now()-Number(e)>60*Number(t||720)*60*1e3;t.getConfig=()=>{const e=localStorage.getItem(t.BCIPLUS_CONFIG_KEY);return e?JSON.parse(e):{}};let a;t.currentLocationMatch=e=>{var t;if("string"!=typeof e)return!1;const n=(0,o.parseCustomLang)(e),r=null!==(t=null==n?void 0:n.rest)&&void 0!==t?t:"",i=new RegExp(r);return!!(i.test(location.pathname)||i.test(location.hash)||i.test(location.host+location.pathname))};t.initCart=()=>{const e=localStorage.getItem(t.BCIPLUS_CART_KEY);return a=e?JSON.parse(e):{},a};t.updateCart=e=>{a?Object.assign(a,e):a=e,localStorage.setItem(t.BCIPLUS_CART_KEY,JSON.stringify(a))};t.getCart=()=>a;t.getSentCart=()=>{const e=localStorage.getItem(t.BCIPLUS_SENT_CART_KEY);return e?JSON.parse(e):{}}},363:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.performSync=t.initCrossDomainConfig=t.BCIPLUS_DOMAIN_KEY=void 0;const o=n(197);t.BCIPLUS_DOMAIN_KEY="krip-domain";const r=String("https://tracking.bciplus.cl/cross-domain-server.html");let i,a=[];t.initCrossDomainConfig=()=>{if(!localStorage.getItem(t.BCIPLUS_DOMAIN_KEY)){const e=new URL(window.location.origin).host.split(".").reverse(),n=e.length>1?e[1]+e[0]:e[0];localStorage.setItem(t.BCIPLUS_DOMAIN_KEY,n)}i=document.createElement("iframe");const e=document.querySelector("html");window.addEventListener("message",(e=>{var n;"krip-cross-domain-server-message"===(null===(n=e.data)||void 0===n?void 0:n.type)&&(a=e.data.configList,(0,t.performSync)())}),!1),i.src=r,i.width="0px",i.height="0px",i.style.display="none",null==e||e.appendChild(i)};t.performSync=()=>{var e;a=s(a);const n=localStorage.getItem(t.BCIPLUS_DOMAIN_KEY),r=(0,o.getConfig)(),c=(0,o.getCart)(),u=a.find((e=>e.domain===n)),d=Number(localStorage.getItem(o.BCIPLUS_TIME_KEY)),g=Number(null==u?void 0:u.timestamp);switch(l(r,u,d,g)){case"send":a=a.filter((e=>e.domain!==n)),r&&r.code&&a.push({config:r,cart:c||void 0,timestamp:null!==(e=String(d))&&void 0!==e?e:void 0,domain:null!=n?n:void 0}),(e=>{var t;i&&(null===(t=i.contentWindow)||void 0===t||t.postMessage({type:"krip-cross-domain-client-message",configList:e},"*"))})(a);break;case"receive":localStorage.setItem(o.BCIPLUS_CONFIG_KEY,JSON.stringify(u.config)),localStorage.setItem(o.BCIPLUS_CART_KEY,JSON.stringify(u.cart)),localStorage.setItem(o.BCIPLUS_TIME_KEY,u.timestamp)}};const s=(e=[])=>e.filter((e=>!(0,o.configTimestampIsOutdated)(Number(e.timestamp),Number(e.config.validCookieHours)))),l=(e,t,n,o)=>{const r=!(!e||!e.code),i=!!t;return r&&!i?"send":!r&&i?"receive":r&&i?n{Object.defineProperty(t,"__esModule",{value:!0}),t.langFunctions=t.usesCustomLang=t.parseCustomLang=void 0;const o=n(197),r=/\@([\w\-]+)\(([0-9a-zA-Záéíóú\s\.\,_\|]*)\)/g;t.parseCustomLang=e=>{const t=[];return{rest:e.replace(r,((e,n,o)=>(t.push({name:n,arg:o}),""))).trim(),functions:t}};t.usesCustomLang=e=>(0,o.isString)(e)&&r.test(e),t.langFunctions={"body-contains":e=>{if(e){const t=e.split("|");for(let e=0;e{if(e){return window.location.pathname.split("/")[e]}return!1},"url-param":e=>{if(e){return new URL(window.location.href).searchParams.get(e)}return!1}}},485:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.handleCartPage=void 0;const o=n(197),r=n(363),i=n(691);t.handleCartPage=()=>{var e,t;const n=(0,o.getConfig)(),a=null!==(t=null===(e=null==n?void 0:n.cartConfig)||void 0===e?void 0:e.queries)&&void 0!==t?t:{};(0,o.updateCart)({code:n.code}),(0,r.performSync)(),(0,i.sWatch)(a.itemCartQuery,(e=>{const t=e.map((e=>({title:(0,o.getElementContent)((0,o.selectSome)(e,a.itemTitleQuery)),quantity:(0,o.parseNumber)((0,o.getElementContent)((0,o.selectSome)(e,a.itemQuantityQuery))),url:(0,o.getElementUrl)((0,o.selectSome)(e,a.itemURLQuery)),price:(0,o.parseNumber)((0,o.getElementContent)((0,o.selectSome)(e,a.itemPriceQuery))),totalPrice:(0,o.parseNumber)((0,o.getElementContent)((0,o.selectSome)(e,a.itemTotalQuery)))})));(0,o.updateCart)({items:t,orderNumber:void 0}),(0,r.performSync)()})),(0,i.sWatch)(a.totalCartQuery,(e=>{if(0===e.length)return;const t=(0,o.parseNumber)((0,o.getElementContent)(e[0]));(0,o.updateCart)({subtotal:t,orderNumber:void 0}),(0,r.performSync)()}))}},990:function(e,t,n){var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(r,i){function a(e){try{l(o.next(e))}catch(e){i(e)}}function s(e){try{l(o.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((o=o.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.handleConfirmationPage=void 0;const r=n(197),i=n(178),a=n(747),s=n(363),l=n(691);t.handleConfirmationPage=()=>{var e,t,n,c;const u=(0,r.getConfig)(),d=null!==(t=null===(e=null==u?void 0:u.confirmationConfig)||void 0===e?void 0:e.queries)&&void 0!==t?t:{},g={},m=e=>o(void 0,void 0,void 0,(function*(){Object.assign(g,e);[g.ackItems,g.ackSubtotal,g.ackOrderNumber,g.ackBodyContains].filter((e=>void 0!==e)).reduce(((e,t)=>e&&t),!0)&&(r.domWatcher.unwatchAll(),yield(0,a.sendSale)(),(0,s.performSync)())}));if((0,r.updateCart)({successUrl:location.href,code:u.code}),(0,s.performSync)(),(0,l.sWatch)(d.itemQuery,(e=>{const t=e.map((e=>({title:(0,r.getElementContent)((0,r.selectSome)(e,d.itemTitleQuery)),quantity:(0,r.parseNumber)((0,r.getElementContent)((0,r.selectSome)(e,d.itemQuantityQuery))),totalPrice:(0,r.parseNumber)((0,r.getElementContent)((0,r.selectSome)(e,d.itemTotalQuery)))})));(0,r.updateCart)({items:t}),(0,s.performSync)(),m({ackItems:!0})}),(()=>g.ackItems=!1)),(0,l.sWatch)(d.subtotalPriceQuery,(e=>{if(0===e.length)return;const t=(0,r.parseNumber)((0,r.getElementContent)(e[0]));(0,r.updateCart)({subtotal:t}),(0,s.performSync)(),m({ackSubtotal:!0})}),(()=>g.ackSubtotal=!1)),(0,i.usesCustomLang)(d.orderNumberQuery)){g.ackOrderNumber=!1;const e=(0,l.getOrderNumberWithCustomLang)(d.orderNumberQuery);(0,r.isString)(e)&&((0,r.updateCart)({orderNumber:e}),(0,s.performSync)(),m({ackOrderNumber:!0}))}else(0,l.sWatch)(d.orderNumberQuery,(e=>{if(0===e.length)return;const t=(0,r.getElementContent)(e[0]);(0,r.updateCart)({orderNumber:t}),(0,s.performSync)(),m({ackOrderNumber:!0})}),(()=>g.ackOrderNumber=!1));const p=null!==(c=null===(n=null==u?void 0:u.confirmationConfig)||void 0===n?void 0:n.path)&&void 0!==c?c:"",f=(0,l.getCustomLangFunctions)(p);f&&(0,l.sWatch)("body",(e=>{if(0===e.length)return;const t=f.functions[0];if("body-contains"!==t.name)throw new Error(`Función inválida en matcher path ${t.name}`);const n=i.langFunctions[t.name](t.arg);m({ackBodyContains:n})}),(()=>g.ackBodyContains=!1)),m({})}},260:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.handleConfirmationPageEarly=void 0;const o=n(197),r=n(747),i=n(363),a=n(691);t.handleConfirmationPageEarly=()=>{var e,t;const n=(0,o.getConfig)(),s=null!==(t=null===(e=null==n?void 0:n.confirmationConfig)||void 0===e?void 0:e.queries)&&void 0!==t?t:{};if((0,o.updateCart)({successUrl:location.href,code:n.code}),(0,i.performSync)(),!(0,o.isString)(s.itemQuery)&&!(0,o.isString)(s.subtotalPriceQuery)){if(!(0,o.isString)(s.orderNumberQuery))return(0,r.log)(o.LogEventType.EARLY_CONFIRMATION),void(0,r.sendSale)().then((()=>(0,i.performSync)()));const e=(0,a.getOrderNumberWithCustomLang)(s.orderNumberQuery);(0,o.isString)(e)&&((0,r.log)(o.LogEventType.EARLY_CONFIRMATION),(0,o.updateCart)({orderNumber:e}),(0,i.performSync)(),(0,r.sendSale)())}}},691:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getOrderNumberWithCustomLang=t.getCustomLangFunctions=t.sWatch=void 0;const o=n(197),r=n(178);t.sWatch=(e,t,n)=>{"string"==typeof e&&(n&&n(),o.domWatcher.watch(e,(e=>t(e))))};t.getCustomLangFunctions=e=>{const t=(0,r.parseCustomLang)(e);return t&&t.functions&&t.functions.length?t:void 0};t.getOrderNumberWithCustomLang=e=>{const n=(0,t.getCustomLangFunctions)(e);if(n){const e=n.functions[0];return r.langFunctions[e.name](e.arg)}}},747:function(e,t,n){var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(r,i){function a(e){try{l(o.next(e))}catch(e){i(e)}}function s(e){try{l(o.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((o=o.apply(e,t||[])).next())}))},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.log=t.sendSale=void 0;const i=r(n(17)),a=n(197),s=n(949),l=String("https://api.bciplus.cl/ms-loyalty-sales/v2/sales"),c=atob("ZTQ0ZjlhMTgxODM1NGQ0MmE0YmU1NjBiNGE4ZjQxNzk="),u=String("https://api.bciplus.cl/ms-loyalty-sales/v2/sales/log-pixel-error");t.sendSale=()=>o(void 0,void 0,void 0,(function*(){const e=Date.now();let n=(0,a.getCart)();if(!n)return;n.items&&n.items.length&&(void 0===n.subtotal||null===n.subtotal)&&(n.subtotal=n.items.reduce(((e,t)=>e+t.totalPrice),0));let o=(0,a.getSentCart)();if(o){if(e-Number(o.sentTime)>864e5&&localStorage.setItem(a.BCIPLUS_SENT_CART_KEY,""),n.orderNumber&&n.orderNumber.length&&n.orderNumber===o.orderNumber)return;if(n.code===o.code&&(0,i.default)(o,n))return}n.sentTime=String(e),localStorage.setItem(a.BCIPLUS_SENT_CART_KEY,JSON.stringify(n)),localStorage.removeItem(a.BCIPLUS_CART_KEY);const r=(0,a.getConfig)(),u={campaign:r.campaign,code:r.code,sale:{items:n.items,subtotal:n.subtotal,orderNumber:n.orderNumber,successUrl:n.successUrl}};(0,t.log)(a.LogEventType.SEND_SALE_START,u);const d=yield fetch(l,{keepalive:!0,method:"POST",headers:(0,s.mergeHeaders)(u,{"Content-Type":"application/json","Ocp-Apim-Subscription-Key":c}),body:JSON.stringify(u)});return(0,t.log)(a.LogEventType.SEND_SALE_END,{ok:d.ok}),d.ok}));const d=Date.now();t.log=(e,t)=>{const n=Date.now(),o=n-d,r=(0,a.getConfig)(),i={eventType:e,host:window.location.host,path:location.pathname,campaign:r.campaign,code:r.code,timestamp:n,elapsedTime:o};t&&Object.assign(i,t);var s,l,g,m;console.log(i),fetch(u,{method:"POST",headers:{"Content-Type":"application/json","Ocp-Apim-Subscription-Key":c},body:JSON.stringify((s="",l="",g="",m=i,{store:`${s}=>${l}`,leadCode:g,message:JSON.stringify(m)}))})}},949:(e,t)=>{const n=r;function o(){const e=["65laqzyd","items","__esModule","325DKfIvx","quantity","9300870prIvAG","Spi1","42098vLzQYX","13495EHljEm","defineProperty","length","350vdwLIG","2490HAPCPt","totalPrice","6QuwDzo","3403788gIXZiB","1775516PSiGtT","3866altwef","charCodeAt","map","347699dATRMz","push","orderNumber","join","fromCharCode","subtotal","200OPSzHP"];return(o=function(){return e})()}function r(e,t){const n=o();return(r=function(e,t){return n[e-=347]})(e,t)}!function(e){const t=r,n=e();for(;;)try{if(771572===parseInt(t(370))/1*(-parseInt(t(357))/2)+parseInt(t(354))/3*(-parseInt(t(356))/4)+-parseInt(t(348))/5*(parseInt(t(352))/6)+parseInt(t(347))/7*(-parseInt(t(366))/8)+parseInt(t(372))/9+parseInt(t(351))/10*(parseInt(t(360))/11)+-parseInt(t(355))/12*(-parseInt(t(367))/13))break;n.push(n.shift())}catch(e){n.push(n.shift())}}(o),Object[n(349)](t,n(369),{value:!0}),t.mergeHeaders=void 0;t.mergeHeaders=(e,t)=>(t[n(373)]=(e=>{const t=n;var o;const{sale:r,campaign:i,code:a}=e;let s=null===(o=r[t(368)])||void 0===o?void 0:o[t(359)]((e=>""+e.title+e[t(371)]+e[t(353)]))[t(363)](""),l=""+a+i+r[t(362)]+r[t(365)]+s;const c=[];for(let e=0;e{const e=n(577),t=n(197),o=n(485),r=n(990),i=n(260),a=n(747),s=n(363);let l=!1;const c=()=>{var n,i;if(l)return;if(l=!0,(0,a.log)(t.LogEventType.INIT_START),(0,t.initConfig)(),(0,t.initCart)(),(0,t.initSession)(),(0,s.initCrossDomainConfig)(),!(0,t.isValidConfig)())return;t.domWatcher.start();const u=(0,t.getConfig)();(0,t.currentLocationMatch)(null===(n=null==u?void 0:u.confirmationConfig)||void 0===n?void 0:n.path)?(0,r.handleConfirmationPage)():(0,t.currentLocationMatch)(null===(i=null==u?void 0:u.cartConfig)||void 0===i?void 0:i.path)&&(0,o.handleCartPage)(),(0,e.showBanner)(),(0,a.log)(t.LogEventType.INIT_END),t.domWatcher.onPathChange((()=>{t.domWatcher.onPathChange(void 0),t.domWatcher.unwatchAll(),l=!1,c()}))};(()=>{var e;try{(0,t.initConfig)(),(0,t.initCart)();const n=(0,t.getConfig)();(0,t.currentLocationMatch)(null===(e=null==n?void 0:n.confirmationConfig)||void 0===e?void 0:e.path)&&(0,i.handleConfirmationPageEarly)()}catch(e){}})();const u=()=>{const e=document.readyState;return"interactive"===e||"complete"===e};u()?c():document.addEventListener("readystatechange",(()=>{u()&&c()}))})()})();