(function(){window.C2B=window.C2B||{},C2B.config={analytics:"//analytics.clic2buy.com/api",cart:"//cart.clic2drive.com",retailers:"//rs.clic2buy.com",cookies:"//t.clic2buy.com"}}).call(this),function(){Array.indexOf||(Array.prototype.indexOf=function(e){var t;for(t=0;t{if(e instanceof TypeError)return fetch(`${C2B.config.cart}/api/events`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})})}},function(){window.C2B=window.C2B||{},window.C2B.Cookies=function(){var e,t,n,i,o,r,a;return o=this,a=new C2B.Utils,n=function(e){var t,n,i,o;for(o=[],n=0,i=e.length;n0&&-1!==(n=document.cookie.indexOf(e+"=")))return n=n+e.length+1,-1===(t=document.cookie.indexOf(";",n))&&(t=document.cookie.length),r(unescape(document.cookie.substring(n,t)))},this.set=function(o,r,a){return new Promise(function(c){var d,s;return s=t(),d=e(C2B.config.cookies+"/cc",s.name,{key:""+o,val:r,ttl:a}),n([s,d]),d.submit(),s.onload=function(){try{s&&d&&i([s,d])}catch(e){}return c(r)}})},this.get=function(e){return new Promise(function(o,c){var d;return d=t(),a.addEvent(window,"message",function(e){var t;if(String(e.data).match(/^c2b/)){try{d&&i([d])}catch(n){}return(t=r(decodeURIComponent(e.data.split(":")[2])))?o(t):c()}}),d.src=C2B.config.cookies+"/rc?key="+e,n([d])})},this.remove=function(o){return new Promise(function(r){var a,c;return c=t(),a=e(C2B.config.cookies+"/dc",c.name,{key:""+o}),n([c,a]),a.submit(),c.onload=function(){try{c&&a&&i([c,a])}catch(e){}return r()}})},o}}.call(this),function(){window.C2B=window.C2B||{},window.C2B.Loading=function(){var e,t,n;return t=this,e=function(){var e,t,n;return t=Date.now(),(e=document.createElement("iframe")).id="iframe_"+t,e.name="iframe_"+t,e.width=550,e.height=210,document.body.appendChild(e),n="0 0 5px rgba(0, 0, 0, 0.5)",e.style.boxShadow=n,e.style.mozBoxShadow=n,e.style.webkitBoxShadow=n,e},n=function(e){return e.style.zIndex=1e4,e.style.top=0,e.style.bottom=0,e.style.left=0,e.style.right=0,e.style.margin="auto",e.style.border="none",e.style.position="absolute",e.style.display="block",e.style.position="fixed",e.style["border-radius"]="25px",e.style.width="570px"},this.create=function(t){var i;return(i=e()).src=t,n(i),i},this.destroy=function(e){return document.body.removeChild(e),!0},t}}.call(this),window.C2B=window.C2B||{},window.C2B.Validation=function(){var e=this;e.validationProcessExecuted=e.validationProcessExecuted||!1,C2B.config.retailer={code:"toy-planet-delivery-es",validation_url:"/es/pedido-confirmado",validation_url_regex:"",validation_query_string_params:[{key:"ID",value:"",value_regex:"\\d+"},{key:"token",value:null,value_regex:"\\w+"}],method:""};var t=new C2B.Retailer,n=new C2B.Cookies;return e.init=function(){return t.isCommitted()?e.validationProcess():C2B.Injector&&(injector=new C2B.Injector,injector.init()),window.addEventListener("c2bPushState",function(){t.isCommitted()&&e.validationProcess()}),e.q&&e.q.forEach(function(t){e.validationProcess.apply(e,t)}),e},e.validationProcess=function(){if(e.validationProcessExecuted)return;e.validationProcessExecuted=!0;var i=arguments[0];const o=`validation-${C2B.config.retailer.code}`;n.get(o).then(e=>t.validateTransaction(e,i)).then(()=>n.remove(o))["catch"](()=>{})},e},"complete"===document.readyState?C2B.Validation().init():window.addEventListener("load",function(){C2B.Validation().init()}),function(e){var t=e.pushState;e.pushState=function(){var n=t.apply(e,arguments),i=document.createEvent("CustomEvent");return i.initCustomEvent("c2bPushState",!1,!1,null),window.dispatchEvent(i),n}}(window.history);