(function(n,t,i){"use strict";function y(n,t){try{const i=new URL(n),r=new URLSearchParams(i.search);return r.get(t)}catch(i){return null}}function st(n,t,i){const e=t.length+1,r=n.location.hash,u=r?.indexOf(t)??-1;if(u<0)return null;const f=u+e;return r.substring(f,f+i)}function o(n,t,i,r,u){r=r||"";const e=new Date;e.setDate(e.getDate()+u);const o=e.toUTCString(),f=n.location.hostname.split("."),h=f.length;if(h===1){t.cookie=s(i,r,f[0],o);return}let c="."+f.slice(f.length-2).join(".");if(t.cookie=s(i,r,c,o),p(i)!==r.toString()){let n="."+f.slice(f.length-3).join(".");t.cookie=s(i,r,n,o)}}function s(n,t,i,r){return n+"="+t+";domain="+i+";path=/;expires="+r}function p(n){var t=document.cookie.split("; ").find(t=>t.startsWith(n));return t?t.split("=")[1]:null}function h(n,t){let i=p(n);return i?{value:i,source:"1pc"}:(i=t.sessionStorage.getItem(n),i?{value:i,source:"s"}:null)}function w(n){try{return b(n)??k(n)}catch(t){console.log(t)}return null}function b(n){let t;if(n===undefined){const n=window.dataLayer?.find(n=>n.event==="purchase"&&n.ecommerce?.transaction_id);if(!n)return null;t=n.ecommerce}else{if(n.event!=="purchase"||!n.ecommerce?.transaction_id)return null;t=n.ecommerce}const i=t.items?t.items.map(n=>({id:n.item_id,price:n.price,quantity:n.quantity,currency:n.currency})):[];return{order_id:t.transaction_id,shop_products:i,amount:t.value}}function k(n){let t;if(n===undefined){const n=window.dataLayer?.find(n=>n.ecommerce?.purchase?.actionField?.id);if(!n)return null;t=n.ecommerce.purchase}else{if(!n.ecommerce?.purchase?.actionField?.id)return null;t=n.ecommerce.purchase}const i=t.products?t.products.map(n=>({id:n.id,price:n.price,quantity:n.quantity,currency:n.currency})):[];return{order_id:t.actionField.id,shop_products:i,amount:t.actionField.revenue}}function ht(n,t){if(typeof Prototype=="undefined"||typeof Array.prototype.toJSON=="undefined")return t?JSON.stringify(n,Object.getOwnPropertyNames(n)):JSON.stringify(n);const i=Array.prototype.toJSON;delete Array.prototype.toJSON;let r=t?JSON.stringify(n,Object.getOwnPropertyNames(n)):JSON.stringify(n);return Array.prototype.toJSON=i,r}function d(n,t,i){console.log(n);n.origin=window.location.origin;let f=encodeURIComponent(ht(n,!0)),r=new FormData;r.append("exception",f);r.append("accountGuid",t);let u=new XMLHttpRequest;u.open("POST",i,!0);u.send(r)}function g(i){const u=y(location,r)??st(n,r,et)??y(document.referrer,r);u&&i&&(n.sessionStorage.setItem(r,u),o(n,t,r,u,c));document.referrer&&document.referrer.includes("ceneo.pl")&&(n.sessionStorage.setItem(l,v),u&&i||o(n,t,r,v,ft),!u&&i&&o(n,t,r,e,c))}function ct(){n[u]?.forEach(t=>{const i=w(t);i&&n._ceneo.e.push(["DataLayerTransaction",i])})}function lt(){n[u]=n[u]||[];const t=n[u].push;n[u].push=function(){const i=t.apply(this,arguments);try{const t=w(arguments[0]);t&&n._ceneo.e.push(["DataLayerTransaction",t])}catch(r){}return i};for(let i in t)t.hasOwnProperty(i)&&(n[u].push[i]=t[i])}function nt(t){if(t=t||[],n.Array.isArray(t)&&!(t.length<1)){let u,f;const o=h(r,n);let s=o?.value===e;o?.value==="true"?(f=o,u=null):s?(f={value:"true",source:null},u={value:null,source:e}):(u=o,f=h(l,n));const c=encodeURIComponent(JSON.stringify({t:Date.now(),es:t,lcid:u?.value,cids:u?.source,fc:f?.value,ag:"f26e7526-18db-4883-a28a-fb708c35d87b"})),a=i+"?body="+c,v=new Image(1,1);v.src=a}}function at(n){let t=[];t.push({n:n[0],p:n[1]});nt(t)}function tt(t){t&&typeof t=="object"&&(t.window_location=n.location?.href,t.random_number=Math.floor(Math.random()*ut))}function vt(){const t=[];for(let i;n._ceneo.e.length&&(i=n._ceneo.e.shift());)i[0]===a?it(i[1]):(tt(i[1]),t.push({n:i[0],p:i[1]}));t.length>0&&nt(t)}function yt(n){const t=n[0];if(t===a)it(n[1]);else try{tt(n[1]);at(n)}catch(i){d(i,"f26e7526-18db-4883-a28a-fb708c35d87b","https://ssl.ceneo.pl/transactions/track/fail")}}function pt(){Object.defineProperty(n._ceneo.e,"push",{value:function(){return arguments[0]&&yt(arguments[0]),this.length}})}function it(n){f&&g(Boolean(n.allow_tracking))}function wt(){const t=n._ceneo.e[0];f=t&&t[0]===rt;f&&n._ceneo.e.shift()}function bt(){}function kt(){}function dt(){if(n._ceneo&&n._ceneo.e)try{bt();kt();u&&(ct(),lt());wt();g(!f);vt();pt()}catch(t){d(t,"f26e7526-18db-4883-a28a-fb708c35d87b","https://ssl.ceneo.pl/transactions/track/fail")}}const r="ceneo_cid",c=30,l="from_ceneo",rt="enableManualConsentMode",a="updateConsentState",u="",ut=57546756756,v=!0,ft=1,et=36;let f=!1;const e="missing";dt()})(window,document,"https://ssl.ceneo.pl/transactions/track/v5/collect")