!function(e,t){const n=!0,o="onetrust",s="#cookieconsent-show-settings";let i,a,c,r=!1,u=!1,d=!1,p=!1,l=!1;function f(){(!a&&!l&&!u||u&&c)&&(h({event_action:"consent_banner_viewed"}),l=!0)}let k=!1;function h(t){"function"==typeof e.sendEvent&&e.sendEvent(t)}function g(e){Array.isArray(e.detail)&&T(e.detail.map((e=>e+":1")).join(","))}function m(){h({event_action:"performance_consent_declined"})}function v(){const e=t.getElementById("onetrust-reject-all-handler");e&&e.addEventListener("click",m,{once:!0,passive:!0})}function b(){const e=t.getElementById("onetrust-banner-sdk");e&&(e.setAttribute("tabindex","0"),e.focus())}function C(e,t){for(const n of e)for(const e of n.addedNodes.values())if("onetrust-consent-sdk"===e.id){e.classList.add("skapa-focus-portal"),f(),v(),e.querySelector("#onetrust-banner-sdk")&&b(),t.disconnect();break}}async function y(){return new Promise(((n,o)=>{if(!r){e.addEventListener("OneTrustGroupsUpdated",g);const s=t.createElement("link");s.rel="stylesheet",s.type="text/css",s.href="https://www.ikea.com/mx/es/cookieconsent/styles/cookieconsent-onetrust-css-v2.css?v=m9goj8da",t.head.appendChild(s);const i=t.createElement("script");i.setAttribute("src","https://cdn.cookielaw.org/scripttemplates/otSDKStub.js"),i.setAttribute("data-domain-script","6e7514f8-3738-4d4b-b0ad-c3a2832bfec3"),i.setAttribute("data-document-language",!0),i.setAttribute("data-script-vendor","onetrust"),i.setAttribute("type","text/javascript"),i.onload=function(){n(!0),"MutationObserver"in e?new MutationObserver(C).observe(t.body,{childList:!0}):f()},i.onerror=function(){o(!1)},t.head.appendChild(i),r=!0}}))}function O(e){const n=e+"=",o=t.cookie.split(";");for(let e=0;e!!e)).map((e=>e+":1")).join(","):"1:1"+("true"===function(e){const n=t.getElementById("nav-styles");return!(!n||!n.dataset[e])&&n.dataset[e]}("optiDefault")?",2:1":",2:0"),n}function A(){const e=O("OptanonConsent");if("string"==typeof e&&""!==e){const t=decodeURIComponent(e),n="groups=",o=t.split("&").find((e=>e.includes(n))),s=o?decodeURIComponent(o.slice(n.length)):"";if(""!==s)return s}return E()}function w(){return void 0!==a&&!1!==a||(a=!!O("OptanonAlertBoxClosed")),a}function S(e,t){var n=e.split(",").filter((function(e){return""!==e&&":0"!==e.substring(e.length-2)})).map((function(e){return"1"===e?e:e.substring(0,e.length-2)})).reduce((function(e,t){return e[t]=!0,e}),{});return t||(n.showBanner=!0),n}function _(n){const o=new Date;o.setTime(o.getTime()+31536e6);const s=["ikea_cookieconsent_"+(function(e=""){const t=e.split("/")[1];return 2===t.length&&t}(e.location.pathname)||"")+"="+encodeURIComponent(JSON.stringify(n)),"path=/","expires="+o.toGMTString(),"domain=.ikea.com","SameSite=None; Secure"].join(";");t.cookie=s}function x(e){if("ikea-cookieconsent"===e.data.namespace&&"get-cookieConsent.status"==e.data.action){var t={namespace:"ikea-cookieconsent",action:"result-cookieConsent.status",result:S(A(),w())};e.source.postMessage(t,"*")}}function L(){e.location.hash===s&&(e.ikea.cookieConsent.togglePreferenceCenter(),D())}function j(){const e=t.location.pathname||"";let n=!1;if(e.includes("/customer-service/")&&(n=new RegExp("(/customer-service/.*cookie-policy)|(^/at/\\w{2}/customer-service/(imprint-|impressum-|privacy-policy))","i").test(e)),n){const e=t.createElement("style");e.textContent="#onetrust-banner-sdk { display:none; }",t.body.appendChild(e),u=!0}}function I(){L(),e.addEventListener("hashchange",L,!1);const o=new CustomEvent("ikeaCookieConsentInit");t.dispatchEvent(o),e.ikea.pubsub&&e.ikea.pubsub.publish("ikeaCookieConsent/init"),n||f()}function T(n,s){const i=void 0!==s?s:w(),r=S(n||A(),i);var l;!p&&r[2]&&(!a&&u&&f(),!p&&(!a||c&&r[2])&&(e.sendEvent?(h({event_action:"performance_consent_accepted"}),d=!1,p=!0):d=!0)),l={consentStatusObject:r,vendor:o,interactedWithBanner:i},e.ikea.cookieConsent.vendor=l.vendor,e.ikea.cookieConsent.status=l.consentStatusObject,e.ikea.cookieConsent.statusStringified=JSON.stringify(l.consentStatusObject),e.ikea.cookieConsent.interactedWithBanner=l.interactedWithBanner,D(),_(r);const k=new CustomEvent("ikeaCookieConsent",{detail:e.ikea.cookieConsent.status});t.dispatchEvent(k),e.ikea.pubsub&&e.ikea.pubsub.publish("ikeaCookieConsent/changed",e.ikea.cookieConsent.status)}!n||r||e.Optanon||((e.Optanon=e.Optanon||{}).ToggleInfoDisplay=async function(){k=!0,y()});let B=!1;function D(){if(B||!e.Optanon||"function"!=typeof e.Optanon.OnConsentChanged)return!1;e.Optanon.OnConsentChanged((()=>{e.location.hash===s&&e.history.replaceState(e.history.state,"","#")})),hasLocationHashResetListener=!0}!function(){(e.ikea=e.ikea||{}).cookieConsent={vendor:o,togglePreferenceCenter:function(){e.Optanon.ToggleInfoDisplay(),c=!0},hasConsent:function(e){return this.status[e]||!1}};const n=new URLSearchParams(t.location.search);i=n.get("cookieconsent-override"),i?/1\:[01],2\:[01],3\:[01],4\:[01]/.test(i)&&(r=!0,T(i,r)):T()}();const N=e=>{const n=t.createElement("script");e.getAttributeNames().forEach((t=>{n.setAttribute(t,e.getAttribute(t))})),n.removeAttribute("type"),e.src||(n.innerText=e.innerText),e.parentNode.replaceChild(n,e)},R=/(?:optanon-category-)+([a-zA-Z0-9]{1,5}-?)+(?:$|\s)/;function M(e={},t=""){const n=t.match(R);return!!n&&n[1].split("-").every((t=>e[t]))}if(n){function U(){j(),I(),function(){const e=t.querySelectorAll('script[class*="optanon-category"]');for(const t of e)M(ikea.cookieConsent.status,t.className)&&N(t)}(),d&&!p&&(h({event_action:"performance_consent_accepted"}),d=!1,p=!0)}i||O("OptanonConsent")&&w()?"loading"===t.readyState?t.addEventListener("DOMContentLoaded",U):U():y();let W=!1;e.OptanonWrapper=function(){W||(j(),W=!0,k&&e.Optanon.ToggleInfoDisplay(),L())}}else{let G=!1;e.OptanonWrapper=function(){L(),G?T():(j(),I(),G=!0)}}e.addEventListener("message",x,!1)}(window,document);