(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))a(n);new MutationObserver(n=>{for(const s of n)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&a(o)}).observe(document,{childList:!0,subtree:!0});function r(n){const s={};return n.integrity&&(s.integrity=n.integrity),n.referrerPolicy&&(s.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?s.credentials="include":n.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function a(n){if(n.ep)return;n.ep=!0;const s=r(n);fetch(n.href,s)}})();const rr=e=>!!(e&&e==="true"),U="https://www.ikea.com",ar="978fda791834980b1fcbf7130ea5f4c1a2c363da",Ne="es-MX",nr={}.VITE_NODE_ENV,je="search-box",sr="eecd2c126b504b78beaef4ddb86c5564",We="271796",bt={}.VITE_SIK_API_VERSION||"20241114",gt="bXgtZXM6a3NkYmtmZ3NkYmZna3NicmVkZ2VyamJubA==",wt="https://sik.search.blue.cdtapps.com",yt="mx/es",k="mx/es",or="ltr",cr=rr("false"),ir="B55RSZvdcuDQ8kD1YxvvN",He=[];let Ae=!1;window.addEventListener("beforeunload",()=>{Ae=!0,setTimeout(()=>{Ae=!1},1e3)});const lr=()=>{const e=new Uint8Array(16);return window.crypto.getRandomValues(e),Array.from(e,t=>`0${(t&255).toString(16)}`.slice(-2)).join("")},Y=(e,t={})=>{if(console.error(e),Ae||Math.floor(Math.random()*10)!==0)return!1;let r="";e instanceof Error&&e.stack&&(r=e.stack);try{const a=typeof e=="object"?e:new Error(e);if(He.indexOf(a.toString())!==-1)return!1;He.push(a.toString()),fetch(`https://sentry.io/api/${We}/store/?sentry_version=7&sentry_client=${je}&sentry_key=${sr}`,{method:"POST",mode:"cors",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:a.toString(),project:We,logger:je,platform:"javascript",request:{headers:{"User-Agent":window.navigator.userAgent},url:window.location.href},fingerprint:[a.toString().replace(k,"SITEFOLDER")],tags:{locale:Ne,siteFolder:k},extra:{stack:r,...t},environment:nr,release:ar,event_id:lr()})})}catch(a){console.error(`Failed to report error: ${a.message}, original error: ${e.message}`)}return!0},H={SMALL:{val:1,bp:600},HEADER_FOOTER:{val:2,bp:700},MEDIUM:{val:3,bp:900},LARGE:{val:4,bp:992},HUGE:{val:5,bp:1120},ENORMUS:{val:6,bp:1200},LUDICROUS:{val:7,bp:1408}},_t=()=>{const e=window.innerWidth;for(const{val:t,bp:r}of Object.values(H))if(e<=r)return t;return H.LUDICROUS.val},ur={error:"",isDropdownVisible:!1,isModalVisible:!1,isSearching:!1,searchFieldFocused:!1,searchFieldValue:"",searchPhrase:"",searchResultsType:null,searchResults:[],showVisualErrorMessage:!1,animateModal:!1,visualSearchWidget:{show:!0,hiding:!1},viewport:_t()},O=(e,t)=>[(r,a)=>{r(a.action,a.payload)},{action:e,payload:t}],be=e=>t=>[(r,a)=>{e(a)},t],dr=e=>t=>[(r,a)=>{requestAnimationFrame(()=>{setTimeout(()=>{e(a)})})},t],hr=(e,{watch:t,reaction:r})=>(r(t),()=>{}),fr=(e,t)=>[hr,{watch:e,reaction:t}],mr=(e,t)=>[r=>{setTimeout(()=>r(e),t)},null],St=e=>{let t;return{debounce:n=>{t&&window.clearTimeout(t),t=window.setTimeout(n,e)},clear:()=>{t&&window.clearTimeout(t),t=null}}},vr=e=>{const{debounce:t}=St(e),r=(n,{action:s,payload:o})=>{t(()=>{n(s,o)})};return n=>(s,o)=>[s,[r,{action:n,payload:o}]]},pr=e=>{const{debounce:t,clear:r}=St(e);return{debounce:a=>n=>t(()=>(a[0]||a)(n,a[1])),clear:()=>[r,null]}},br=()=>[()=>{window.scrollTo(0,0)},null],gr=(e,t)=>[r=>{Promise.resolve().then(()=>requestAnimationFrame(()=>r(e,t)))},null],D=()=>{var e;try{return typeof((e=window.localStorage)==null?void 0:e.getItem)=="function"}catch{return console.warn("localStorage unavailable (cookies disabled)"),!1}},Et=()=>{try{return typeof window.sessionStorage.getItem=="function"}catch{return console.warn("sessionStorage unavailable (cookies disabled)"),!1}},Ge={internal_search_hits:void 0,internal_search_term:void 0,attribution_token:void 0},G=({sendLater:e,sendLaterTime:t,...r})=>window.sendEvent?(e?requestAnimationFrame(()=>{setTimeout(()=>{window.sendEvent({event_action:r.event_action||r.custom.search_type,event_category:"search_box",...r,custom:{...Ge,...r.custom}})},t||300)}):window.sendEvent({event_action:r.event_action||r.custom.search_type,event_category:"search_box",...r,custom:{...Ge,...r.custom}}),!0):!1,wr=e=>{try{if(typeof sessionStorage!="object"||typeof sessionStorage.getItem!="function")return!1;const t=`search-ga-search-type-${k.split("/").join("")}`;sessionStorage.setItem(t,e)}catch(t){Y(t)}},yr=e=>{try{if(typeof sessionStorage!="object"||typeof sessionStorage.getItem!="function")return!1;const t=`search-ga-search-origin-${k.split("/").join("")}`;sessionStorage.setItem(t,e)}catch(t){Y(t)}},z=e=>typeof window.ikea!="object"?!1:typeof window.ikea=="object"&&typeof window.ikea.cookieConsent=="object"?window.ikea.cookieConsent.hasConsent(e):!0,_r=()=>new Promise(e=>{if(typeof window.ikea=="object"&&window.ikea.cookieConsent){let t;const r=()=>{if(t&&window.cancelAnimationFrame(t),window.ikea.cookieConsent.vendor!=="unknown"){e(null);return}t=window.requestAnimationFrame(()=>r())};r()}else e(null)}),B={setItem:(e,t)=>{!z(2)||!D()||window.localStorage.setItem(e,t)},getItem:e=>!z(2)||!D()?null:window.localStorage.getItem(e)},de=()=>{var e,t;return!((t=(e=window.ikea)==null?void 0:e.experiment)!=null&&t.getUserId)||!z(2)?null:window.ikea.experiment.getUserId()||null},Sr=30*60*1e3,Ve=e=>`${e}-${k.split("/").join("")}`,Er=e=>{try{if(!D())return;const t=Ve("search-sik-usergroup"),r=localStorage.getItem(t),a=Ve("search-sik-usergroup-ga-time"),n=parseInt(localStorage.getItem(a)||"",10),s=Date.now();(Number.isNaN(n)||s-n>Sr||r!==e)&&(B.setItem(a,s.toString()),B.setItem(t,e),G({event_category:"search_backend",event_action:"usergroup",event_label:e,non_interaction:!0,custom:{additional_search_info:de()},sendLater:!0}))}catch(t){Y(t,{functionName:"setSikUsergroup"})}},xr=e=>{D()&&(localStorage.removeItem(`search-sik-usergroup-${e}`),localStorage.removeItem(`search-sik-usergroup-ga-time-${e}`))};let he,Ye=!1;const xt=async()=>{var e,t,r,a;if((e=window.ikea)!=null&&e.cookieConsent&&!((r=(t=window.ikea)==null?void 0:t.cookieConsent)!=null&&r.hasConsent(3)))document.addEventListener("ikeaCookieConsent",async()=>{var n,s;(s=(n=window.ikea)==null?void 0:n.cookieConsent)!=null&&s.hasConsent(3)&&!Ye&&(Ye=!0,xt())});else try{if(!((a=window.ikea)!=null&&a.experiment))return;const n={},s={};he=await window.ikea.experiment.init(ir,n,s),he.activateOnce("listing-3375-preact-search-box")}catch(n){console.error("Optimizely error",n)}},kr=e=>he?he.activateOnce(e):null,Fr=e=>e.includes("search-box")||e.includes("more-content")?[]:["subcategories-style","tree-navigation"],Ir=async(e,t)=>{var r;try{if(!D()||e.includes("more-content")||e.includes("product-group-page")||e.includes("visual-search-result-page"))return[];if(e.includes("search-box")){const a=new URLSearchParams(window.location.search),n=a.has("store")?a.get("store"):await((r=window.ikea.store)==null?void 0:r.get().catch(()=>""));return n?["store",n]:[]}return t.selectedStore?["store",t.selectedStore]:[]}catch(a){return Y(a),[]}},Tr=()=>{const e=new URLSearchParams(window.location.search);return e.has("sikForceAb")?["forceAb",e.get("sikForceAb")||""]:[]},Lr=()=>{const e=new URLSearchParams(window.location.search);return e.has("sikExperimental")?["experimental",e.get("sikExperimental")||""]:[]},Rr=e=>{if(!e.includes("search-box"))return[];const t=window.location.pathname.match("/cat/[^/]+-([a-z0-9]+)/");return t?["category",decodeURIComponent(t[1])]:[]},Ar=e=>{if(!e.includes("search-box"))return[];const t=window.location.pathname.match("/rooms/([a-z0-9\\-]+)/?");return t?["room",decodeURIComponent(t[1])]:[]},Cr=e=>{const t=new URLSearchParams(window.location.search);return!e.includes("search-box")||!t.has("q")?[]:["previousQ",t.get("q")||""]},Dr=()=>{var e;return(e=window==null?void 0:window.ikea)!=null&&e.postalCode?window.ikea.postalCode.get().catch(()=>[]).then(t=>t?["zip",t.postalCode]:[]):[]},Pr=e=>e.includes("search-box")?[]:e.includes("visual-search-result-page")||e.includes("product-group-page")?["types","PRODUCT"]:["types","PRODUCT,CONTENT,PLANNER,REFINED_SEARCHES,ANSWER,SHOPPABLE_IMAGE"],Or=async(e,t,r)=>{const a=new URL(wt);a.pathname=`${yt}/${t}`,a.search=new URLSearchParams([...Mr(r),Tr(),Lr(),Rr(t),Ar(t),Cr(t),await Ir(t,r),await Dr(),Fr(t),Pr(t),["c",e],["v",bt]].filter(s=>s.length)).toString();let n;return n=fetch(a.toString(),{headers:{...de()?{"Session-Id":de()??""}:{},authorization:`Basic ${gt}`}}),n.then(s=>{if(s.status!==200){const o=new Error(`Got HTTP status ${s.status} from backend`);return Promise.reject(o)}return s.json()}).then(s=>{var o,c;return Er(s.usergroup),(c=(o=s.testActivationTriggers)==null?void 0:o.onLoad)==null||c.forEach(i=>kr(i)),s})},Mr=e=>Object.keys(e).filter(r=>e[r]!==void 0&&e[r]!==null).map(r=>[r,e[r].toString()]),$r=(e,t)=>{const r=de();if(!t||t.length===0||!r)return;const a=new URL(wt);a.pathname=`${yt}/rewards`,a.search=new URLSearchParams([["c",e],["v",bt]]).toString();const n=JSON.stringify(t),s={headers:{...r?{"Session-Id":r}:{}},method:"POST",body:n};s.headers={...s.headers,authorization:`Basic ${gt}`},fetch(a.toString(),s).then(o=>{if(o.status!==200)return Promise.reject(new Error(`Got HTTP status ${o.status} from backend`))})},Nr="sb",Br=async e=>$r(Nr,e),kt=be(e=>Br(e)),Ft=(e,t)=>(r,a)=>[r,O(e,a),[()=>{t(a)},null]],fe=e=>Ft(e,t=>t.preventDefault()),Ur=e=>Ft(e,t=>t.stopPropagation()),zr=e=>(t,r)=>{var a;return r.target?[e,(a=r.target)==null?void 0:a.value]:t},qr=(e,t)=>{const r=new CustomEvent(t.name,{detail:t.detail,cancelable:!!t.onFinish||!!t.onCancel});let a=window.dispatchEvent(r);a&&t.onFinish?e(t.onFinish,r):!a&&t.onCancel&&e(t.onCancel,r)},It=e=>[qr,e],jr=e=>fr(e.watch,t=>{const r=new CustomEvent(e.name,{detail:e.getDetail(t)});Promise.resolve().then(()=>window.dispatchEvent(r))}),Wr=(e,t)=>{const r=a=>{e(t.action,a.detail)};return window.addEventListener(t.name,r),()=>{window.removeEventListener(t.name,r)}},Hr=(e,t)=>[Wr,{name:e,action:t}],Gr=e=>{const t=e.match(/^[Ss]?\d(?:[ .-]?\d){7}$/);return t?t[0].replace(/(?:[.|\-| ])/g,""):e.replace(/^[\s\uFEFF\xA0]+/g,"").replace(/[\s\uFEFF\xA0]+/g," ")},Vr=e=>(e.match(/^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?/)&&(e=e.replace(/^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([a-zA-Z\u00c0-\u017e])*\/?/,"$4"),e=e.replace(/\//g," "),e=e.replace(/\./g," "),e=e.replace(/\?.+/,"")),e),Tt=()=>{var e;return((e=window.location.pathname.split("/"))==null?void 0:e[3])==="search"||!1},Yr=window.location.hostname.includes("localhost"),Lt=(e,{path:t="",params:r=""})=>[e,[()=>{Tt()?window.history.pushState({},"",window.location.pathname+`${r}`):window.location.href=`${Yr?"":`${U}`}/${k}/${t}/${r}`},null],O([ye,!1])],Jr=(e,t)=>{const r=Vr(e),a=Gr(r),s=new URLSearchParams(window.location.search).get("seaForceAb");return It({name:"pagenavigationrequest",detail:{query:{q:a}},onFinish:[Lt,{path:"search",params:`?q=${encodeURIComponent(a)}${s?`&seaForceAb=${s}`:""}`}],onCancel:t})},Xr=e=>{const r=new URLSearchParams(window.location.search).get("seaForceAb");return It({name:"pagenavigationrequest",detail:{query:null},onFinish:[Lt,{path:"search",params:r?`?visual=true&seaForceAb=${r}`:"?visual=true"}],onCancel:e})},Zr="sb",Qr=e=>Or(Zr,"search-box",{q:e}),Kr=e=>({universal:e.searchBox.universal}),ea={close:"Cierra y deja el desplegable de búsqueda.",desc:{category:"Página de categoría",completion:"Search suggestion",content:"Página de contenido",planner:"Herramienta de planificación",product:"Página del producto",store:"Store information page"},skiplink:"Fin del desplegable de búsqueda."},ta={heading:"Buscar sugerencias"},ra={visualSearch:{text:"Buscar productos IKEA con una foto"}},aa={message:"¡Uy! Algo salió mal."},na={productsLabel:"Producto reciente",searchLabel:"Búsqueda reciente"},sa={clear:"Limpiar todo",heading:"Su historial de búsqueda"},oa={clearInput:"Borra el campo de entrada de búsqueda",close:"Cerrar",inputLabel:"Busque productos, inspiración o novedades",label:"¿Qué es lo que buscas?",placeholder:"Busca productos, inspiración o novedades",search:"Buscar"},ca={closed:"Cerrado",deviations:"Consulte la página de la tienda para ver más información.",deviationShortLink:"Consulte la página de la tienda para más información."},ia={captureImageButtonText:"Tomar o subir una foto",closeIcon:"Cerrar",disclaimer:"Tu privacidad es importante para nosotros. No subas imágenes con personas. Las imágenes solo se utilizarán para mejorar la calidad de búsqueda.",examplePhotosText:"O pruébalo haciendo clic en una de las imágenes de abajo",explanationHeader:"¿Cómo funciona esto?",explanationText:"¿Buscas la silla con estilo que acabas de ver pero no sabes cómo se llama? Saca una foto. Úsalo para buscar y descubrir nuestras coincidencias más cercanas.",headerText:"Buscar productos IKEA con una foto",imageErrorMessage:"Ha ocurrido un error. Por favor intente de nuevo.",labelText:"Búsqueda de imágenes","showVisualExampleImgs-text":"¿No estás listo para usar tu propia foto?",tryExamplePhoto:"Prueba una de nuestras imágenes"},la={a11yDropdownItem:ea,autocomplete:ta,dropdownWidget:ra,errorMessage:aa,recent:na,recentSearches:sa,searchField:oa,storeInfo:ca,visualModal:ia},ua=(e,t,r)=>{let a;try{const n=new Intl.PluralRules(Ne).select(t.number);a=e[n]??e.other}catch(n){return Y(n,{functionName:"i18n.js",state}),r}return a?Object.keys(t).reduce((n,s)=>n.replace(`{${s}}`,t[s]),a):r},b=(e,t={},r=!1)=>{if(!e)return e;const a=e.split(".");let n;try{n=a.reduce((s,o)=>s[o],{...la})}catch{return e}return n===void 0?e:r?Object.keys(t).reduce((s,o)=>s.reduce((c,i)=>typeof i=="string"?c.concat(i.split(`{${o}}`).reduce((d,v)=>d?[...d,t[o],v]:[v],null)):c.concat(i),[]),[n]):typeof n=="object"?Object.keys(t).includes("number")?ua(n,t,e):e:Object.keys(t).reduce((s,o)=>s.replace(`{${o}}`,t[o]),n)},me=`search-recent-searches-${k.split("/").join("")}`,da=e=>{if(!z(1)||!D())return;let t=window.localStorage.getItem(me);t===null&&(t="[]");const r=JSON.parse(t).slice(0,5);r&&r.forEach((a,n)=>{var s,o,c;(a===((s=e==null?void 0:e.completion)==null?void 0:s.text)||typeof a=="object"&&((o=a==null?void 0:a.completion)==null?void 0:o.text)===((c=e==null?void 0:e.completion)==null?void 0:c.text))&&r&&r.splice(n,1)}),r.unshift(e),window.localStorage.setItem(me,JSON.stringify(r))},ha=()=>{if(!z(1)||!D())return[];const e=window.localStorage.getItem(me);return e===null?[]:JSON.parse(e).reverse().map((r,a)=>typeof r=="object"?r:{label:b("recentSearchLabel"),timestamp:a,completion:{metadata:"generic",text:r}})},fa=()=>{D()&&window.localStorage.setItem(me,"[]")},ma=async()=>{let e=[];if(!D())return e;const{ikeaBrowserHistory:t}=window.localStorage;if(t){const r=JSON.parse(t);if(r.pip){const a=r.pip.reverse().slice(0,10);let n=await Promise.all(a.map(s=>fetch(`${U}/${k}/products/${s.id.slice(-3)}/${s.id}.json`).then(o=>o.json()).then(o=>({...s,...o})).catch(()=>({}))));n=n.reduce((s,o)=>(o.id&&o.name&&o.pipUrl&&s.push(o),s),[]),e.push(...n.map(s=>{var o,c;return{label:b("recent.productsLabel"),timestamp:s.timestamp,product:{colors:[],currencyCode:s.currencyCode,id:s.id,itemMeasureReferenceText:"",mainImageUrl:(o=s==null?void 0:s.mainImage)==null?void 0:o.url,name:s.name,onlineSellable:!0,pipUrl:s.pipUrl,priceNumeral:(c=s==null?void 0:s.salesPrice)==null?void 0:c.numeral,typeName:s.typeName}}}))}}return e},va=()=>{B.setItem("ikeaBrowserHistory","{}")};let Te={};const Je=async e=>{if(Te[e])return[Te[e],0];let t=performance.now(),r=await Qr(e).then(Kr).then(n=>n.universal),a=performance.now()-t;return Te[e]=r,[r,a]},pa=async(e,t)=>{try{let r="recent",a=[],n=0,s=t.phrase.trimStart();if(s.length)r="suggest",[a,n]=await Je(s);else{let o=await ma(),c=ha();a=[...o,...c],a.length||([a,n]=await Je(""),r="popular")}e(t.OnResult,{phrase:t.phrase,result:a,duration:n,type:r})}catch(r){Y(r),e(t.OnError)}},ba=e=>[pa,e],ga=()=>[()=>{const e=document.querySelector('[data-namespace="search-box"] .search-field__input');e&&e instanceof HTMLInputElement&&e.blur()},null],wa=e=>[()=>{da({label:b("recent.searchLabel"),timestamp:new Date().getTime(),completion:{metadata:"generic",text:e}})},null],ya=()=>[()=>{fa(),va()},null],_a=(e,t)=>[()=>{},null],V=be(G),se=dr(G),ge=be(wr),Sa=be(yr);new IntersectionObserver((e,t)=>e.forEach(r=>{r.isIntersecting&&(G(r.target._evdata),t.unobserve(r.target))}),{threshold:1});const Xe=1e3,Ea="visual-search-test-image-zu0h51trui.jpg",xa=e=>fetch(e,{cache:"no-store"}).then(t=>t.blob()).catch(t=>{throw new Error("visual search - fetch example image failed")}),ka=e=>new Promise((t,r)=>{if(!e){r(new Error("visual search - no data"));return}const a=new FileReader;a.onerror=n=>{r(n)},a.onload=()=>{t(a.result)},a.readAsDataURL(e)}),Fa=e=>{const t=e.split(",")[1];return t.substr(0,4)==="/9j/"||t.substr(0,5)==="UklGR"||t.substr(0,5)==="iVBOR"},Ia=e=>new Promise((t,r)=>{const a=()=>{r(new Error("visual search - image resize error"))},n=new Image;n.onerror=a,n.onload=()=>{const s=n.widthfetch("https://v4.ai.ingka.ikea.net/api/public/image",{method:"POST",headers:{"Content-Type":"application/json","x-api-key":"AIzaSyBX8RsOkAzdfM1WW0ZiHVG8q7coOdowdXk"},body:JSON.stringify({jobs:[{features:[{type:"search",countryCode:k.split("/")[0],languageCode:k.split("/")[1],includeIdentify:!0,saveImage:cr&&!t,maxResults:1,maxDetections:10,sortBy:{poi:{pt:[.5,.5],sortOrder:"desc"}}}],base64:e}]})}).then(r=>r.json()),La=e=>{if(!e.results)throw new Error("visual search - bad response "+(e==null?void 0:e.message));return e.results.length?e.results[0].search[0].products?e.results[0].search.reduce((r,a,n)=>(a.products.forEach((s,o)=>{r[o]=r[o]||[];const c=s.itemNoGlobal[0].toLowerCase()==="s"?s.itemNoGlobal.slice(1):s.itemNoGlobal;r[o][n]=c}),r),[]).flat().filter(r=>!!r).reduce((r,a)=>`${r},${a}`):e.results[0].search.map(r=>r.article[0].toLowerCase()==="s"?r.article.slice(1):r.article).reduce((r,a)=>`${r},${a}`):""},Ra=async(e,t)=>{if(!Et())throw new Error("visual search - session storage not available");let r=await ka(e);if(!t&&!Fa(r))throw new Error("visual search - invalid image data");return t||(r=await Ia(r)),r.split(",")[1]},Aa=async(e,t)=>{window.sessionStorage.setItem("visualSearchImage",e);const r=await Ta(e,t),a=La(r);return window.sessionStorage.setItem("visualSearchResult",a),a},Ca=async(e,t)=>{try{let r,a;t.source instanceof File?(r=t.source,a=r.name===Ea):(r=await xa(t.source),a=!0);const n=await Ra(r,a);e(t.onBegin,n);const s=await Aa(n,a);window.sessionStorage.setItem("visualSearchResult",s),e(t.onFinish,s)}catch(r){e(t.onError,r)}},Da=e=>[Ca,e],we=pr(300),Rt=(e,t)=>[{...e,searchFieldValue:t,searchFieldFocused:!0,isDropdownVisible:!0},we.debounce(O(oe))],Ce=(e,t)=>[{...e,searchFieldValue:t??"",isSearching:e.searchFieldFocused?e.isSearching:!1},e.searchFieldFocused&&O(oe)],Ze=e=>e.isDropdownVisible?e:[{...e,searchFieldFocused:!0,isDropdownVisible:!0},!e.isDropdownVisible&&V({event_action:"focus",sendLater:!0}),O(oe)],oe=e=>[{...e,isSearching:!0,searchPhrase:e.searchFieldValue},we.clear(),ba({phrase:e.searchFieldValue,OnError:Pa,OnResult:Oa})],Pa=(e,t)=>({...e,error:t.message,isSearching:!1}),Oa=(e,t)=>t.phrase!==e.searchFieldValue?e:[{...e,searchResults:t.result,searchResultsType:t.type,isSearching:!1,searchPhrase:t.phrase},t.duration>0&&V({event_category:"search_box_actions",event_value:t.duration,event_label:t.duration,event_action:"sik_request_duration_search_box",non_interaction:!0,sendLater:!0})],Ma=e=>[e,ya(),O(oe)],$a=e=>[{...e,searchFieldFocused:!1}],At=(e,t)=>e.searchFieldValue.trim()===""?e:[e,we.clear(),br(),ga(),Jr(e.searchFieldValue,[ye,!1]),wa(e.searchFieldValue),t.hard_search&&!!e.searchFieldValue.trim().length&&V({event_label:e.searchFieldValue,custom:{search_type:"hard_search"}}),Sa("search_box")],ye=(e,t)=>({...e,isDropdownVisible:t}),Ct=e=>[{...e,visualSearchWidget:{...e.visualSearchWidget,show:!1},isDropdownVisible:!1,isModalVisible:!0,animateModal:!1},gr(t=>({...t,animateModal:!0})),se({event_category:"search_box_actions",event_action:`visual-search-icon_clicked_${e.isDropdownVisible?"dropdown_open":"dropdown_closed"}`})],Na=()=>[()=>{requestAnimationFrame(()=>{const e=document.getElementById("search-box__visualsearch");e&&e.blur()})},null],_e=e=>[{...e,animateModal:!1},mr(t=>[{...t,isModalVisible:!1},Na()],300)],Ba=e=>[{...e,searchFieldValue:"",searchFieldFocused:!0},O(oe),se({event_action:"clear-icon-clicked",event_category:"search_box_actions"})],Ua=e=>[{...e},ge("hard_search")],Dt=e=>[{...e,isDropdownVisible:!1},se({event_action:"close-search-box-icon-clicked",event_category:"search_box_actions"})],za=(e,t)=>[{...e,isSearching:!1,showVisualErrorMessage:!0},_a()],qa=e=>({...e,isSearching:!0,showVisualErrorMessage:!1}),ja=e=>[{...e,searchPhrase:"",isSearching:!1},O(_e)],Wa=(e,t)=>{const r=t?"visual_search_upload_image":"visual_search_example_image",a="visual_searches";return[{...e,isSearching:!1},V({event_category:"search_box_actions",event_action:r}),V({event_label:"visual",custom:{search_type:a}}),ge(a),Xr(ja),O(_e)]},Qe=(e,t)=>[e,we.clear(),Da({source:t,onBegin:qa,onFinish:[Wa,t instanceof File],onError:za})],Ha=(e,{text:t,actionTokens:r,listPosition:a,searchType:n,metadata:s})=>[{...e,searchFieldValue:t},kt(r||[]),V({event_label:t,value:a+1,custom:{search_type:n,additional_search_info:s}}),ge(n),O([At,{hard_search:!1}])],Pt=(e,t)=>({...e,searchFieldValue:t}),Ga=e=>({...e,visualSearchWidget:{...e.visualSearchWidget,hiding:!1}}),Va=e=>[e,O(Ct),se({event_category:"search_box_actions",event_action:"visual_search_widget_accepted"})],Ya=e=>[{...e,visualSearchWidget:{show:!1,hiding:!0}},se({event_category:"search_box_actions",event_action:"visual_search_widget_dismissed"})],Ja=e=>({...e,viewport:_t()});var Ot=1,ne=3,Se={},Ee=[],Xa="http://www.w3.org/2000/svg",Ke=e=>e,Za=Ee.map,xe=Array.isArray,Qa=typeof requestAnimationFrame<"u"?requestAnimationFrame:setTimeout,Mt=e=>{var t="";if(typeof e=="string")return e;if(xe(e))for(var r=0,a;r{for(var r in{...e,...t})if(typeof(xe(e[r])?e[r][0]:e[r])=="function")t[r]=e[r];else if(e[r]!==t[r])return!0},en=(e,t=Ee,r)=>{for(var a=[],n=0,s,o;ne==null?e:e.key,$t=(e,t,r,a,n,s)=>{if(t==="style")for(var o in{...r,...a})r=a==null||a[o]==null?"":a[o],o[0]==="-"?e[t].setProperty(o,r):e[t][o]=r;else t[0]==="o"&&t[1]==="n"?((e.events||(e.events={}))[t=t.slice(2)]=a)?r||e.addEventListener(t,n):e.removeEventListener(t,n):!s&&t!=="list"&&t!=="form"&&t in e?e[t]=a??"":a==null||a===!1?e.removeAttribute(t):e.setAttribute(t,a)},De=(e,t,r)=>{var a=e.props,n=e.type===ne?document.createTextNode(e.tag):(r=r||e.tag==="svg")?document.createElementNS(Xa,e.tag,a.is&&a):document.createElement(e.tag,a.is&&a);for(var s in a)$t(n,s,null,a[s],t,r);for(var o=0;o{if(r!==a)if(r!=null&&r.type===ne&&a.type===ne)r.tag!==a.tag&&(t.nodeValue=a.tag);else if(r==null||r.tag!==a.tag)t=e.insertBefore(De(a=Q(a),n,s),t),r!=null&&e.removeChild(r.node);else{var o,c,i,d,v=r.props,g=a.props,h=r.children,m=a.children,f=0,y=0,L=h.length-1,A=m.length-1;s=s||a.tag==="svg";for(var _ in{...v,...g})(_==="value"||_==="selected"||_==="checked"?t[_]:v[_])!==g[_]&&$t(t,_,v[_],g[_],n,s);for(;y<=A&&f<=L&&!((i=W(h[f]))==null||i!==W(m[y]));)J(t,h[f].node,h[f],m[y]=Q(m[y++],h[f++]),n,s);for(;y<=A&&f<=L&&!((i=W(h[L]))==null||i!==W(m[A]));)J(t,h[L].node,h[L],m[A]=Q(m[A--],h[L--]),n,s);if(f>L)for(;y<=A;)t.insertBefore(De(m[y]=Q(m[y++]),n,s),(c=h[f])&&c.node);else if(y>A)for(;f<=L;)t.removeChild(h[f++].node);else{for(var M={},$={},_=f;_<=L;_++)(i=h[_].key)!=null&&(M[i]=h[_]);for(;y<=A;){if(i=W(c=h[f]),d=W(m[y]=Q(m[y],c)),$[i]||d!=null&&d===W(h[f+1])){i==null&&t.removeChild(c.node),f++;continue}d==null||r.type===Ot?(i==null&&(J(t,c&&c.node,c,m[y],n,s),y++),f++):(i===d?(J(t,c.node,c,m[y],n,s),$[d]=!0,f++):(o=M[d])!=null?(J(t,t.insertBefore(o.node,c&&c.node),o,m[y],n,s),$[d]=!0):J(t,c&&c.node,null,m[y],n,s),y++)}for(;f<=L;)W(c=h[f++])==null&&t.removeChild(c.node);for(var _ in M)$[_]==null&&t.removeChild(M[_].node)}}return a.node=t},tn=(e,t)=>{for(var r in e)if(e[r]!==t[r])return!0;for(var r in t)if(e[r]!==t[r])return!0},Q=(e,t)=>e!==!0&&e!==!1&&e?typeof e.tag=="function"?((!t||t.memo==null||tn(t.memo,e.memo))&&((t=e.tag(e.memo)).memo=e.memo),t):e:w(""),Nt=e=>e.nodeType===ne?w(e.nodeValue,e):Be(e.nodeName.toLowerCase(),Se,Za.call(e.childNodes,Nt),Ot,e),Be=(e,{key:t,...r},a,n,s)=>({tag:e,props:r,key:t,children:a,type:n,node:s}),w=(e,t)=>Be(e,Se,Ee,ne,t),Bt=(e,{class:t,...r},a=Ee)=>Be(e,{...r,...t?{class:Mt(t)}:Se},xe(a)?a:[a]),rn=({node:e,view:t,subscriptions:r,dispatch:a=Ke,init:n=Se})=>{var s=e&&Nt(e),o=[],c,i,d=h=>{c!==h&&((c=h)==null&&(a=r=v=Ke),r&&(o=en(o,r(c),a)),t&&!i&&Qa(v,i=!0))},v=()=>e=J(e.parentNode,e,s,s=t(c),g,i=!1),g=function(h){a(this.events[h.type],h)};return(a=a((h,m)=>typeof h=="function"?a(h(c,m)):xe(h)?typeof h[0]=="function"?a(h[0],h[1]):h.slice(1).map(f=>f&&f!==!0&&(f[0]||f)(a,f[1]),d(h[0])):d(h)))(n),a};const an=[],et={},T=e=>(t=et,r=t.tag!=null||Array.isArray(t)?t:an)=>Bt(e,t===r?et:t,r),ce=T("a"),tt=T("b"),X=T("p"),nn=T("h2"),Ut=T("h3"),zt=T("li"),sn=T("ol"),F=T("div"),Pe=T("img"),on=T("form"),C=T("span"),cn=T("aside"),qt=T("input"),ln=T("label"),Ue=T("button"),un=T("footer"),dn=T("header"),hn=[],fn={},ze=e=>(t,r=t.tag!=null||Array.isArray(t)?t:hn)=>Bt(e,t===r?fn:t,r),jt=ze("svg"),I=ze("path"),mn=ze("circle"),P=({className:e,height:t,width:r},a)=>jt({class:["svg-icon",e],width:r,height:t,viewBox:"0 0 24 24","aria-hidden":"true"},a),vn=({className:e,height:t,width:r})=>P({className:e,height:t,width:r},[I({"fill-rule":"evenodd","clip-rule":"evenodd",d:"M16.002 13a4 4 0 11-8 0 4 4 0 018 0zm-2 0a2 2 0 11-4 0 2 2 0 014 0z",fill:"currentColor"}),I({"fill-rule":"evenodd","clip-rule":"evenodd",d:"M9.443 4L7.586 7H3v13h18V7h-4.586l-1.857-3H9.443zm1.114 2h2.886L15.3 9H19v9H5V9h3.7l1.857-3z",fill:"currentColor"})]),pn=({className:e,height:t,width:r})=>P({className:e,height:t,width:r},[I({"fill-rule":"evenodd","clip-rule":"evenodd",d:"M13.98 15.395a6.294 6.294 0 111.414-1.414l4.602 4.601-1.414 1.414-4.602-4.601zm.607-5.101a4.294 4.294 0 11-8.587 0 4.294 4.294 0 018.587 0z",fill:"currentColor"})]),bn=({className:e,height:t,width:r})=>jt({class:`svg-icon ${e}`,width:r,height:t,viewBox:"0 0 24 24"},I({fill:"currentColor","fill-rule":"evenodd","clip-rule":"evenodd",d:"M12.0002 13.4144L16.9499 18.3642L18.3642 16.9499L13.4144 12.0002L18.3642 7.05044L16.95 5.63623L12.0002 10.586L7.05044 5.63623L5.63623 7.05044L10.586 12.0002L5.63624 16.9499L7.05046 18.3642L12.0002 13.4144Z"})),gn=({className:e,height:t,width:r})=>P({className:e,height:t,width:r},[I({"fill-rule":"evenodd","clip-rule":"evenodd",d:"M12.0006 13.4148l2.8283 2.8283 1.4142-1.4142-2.8283-2.8283 2.8283-2.8283-1.4142-1.4142-2.8283 2.8283L9.172 7.7578 7.7578 9.172l2.8286 2.8286-2.8286 2.8285 1.4142 1.4143 2.8286-2.8286z"})]),wn=({className:e,height:t,width:r})=>P({className:e,height:t,width:r},[I({"fill-rule":"evenodd",d:"M3 3h10v10H3V3zm2 2v6h6V5H5z"}),I({d:"M17 7v10H7v-2h8V7h2zm4 14V11h-2v8h-8v2h10z"})]),yn=({className:e,height:t,width:r})=>P({className:e,height:t,width:r},[I({"fill-rule":"evenodd",d:"M22 20V4H2v16h20zM20 6H4v12h3v-8h10v8h3V6zm-9 6H9v6h2v-6zm2 6h2v-6h-2v6z"})]),_n=({className:e,height:t,width:r})=>P({className:`icon-spinner ${e}`,height:t,width:r},[I({d:"M13.5 3.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 1 1 3 0zM7.073 4.986a1.5 1.5 0 0 1-2.121 2.121 1.5 1.5 0 0 1 2.121-2.121zM3.58 10.58a1.5 1.5 0 1 1 0 3 1.5 1.5 0 1 1 0-3zm1.487 6.427a1.5 1.5 0 0 1 2.121 2.121 1.5 1.5 0 0 1-2.121-2.121zM10.66 20.5a1.5 1.5 0 1 1 3 0 1.5 1.5 0 1 1-3 0zm6.427-1.485a1.5 1.5 0 1 1 2.121-2.122 1.5 1.5 0 1 1-2.121 2.122zm3.493-5.595a1.5 1.5 0 1 1 0-3 1.5 1.5 0 1 1 0 3zm-1.486-6.427a1.5 1.5 0 0 1-2.121-2.121 1.5 1.5 0 0 1 2.121 2.121z"})]),Sn=({className:e,height:t,width:r})=>P({className:e,height:t,width:r},[I({"fill-rule":"evenodd","clip-rule":"evenodd",d:"M16.415 12.001l-8.001 8L7 18.588l6.587-6.586L7 5.414 8.415 4l8 8.001z"})]),En=({className:e,height:t,width:r})=>P({className:e,height:t,width:r},[I({"fill-rule":"evenodd",d:"M13.001 2.586L4 11.587v5.414h5.414l8.994-8.994-5.408-5.421zM6 15.001v-2.586l6.999-6.999 2.583 2.589-6.996 6.996H6z"}),I({d:"M4 21.001h16v-2H4v2z"})]),xn=({className:e,height:t,width:r})=>P({className:e,height:t,width:r},[mn({cx:"12",cy:"12",r:"10"}),I({fill:"#666","fill-rule":"evenodd","clip-rule":"evenodd",d:"M12 10.6L15.6 7 17 8.4 13.4 12l3.6 3.6-1.4 1.4-3.6-3.6L8.4 17 7 15.6l3.6-3.6L7 8.4 8.4 7l3.6 3.6z"})]),kn=({className:e,height:t,width:r})=>P({className:e,height:t,width:r},[I({d:"M11.004 14.134h2v-6h-2v6zm1 1.5a1.25 1.25 0 100 2.5 1.25 1.25 0 000-2.5z"}),I({"fill-rule":"evenodd","clip-rule":"evenodd",d:"M1.115 20.418l10-19h1.77l10 19L22 21.884H2l-.885-1.466zm2.542-.534h16.687L12 4.03 3.656 19.884z"})]),Fn=({className:e,height:t,width:r})=>P({className:e,height:t,width:r},[I({d:"M12 9.5A1.25 1.25 0 1 0 12 7a1.25 1.25 0 1 0 0 2.5zM11 11v6h2v-6h-2z"}),I({"fill-rule":"evenodd",d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zM4 12a8 8 0 1 1 16 0 8 8 0 1 1-16 0z"})]),rt=({className:e,height:t,width:r})=>P({className:e,height:t,width:r},[I({"fill-rule":"evenodd","clip-rule":"evenodd",d:"m3.999 11.9997 8 8.0011 1.4143-1.4141-5.5859-5.5866H20v-2H7.8273l5.5871-5.5868-1.4142-1.4143-8.0012 8.0007z",fill:"currentColor"})]),q=({className:e="",height:t="24",width:r="24",name:a})=>{switch(a){case"arrow-left":return rt({className:e,width:r,height:t});case"arrow-right":return rt({className:[e,"icon--rotated"],width:r,height:t});case"camera":return vn({className:e,width:r,height:t});case"chevron":return Sn({className:e,width:r,height:t});case"stack":return wn({className:e,width:r,height:t});case"store":return yn({className:e,width:r,height:t});case"pencil":return En({className:e,width:r,height:t});case"information-circle":return Fn({className:e,width:r,height:t});case"close":return bn({className:e,width:r,height:t});case"cross-small":return gn({className:e,width:r,height:t});case"search":return pn({className:e,width:r,height:t});case"clear-input-field":return xn({className:e,width:r,height:t});case"warning-triangle":return kn({className:e,width:r,height:t});case"spinner":return _n({className:e,width:r,height:t});default:return}},In=({message:e,error:t})=>t?X({class:"error"},[q({name:"warning-triangle"}),w(e)]):!1,Tn=(e,t)=>{const r=t.toLowerCase().indexOf(e.toLowerCase());if(r===-1)return[w(t)];const a=r+e.length;return[tt(w(t.slice(0,r))),w(t.slice(r,a)),tt(w(t.slice(a)))]},Ln=e=>zt({class:"universal-item"},[ce({tabindex:-1,class:"universal-item__link",href:`${U}/${k}/search/?q=${e.text}`,onclick:fe([Ha,e]),onselect:[Pt,e.text],"aria-label":e.text,"aria-describedby":`description-id-${e.listPosition}`},C({class:"universal-item__text"},C({class:"universal-item__title with-autocomplete-icon"},[q({name:"search",className:"universal-item__icon"}),...Tn(e.searchPhrase,e.text)]))),C({id:`description-id-${e.listPosition}`,hidden:!0},w(e.ariaDescription))]),Rn=(e,{eventLabel:t,searchType:r,metadata:a,actionTokens:n})=>[e,kt(n||[]),V({event_category:"search",event_label:t,custom:{search_type:r,number_of_internal_searches:1,internal_search_term:e.searchFieldValue,search_origin:"search_box"}}),V({event_action:r,event_label:t,custom:{search_type:r,additional_search_info:a}}),ge(r)],ee=e=>zt({class:"universal-item"},[ce({tabindex:-1,class:"universal-item__link",onclick:[Rn,e],onselect:[Pt,[e.title,e.label].filter(Boolean).join(", ")],href:e.url,"aria-label":e.title,"aria-describedby":`description-id-${e.id}`},[F({class:"universal-item__text"},[X({class:"universal-item__title"},[!e.thumbnail&&q({name:e.icon,className:"universal-item__icon"}),w(e.title)]),!!e.label&&X({class:"universal-item__label"},w(e.label))]),!!e.thumbnail&&Pe({src:e.thumbnail,alt:"",class:"universal-item__thumbnail",onerror:(t,r)=>(r.target.style.display="none",t)})]),C({id:`description-id-${e.id}`,hidden:!0},w(e.ariaDescription))]),An=(e,t)=>{const r=new Date,a=r.toISOString().substring(0,10);r.setDate(r.getDate()+1);const n=r.toISOString().substring(0,10);return e.filter(o=>o.date===a||o.date===n).map(o=>{const c=new Date(o.date);return{hours:o.hours,date:c.toLocaleString(Ne,{weekday:"short"})}}).map(o=>{const c=o.hours.length===0?b("storeInfo.closed"):o.hours.map(i=>`${i.open} - ${i.close}`).join(", ");return`${o.date} ${c}`}).join(t)},Cn=({searchPhrase:e,universalItems:t,listType:r})=>!!(t!=null&&t.length)&&F({class:"search-results__container search-results__container--search-history"},[r==="recent"&&X({class:"search-results__heading"},[w(b("recentSearches.heading")+" "),ce({tabindex:-1,class:"search-results__clear",onclick:Ma,ariaLabel:`${b("recentSearches.clear")} ${b("recentSearches.heading")}`},w(b("recentSearches.clear")))]),sn({class:"search-results__list search-results__container search-results__container--autocomplete",id:"search-suggestions",ariaLabel:b("autocomplete.heading")},t.map((a,n)=>{if(a.completion!=null)return Ln({listPosition:n,searchPhrase:e,searchType:r==="popular"?"popular_searches":r==="recent"?"historical_searches":"autocomplete",metadata:a.metadata,text:a.completion.text,actionTokens:a==null?void 0:a.actionTokens,ariaDescription:b("a11yDropdownItem.desc.completion")});if(a.product!=null)return ee({icon:"chevron",title:a.product.name,label:[a.product.typeName,a.product.itemMeasureReferenceText].filter(Boolean).join(", "),url:a.product.pipUrl,thumbnail:a.product.mainImageUrl&&`${a.product.mainImageUrl}?f=u`,eventLabel:a.product.name,searchType:"product_"+r,metadata:a.metadata,actionTokens:a.actionTokens,ariaDescription:b("a11yDropdownItem.desc.product"),id:n});if(a.category!=null)return ee({icon:"stack",title:a.category.name,url:a.category.url,eventLabel:a.category.name,searchType:"category_"+r,metadata:a.metadata,actionTokens:a.actionTokens,ariaDescription:b("a11yDropdownItem.desc.category"),id:n});if(a.planner!=null)return ee({icon:"pencil",title:a.planner.title,url:a.planner.url,eventLabel:a.planner.title,searchType:"planner_"+r,metadata:a.metadata,actionTokens:a.actionTokens,ariaDescription:b("a11yDropdownItem.desc.planner"),id:n});if(a.content!=null)return ee({icon:"information-circle",title:a.content.title,url:a.content.url,eventLabel:a.content.title,searchType:"content_"+r,metadata:a.metadata,actionTokens:a.actionTokens,ariaDescription:b("a11yDropdownItem.desc.content"),id:n});if(a.store!=null)return ee({icon:"store",title:a.store.name,label:a.store.openingHours.days.length?An(a.store.openingHours.days," & "):null,url:a.store.website,eventLabel:a.store.name,searchType:"store_"+r,metadata:a.metadata,actionTokens:a.actionTokens,ariaDescription:b("a11yDropdownItem.desc.store"),id:n})}))]),Wt=({ariaLabel:e,className:t,icon:r,id:a,label:n,title:s,onclick:o,type:c="button"})=>Ue({id:a,class:["search-btn",t],onclick:o,"aria-label":e,...s?{title:s}:{},type:c},[q({name:r}),!!n&&C({class:"search-box__btn-label"},w(n))]),Dn=({animating:e})=>F({class:{"visual-search__widget":!0,"animation-fadeout":e},onclick:Va,onanimationend:e?Ga:t=>t},[C({class:"visual-search__widget--content"},[C({class:"visual-search__widget-icon"},q({name:"camera"})),X({class:"visual-search__widget--content--text"},w(b("dropdownWidget.visualSearch.text")))]),Wt({ariaLabel:b("visualModal.closeIcon"),type:"button",className:"widget__cancel-button",icon:"close",onclick:Ur(Ya)})]),Pn=(e="primary")=>q({name:"spinner",className:e}),On=({color:e="primary",size:t="medium"}={})=>C({class:{"loading-ball":!0,[`${e}`]:!0,[`ball-${t}`]:!0}}),qe=({type:e="ball",color:t="primary",size:r="medium"}={})=>F({class:"loading-wrapper","aria-hidden":!0},[e==="spinner"&&Pn(t),e==="ball"&&On({color:t,size:r})]),Mn=e=>!e.searchPhrase&&z(2)&&(e.visualSearchWidget.show||e.visualSearchWidget.hiding),$n=e=>e.isDropdownVisible?F({class:"dropdown",tabindex:-1},In({error:e.error,message:b("errorMessage.message")})||[Mn(e)&&Dn({animating:e.visualSearchWidget.hiding}),!!e.searchResults.length&&!!e.searchResultsType&&F({class:"search-results"},[Cn({searchPhrase:e.searchPhrase,universalItems:e.searchResults,listType:e.searchResultsType}),ce({href:"#search-box-anchor",class:"sr-only",onclick:Dt,tabIndex:-1},w(b("a11yDropdownItem.close"))),e.isSearching&&F({class:"search-loader"},qe({type:"ball",size:"large"}))])]):!1,Nn=(e,t)=>{let r;return Object.defineProperty(e,"node",{get(){return r},set(a){r=a,r._once||(r._once=!0,window.requestAnimationFrame(()=>t(r)))}}),e},Bn=new IntersectionObserver(([e])=>{e.intersectionRect.width!==e.boundingClientRect.width&&e.target.classList.add("tooltip--intoview--y-axis"),e.intersectionRect.height!==e.boundingClientRect.height&&e.target.classList.add("tooltip--intoview--x-axis")},{root:null,rootMargin:"0px",threshold:[0]}),Un=({id:e,ariaLabel:t,tooltipText:r})=>Nn(F({class:"tooltip",role:"tooltip","aria-hidden":"true",id:e+"--tooltip"},w(r||t)),a=>Bn.observe(a));let at;const te=e=>e.currentTarget,re=(e,t)=>{const r=matchMedia("(pointer:fine)").matches,a=document==null?void 0:document.getElementById(e+"--tooltip");t==="add"?r&&(a==null||a.classList[t]("show-tooltip")):a==null||a.classList[t]("show-tooltip")},ke=({ariaLabel:e,tooltipText:t,className:r,iconClassName:a,icon:n,id:s,style:o,label:c,onclick:i,isLoading:d=!1,type:v="button",loaderColor:g="primary"})=>F({class:"button-and-tooltip"},[Ue({id:s,class:["search-btn",r],disabled:d,style:o,onmouseover:(h,m)=>{const f=te(m);return f!=null&&f.hidingTooltip||(at=setTimeout(()=>{re(s,"add")},400)),h},onmouseleave:(h,m)=>{clearTimeout(at);const f=te(m);return f&&(re(s,"remove"),f.hidingTooltip=!1,f.blur()),h},onclick:(h,m)=>{const f=te(m);return f&&(f.hidingTooltip=!0),re(s,"remove"),i?[i,m]:h},onfocus:(h,m)=>{const f=te(m);return f!=null&&f.hidingTooltip||re(s,"add"),h},onblur:(h,m)=>{const f=te(m);return f&&(f.hidingTooltip=!1),re(s,"remove"),h},...!t&&{"aria-labelledby":s+"--tooltip"},...t&&{"aria-label":e},type:v},[d?qe({color:g}):q({name:n,className:a}),!!c&&C({class:"search-box__btn-label"},w(c))]),Un({id:s,ariaLabel:e,tooltipText:t})]),zn=()=>{const e=document.querySelector("html");return e?e.getAttribute("dir")==="rtl":!1},qn=()=>ke({ariaLabel:b("searchField.clearInput"),className:"search-box__button double clear-input",id:"clear-input",icon:"cross-small",onclick:fe(Ba)}),jn=()=>ke({ariaLabel:b("searchField.search"),className:{"search-box__button":!0,double:!0,search:!0},icon:"search",id:"search-box__searchbutton",type:"submit",onclick:Ua}),Wn=e=>ke({ariaLabel:b("visualModal.headerText"),className:`search-box__button single ${e.searchPhrase.length&&!e.isDropdownVisible||e.searchPhrase.length===0?"":"hidden"}`,icon:"camera",id:"search-box__visualsearch",onclick:Ct}),Hn=()=>ke({className:{"search-box__button":!0,close:!0},ariaLabel:b("searchField.close"),icon:zn()?"arrow-right":"arrow-left",id:"search-box__closebutton",onclick:Dt}),Gn=()=>[Oe(qn()),Oe(jn())],Oe=e=>C({class:"search-box__button-wrapper-item"},e),Vn=e=>F({class:{"search-field":!0,"search-field--has-input":!!e.searchFieldValue}},[q({name:"search",className:{"search-field__search-icon":!0,"search-field__search-icon--show":!e.searchFieldValue&&e.viewport>H.HEADER_FOOTER.val||!e.searchFieldValue&&!e.isDropdownVisible&&e.viewport<=H.HEADER_FOOTER.val,"search-field__search-icon--hide":!(!e.searchFieldValue&&e.viewport>H.HEADER_FOOTER.val||!e.searchFieldValue&&!e.isDropdownVisible&&e.viewport<=H.HEADER_FOOTER.val)}}),C({class:"search-box__button-wrapper-close-icon"},[e.isDropdownVisible&&e.viewport<=H.HEADER_FOOTER.val&&Hn()]),qt({type:"text",enterkeyhint:"search",role:"combobox",name:"q",id:"ikea-search-input",maxlength:150,class:{"search-field__input":!0,"search-field__input--has-loading-icon":e.isSearching,"search-field__input--has-clear-button":!!e.searchFieldValue.length,"search-field__input--has-input":!!e.searchFieldValue&&(e.viewport>H.HEADER_FOOTER.val||!e.isDropdownVisible)},spellcheck:!1,"aria-label":b("searchField.inputLabel"),"aria-controls":"search-suggestions","aria-expanded":e.isDropdownVisible?"true":"false","aria-haspopup":"false",placeholder:b("searchField.label"),autocomplete:"off",value:e.searchFieldValue,oninput:zr(Rt),onfocus:Ze,onblur:$a,onclick:Ze}),C({class:{"search-box__button-wrapper":!0}},[...e.searchFieldValue.length?Gn():[],CSS.supports("image-orientation","from-image")&&z(2)&&(!e.searchPhrase.length||!e.isDropdownVisible)&&!e.searchFieldValue.length&&Oe(Wn(e))])]),Ht=({animate:e,className:t,onclick:r})=>F({class:`${t||""} overlay ${e?"fade-animation":""}`,onclick:r}),Yn=({animate:e,title:t,onClose:r,footerPart:a},n)=>F({class:"modal__container"},[cn({ariaModal:"true",class:{modal:!0,"slide-animation":e}},[dn({class:{modal__header:!0,"modal__header--no-title":!t}},[!!t&&Ut({className:"modal__title"},w(t)),Wt({ariaLabel:b("visualModal.closeIcon"),type:"button",className:"modal__cancel-button",icon:"close",onclick:r})]),F({class:{modal__body:!0}},n),!!a&&un({class:"modal__footer"},a)]),Ht({animate:e,onclick:r})]),Jn=[`${U}/${k}/search/visual/visual1.jpg`,`${U}/${k}/search/visual/visual4.jpg`,`${U}/${k}/search/visual/visual2.jpg`,`${U}/${k}/search/visual/visual3.jpg`],Xn=({isLoading:e,hasError:t,animate:r})=>Yn({animate:r,onClose:_e,footerPart:t&&F({class:"visual__modal-error"},w(b("visualModal.imageErrorMessage"))),title:b("visualModal.headerText")},[ln({class:"visual__modal-upload_button",role:"button"},[qt({class:"sr-only",type:"file",accept:"image/*",disabled:e,onchange:(a,n)=>{var s;return[Qe,(s=n.target.files)==null?void 0:s[0]]}}),...e?[qe({color:"secondary"})]:[q({name:"camera",className:"visual__modal-upload-icon"}),w(b("visualModal.captureImageButtonText"))]]),X({class:"visual__modal-warning with-content-icon"},w(b("visualModal.disclaimer"))),Ut({class:"visual__modal-photo-grid-header"},w(b("visualModal.examplePhotosText"))),F({class:"visual__modal-photo-grid"},Jn.map(a=>Ue({type:"button",disabled:e,class:"search-btn visual__modal-image-example",onclick:[Qe,a]},Pe({src:a})))),F({class:"visual__modal-explanation"},[nn({class:"visual__modal-header-text"},w(b("visualModal.explanationHeader"))),Pe({src:`${U}/${k}/search/visual/visual-search-placeholder.svg`,class:"visual__modal-placeholder-illustration"}),X(w(b("visualModal.explanationText")))])]),Zn=e=>F({class:"notranslate","data-id":"box-mount",dir:or},[on({role:"search","aria-expanded":e.isDropdownVisible,action:`${U}/${k}/search/`,class:`search-box ${e.isDropdownVisible?"active":""}`,onsubmit:fe([At,{hard_search:!0}])},[F({class:"search-wrapper"},Vn(e)),$n(e),ce({id:"search-box-anchor",tabIndex:-1,class:"sr-only","aria-hidden":"true"},w(b("a11yDropdownItem.skiplink")))]),e.isModalVisible&&Xn({isLoading:e.isSearching,animate:e.animateModal,hasError:e.showVisualErrorMessage}),e.isDropdownVisible&&Ht({animate:!0,className:"dropdown__overlay",onclick:fe([ye,!1])})]),nt=30*60*1e3,Qn=4*7*24*60*60*1e3,Kn=50,es="-impact",st=e=>`${e}-${k.split("/").join("")}`,ot=(e=!1)=>{const t=Date.now();try{if(!D())return!1;Object.keys(localStorage).reduce((r,a)=>{if(a.startsWith("search-abtest")&&!a.startsWith("search-abtest-gatime")){const n=/search-abtest-(.*)-([a-z0-9]{4})/,s=a.match(n);if(s&&s.length===3){const o=s[1],c=s[2],i=`search-abtest-gatime-${o}-${c}`,d=parseInt(localStorage.getItem(i)||"",10);(Number.isNaN(d)||t-d>Qn||e)&&(r.push(a),r.push(i))}}return r},[]).forEach(r=>localStorage.removeItem(r))}catch(r){Y(r)}},Gt=(e,t=Kn,r=1e3)=>{const a=new URLSearchParams(window.location.search);if(t>50)throw new Error("percent cant be larger then 50");if(a.has("seaForceAb")){const v=a.get("seaForceAb");if(v){if([...v.split(","),...v.split(",").map(h=>`${h}${es}`)].includes(e.toLowerCase()))return!0}else return!1}if(!z(2)||!D()||window.forceABVariantA===!0)return!1;const n=st(`search-abtest-${e}`);let s=parseInt(localStorage.getItem(n)||"",10);const o=Date.now(),c=st(`search-abtest-gatime-${e}`);if(Number.isNaN(s)){s=Math.floor(Math.random()*100);try{if(B.setItem(n,s.toString()),s.toString()!==B.getItem(n))return!1}catch{return B.setItem(c,o.toString()),!1}}let i;s99-t?i="B":(B.setItem(c,o.toString()),i="A");const d=parseInt(localStorage.getItem(c)||"",10);return(Number.isNaN(d)||o-d>nt)&&(window._uxa=window._uxa||[],window._uxa.push(["trackDynamicVariable",{key:`search-abtest-${e}`,value:i}]),G({event_category:"ab_test",event_action:"search",non_interaction:!0,custom:{version:`SEA-${e}-${i}`}})?B.setItem(c,o.toString()):(B.setItem(c,(o-nt).toString()),setTimeout(()=>Gt(e,t,r*2),r))),i==="B"},ct=e=>{document.activeElement instanceof HTMLElement&&document.activeElement.className.indexOf("search-field__input")!==-1&&e.target instanceof HTMLElement&&e.target.className.indexOf("search-field__input")===-1&&document.activeElement.blur()},ts=()=>(document.body.addEventListener("touchstart",ct),()=>{document.body.removeEventListener("touchstart",ct)}),rs=()=>[ts,null],ie=(e,t)=>{var r;!e||!e.parentElement||[...(r=e.parentElement)==null?void 0:r.children].forEach(a=>{a!==e&&a.toggleAttribute("inert",t)})},as={xxs:"20em",xs:"30em",s:"37.5em",m:"48em",l:"56.25em",xl:"64em",xxl:"75em",hd:"90em",headerMedium:"43.75em"},it=e=>{const t=as[e];if(!t)throw new Error(`Unknown breakpoint: ${e}`);return window.matchMedia(`(min-width: ${t})`).matches},ns=(e,t)=>{const r=document.querySelector("body"),a=document.querySelector(".hnf-header, .header"),n=document.querySelector(".hnf-header__search"),s=document.querySelector('[data-namespace="search-box"]'),o=document.querySelector("html"),c=["search-box-dropdown-open","noscroll"];return r&&r instanceof HTMLElement&&a&&a instanceof HTMLElement&&n&&n instanceof HTMLElement&&s&&s instanceof HTMLElement&&(t.modal?(r.classList.add(...c),o==null||o.classList.add(...c),a.classList.add("search-box-open"),s.classList.add("active"),it("headerMedium")||(ie(a,!0),ie(n,!0))):(r.classList.remove(...c),o==null||o.classList.remove(...c),a.classList.remove("search-box-open"),s.classList.remove("active"),it("headerMedium")||(ie(a,!1),ie(n,!1)))),()=>{}},ss=e=>[ns,{modal:e}];/*! * tabbable 5.3.3 * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE */var Vt=["input","select","textarea","a[href]","button","[tabindex]:not(slot)","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable="false"])',"details>summary:first-of-type","details"],ve=Vt.join(","),Yt=typeof Element>"u",Z=Yt?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Me=!Yt&&Element.prototype.getRootNode?function(e){return e.getRootNode()}:function(e){return e.ownerDocument},Jt=function(t,r,a){var n=Array.prototype.slice.apply(t.querySelectorAll(ve));return r&&Z.call(t,ve)&&n.unshift(t),n=n.filter(a),n},Xt=function e(t,r,a){for(var n=[],s=Array.from(t);s.length;){var o=s.shift();if(o.tagName==="SLOT"){var c=o.assignedElements(),i=c.length?c:o.children,d=e(i,!0,a);a.flatten?n.push.apply(n,d):n.push({scope:o,candidates:d})}else{var v=Z.call(o,ve);v&&a.filter(o)&&(r||!t.includes(o))&&n.push(o);var g=o.shadowRoot||typeof a.getShadowRoot=="function"&&a.getShadowRoot(o),h=!a.shadowRootFilter||a.shadowRootFilter(o);if(g&&h){var m=e(g===!0?o.children:g.children,!0,a);a.flatten?n.push.apply(n,m):n.push({scope:o,candidates:m})}else s.unshift.apply(s,o.children)}}return n},Zt=function(t,r){return t.tabIndex<0&&(r||/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||t.isContentEditable)&&isNaN(parseInt(t.getAttribute("tabindex"),10))?0:t.tabIndex},os=function(t,r){return t.tabIndex===r.tabIndex?t.documentOrder-r.documentOrder:t.tabIndex-r.tabIndex},Qt=function(t){return t.tagName==="INPUT"},cs=function(t){return Qt(t)&&t.type==="hidden"},is=function(t){var r=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(a){return a.tagName==="SUMMARY"});return r},ls=function(t,r){for(var a=0;asummary:first-of-type"),o=s?t.parentElement:t;if(Z.call(o,"details:not([open]) *"))return!0;var c=Me(t).host,i=(c==null?void 0:c.ownerDocument.contains(c))||t.ownerDocument.contains(t);if(!a||a==="full"){if(typeof n=="function"){for(var d=t;t;){var v=t.parentElement,g=Me(t);if(v&&!v.shadowRoot&&n(v)===!0)return lt(t);t.assignedSlot?t=t.assignedSlot:!v&&g!==t.ownerDocument?t=g.host:t=v}t=d}if(i)return!t.getClientRects().length}else if(a==="non-zero-area")return lt(t);return!1},ms=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var r=t.parentElement;r;){if(r.tagName==="FIELDSET"&&r.disabled){for(var a=0;a=0)},ps=function e(t){var r=[],a=[];return t.forEach(function(n,s){var o=!!n.scope,c=o?n.scope:n,i=Zt(c,o),d=o?e(n.candidates):c;i===0?o?r.push.apply(r,d):r.push(c):a.push({documentOrder:s,tabIndex:i,item:n,isScope:o,content:d})}),a.sort(os).reduce(function(n,s){return s.isScope?n.push.apply(n,s.content):n.push(s.content),n},[]).concat(r)},bs=function(t,r){r=r||{};var a;return r.getShadowRoot?a=Xt([t],r.includeContainer,{filter:$e.bind(null,r),flatten:!1,getShadowRoot:r.getShadowRoot,shadowRootFilter:vs}):a=Jt(t,r.includeContainer,$e.bind(null,r)),ps(a)},gs=function(t,r){r=r||{};var a;return r.getShadowRoot?a=Xt([t],r.includeContainer,{filter:pe.bind(null,r),flatten:!0,getShadowRoot:r.getShadowRoot}):a=Jt(t,r.includeContainer,pe.bind(null,r)),a},le=function(t,r){if(r=r||{},!t)throw new Error("No node provided");return Z.call(t,ve)===!1?!1:$e(r,t)},ws=Vt.concat("iframe").join(","),Le=function(t,r){if(r=r||{},!t)throw new Error("No node provided");return Z.call(t,ws)===!1?!1:pe(r,t)};/*! * focus-trap 6.9.4 * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE */function ut(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,a)}return r}function dt(e){for(var t=1;t0){var a=e[e.length-1];a!==r&&a.pause()}var n=e.indexOf(r);n===-1||e.splice(n,1),e.push(r)},deactivateTrap:function(r){var a=e.indexOf(r);a!==-1&&e.splice(a,1),e.length>0&&e[e.length-1].unpause()}}}(),_s=function(t){return t.tagName&&t.tagName.toLowerCase()==="input"&&typeof t.select=="function"},Ss=function(t){return t.key==="Escape"||t.key==="Esc"||t.keyCode===27},Es=function(t){return t.key==="Tab"||t.keyCode===9},ft=function(t){return setTimeout(t,0)},mt=function(t,r){var a=-1;return t.every(function(n,s){return r(n)?(a=s,!1):!0}),a},ae=function(t){for(var r=arguments.length,a=new Array(r>1?r-1:0),n=1;n1?p-1:0),S=1;S=0)l=a.activeElement;else{var u=s.tabbableGroups[0],p=u&&u.firstTabbableNode;l=p||d("fallbackFocus")}if(!l)throw new Error("Your focus-trap needs to have at least one focusable element");return l},g=function(){if(s.containerGroups=s.containers.map(function(l){var u=bs(l,n.tabbableOptions),p=gs(l,n.tabbableOptions);return{container:l,tabbableNodes:u,focusableNodes:p,firstTabbableNode:u.length>0?u[0]:null,lastTabbableNode:u.length>0?u[u.length-1]:null,nextTabbableNode:function(S){var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,N=p.findIndex(function(j){return j===S});if(!(N<0))return R?p.slice(N+1).find(function(j){return le(j,n.tabbableOptions)}):p.slice(0,N).reverse().find(function(j){return le(j,n.tabbableOptions)})}}}),s.tabbableGroups=s.containerGroups.filter(function(l){return l.tabbableNodes.length>0}),s.tabbableGroups.length<=0&&!d("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times")},h=function E(l){if(l!==!1&&l!==a.activeElement){if(!l||!l.focus){E(v());return}l.focus({preventScroll:!!n.preventScroll}),s.mostRecentlyFocusedNode=l,_s(l)&&l.select()}},m=function(l){var u=d("setReturnFocus",l);return u||(u===!1?!1:l)},f=function(l){var u=ue(l);if(!(i(u)>=0)){if(ae(n.clickOutsideDeactivates,l)){o.deactivate({returnFocus:n.returnFocusOnDeactivate&&!Le(u,n.tabbableOptions)});return}ae(n.allowOutsideClick,l)||l.preventDefault()}},y=function(l){var u=ue(l),p=i(u)>=0;p||u instanceof Document?p&&(s.mostRecentlyFocusedNode=u):(l.stopImmediatePropagation(),h(s.mostRecentlyFocusedNode||v()))},L=function(l){var u=ue(l);g();var p=null;if(s.tabbableGroups.length>0){var x=i(u),S=x>=0?s.containerGroups[x]:void 0;if(x<0)l.shiftKey?p=s.tabbableGroups[s.tabbableGroups.length-1].lastTabbableNode:p=s.tabbableGroups[0].firstTabbableNode;else if(l.shiftKey){var R=mt(s.tabbableGroups,function(Fe){var Ie=Fe.firstTabbableNode;return u===Ie});if(R<0&&(S.container===u||Le(u,n.tabbableOptions)&&!le(u,n.tabbableOptions)&&!S.nextTabbableNode(u,!1))&&(R=x),R>=0){var N=R===0?s.tabbableGroups.length-1:R-1,j=s.tabbableGroups[N];p=j.lastTabbableNode}}else{var K=mt(s.tabbableGroups,function(Fe){var Ie=Fe.lastTabbableNode;return u===Ie});if(K<0&&(S.container===u||Le(u,n.tabbableOptions)&&!le(u,n.tabbableOptions)&&!S.nextTabbableNode(u))&&(K=x),K>=0){var er=K===s.tabbableGroups.length-1?0:K+1,tr=s.tabbableGroups[er];p=tr.firstTabbableNode}}}else p=d("fallbackFocus");p&&(l.preventDefault(),h(p))},A=function(l){if(Ss(l)&&ae(n.escapeDeactivates,l)!==!1){l.preventDefault(),o.deactivate();return}if(Es(l)){L(l);return}},_=function(l){var u=ue(l);i(u)>=0||ae(n.clickOutsideDeactivates,l)||ae(n.allowOutsideClick,l)||(l.preventDefault(),l.stopImmediatePropagation())},M=function(){if(s.active)return ht.activateTrap(o),s.delayInitialFocusTimer=n.delayInitialFocus?ft(function(){h(v())}):h(v()),a.addEventListener("focusin",y,!0),a.addEventListener("mousedown",f,{capture:!0,passive:!1}),a.addEventListener("touchstart",f,{capture:!0,passive:!1}),a.addEventListener("click",_,{capture:!0,passive:!1}),a.addEventListener("keydown",A,{capture:!0,passive:!1}),o},$=function(){if(s.active)return a.removeEventListener("focusin",y,!0),a.removeEventListener("mousedown",f,!0),a.removeEventListener("touchstart",f,!0),a.removeEventListener("click",_,!0),a.removeEventListener("keydown",A,!0),o};return o={get active(){return s.active},get paused(){return s.paused},activate:function(l){if(s.active)return this;var u=c(l,"onActivate"),p=c(l,"onPostActivate"),x=c(l,"checkCanFocusTrap");x||g(),s.active=!0,s.paused=!1,s.nodeFocusedBeforeActivation=a.activeElement,u&&u();var S=function(){x&&g(),M(),p&&p()};return x?(x(s.containers.concat()).then(S,S),this):(S(),this)},deactivate:function(l){if(!s.active)return this;var u=dt({onDeactivate:n.onDeactivate,onPostDeactivate:n.onPostDeactivate,checkCanReturnFocus:n.checkCanReturnFocus},l);clearTimeout(s.delayInitialFocusTimer),s.delayInitialFocusTimer=void 0,$(),s.active=!1,s.paused=!1,ht.deactivateTrap(o);var p=c(u,"onDeactivate"),x=c(u,"onPostDeactivate"),S=c(u,"checkCanReturnFocus"),R=c(u,"returnFocus","returnFocusOnDeactivate");p&&p();var N=function(){ft(function(){R&&h(m(s.nodeFocusedBeforeActivation)),x&&x()})};return R&&S?(S(m(s.nodeFocusedBeforeActivation)).then(N,N),this):(N(),this)},pause:function(){return s.paused||!s.active?this:(s.paused=!0,$(),this)},unpause:function(){return!s.paused||!s.active?this:(s.paused=!1,g(),M(),this)},updateContainerElements:function(l){var u=[].concat(l).filter(Boolean);return s.containers=u.map(function(p){return typeof p=="string"?a.querySelector(p):p}),s.active&&g(),this}},o.updateContainerElements(t),o};const ks=e=>{let t=null;const r=a=>{a.key==="Escape"&&e(_e)};return document.addEventListener("keydown",r),Promise.resolve().then(()=>requestAnimationFrame(()=>{const a=document.querySelector('[data-namespace="search-box"] .modal__container');a&&(t=xs(a,{clickOutsideDeactivates:!0,escapeDeactivates:!0}),t.activate())})),()=>{t&&t.deactivate(),document.removeEventListener("keydown",r)}},Fs=()=>[ks,{}],Re={},Is=e=>{let t=!0;return(r,a)=>{if(t){let n=localStorage.getItem(e);n&&requestAnimationFrame(()=>{r(s=>({...s,...JSON.parse(n)}))}),t=!1}else localStorage.setItem(e,JSON.stringify(a));return()=>{}}},Ts=(e,t,r)=>{if(!z(2)||!D())return!1;const a=Object.fromEntries(r.map(n=>[n,t[n]]));return e in Re||(Re[e]=Is(e)),[Re[e],a]},Ls=[{x:0,y:-1,key:"ArrowUp"},{x:0,y:1,key:"ArrowDown"},{x:-1,y:0,key:"ArrowLeft"},{x:1,y:0,key:"ArrowRight"}];let vt=!1,pt=!1;const Rs=(e,t,r)=>{const a={x:0,y:-1};let n=[];const s=()=>{a.x=0,a.y=-1},o=c=>{if(n=[],Array.prototype.forEach.call(t.querySelectorAll(r),(i,d)=>{n[d]||(n[d]=[]),n[d].push(...Array.from(i.querySelectorAll("a:not(.search-results__clear)")))}),n.forEach(i=>i.forEach(d=>d.classList.remove("active"))),(c.key==="ArrowUp"||c.key==="ArrowDown")&&c.preventDefault(),c.key==="ArrowUp"||c.key==="ArrowDown"||c.key==="ArrowLeft"||c.key==="ArrowRight"){const i=Ls.find(d=>d.key===c.key);if(i){const d={x:a.x+i.x,y:a.y+i.y};if(d.x===0&&d.y===-1){a.x=d.x,a.y=d.y;return}if(n[d.x]&&(document.activeElement!==e&&(a.x=d.x),i.y!==0&&(d.y>=n[a.x].length||d.y===-1)?(a.x+i.y>n.length-1?a.x=0:a.x+=i.y,i.y===1?a.y=0:a.y=n[a.x].length-1):d.y>=n[a.x].length?a.y=n[a.x].length-1:d.y>=0&&(i.x!==0&&a.x===2?a.y=0:a.y=d.y)),a.x>=0&&a.y>=0){const v=n[a.x][a.y],g=document.createEvent("HTMLEvents");g.initEvent("select",!1,!0),v.dispatchEvent(g),v.classList.add("active")}}}a.x>=0&&a.y>=0&&c.key==="Enter"&&(c.preventDefault(),n[a.x][a.y].click()),a.y===0&&!vt&&(G({event_category:"search_box_actions",event_action:"keyboard_nav_vertical_shift"}),vt=!0),a.x>0&&G({event_category:"search_box_actions",event_action:"keyboard_nav_column_shift"}),c.key==="Enter"&&a.y>-1&&!pt&&(G({event_category:"search_box_actions",event_action:"keyboard_nav_enter_press"}),pt=!0)};return e.addEventListener("input",s),document.addEventListener("keydown",o),{deactivate(){e.removeEventListener("input",s),document.removeEventListener("keydown",o)}}},As=e=>{const t=a=>{var y,L,A,_,M,$;const n=a.key==="Escape",s=a.key==="Tab",o=a.shiftKey,c=(y=document.activeElement)==null?void 0:y.id.includes("search-box__closebutton"),i=(L=document.activeElement)==null?void 0:L.id.includes("clear-input"),d=(A=document.activeElement)==null?void 0:A.id.includes("search-box__searchbutton"),v=(_=document.activeElement)==null?void 0:_.id.includes("search-box__visualsearch"),g=(M=document.activeElement)==null?void 0:M.className.includes("search-field__input"),h=($=document.activeElement)==null?void 0:$.className.includes("widget__cancel-button"),m=document.getElementsByClassName("visual-search__widget")[0];(n||s&&!o&&d||s&&!o&&v&&!m||s&&!o&&h&&m||s&&!o&&!g&&!v&&!m&&!i||s&&o&&c||s&&o&&g)&&e(ye,!1)};document.addEventListener("keydown",t,!0);let r=null;return Promise.resolve().then(()=>{requestAnimationFrame(()=>{const a=document.querySelector('[data-namespace="search-box"] .search-box .dropdown'),n=document.querySelector('[data-namespace="search-box"] .search-field__input');!a||!n||(r=Rs(n,a,".search-results__container > .search-results__list"))})}),()=>{r&&r.deactivate(),document.removeEventListener("keydown",t,!0)}},Cs=()=>[As,{}],Ds=(e,t)=>{const r=()=>{e(t.action)};return window.addEventListener("resize",r),()=>{window.removeEventListener("resize",r)}},Ps=vr(50),Os=()=>[Ds,{action:Ps(Ja)}],Kt=new IntersectionObserver(e=>{for(const t of e){const r=t.boundingClientRect;document.documentElement.style.setProperty("--box-bottom",r.bottom+"px")}Kt.disconnect()}),Ms=()=>{const e=document.querySelector(".search-box");return e&&Kt.observe(e),()=>{}},$s=()=>[Ms,null],Ns=e=>[jr({watch:e.searchPhrase,name:"searchphrasechanged",getDetail:t=>({searchPhrase:t})}),ss(e.isModalVisible||e.isDropdownVisible),Ts("search-box",e,["visualSearchWidget"]),Hr("searchstatechanged",(t,r)=>[Ce,r.query.q]),e.isDropdownVisible&&rs(),e.isDropdownVisible&&Cs(),e.isDropdownVisible&&$s(),(e.isModalVisible||e.animateModal)&&Fs(),Os()],Bs=async e=>{var t;try{new URLSearchParams(window.location.search).has("seaRtl")&&((t=document.querySelector("html"))==null||t.setAttribute("dir","rtl"));const r=document.querySelector('[data-namespace="search-box"] [data-id="box-mount"]')?document.querySelector('[data-namespace="search-box"] [data-id="box-mount"]'):document.querySelector('[data-namespace="search-box"] input'),a=document.querySelector('[data-namespace="search-box"] input');if(r){await _r();const n=e({init:{...ur,searchPhrase:(a==null?void 0:a.value)??""},view:Zn,node:r,subscriptions:Ns});a!=null&&a.value&&n(Ce,decodeURIComponent((a==null?void 0:a.value)??"")),document.activeElement===a&&n(Rt,decodeURIComponent((a==null?void 0:a.value)??"")),requestAnimationFrame(()=>{const c=new URLSearchParams(window.location.search).get("q");c&&Tt()&&n(Ce,c);const i=document.getElementById("ikea-search-input");i&&i.setAttribute("autocorrect","off")}),[].forEach(c=>Gt(c)),document.addEventListener("ikeaCookieConsent",()=>{if(!window.ikea.cookieConsent.hasConsent(2)){const c=k.replace("/","");ot(!0),xr(c)}});const o=new URLSearchParams(window.location.search);Et()&&(o.has("seaForceAb")&&window.sessionStorage.setItem("seaForceAb",`&seaForceAb=${o.get("seaForceAb")}`),o.has("sikForceAb")&&window.sessionStorage.setItem("sikForceAb",`&sikForceAb=${o.get("sikForceAb")}`)),xt(),ot()}}catch(r){Y(r,{functionName:"index.js"})}};Bs(rn);