@abtasty/search 0.0.2-1 → 0.0.2-11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.js CHANGED
@@ -1 +1 @@
1
- !function(){"use strict";const e=()=>Object.prototype.hasOwnProperty.call(top,"ABTastyEditor"),t=e=>(e=>{if("string"!=typeof e||!e.trim().length)return null;const[t,a,s]=e.split("[]").map(e=>e.trim()),r=Boolean(s)?s:e,i=a?document.querySelector(t)?.[a]:document;return i?i.querySelector(r):null})(e),a=(e,a)=>{const s=document.querySelector("body")||document.documentElement,r={childList:!0,subtree:!0,attributes:!0},i=()=>n.disconnect(),n=new MutationObserver(()=>{const s=t(a);return s&&!i()&&e(s)});return{clear:i,observe:(e=s)=>n.observe(e,r)}},s=()=>{},r=(i,n)=>{const c=t(i),o={selector:i,clear:s,observe:s};if(c)return setTimeout(()=>n(c),0),o;if(e())return setTimeout(()=>r(i,n),1e3),o;if(i.includes("[]"))return((e,s)=>{const[r,i]=s.split("[]").map(e=>e.trim()),n=t(r),c=n?.[i],{clear:o,observe:h}=a(e,s),l=()=>{const a=t(s);return a&&!d()&&e(a)},d=()=>{o(),n?.removeEventListener("load",l)},g=()=>{h(c),"iframe"===n?.localName&&n.addEventListener("load",l)};return g(),{selector:s,clear:d,observe:g}})(n,i);const{clear:h,observe:l}=a(n,i);return l(),{selector:i,clear:h,observe:l}},i=["hasbro","lego","mattel"],n=e=>({"Content-Type":"application/json",Authorization:`Bearer ${e}`}),c=(e,t)=>{const a=e.toLowerCase(),s=t.toLowerCase();return i.some(e=>a.includes(e))&&!i.some(e=>s.includes(e))?-1:i.some(e=>s.includes(e))&&!i.some(e=>a.includes(e))?1:0};(()=>{const t=(()=>{if(e()||(()=>{const e=!!document.getElementById("ABTastyPreviewBar"),t=location.href.includes("ab_project=preview");return e||t})())return!1;const t=ABTasty.getTestsOnPage()[TEST_ID];return!!t&&Object.keys(t.targetings.qaParameters).length>0})(),a=window.document.cookie.includes("abTastyDebug=")||!0===window.abTastyDebug;if(t||a){const e=(()=>{const e=(()=>{const{type:e}=DATA;return`${PACKAGE.replace("@abtasty/","")}${e?`_${e}`:""}`})();return`${e.charAt(0).toUpperCase()}${e.slice(1)}`.split("-").join(" ")})();window.console.log(`%c${e} - ${t?"QA":"Debug"} Mode for campaign ${TEST_ID} %c Widget launch`,"background-color: #D6FF01; color: #3100be; padding: 3px 0 3px 10px; border-radius: 5px 0 0 5px; font-weight: bold;","background-color: #3100be; color: white; padding: 3px 10px 3px 0; border-radius: 0 5px 5px 0;")}})();const o=new class{constructor(){this.baseClassName="abtasty-search-widget",this.search="",this.target=null}async init(){const{elementReferrer:e}=DATA;return new Promise(t=>{r(e,e=>{const a=e.getRootNode();this.rootElement=a,this.target=e,this.target.onclick=e=>{e.preventDefault(),e.stopPropagation(),this.onSearchOpen()},t()})})}insertIn(e,t){return e.insertAdjacentElement(t,this.container),this}removeChildren(e){for(;e.firstChild;)e.removeChild(e.lastChild)}remove(){const e=this.rootElement.querySelector("body");this.removeChildren(this.container),e.removeChild(this.container)}onSearchOpen(){const e=this.rootElement.querySelector("body");this.container=this.getSearchContainerElement(),this.searchBarContainer=this.getSearchBarContainerElement(),this.searchResultsContainer=this.getSearchResultsContainerElement(),this.container.append(this.searchBarContainer,this.searchResultsContainer),this.insertIn(e,"afterbegin"),this.searchInput.focus()}onSearchClose(){this.remove(),document.body.style.overflow="initial"}onInput=e=>{this.search=e.target.value,this.debouncedQuerySuggest()};debouncedQuerySuggest=(()=>(e=>{let t=null;return function(){for(var a=arguments.length,s=new Array(a),r=0;r<a;r++)s[r]=arguments[r];window.clearTimeout(t),t=window.setTimeout(()=>{e(...s)},500)}})(this.onQuerySuggest.bind(this)))();async onSearch(){const{siteId:e,apiKey:t}=DATA;t&&e&&this.search?fetch("https://sellingassistant.netlify.app/.netlify/functions/search",{method:"POST",headers:n(t),body:JSON.stringify({siteId:e,search:this.search,maxPerPage:50})}).then(e=>e.json()).then(e=>this.setSearchResults(e.hits.sort((e,t)=>c(e.name,t.name)).filter(e=>e.link&&e.img_link&&e.price))).catch(e=>{window.console.error(e)}):this.container.classList.remove("search-completed")}async onQuerySuggest(){const{siteId:e,apiKey:t}=DATA;t&&e&&this.search.length>1?fetch("https://sellingassistant.netlify.app/.netlify/functions/querySuggest",{method:"POST",headers:n(t),body:JSON.stringify({siteId:e,search:this.search,suggestLimit:"20"})}).then(e=>e.json()).then(e=>this.setSuggestions(e.querySuggest.map(e=>e.pleinText).sort((e,t)=>c(e,t)).slice(0,4))).catch(e=>{window.console.error(e)}):(this.removeChildren(this.searchResultsContainer),this.container.classList.remove("search-completed"),this.setSuggestions([]))}setSuggestions(e){if(this.removeChildren(this.searchSuggestionsContainer),e.length){const t=this.getSuggestionsElements(e);this.searchBarContainer.style.minHeight="auto",this.searchSuggestionsContainer.append(...t),this.searchSuggestionsContainer.classList.add("visible")}else this.searchBarContainer.style.minHeight=this.getSearchBarContainerHeight(),this.searchSuggestionsContainer.classList.remove("visible")}setSearchResults(e){if(this.container.classList.add("search-completed"),this.removeChildren(this.searchResultsContainer),e.length)for(const[t,a]of e.entries()){const e=document.createElement("a");e.href=a.link,e.target="_blank",e.rel="noreferrer",e.innerHTML=`\n\t\t\t\t\t<div class="${this.baseClassName}-search-result result-${t}">\n\t\t\t\t\t\t<img src="${a.img_link}" />\n\t\t\t\t\t\t<div class="${this.baseClassName}-search-result-name">${a.name}</div>\n\t\t\t\t\t\t<div class="${this.baseClassName}-search-result-price">${a.price}€</div>\n\t\t\t\t\t</div\n\t\t\t\t\t`,this.searchResultsContainer.appendChild(e)}else{const e=document.createElement("div");e.className=`${this.baseClassName}-search-no-result`,e.innerHTML="No results found",this.searchResultsContainer.appendChild(e)}this.searchResultsContainer.classList.add("visible")}getSearchBarContainerHeight(){const e=this.target.closest("header");return e?e.getBoundingClientRect().height+"px":"auto"}getSearchContainerElement(){const e=document.createElement("div");return e.className=`${this.baseClassName}-container`,document.head.insertAdjacentElement("afterbegin",(e=>{const t=document.createElement("style");return t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e)),t})(".abtasty-search-widget-container{-webkit-box-orient:vertical;-webkit-box-direction:normal;background-color:hsla(0,0%,100%,.5);bottom:0;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;font-family:Lato,sans-serif;height:100vh;left:0;position:fixed;right:0;top:0;width:100vw;z-index:9999}.abtasty-search-widget-container i{display:inline-block;-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:contain;mask-size:contain}.abtasty-search-widget-container.search-completed{background-color:#fff;height:auto}.abtasty-search-widget-container .abtasty-search-widget-search-bar-container{-webkit-box-orient:vertical;-webkit-box-direction:normal;background-color:#0c4884;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;padding:22.5px 100px}.abtasty-search-widget-container .abtasty-search-widget-search-bar-container .abtasty-search-widget-search-bar{background-color:#fff;border-radius:12px;padding:12px;width:100%}.abtasty-search-widget-container .abtasty-search-widget-search-bar-container .abtasty-search-widget-search-input-label{color:#fff;font-size:12px;font-weight:400;line-height:17px;margin-left:auto;margin-right:auto;margin-top:auto}.abtasty-search-widget-container .abtasty-search-widget-search-bar-container .abtasty-search-widget-search-bar-close-button-container{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;line-height:unset}.abtasty-search-widget-container .abtasty-search-widget-search-bar-container .abtasty-search-widget-search-bar .abtasty-search-widget-search-input{border:unset;font-size:1.6em;font-weight:700;outline:0;padding:unset;width:100%}.abtasty-search-widget-container .abtasty-search-widget-search-bar-container .abtasty-search-widget-close-icon-container{border:none;border-radius:100%;padding:8px;-webkit-transform:translateX(150%);transform:translateX(150%);vertical-align:middle}.abtasty-search-widget-container .abtasty-search-widget-search-bar-container .abtasty-search-widget-close-icon{background-color:#0c4884;height:28px;-webkit-mask-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 512' fill='rgba(0, 0, 0, 0.999)'%3E%3Cpath d='M310.6 361.4c12.5 12.5 12.5 32.75 0 45.25-6.2 6.25-14.4 9.35-22.6 9.35s-16.38-3.125-22.62-9.375L160 301.3 54.63 406.6C48.38 412.9 40.19 416 32 416s-16.37-3.1-22.625-9.4c-12.5-12.5-12.5-32.75 0-45.25l105.4-105.4L9.375 150.6c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0L160 210.8l105.4-105.4c12.5-12.5 32.75-12.5 45.25 0s12.5 32.75 0 45.25l-105.4 105.4L310.6 361.4z'/%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 512' fill='rgba(0, 0, 0, 0.999)'%3E%3Cpath d='M310.6 361.4c12.5 12.5 12.5 32.75 0 45.25-6.2 6.25-14.4 9.35-22.6 9.35s-16.38-3.125-22.62-9.375L160 301.3 54.63 406.6C48.38 412.9 40.19 416 32 416s-16.37-3.1-22.625-9.4c-12.5-12.5-12.5-32.75 0-45.25l105.4-105.4L9.375 150.6c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0L160 210.8l105.4-105.4c12.5-12.5 32.75-12.5 45.25 0s12.5 32.75 0 45.25l-105.4 105.4L310.6 361.4z'/%3E%3C/svg%3E\");vertical-align:middle;width:28px}.abtasty-search-widget-container .abtasty-search-widget-search-bar-container .abtasty-search-widget-search-suggestions-container{display:none;gap:8px;margin-top:12px;overflow-x:auto}.abtasty-search-widget-container .abtasty-search-widget-search-bar-container .abtasty-search-widget-search-suggestions-container.visible{display:-webkit-box;display:-ms-flexbox;display:flex}.abtasty-search-widget-container .abtasty-search-widget-search-bar-container .abtasty-search-widget-search-suggestions-container>.abtasty-search-widget-search-suggestion{background-color:transparent;border:none;color:#fff;font-size:15px;font-weight:700;max-width:150px;min-width:70px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.abtasty-search-widget-container .abtasty-search-widget-search-bar-container .abtasty-search-widget-search-suggestions-container>.abtasty-search-widget-search-suggestion>.abtasty-search-widget-search-icon{background-color:#fff;height:12.5px;margin-right:6px;-webkit-mask-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512' fill='rgba(74, 76, 83, 0.999)'%3E%3Cpath d='M500.3 443.7 380.6 324c27.22-40.41 40.65-90.9 33.46-144.7C401.8 87.79 326.8 13.32 235.2 1.723 99.01-15.51-15.51 99.01 1.724 235.2c11.6 91.64 86.08 166.7 177.6 178.9 53.8 7.189 104.3-6.236 144.7-33.46l119.7 119.7c15.62 15.62 40.95 15.62 56.57 0 15.606-15.64 15.606-41.04.006-56.64zM79.1 208c0-70.58 57.42-128 128-128s128 57.42 128 128-57.42 128-128 128-128-57.4-128-128z'/%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512' fill='rgba(74, 76, 83, 0.999)'%3E%3Cpath d='M500.3 443.7 380.6 324c27.22-40.41 40.65-90.9 33.46-144.7C401.8 87.79 326.8 13.32 235.2 1.723 99.01-15.51-15.51 99.01 1.724 235.2c11.6 91.64 86.08 166.7 177.6 178.9 53.8 7.189 104.3-6.236 144.7-33.46l119.7 119.7c15.62 15.62 40.95 15.62 56.57 0 15.606-15.64 15.606-41.04.006-56.64zM79.1 208c0-70.58 57.42-128 128-128s128 57.42 128 128-57.42 128-128 128-128-57.4-128-128z'/%3E%3C/svg%3E\");width:12.5px}.abtasty-search-widget-container .abtasty-search-widget-search-bar-container .abtasty-search-widget-search-suggestions-container>.abtasty-search-widget-search-suggestion:hover{opacity:.8}.abtasty-search-widget-container .abtasty-search-widget-search-results-container{-webkit-box-pack:center;-ms-flex-pack:center;-webkit-box-orient:horizontal;-webkit-box-direction:normal;display:none;-ms-flex-direction:row;flex-direction:row;-ms-flex-wrap:wrap;flex-wrap:wrap;gap:24px;justify-content:center;overflow-y:auto;padding:32px}.abtasty-search-widget-container .abtasty-search-widget-search-results-container.visible{display:grid;grid-template-columns:1fr 1fr 1fr 1fr 1fr}.abtasty-search-widget-container .abtasty-search-widget-search-results-container .abtasty-search-widget-search-no-result{font-size:38px;font-weight:700;margin-top:82px}.abtasty-search-widget-container .abtasty-search-widget-search-results-container>a>.abtasty-search-widget-search-result{-webkit-box-orient:vertical;-webkit-box-direction:normal;border-radius:12px;-webkit-box-shadow:0 2px 8px 0 rgba(0,0,0,.11);box-shadow:0 2px 8px 0 rgba(0,0,0,.11);display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;height:400px;padding:18px;width:100%}.abtasty-search-widget-container .abtasty-search-widget-search-results-container>a>.abtasty-search-widget-search-result img{aspect-ratio:400/450;height:100%;margin-left:auto;margin-right:auto;-o-object-fit:contain;object-fit:contain;width:100%}.abtasty-search-widget-container .abtasty-search-widget-search-results-container>a>.abtasty-search-widget-search-result .abtasty-search-widget-search-result-name{color:#0d4884;display:block;font-size:1.167em;font-weight:900;height:50px;line-height:1.43;margin-top:16px;overflow:hidden;text-overflow:ellipsis;text-transform:uppercase}.abtasty-search-widget-container .abtasty-search-widget-search-results-container>a>.abtasty-search-widget-search-result .abtasty-search-widget-search-result-price{color:#404040;font-size:1.833em;font-weight:900}@media (max-width:1199.98px){.abtasty-search-widget-container .abtasty-search-widget-search-results-container.visible{grid-template-columns:1fr 1fr 1fr 1fr}}@media (max-width:991.98px){.abtasty-search-widget-container .abtasty-search-widget-search-results-container.visible{grid-template-columns:1fr 1fr 1fr}}@media (max-width:767.98px){.abtasty-search-widget-container .abtasty-search-widget-search-results-container.visible{grid-template-columns:1fr 1fr}}@media (max-width:575.98px){.abtasty-search-widget-container .abtasty-search-widget-search-bar-container{padding:22.5px}.abtasty-search-widget-container .abtasty-search-widget-search-bar-container .abtasty-search-widget-close-icon-container{-webkit-transform:translateX(15%);transform:translateX(15%)}.abtasty-search-widget-container .abtasty-search-widget-search-results-container.visible{grid-template-columns:1fr}}")),e}getSearchBarContainerElement(){const{searchLabel:e}=DATA;document.body.style.overflow="hidden";const t=document.createElement("div");t.className=`${this.baseClassName}-search-bar-container`,t.style.minHeight=this.getSearchBarContainerHeight();const a=document.createElement("label");a.className=`${this.baseClassName}-search-input-label`,a.innerHTML=e;const s=document.createElement("div");s.className=`${this.baseClassName}-search-bar-close-button-container`;const r=document.createElement("div");r.className=`${this.baseClassName}-search-bar`;const i=document.createElement("input",{autofocus:!0});i.className=`${this.baseClassName}-search-input`,i.addEventListener("input",this.onInput.bind(this),{capture:!0}),i.addEventListener("change",this.onSearch.bind(this),{capture:!0}),a.htmlFor=i,this.searchInput=i;const n=document.createElement("button");n.className=`${this.baseClassName}-close-icon-container`,n.onclick=this.onSearchClose.bind(this);const c=document.createElement("i");return c.className=`${this.baseClassName}-close-icon`,n.appendChild(c),r.appendChild(i),s.append(r,n),t.appendChild(a),t.appendChild(s),this.searchSuggestionsContainer=this.getSearchSuggestionsContainerElement(),t.appendChild(this.searchSuggestionsContainer),t}getSearchSuggestionsContainerElement(){const e=document.createElement("div");return e.className=`${this.baseClassName}-search-suggestions-container`,e}getSuggestionsElements(e){const t=[];for(const a of e){const e=document.createElement("button");e.className=`${this.baseClassName}-search-suggestion`,e.innerHTML=`\n\t\t\t\t<i class="${this.baseClassName}-search-icon"></i>${a}\n\t\t\t`,e.onclick=()=>{this.search=a,this.searchInput.value=a,this.onSearch()},t.push(e)}return t}getSearchResultsContainerElement(){const e=document.createElement("div");return e.className=`${this.baseClassName}-search-results-container`,e}}(DATA);o.init().then(()=>{})}();
1
+ !function(){"use strict";const t=()=>{let t;return window.ABTasty||window.ABTASTY_S?(window.ABTASTY_S?.USER?.accountIdentifier?.length?t=window.ABTASTY_S.USER.accountIdentifier:"function"==typeof window.ABTasty?.getAccountSettings?t=window.ABTasty.getAccountSettings().identifier:window.ABTasty?.accountSettings&&(t=window.ABTasty.accountSettings.identifier),t):t},e=()=>Object.prototype.hasOwnProperty.call(top,"ABTastyEditor"),a=t=>(t=>{if("string"!=typeof t||!t.trim().length)return null;const[e,a,s]=t.split("[]").map(t=>t.trim()),i=Boolean(s)?s:t,r=a?document.querySelector(e)?.[a]:document;return r?r.querySelector(i):null})(t),s=(t,e)=>{const s=document.querySelector("body")||document.documentElement,i={childList:!0,subtree:!0,attributes:!0},r=()=>n.disconnect(),n=new MutationObserver(()=>{const s=a(e);return s&&!r()&&t(s)});return{clear:r,observe:(t=s)=>n.observe(t,i)}},i=()=>{},r=(t,n)=>{const o=a(t),c={selector:t,clear:i,observe:i};if(o)return setTimeout(()=>n(o),0),c;if(e())return setTimeout(()=>r(t,n),1e3),c;if(t.includes("[]"))return((t,e)=>{const[i,r]=e.split("[]").map(t=>t.trim()),n=a(i),o=n?.[r],{clear:c,observe:l}=s(t,e),h=()=>{const s=a(e);return s&&!d()&&t(s)},d=()=>{c(),n?.removeEventListener("load",h)},b=()=>{l(o),"iframe"===n?.localName&&n.addEventListener("load",h)};return b(),{selector:e,clear:d,observe:b}})(n,t);const{clear:l,observe:h}=s(n,t);return h(),{selector:t,clear:l,observe:h}},n="https://ms-839f1388554f-19719.fra.meilisearch.io",o=`${n}/indexes/${DATA.meilisearchIndex||t()}/search`,c=`${n}/multi-search`,l=["hasbro","lego","mattel"],h={"Content-Type":"application/json",Authorization:"Bearer 1b3d6acfb9eac2780cd20a30ce8728a565960d213b0729b01d9b5e9fdcd3f77b"};function d(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),a.push.apply(a,s)}return a}function b(t){for(var e=1;e<arguments.length;e++){var a=null!=arguments[e]?arguments[e]:{};e%2?d(Object(a),!0).forEach(function(e){g(t,e,a[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):d(Object(a)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(a,e))})}return t}function g(t,e,a){return(e=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var a=e.call(t,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}const u=t=>{for(;t.firstChild;)t.removeChild(t.lastChild)},m=function(t,e){let a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return Object.entries(t).reduce((t,e)=>{let[s,i]=e;return t[s]&&(Array.isArray(t[s].values)?t[s]=b(b({},i),{},{values:t[s].values.map(t=>{let[e,s]=t;const r=i.values.find(t=>{let[a]=t;return a===e});return r?[e,r[1]]:[e,a?0:s]})}):t[s]=b(b({},i),{},{min:t[s].values.min,max:t[s].values.max})),t},b({},e))};class p{constructor(t){let{baseContainer:e,baseClassName:a,target:s,onInput:i,closeSearchWidget:r}=t;this.baseContainer=e,this.baseClassName=a,this.target=s,this.onInput=i,this.closeSearchWidget=r,this.inputId=`${this.baseClassName}-search-input`,this.searchBarContainer=this.getSearchBarContainer(),this.searchBarLabel=this.getSearchBarLabel(),this.searchBar=this.getSearchBar(),this.searchInput=this.getSearchInput(),this.renderSearchBar()}getSearchBarContainerHeight(){const t=this.target.closest("header");if(t){const e=t.getBoundingClientRect().height;return Math.max(e,150)+"px"}return"auto"}getCurrentSearchBarContainerHeight(){return this.searchBarContainer.getBoundingClientRect().height}resetSearchBarHeight(){this.searchBarContainer.style.minHeight=this.getSearchBarContainerHeight()}focusInput(){this.searchInput.focus()}getSearchBarContainer(){const t=document.createElement("div");return t.className=`${this.baseClassName}-search-bar-container`,t.style.minHeight=this.getSearchBarContainerHeight(),t}getSearchBarLabel(){const{searchLabel:t}=DATA,e=document.createElement("label");return e.className=`${this.baseClassName}-search-input-label`,e.innerHTML=t,e.htmlFor=this.inputId,e}getSearchBarAndCloseButtonContainer(){const t=document.createElement("div");return t.className=`${this.baseClassName}-search-bar-close-button-container`,t}getSearchBar(){const t=document.createElement("div");return t.className=`${this.baseClassName}-search-bar`,t}getSearchInput(){const t=document.createElement("input");return t.id=this.inputId,t.className=`${this.baseClassName}-search-input`,t.oninput=this.onInput,t}getSearchCloseButton(){const t=document.createElement("button");t.className=`${this.baseClassName}-close-icon-container`,t.onclick=this.closeSearchWidget;const e=document.createElement("i");return e.className=`${this.baseClassName}-close-icon`,t.appendChild(e),t}renderSearchBar(){this.searchBar.appendChild(this.searchInput);const t=this.getSearchBarAndCloseButtonContainer();t.append(this.searchBar,this.getSearchCloseButton()),this.searchBarContainer.appendChild(this.searchBarLabel),this.searchBarContainer.appendChild(t),this.baseContainer.appendChild(this.searchBarContainer)}}function f(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),a.push.apply(a,s)}return a}function y(t){for(var e=1;e<arguments.length;e++){var a=null!=arguments[e]?arguments[e]:{};e%2?f(Object(a),!0).forEach(function(e){w(t,e,a[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):f(Object(a)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(a,e))})}return t}function w(t,e,a){return(e=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var a=e.call(t,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}const v={text:"",filters:{},sort:["relevance"],page:0,totalPages:0,totalHits:0},x=function(){let t=y({},v);return y({get state(){return t},isNoFiltersAndNoSort:()=>0===Object.keys(t.filters).length&&"relevance"===t.sort[0]},{logState(t){},setText(e){t.text=e,this.logState("setText")},setPage(e){t.page=e,this.logState("setPage")},setTotalPages(e){t.totalPages=e,this.logState("setTotalPages")},setTotalHits(e){t.totalHits=e,this.logState("setTotalHits")},setSort(e){t.sort=""===e?[]:[e],this.logState("setSort")},onFilterChange(e,a,s){t.page=0,void 0!==s.checked?this.updateFilterArray(e,a,s.checked):this.updateRangeFilter(e,s.min,s.max),this.logState("onFilterChange")},updateRangeFilter(e,a,s){t.filters[e]=[{operator:">",value:a},{operator:"<",value:s}],this.logState("updateRangeFilter")},updateFilterArray(e,a,s){s?t.filters[e]=[...t.filters[e]||[],a]:(t.filters[e].length&&(t.filters[e]=t.filters[e].filter(t=>t!==a)),0===t.filters[e].length&&delete t.filters[e]),this.logState("updateFilterArray")},resetFiltersAndPagination(){this.resetFilters(),this.resetPagination(),this.logState("resetFiltersAndPagination")},resetFilters(){t.filters={},this.logState("resetFilters")},resetPagination(){t.page=0,t.totalPages=0,this.logState("resetPagination")},resetSort(){t.sort=["relevance"],this.logState("resetSort")},reset(){t=y({},v),this.logState("reset")}})}();class C{constructor(t){let{id:e,facet:a,baseClassName:s,facetsListContainer:i,onFiltersChange:r}=t;this.id=e,this.facet=a,this.baseClassName=s,this.facetsListContainer=i,this.onFiltersChange=r,this.facetContentContainers=this.createFacetContainers(),this.facetsListContainer.insertBefore(this.facetContentContainers.facetContainer,this.facetsListContainer.lastChild.previousElementSibling)}createFacetContainers(){const{facetsTranslationKeys:t}=DATA,e=t?JSON.parse(t):{},a=`${(s=this.facet.title).charAt(0).toUpperCase()}${s.slice(1)}`;var s;const i=e[a]??a,r=document.createElement("details");r.className=`${this.baseClassName}-search-facet`,r.open=!0;const n=document.createElement("summary");n.innerHTML=`\n\t\t\t<span>${i}</span>\n\t\t\t<div class="${this.baseClassName}-search-facet-arrow" />\n\t\t`;const o=document.createElement("div");return o.className=`${this.baseClassName}-search-facet-content ${this.facet.type}-facet`,r.append(n,o),{facetContainer:r,facetContent:o}}getFacetContainers(){return this.facetContentContainers}}class S extends C{constructor(t){let{id:e,facet:a,baseClassName:s,facetsListContainer:i,onFiltersChange:r}=t;super({id:e,facet:a,baseClassName:s,facetsListContainer:i,onFiltersChange:r});const{facetContent:n,facetContainer:o}=this.getFacetContainers();this.facetContent=n,this.facetContainer=o,this.facetList=this.getFacetListElement(),this.onFiltersChange=r,this.showAll=!1,this.facetContent.append(this.facetList)}createFacetContent(){const t=this.facet.values.sort((t,e)=>{let[a,s]=t,[i,r]=e;return r-s}).sort((t,e)=>{let[a,s]=t,[i,r]=e;const n=(x.state.filters[this.facet.title]||[]).includes(a),o=(x.state.filters[this.facet.title]||[]).includes(i);return n===o?r-s:o-n}),e=this.showAll?t:t.slice(0,10),a=[];for(const[t,s]of e){const e=this.getFacetListItemElement({name:t,count:s});a.push(e)}if(this.facetList.append(...a),this.facet.values.length>10){const t=document.createElement("button");t.className=`${this.baseClassName}-search-facet-show-more`,t.innerHTML="Show "+(this.showAll?"less":"more"),t.onclick=()=>{this.showAll=!this.showAll,this.updateFacetContent()},this.facetList.append(t)}}getFacetListElement(){const t=document.createElement("ul");return t.style.padding="0",t}getFacetListItemElement(t){const{name:e,count:a}=t,s=document.createElement("li");s.className=`${this.baseClassName}-search-facet-list-item`,s.id=`${this.baseClassName}-search-facet-list-item-${e.replace(" ","-").toLowerCase()}`;const i=(x.state.filters[this.facet.title]||[]).includes(e),r=document.createElement("label");r.className=`${this.baseClassName}-search-facet-checkbox-container ${i||0!==a?"":"disabled"} ${i?"checked":""}`,r.innerHTML=`${e} (${a})`;const n=document.createElement("span");n.className=`${this.baseClassName}-search-facet-checkbox-checkmark`;const o=document.createElement("input");return o.disabled=!i&&0===a,o.checked=i,o.type="checkbox",o.onclick=()=>{const t=o.checked;this.onFiltersChange({facetType:"list",facetKey:this.facet.title,facetValue:e,options:{checked:t}})},r.appendChild(o),r.appendChild(n),s.appendChild(r),s}updateFacetContent(){u(this.facetList),0!==this.facet.values.length&&this.createFacetContent()}updateFacet(t){this.facet={title:this.facet.title,type:this.facet.type,values:t.values},this.showAll=!1,this.updateFacetContent()}}class k{constructor(t){let{baseClassName:e,currentRange:a,min:s,max:i,onRangeChange:r}=t;this.baseClassName=e,this.currentRange=a||{min:s,max:i},this.min=s,this.max=i,this.onRangeChange=r}render(){const t=document.createElement("div");t.className=`${this.baseClassName}-range-slider`;const e=document.createElement("div");e.className="range-progress";const a=document.createElement("div");a.className="range-handle";const s=document.createElement("div");s.className="range-handle";const i=document.createElement("div");if(i.className=`${this.baseClassName}-range-values`,this.min===this.max)return a.style.left="0%",s.style.left="100%",e.style.left="0%",e.style.width="100%",a.style.pointerEvents="none",s.style.pointerEvents="none",i.innerHTML=`\n\t\t\t\t<span>${this.min}</span>\n\t\t\t\t<span>${this.max}</span>\n\t\t\t`,t.append(e,a,s),{rangeContainer:t,valuesContainer:i};const r=(this.currentRange.min-this.min)/(this.max-this.min)*100,n=(this.currentRange.max-this.min)/(this.max-this.min)*100;a.style.left=`${r}%`,s.style.left=`${n}%`,e.style.left=`${r}%`,e.style.width=n-r+"%",i.innerHTML=`\n\t\t\t<span>${this.currentRange.min}</span>\n\t\t\t<span>${this.currentRange.max}</span>\n\t\t`,t.append(e,a,s);let o=!1,c=null,l=0,h=0;const d=()=>{const t=parseFloat(a.style.left),e=parseFloat(s.style.left),r=(this.min+t/100*(this.max-this.min)).toFixed(2),n=(this.min+e/100*(this.max-this.min)).toFixed(2);return i.innerHTML=`\n\t\t\t\t<span>${r}</span>\n\t\t\t\t<span>${n}</span>\n\t\t\t`,{minValue:r,maxValue:n}},b=t=>{t.preventDefault(),o=!0,c=t.target,l=t.clientX,h=parseFloat(c.style.left)},g=i=>{if(!o)return;i.preventDefault();const r=i.clientX-l,n=t.offsetWidth;let b=h+r/n*100;b=c===a?Math.max(0,Math.min(b,parseFloat(s.style.left))):Math.max(parseFloat(a.style.left),Math.min(b,100)),b=.8*Math.round(b/.8),c.style.left=`${b}%`,(()=>{const t=parseFloat(a.style.left),i=parseFloat(s.style.left);e.style.left=`${t}%`,e.style.width=i-t+"%"})(),d()},u=()=>{if(!o)return;o=!1,c=null;const{minValue:t,maxValue:e}=d();this.currentRange={min:t,max:e},this.onRangeChange(this.currentRange)};return[a,s].forEach(t=>{t.addEventListener("mousedown",b),document.addEventListener("mousemove",g),document.addEventListener("mouseup",u)}),{rangeContainer:t,valuesContainer:i}}}class F extends C{constructor(t){let{id:e,facet:a,baseClassName:s,facetsListContainer:i,onFiltersChange:r}=t;super({id:e,facet:a,baseClassName:s,facetsListContainer:i,onFiltersChange:r});const{facetContent:n,facetContainer:o}=this.getFacetContainers();this.facetContent=n,this.facetContainer=o,this.onFiltersChange=r,this.filterRange=new k({baseClassName:this.baseClassName,currentRange:{min:this.facet.values.min,max:this.facet.values.max},min:this.facet.values.min,max:this.facet.values.max,onRangeChange:t=>{this.onFiltersChange({facetType:"range",facetKey:this.facet.title,options:t})}})}createFacetContent(){const{rangeContainer:t,valuesContainer:e}=this.filterRange.render();this.facetContent.append(t,e)}updateFacetContent(){u(this.facetContent),void 0!==this.facet.values.min&&void 0!==this.facet.values.max&&(this.filterRange=new k({baseClassName:this.baseClassName,currentRange:{min:this.facet.values.min,max:this.facet.values.max},min:this.facet.values.min,max:this.facet.values.max,onRangeChange:t=>{this.onFiltersChange({facetType:"range",facetKey:this.facet.title,options:t})}}),this.createFacetContent())}updateFacet(t){this.facet={title:this.facet.title,type:this.facet.type,values:t.values},this.updateFacetContent()}}class N{constructor(t){let{baseClassName:e,sortOptions:a,onSortChange:s}=t;this.baseClassName=e,this.onSortChange=s,this.sortOptions=a,this.element=this.getSortFacetElement()}getSortOptionsElements(){const t=document.createElement("div");t.className=`${this.baseClassName}-search-sort-options`;for(const e of this.sortOptions){const a=document.createElement("button");a.classList.add(`${this.baseClassName}-search-sort-option`),(""===e.value&&0===x.state.sort.length||x.state.sort.includes(e.value))&&(a.classList.add("active"),a.disabled=!0),a.innerHTML=e.label,a.dataset.value=e.value,a.onclick=()=>this.onSortChange(e.value),t.appendChild(a)}return t}getSortFacetElement(){const t=document.createElement("div");t.className=`${this.baseClassName}-search-sort-facet`;const e=document.createElement("label");return e.className=`${this.baseClassName}-search-sort-label`,e.textContent="Sort by:",t.appendChild(e),t.appendChild(this.getSortOptionsElements()),t}update(t){this.element.querySelectorAll(".active").forEach(t=>{t.classList.remove("active"),t.disabled=!1});const e=this.element.querySelector(`[data-value="${t[0]||"relevance"}"]`);e&&(e.classList.add("active"),e.disabled=!0)}}class E{constructor(t){let{baseClassName:e,baseContainer:a,searchBar:s,onFiltersChange:i,onFiltersReset:r,onSortChange:n,sortOptions:o}=t;this.baseClassName=e,this.baseContainer=a,this.searchBar=s,this.onFiltersChange=i,this.onFiltersReset=r,this.onSortChange=n,this.sortOptions=o,this.facets=[],this.facetsListContainer=this.getFacetsListContainer()}setMaxHeight(t){this.facetsListContainer.style.maxHeight=t}getFacetsListContainer(){const t=document.createElement("div");t.className=`${this.baseClassName}-search-facets-list`;const e=document.createElement("button");e.className=`${this.baseClassName}-search-facets-list-close-button`,e.onclick=this.closeFilters.bind(this);const a=document.createElement("i");a.className=`${this.baseClassName}-close-icon`,e.appendChild(a),this.sortFacet=new N({baseClassName:this.baseClassName,sortOptions:this.sortOptions,onSortChange:this.onSortChange});const s=document.createElement("button");s.className=`${this.baseClassName}-search-facets-list-reset-button`,s.innerHTML="Reset",s.onclick=this.onFiltersReset.bind(this);const i=document.createElement("button");return i.className=`${this.baseClassName}-search-facets-list-bottom-close-button`,i.innerHTML="Close",i.onclick=this.closeFilters.bind(this),t.append(e,this.sortFacet.element,s,i),t}renderFacets(t){[...this.facetsListContainer.children].forEach(t=>{t.tagName.toLowerCase()==="details".toLowerCase()&&t.parentNode.removeChild(t)}),this.facets=[];for(const[e,a]of Object.entries(t)){if(0===a.values.length||1===a.values.length)continue;const t={id:e,facet:{title:e,values:a.values,type:a.type},baseClassName:this.baseClassName,facetsListContainer:this.facetsListContainer,onFiltersChange:this.onFiltersChange},s=new("range"===a.type?F:S)(t);this.facets.push(s)}this.facets.forEach(t=>{t.createFacetContent()}),this.baseContainer.appendChild(this.facetsListContainer)}updateRangeFacets(t){this.facets.filter(t=>t instanceof F).forEach(e=>{e.updateFacet(t[e.id])})}updateListFacets(t){this.facets.filter(t=>t instanceof S).forEach(e=>{e.updateFacet(t[e.id])})}updateFacets(t){this.updateRangeFacets(t),this.updateListFacets(t)}openFilters(){const t=this.baseContainer.parentElement,e=document.createElement("div");e.className=`${this.baseClassName}-search-facets-list-overlay`,e.onclick=this.closeFilters.bind(this),t.insertAdjacentElement("afterbegin",e),this.facetsListContainer.classList.add("open")}closeFilters(){this.facetsListContainer.classList.remove("open");const t=this.baseContainer.parentElement.firstChild;this.baseContainer.parentElement.removeChild(t)}}class A{constructor(t){let{result:e,index:a,baseClassName:s}=t;this.result=e,this.index=a,this.baseClassName=s}getSearchResultElement(){const t=document.createElement("a");return t.className=`${this.baseClassName}-search-result-container`,t.href=this.result.link,t.target="_blank",t.rel="noreferrer",t.innerHTML=`\n <div class="${this.baseClassName}-search-result result-${this.index}">\n <img loading="lazy" src="${this.result.img_link}" />\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<div class="${this.baseClassName}-search-result-name">${this.result.name}</div>\n\t\t\t\t\t\t<div class="${this.baseClassName}-search-result-price">${this.result.price}€</div>\n\t\t\t\t\t</div>\n </div\n\t\t`,t}}class T{constructor(t){let{baseClassName:e,sortOptions:a,infos:s,onSortChange:i,openFilters:r}=t;this.baseClassName=e,this.onSortChange=i,this.sortOptions=a,this.infos=s,this.openFilters=r,this.infosElement=this.getInfosElement(),this.sortLabelElement=this.getSortLabelElement(),this.sortSelectElement=this.getSortSelectElement(),this.sortAndFiltersButtonElement=this.getSortAndFiltersButtonElement(),this.infosAndSortContainer=this.getInfoAndSortContainerElement(),this.infosAndSortContainer.appendChild(this.infosElement),this.infosAndSortContainer.appendChild(this.sortAndFiltersButtonElement),this.setSortOptions()}getInfoAndSortContainerElement(){const t=document.createElement("div");return t.className=`${this.baseClassName}-search-info-and-sort`,t}getInfosElement(){const t=document.createElement("div");return t.className=`${this.baseClassName}-search-infos`,t.style.whiteSpace="nowrap",t.innerHTML=`\n\t\t\t<span><strong>${this.infos.totalHits}</strong> items</span>\n\t\t`,t}getSortLabelElement(){const t=document.createElement("label");return t.className=`${this.baseClassName}-search-sort-label`,t.textContent="Sort by:",t.htmlFor=`${this.baseClassName}-search-sort-select`,t}getSortSelectElement(){const t=document.createElement("select");return t.className=`${this.baseClassName}-search-sort-select`,t.id=`${this.baseClassName}-search-sort-select`,t.name=`${this.baseClassName}-search-sort-select`,t.onchange=this.handleSortChange.bind(this),t}getSortElement(){const t=document.createElement("div");return t.className=`${this.baseClassName}-search-sort`,t.appendChild(this.sortLabelElement),t.appendChild(this.sortSelectElement),t}getFiltersButtonElement(){const t=document.createElement("button");return t.className=`${this.baseClassName}-search-filters-button`,t.innerHTML="Filters",t.onclick=this.openFilters.bind(this),t}getSortAndFiltersButtonElement(){const t=document.createElement("div");t.className=`${this.baseClassName}-search-sort-and-filters-button-container`;const e=this.getSortElement(),a=this.getFiltersButtonElement();return t.appendChild(e),t.appendChild(a),t}setSortOptions(){this.sortSelectElement.childElementCount&&removeChildren(this.sortSelectElement);for(const t of this.sortOptions){const e=document.createElement("option");e.value=t.value,e.textContent=t.label,this.sortSelectElement.appendChild(e)}}handleSortChange(t){const e=t.target.value;this.onSortChange(e)}updateInfos(t){this.infos=t,this.infosElement.innerHTML=`\n\t\t\t<span><strong>${this.infos.totalHits}</strong> items</span>\n\t\t`}updateSort(t){this.sortSelectElement.value=t[0]||"relevance"}updateSortOptions(t){this.sortOptions=t,this.setSortOptions()}}class R{hasTriggeredSeeMore=!1;constructor(t){let{baseContainer:e,baseClassName:a,searchBar:s,onFiltersChange:i,onSortChange:r,onSeeMore:n,onFiltersReset:o}=t;this.baseContainer=e,this.baseClassName=a,this.searchBar=s,this.onFiltersChange=i,this.onSortChange=r,this.onSeeMore=n,this.onFiltersReset=o,this.sortOptions=[{value:"relevance",label:"Relevance"},{value:"price:asc",label:"↑ Price"},{value:"price:desc",label:"↓ Price"}],this.searchResultContainer=this.getSearchResultContainerElement(),this.searchResultListContainer=this.getSearchResultListContainerElement(),this.searchResultList=this.getSearchResultListElement(),this.facetsList=new E({searchBar:this.searchBar,baseContainer:this.searchResultContainer,baseClassName:this.baseClassName,onFiltersChange:this.onFiltersChange,onFiltersReset:this.onFiltersReset,onSortChange:this.onSortChange,sortOptions:this.sortOptions}),this.infoAndSort=new T({baseClassName:this.baseClassName,infos:{totalHits:x.state.totalHits},sortOptions:this.sortOptions,onSortChange:this.onSortChange,openFilters:this.openFilters.bind(this)}),new MutationObserver(this.mutationCallback.bind(this)).observe(this.searchResultContainer,{childList:!0})}mutationCallback(t){for(const e of t)if("childList"===e.type)if(!e.target.childNodes.length||"0px"!==this.searchResultContainer.style.maxHeight&&""!==this.searchResultContainer.style.maxHeight)0===e.target.childNodes.length&&(this.searchResultListContainer.style.maxHeight="0px",this.facetsList.setMaxHeight("0px"));else{const t=`calc(100vh - ${this.searchBar.getCurrentSearchBarContainerHeight()||0}px)`;this.searchResultListContainer.style.maxHeight=t,this.facetsList.setMaxHeight(t)}}scrollToTop(){this.searchResultList.scrollTop=0}openFilters(){this.facetsList.openFilters()}clearSearchResults(){u(this.searchResultList),u(this.searchResultListContainer),u(this.searchResultContainer),this.searchResultContainer.classList.remove("visible","no-results")}getSearchResultContainerElement(){const t=document.createElement("div");return t.className=`${this.baseClassName}-search-result-container`,t}getSearchResultListContainerElement(){const t=document.createElement("div");return t.className=`${this.baseClassName}-search-result-list-container`,t.addEventListener("scroll",t=>{const e=t.target.scrollTop+t.target.clientHeight>=t.target.scrollHeight-500;!this.hasTriggeredSeeMore&&e&&x.state.page<x.state.totalPages&&(this.hasTriggeredSeeMore=!0,this.onSeeMore())}),t}getSearchResultListElement(){const t=document.createElement("div");return t.className=`${this.baseClassName}-search-result-list`,t}updateSearchResults(t){if(u(this.searchResultList),this.searchResultContainer.classList.remove("no-results"),this.infoAndSort.updateInfos({totalHits:x.state.totalHits}),t.length)for(const[e,a]of t.entries()){const t=new A({result:a,index:e,searchResultContainer:this.searchResultList,baseClassName:this.baseClassName});this.searchResultList.appendChild(t.getSearchResultElement())}else{const t=document.createElement("div");t.className=`${this.baseClassName}-search-no-result`,t.innerHTML="No results found",this.searchResultContainer.classList.add("no-results"),this.searchResultList.appendChild(t)}this.hasTriggeredSeeMore=!1}renderSearchResults(t,e){if(this.baseContainer.classList.add("search-completed"),this.clearSearchResults(),this.infoAndSort.updateInfos({totalHits:x.state.totalHits}),t.length){this.facetsList.renderFacets(e);for(const[e,a]of t.entries()){const t=new A({result:a,index:e,searchResultContainer:this.searchResultList,baseClassName:this.baseClassName});this.searchResultList.appendChild(t.getSearchResultElement())}this.searchResultListContainer.appendChild(this.infoAndSort.infosAndSortContainer),this.searchResultListContainer.appendChild(this.searchResultList),this.searchResultContainer.appendChild(this.searchResultListContainer),this.baseContainer.appendChild(this.searchResultContainer)}else{const t=document.createElement("div");t.className=`${this.baseClassName}-search-no-result`,t.innerHTML="No results found",this.searchResultContainer.classList.add("no-results"),this.searchResultContainer.appendChild(t)}this.searchResultContainer.classList.add("visible"),this.baseContainer.appendChild(this.searchResultContainer),this.hasTriggeredSeeMore=!1}}function L(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),a.push.apply(a,s)}return a}function $(t){for(var e=1;e<arguments.length;e++){var a=null!=arguments[e]?arguments[e]:{};e%2?L(Object(a),!0).forEach(function(e){O(t,e,a[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):L(Object(a)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(a,e))})}return t}function O(t,e,a){return(e=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var a=e.call(t,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}const P={results:[],facets:{},selectedFacets:{}},j=(()=>{let t=$({},P);return $({get state(){return t}},{logState(t){},addResults(e){t.results=[...t.results,...e.sort((t,e)=>((t,e)=>{const a=t.toLowerCase(),s=e.toLowerCase();return l.some(t=>a.includes(t))&&!l.some(t=>s.includes(t))?-1:l.some(t=>s.includes(t))&&!l.some(t=>a.includes(t))?1:0})(t.name,e.name))],this.logState("addResults")},setFacets(e){t.facets=e,this.logState("setFacets")},addRangeToSelectedFacets(e,a){t.selectedFacets[e]={type:a.type,values:a.values},this.logState("addRangeToSelectedFacets")},addListToSelectedFacets(e,a){if(a){const s=a.values[0],i=a.values[1],r=t.selectedFacets[e];if(r){const t=r.values.findIndex(t=>{let[e]=t;return e===s});t>-1?r.values[t]=[s,r.values[t][1]+i]:r.values.push([s,i])}else t.selectedFacets[e]={type:a.type,values:[[s,i]]}}this.logState("addListToSelectedFacets")},removeSelectedFacet(e,a){const s=t.selectedFacets[e];s&&(s.values=s.values.filter(t=>{let[e]=t;return e!==a})),0===s.values.length&&delete t.selectedFacets[e],this.logState("removeSelectedFacet")},updateSelectedFacets(e){const a=m(e,t.selectedFacets,!0);t.selectedFacets=a,this.logState("updateSelectedFacets")},updateFacets(e){t.facets=m(e,t.facets,!0),this.logState("updateFacets")},setSelectedFacets(e){t.selectedFacets=e,this.logState("setSelectedFacets")},clearResults(){t.results=[],this.logState("clearResults")},reset(){t=$({},P),this.logState("reset")}})})();function B(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),a.push.apply(a,s)}return a}function I(t){for(var e=1;e<arguments.length;e++){var a=null!=arguments[e]?arguments[e]:{};e%2?B(Object(a),!0).forEach(function(e){D(t,e,a[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):B(Object(a)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(a,e))})}return t}function D(t,e,a){return(e=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var a=e.call(t,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}const M=function(t){let e=[];for(const a in t){const s=t[a];if(Array.isArray(s))if("object"==typeof s[0]){const t=s.map(t=>`${a} ${t.operator} ${t.value}`);e.push(`(${t.join(" AND ")})`)}else{const t=s.map(t=>`"${a}" = "${t}"`);e.push(`(${t.join(" OR ")})`)}}return e.join(" AND ")},H=function(t){const{facetDistribution:e,facetStats:a}=t;let s={};for(const t in e)a&&a[t]?s[t]={type:"range",values:{min:a[t].min,max:a[t].max}}:s[t]={type:"list",values:Object.entries(e[t])};return s},z=t=>{const e=DATA.language,a=[];for(const s of t){let t=s.title,i=s.link;e&&(s.localized_title&&(t=JSON.parse(s.localized_title)[e]??s.title),s.localized_link&&(i=JSON.parse(s.localized_link)[e]??s.link)),i&&s.img_link&&s.price&&a.push({name:t,link:i,img_link:s.img_link,price:s.price,category:s.category,brand:s.brand})}return a},W=t=>{let{text:e,filters:a,sort:s,page:i}=t;return JSON.stringify({q:e,filter:M(a),facets:["*"],hitsPerPage:50,page:i+1,sort:"relevance"===s[0]?[]:s})},_=t=>({hits:z(t.hits),facets:H(t),page:t.page,totalPages:t.totalPages,totalHits:t.totalHits}),q=/.+\/([^.]+)\.(otf|ttf)$/,J=(t,e)=>t&&"inherit"!==t?`font-family:${t}_${e.match(q)?e.match(q)[1]:""};`:e||"",U=()=>{const{primaryColor:t,secondaryColor:e,tertiaryColor:a,searchBarTitleAlign:s,searchBarTitleFontName:i,searchBarTitleFontSize:r,searchBarTitleFontStyle:n,searchBarTitleCustomFontColor:o,searchBarTitleTextColor:c,searchBarInputAlign:l,searchBarInputFontName:h,searchBarInputFontSize:d,searchBarInputFontStyle:b,searchBarInputCustomFontColor:g,searchBarInputTextColor:u}=DATA;return["div.abtasty-search-widget-container div.abtasty-search-widget-search-bar-container {",`background-color: ${t};`,"}","div.abtasty-search-widget-container i.abtasty-search-widget-close-icon {",`background-color: ${t};`,"}","div.abtasty-search-widget-container label.abtasty-search-widget-search-input-label {",`text-align: ${s};`,J(i,n),`font-size: ${r}px;`,`color: ${o?c:e};`,"}","div.abtasty-search-widget-container input.abtasty-search-widget-search-input {",`text-align: ${l};`,J(h,b),`font-size: ${d}px;`,`color: ${g?u:a};`,"}"].join("")},X=()=>{const{primaryColor:t,secondaryColor:e,tertiaryColor:a,facetSectionTitleAlign:s,facetSectionTitleFontName:i,facetSectionTitleFontSize:r,facetSectionTitleFontStyle:n,facetSectionTitleCustomFontColor:o,facetSectionTitleTextColor:c,facetTitleAlign:l,facetTitleFontName:h,facetTitleFontSize:d,facetTitleFontStyle:b,facetTitleCustomFontColor:g,facetTitleTextColor:u}=DATA;return["div.abtasty-search-widget-container details.abtasty-search-widget-search-facet summary {",`text-align: ${s};`,J(i,n),`font-size: ${r}px;`,`color: ${o?c:t};`,"}","div.abtasty-search-widget-container label.abtasty-search-widget-search-facet-checkbox-container {",`text-align: ${l};`,J(h,b),`font-size: ${d}px;`,`color: ${g?u:a};`,"}","div.abtasty-search-widget-container button.abtasty-search-widget-search-facet-show-more {",`color: ${t};`,"}","div.abtasty-search-widget-container div.abtasty-search-widget-range-slider {",`background-color: ${e};`,"}","div.abtasty-search-widget-container div.abtasty-search-widget-search-facets-list button.abtasty-search-widget-search-facets-list-close-button,","div.abtasty-search-widget-container div.abtasty-search-widget-range-slider div.range-progress {",`background-color: ${t};`,"}","div.abtasty-search-widget-container div.abtasty-search-widget-search-facets-list button.abtasty-search-widget-search-facets-list-bottom-close-button {",`background-color: ${t};`,`color: ${e};`,"}","div.abtasty-search-widget-container div.abtasty-search-widget-range-slider div.range-handle {",`background-color: ${t};`,"}","div.abtasty-search-widget-container div.abtasty-search-widget-range-values {",`color: ${a};`,"}"].join("")},Z=()=>{const{primaryColor:t,tertiaryColor:e,searchResultNameAlign:a,searchResultNameFontName:s,searchResultNameFontSize:i,searchResultNameFontStyle:r,searchResultNameCustomFontColor:n,searchResultNameTextColor:o,searchResultPriceAlign:c,searchResultPriceFontName:l,searchResultPriceFontSize:h,searchResultPriceFontStyle:d,searchResultPriceCustomFontColor:b,searchResultPriceTextColor:g}=DATA;return["div.abtasty-search-widget-container div.abtasty-search-widget-search-result-name {",`text-align: ${a};`,J(s,r),`font-size: ${i}px;`,`color: ${n?o:t};`,"}","div.abtasty-search-widget-container div.abtasty-search-widget-search-result-price {",`text-align: ${c};`,J(l,d),`font-size: ${h}px;`,`color: ${b?g:e};`,"}"].join("")};class G{constructor(t){let{target:e,rootElement:a}=t;this.baseClassName="abtasty-search-widget",this.target=e,this.rootElement=a,this.searchOpen=!1,this.searchWidgetContainer=this.getSearchWidgetContainerElement(),this.searchBar=new p({baseContainer:this.searchWidgetContainer,baseClassName:this.baseClassName,target:this.target,onInput:this.debouncedOnInput.bind(this),closeSearchWidget:this.closeSearchWidget.bind(this)}),this.searchResultsList=new R({baseClassName:this.baseClassName,baseContainer:this.searchWidgetContainer,searchBar:this.searchBar,onFiltersChange:this.onFiltersChange.bind(this),onSeeMore:this.onSeeMore.bind(this),onSortChange:this.onSortChange.bind(this),onFiltersReset:this.onFiltersReset.bind(this)})}insertIn(t,e){t.insertAdjacentElement(e,this.searchWidgetContainer)}remove(){this.rootElement.querySelector("body").removeChild(this.searchWidgetContainer)}openSearchWidget(){if(this.searchOpen)return;const t=this.rootElement.querySelector("body");this.rootElement.querySelector("html").classList.add("search-open"),this.insertIn(t,"afterbegin"),this.searchBar.focusInput(),this.searchOpen=!0}closeSearchWidget(){this.rootElement.querySelector("html").classList.remove("search-open"),this.searchOpen=!1,this.remove()}onFiltersReset=()=>{x.isNoFiltersAndNoSort()||(x.resetFiltersAndPagination(),x.resetSort(),this.onSearch())};onFiltersChange=t=>{let{facetType:e,facetKey:a,facetValue:s,options:i}=t;"range"===e?this.onRangeChange(a,i.min,i.max):this.onListCheckboxChange(a,s,i.checked)};onSortChange=async t=>{x.setPage(0),j.clearResults(),x.setSort(t),this.searchResultsList.scrollToTop();const e=await(async()=>{try{const t=await fetch(o,{method:"POST",headers:h,body:W(x.state)}),e=await t.json();return{results:_(e).hits}}catch(t){return window.console.error(t),{results:[]}}})();if(!e)return;const{results:a}=e;j.addResults(a),this.searchResultsList.updateSearchResults(j.state.results),this.searchResultsList.facetsList.sortFacet.update(x.state.sort),this.searchResultsList.infoAndSort.updateSort(x.state.sort)};onRangeChange=async(t,e,a)=>{x.resetPagination(),j.clearResults(),x.updateRangeFilter(t,e,a);const s=await this.onSearchWithFilters();if(!s)return;const{results:i,facets:r,totalPages:n,totalHits:o}=s;j.addResults(i),r[t]&&delete r[t],j.updateFacets(r),j.addRangeToSelectedFacets(t,{type:"range",values:{min:e,max:a}}),x.setTotalPages(n),x.setTotalHits(o),this.searchResultsList.updateSearchResults(j.state.results),this.searchResultsList.facetsList.updateListFacets(j.state.facets)};onListCheckboxChange=async(t,e,a)=>{x.resetPagination(),j.clearResults(),x.updateFilterArray(t,e,a);const s=await this.onSearchWithFilters();if(!s)return;const{results:i,facets:r,totalPages:n,totalHits:o}=s;if(j.addResults(i),j.updateFacets(r),a){const a=r[t]?.values.find(t=>{let[a]=t;return a===e});j.addListToSelectedFacets(t,{type:"list",values:a||[e,0]})}else j.removeSelectedFacet(t,e);x.setTotalPages(n),x.setTotalHits(o),this.searchResultsList.updateSearchResults(j.state.results),this.searchResultsList.facetsList.updateFacets(j.state.facets)};onInput=t=>{x.setText(t.target.value),t.target.value.length?((Object.keys(x.state.filters).length||x.state.page>0)&&x.resetFiltersAndPagination(),this.onSearch()):(this.searchWidgetContainer.classList.remove("search-completed"),this.searchResultsList.clearSearchResults())};onSeeMore=async()=>{x.setPage(x.state.page+1);const t=await(async()=>{try{const t=await fetch(o,{method:"POST",headers:h,body:W(x.state)}),e=await t.json(),a=_(e);return{results:a.hits,totalPages:a.totalPages}}catch(t){return window.console.error(t),null}})();if(!t)return;const{results:e,totalPages:a}=t;j.addResults(e),x.setTotalPages(a),this.searchResultsList.updateSearchResults(j.state.results)};async onSearchWithFilters(){const{text:e}=x.state;return this.searchResultsList.scrollToTop(),e?await(async()=>{const e=(t=>{const e=[],{text:a,filters:s,page:i,sort:r}=x.state;return e.push({indexUid:t,q:a,filter:M(s),hitsPerPage:50,page:i+1,sort:"relevance"===r[0]?[]:r}),Object.entries(j.state.facets).forEach(i=>{let[r]=i;const n=I({},s);delete n[r],e.push({indexUid:t,q:a,filter:M(n),facets:[r],hitsPerPage:0})}),JSON.stringify({queries:e})})(DATA.meilisearchIndex||t());try{const t=await fetch(c,{method:"POST",headers:h,body:e}),a=(t=>{const{results:e}=t,a=e.slice(1).reduce((t,e)=>{const a=H(e);return I(I({},t),a)},{});return{hits:z(e[0].hits),facets:a,page:e[0].page,totalPages:e[0].totalPages,totalHits:e[0].totalHits}})(await t.json());return{results:a.hits,facets:a.facets,totalPages:a.totalPages,page:a.page,totalHits:a.totalHits}}catch(t){return window.console.error(t),null}})():(this.searchWidgetContainer.classList.remove("search-completed"),null)}onSearch=async()=>{const{text:t}=x.state;if(j.clearResults(),this.searchResultsList.scrollToTop(),t)try{const t=await(async()=>{try{const t=await fetch(o,{method:"POST",headers:h,body:W(x.state)}),e=await t.json(),a=_(e);return{results:a.hits,facets:a.facets,totalPages:a.totalPages,page:a.page,totalHits:a.totalHits}}catch(t){return window.console.error(t),{results:[],facets:{},totalPages:0,page:0,totalHits:0}}})(),{results:e,facets:a,totalPages:s,totalHits:i}=t;j.addResults(e),j.setFacets(a),x.setTotalPages(s),x.setTotalHits(i),this.searchResultsList.renderSearchResults(e,a)}catch(t){window.console.error(t)}else this.searchWidgetContainer.classList.remove("search-completed")};debouncedOnInput=(()=>(t=>{let e=null;return function(){for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];window.clearTimeout(e),e=window.setTimeout(()=>{t(...s)},150)}})(this.onInput.bind(this)))();getSearchWidgetContainerElement(){const t=document.createElement("div"),e=document.createElement("style");t.className=`${this.baseClassName}-container`;const[a,s,i]=[U(),Z(),X()],r=document.createTextNode("html.search-open{height:100vh;overflow:hidden;padding:0}div.abtasty-search-widget-container{-webkit-box-orient:vertical;-webkit-box-direction:normal;background-color:hsla(0,0%,100%,.5);bottom:0;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;font-family:inherit;height:100vh;left:0;position:fixed;right:0;top:0;width:100vw;z-index:9999}div.abtasty-search-widget-container button:not(:disabled):hover{opacity:.5}div.abtasty-search-widget-container i{display:inline-block;-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:contain;mask-size:contain}div.abtasty-search-widget-container.search-completed{background-color:#fff}div.abtasty-search-widget-container div.abtasty-search-widget-search-bar-container{-webkit-box-orient:vertical;-webkit-box-direction:normal;background-color:#0c4884;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;padding:22.5px 100px;position:sticky;top:0}div.abtasty-search-widget-container div.abtasty-search-widget-search-bar{background-color:#fff;border-radius:12px;margin-top:12px;padding:12px;width:100%}div.abtasty-search-widget-container label.abtasty-search-widget-search-input-label{color:#fff;font-size:16px;font-weight:700;line-height:17px;margin-left:auto;margin-right:auto;margin-top:auto}div.abtasty-search-widget-container div.abtasty-search-widget-search-bar-close-button-container{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;line-height:unset}div.abtasty-search-widget-container input.abtasty-search-widget-search-input{border:unset;font-size:1.6em;font-weight:700;outline:0;padding:unset;width:100%}div.abtasty-search-widget-container button.abtasty-search-widget-close-icon-container{background-color:#fff!important;border:none;border-radius:100%;cursor:pointer!important;margin-top:12px;padding:8px;-webkit-transform:translateX(150%);transform:translateX(150%);vertical-align:middle}div.abtasty-search-widget-container i.abtasty-search-widget-close-icon{background-color:#0c4884;height:28px;-webkit-mask-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 512' fill='rgba(0, 0, 0, 0.999)'%3E%3Cpath d='M310.6 361.4c12.5 12.5 12.5 32.75 0 45.25-6.2 6.25-14.4 9.35-22.6 9.35s-16.38-3.125-22.62-9.375L160 301.3 54.63 406.6C48.38 412.9 40.19 416 32 416s-16.37-3.1-22.625-9.4c-12.5-12.5-12.5-32.75 0-45.25l105.4-105.4L9.375 150.6c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0L160 210.8l105.4-105.4c12.5-12.5 32.75-12.5 45.25 0s12.5 32.75 0 45.25l-105.4 105.4L310.6 361.4z'/%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 512' fill='rgba(0, 0, 0, 0.999)'%3E%3Cpath d='M310.6 361.4c12.5 12.5 12.5 32.75 0 45.25-6.2 6.25-14.4 9.35-22.6 9.35s-16.38-3.125-22.62-9.375L160 301.3 54.63 406.6C48.38 412.9 40.19 416 32 416s-16.37-3.1-22.625-9.4c-12.5-12.5-12.5-32.75 0-45.25l105.4-105.4L9.375 150.6c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0L160 210.8l105.4-105.4c12.5-12.5 32.75-12.5 45.25 0s12.5 32.75 0 45.25l-105.4 105.4L310.6 361.4z'/%3E%3C/svg%3E\");vertical-align:middle;width:28px}div.abtasty-search-widget-container i.abtasty-search-widget-search-icon{background-color:#fff;height:12.5px;margin-right:6px;-webkit-mask-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512' fill='rgba(74, 76, 83, 0.999)'%3E%3Cpath d='M500.3 443.7 380.6 324c27.22-40.41 40.65-90.9 33.46-144.7C401.8 87.79 326.8 13.32 235.2 1.723 99.01-15.51-15.51 99.01 1.724 235.2c11.6 91.64 86.08 166.7 177.6 178.9 53.8 7.189 104.3-6.236 144.7-33.46l119.7 119.7c15.62 15.62 40.95 15.62 56.57 0 15.606-15.64 15.606-41.04.006-56.64zM79.1 208c0-70.58 57.42-128 128-128s128 57.42 128 128-57.42 128-128 128-128-57.4-128-128z'/%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512' fill='rgba(74, 76, 83, 0.999)'%3E%3Cpath d='M500.3 443.7 380.6 324c27.22-40.41 40.65-90.9 33.46-144.7C401.8 87.79 326.8 13.32 235.2 1.723 99.01-15.51-15.51 99.01 1.724 235.2c11.6 91.64 86.08 166.7 177.6 178.9 53.8 7.189 104.3-6.236 144.7-33.46l119.7 119.7c15.62 15.62 40.95 15.62 56.57 0 15.606-15.64 15.606-41.04.006-56.64zM79.1 208c0-70.58 57.42-128 128-128s128 57.42 128 128-57.42 128-128 128-128-57.4-128-128z'/%3E%3C/svg%3E\");width:12.5px}div.abtasty-search-widget-container div.abtasty-search-widget-search-result-container{display:none}div.abtasty-search-widget-container div.abtasty-search-widget-search-result-container.visible{-webkit-box-orient:horizontal;-webkit-box-direction:normal;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row}div.abtasty-search-widget-container div.abtasty-search-widget-search-result-list-container{-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-box-sizing:border-box;box-sizing:border-box;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;overflow-y:auto;overscroll-behavior:none;padding:16px 16px 50px}div.abtasty-search-widget-container div.abtasty-search-widget-search-info-and-sort{-webkit-box-align:center;-ms-flex-align:center;-webkit-box-pack:justify;-ms-flex-pack:justify;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;justify-content:space-between}div.abtasty-search-widget-container div.abtasty-search-widget-search-sort{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;position:relative}div.abtasty-search-widget-container div.abtasty-search-widget-search-sort label.abtasty-search-widget-search-sort-label{margin-right:12px;white-space:nowrap}div.abtasty-search-widget-container div.abtasty-search-widget-search-sort select{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#fff;border:1px solid #caced1;border-radius:4px;color:#000;cursor:pointer;font-size:16px;outline:none;padding:.675em 2em .675em 1em;width:100%}div.abtasty-search-widget-container div.abtasty-search-widget-search-sort:after,div.abtasty-search-widget-container div.abtasty-search-widget-search-sort:before{content:\"\";pointer-events:none;position:absolute;right:16px;right:1rem}div.abtasty-search-widget-container div.abtasty-search-widget-search-sort:before{border-bottom:.3rem solid #000;border-left:.3rem solid transparent;border-right:.3rem solid transparent;top:35%}div.abtasty-search-widget-container div.abtasty-search-widget-search-sort:after{border-left:.3rem solid transparent;border-right:.3rem solid transparent;border-top:.3rem solid #000;top:55%}div.abtasty-search-widget-container div.abtasty-search-widget-search-sort-and-filters-button-container{-webkit-box-align:center;-ms-flex-align:center;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-webkit-box-pack:end;-ms-flex-pack:end;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;justify-content:end;width:100%}div.abtasty-search-widget-container button.abtasty-search-widget-search-filters-button{background-color:#fff;border:1px solid #caced1;border-radius:4px;color:#000;cursor:pointer;display:none;font-size:16px;margin-left:12px;outline:none;padding:.675em}div.abtasty-search-widget-container div.abtasty-search-widget-search-result-list{-webkit-box-pack:center;-ms-flex-pack:center;-webkit-box-orient:horizontal;-webkit-box-direction:normal;display:grid;-ms-flex-direction:row;flex-direction:row;-ms-flex-wrap:wrap;flex-wrap:wrap;gap:24px;justify-content:center;margin-top:16px}div.abtasty-search-widget-container div.abtasty-search-widget-search-result-container.visible.no-results div.abtasty-search-widget-search-result-list-container{display:-webkit-box;display:-ms-flexbox;display:flex;width:100%}div.abtasty-search-widget-container div.abtasty-search-widget-search-result-container.visible:not(.no-results) div.abtasty-search-widget-search-result-list{grid-template-columns:repeat(5,minmax(0,1fr))}div.abtasty-search-widget-container div.abtasty-search-widget-search-no-result{font-size:38px;font-weight:700;margin-left:auto;margin-right:auto;margin-top:82px;text-align:center}div.abtasty-search-widget-container a.abtasty-search-widget-search-result-container{color:unset!important;text-decoration:none!important}div.abtasty-search-widget-container div.abtasty-search-widget-search-result{-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-box-pack:justify;-ms-flex-pack:justify;border-radius:12px;-webkit-box-shadow:0 2px 8px 0 rgba(0,0,0,.11);box-shadow:0 2px 8px 0 rgba(0,0,0,.11);display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;height:400px;justify-content:space-between;padding:18px;width:auto}div.abtasty-search-widget-container div.abtasty-search-widget-search-result img{aspect-ratio:400/450;height:60%;margin-bottom:12px;margin-left:auto;margin-right:auto;-o-object-fit:contain;object-fit:contain;width:100%}div.abtasty-search-widget-container div.abtasty-search-widget-search-result-name{-webkit-line-clamp:3;-webkit-box-orient:vertical;color:#0d4884;display:-webkit-box;font-size:1em;font-weight:700;height:4.5em;line-height:1.5em;margin-bottom:8px;max-height:4.5em;min-height:4.5em;overflow:hidden;text-decoration:none!important}div.abtasty-search-widget-container div.abtasty-search-widget-search-result-price{color:#404040;font-size:1.833em;font-weight:bolder;line-height:normal;margin-top:auto;text-decoration:none!important}div.abtasty-search-widget-container div.abtasty-search-widget-search-facets-list{-webkit-box-sizing:border-box;box-sizing:border-box;min-width:240px;overflow-y:auto;overscroll-behavior:none;padding-bottom:50px}div.abtasty-search-widget-container div.abtasty-search-widget-search-facets-list-overlay{background-color:rgba(0,0,0,.5);bottom:0;display:none;left:0;position:absolute;right:0;top:0;z-index:1}div.abtasty-search-widget-container div.abtasty-search-widget-search-sort-facet{-webkit-box-orient:vertical;-webkit-box-direction:normal;background-color:rgba(0,0,0,.067);display:none;-ms-flex-direction:column;flex-direction:column}div.abtasty-search-widget-container div.abtasty-search-widget-search-sort-facet label.abtasty-search-widget-search-sort-label{margin-left:18px;margin-top:18px;white-space:nowrap}div.abtasty-search-widget-container div.abtasty-search-widget-search-sort-facet div.abtasty-search-widget-search-sort-options{-webkit-box-orient:horizontal;-webkit-box-direction:normal;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-wrap:wrap;flex-wrap:wrap;gap:8px;padding:12px 18px}div.abtasty-search-widget-container div.abtasty-search-widget-search-sort-facet button.abtasty-search-widget-search-sort-option{border:1px solid #caced1;border-radius:50rem;padding:.2em .675em;white-space:nowrap}div.abtasty-search-widget-container div.abtasty-search-widget-search-sort-facet button.abtasty-search-widget-search-sort-option.active{background-color:#0c4884;color:#fff}div.abtasty-search-widget-container div.abtasty-search-widget-search-facets-list button.abtasty-search-widget-search-facets-list-close-button{-webkit-box-align:center;-ms-flex-align:center;align-items:center;background-color:#0c4884;border:none;cursor:pointer;display:none;margin-left:auto;padding:8px}div.abtasty-search-widget-container div.abtasty-search-widget-search-facets-list button.abtasty-search-widget-search-facets-list-bottom-close-button,div.abtasty-search-widget-container div.abtasty-search-widget-search-facets-list button.abtasty-search-widget-search-facets-list-reset-button{-webkit-box-pack:center;-ms-flex-pack:center;border:2px solid #0c4884;border-radius:8px;-webkit-box-sizing:border-box;box-sizing:border-box;cursor:pointer;justify-content:center;margin-left:auto;margin-right:auto;padding:8px;width:85%}div.abtasty-search-widget-container div.abtasty-search-widget-search-facets-list button.abtasty-search-widget-search-facets-list-reset-button{background-color:transparent;color:#0c4884;display:-webkit-box;display:-ms-flexbox;display:flex}div.abtasty-search-widget-container div.abtasty-search-widget-search-facets-list button.abtasty-search-widget-search-facets-list-bottom-close-button{background-color:#0c4884;color:#fff;display:none;margin-top:12px}div.abtasty-search-widget-container div.abtasty-search-widget-search-facets-list button.abtasty-search-widget-search-facets-list-close-button i.abtasty-search-widget-close-icon{background-color:#fff}div.abtasty-search-widget-container div.abtasty-search-widget-search-facet-content{padding-left:18px;padding-right:18px}div.abtasty-search-widget-container button.abtasty-search-widget-search-facet-show-more{background-color:transparent;border:none;color:#0c4884;font-size:14px;font-weight:700;margin-bottom:12px;padding:0;text-decoration:underline}div.abtasty-search-widget-container div.abtasty-search-widget-search-facet-content.range-facet{margin-bottom:12px;padding-right:18px}div.abtasty-search-widget-container div.abtasty-search-widget-search-facet-list-item-container{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-webkit-box-align:center;-ms-flex-align:center;-webkit-box-pack:justify;-ms-flex-pack:justify;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;justify-content:space-between}div.abtasty-search-widget-container div.abtasty-search-widget-search-facet-list-item-container div.checkbox{margin:unset}div.abtasty-search-widget-container label.abtasty-search-widget-search-facet-checkbox-container{cursor:pointer;display:block;font-size:14px;font-weight:400;line-height:14px;margin-bottom:12px;padding-left:30px;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}div.abtasty-search-widget-container label.abtasty-search-widget-search-facet-checkbox-container.checked,div.abtasty-search-widget-container label.abtasty-search-widget-search-facet-checkbox-container:hover:not(.disabled){font-weight:700}div.abtasty-search-widget-container label.abtasty-search-widget-search-facet-checkbox-container.disabled{cursor:not-allowed}div.abtasty-search-widget-container label.abtasty-search-widget-search-facet-checkbox-container input{cursor:pointer;height:0;opacity:0;position:absolute;width:0}div.abtasty-search-widget-container label.abtasty-search-widget-search-facet-checkbox-container.disabled input{cursor:not-allowed}div.abtasty-search-widget-container label.abtasty-search-widget-search-facet-checkbox-container input[type=checkbox]:before{content:none!important}div.abtasty-search-widget-container span.abtasty-search-widget-search-facet-checkbox-checkmark{background-color:transparent;border:1px solid #000;border-radius:4px;height:15px;left:0;position:absolute;top:0;width:15px}div.abtasty-search-widget-container label.abtasty-search-widget-search-facet-checkbox-container input:checked~span.abtasty-search-widget-search-facet-checkbox-checkmark{background-color:#0c4884;font-weight:700}div.abtasty-search-widget-container span.abtasty-search-widget-search-facet-checkbox-checkmark:after{content:\"\";display:none;position:absolute}div.abtasty-search-widget-container label.abtasty-search-widget-search-facet-checkbox-container input:checked~span.abtasty-search-widget-search-facet-checkbox-checkmark:after{display:block}div.abtasty-search-widget-container label.abtasty-search-widget-search-facet-checkbox-container span.abtasty-search-widget-search-facet-checkbox-checkmark:after{border:solid #fff;border-width:0 2px 2px 0;height:8px;left:4.5px;top:1.5px;-webkit-transform:rotate(45deg);transform:rotate(45deg);width:4px}div.abtasty-search-widget-container li.abtasty-search-widget-search-facet-list-item{margin-bottom:12px;margin-top:12px}div.abtasty-search-widget-container details.abtasty-search-widget-search-facet summary{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-webkit-box-pack:justify;-ms-flex-pack:justify;-webkit-box-align:center;-ms-flex-align:center;align-items:center;background-color:rgba(0,0,0,.067);cursor:pointer;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;font-size:16px;font-weight:700;justify-content:space-between;padding:13.5px 18px}div.abtasty-search-widget-container details.abtasty-search-widget-search-facet summary:before{content:none}div.abtasty-search-widget-container details.abtasty-search-widget-search-facet summary div.abtasty-search-widget-search-facet-arrow:before{content:\"\\276F\"}div.abtasty-search-widget-container details.abtasty-search-widget-search-facet summary div.abtasty-search-widget-search-facet-arrow{-webkit-transform:rotate(90deg);transform:rotate(90deg);-webkit-transform-origin:center;transform-origin:center}div.abtasty-search-widget-container details.abtasty-search-widget-search-facet[open] summary div.abtasty-search-widget-search-facet-arrow{-webkit-transform:rotate(270deg);transform:rotate(270deg)}div.abtasty-search-widget-container div.abtasty-search-widget-search-facet-content ul{list-style:none}div.abtasty-search-widget-container div.abtasty-search-widget-range-slider{background-color:#e0e0e0;border-radius:5px;height:5px;margin:20px 0;position:relative;width:100%}div.abtasty-search-widget-container div.abtasty-search-widget-range-slider div.range-progress{background-color:#0c4884;border-radius:5px;height:100%;position:absolute;z-index:1}div.abtasty-search-widget-container div.abtasty-search-widget-range-slider div.range-handle{background-color:#0c4884;border:2px solid #fff;border-radius:50%;-webkit-box-shadow:0 2px 4px rgba(0,0,0,.2);box-shadow:0 2px 4px rgba(0,0,0,.2);cursor:pointer;height:20px;position:absolute;top:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);width:20px;z-index:2}div.abtasty-search-widget-container div.abtasty-search-widget-range-values{-webkit-box-pack:justify;-ms-flex-pack:justify;color:#404040;display:-webkit-box;display:-ms-flexbox;display:flex;font-size:14px;justify-content:space-between;margin-top:10px}div.abtasty-search-widget-container div.abtasty-search-widget-range-values span{font-weight:600}div.abtasty-search-widget-container button.abtasty-search-widget-filters-button{background-color:#fff!important;border:none;border-radius:100%;cursor:pointer!important;display:none;margin-top:12px;padding:11px;-webkit-transform:translateX(-15%);transform:translateX(-15%);vertical-align:middle}div.abtasty-search-widget-container i.abtasty-search-widget-filters-icon{background-color:#0c4884;height:22px;-webkit-mask-image:url(\"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iODAwIiBoZWlnaHQ9IjgwMCIgdmlld0JveD0iMCAwIDE4IDE4IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGZpbGw9IiM0OTRjNGUiIGQ9Ik0xNyA1SDFhMSAxIDAgMCAxIDAtMmgxNmExIDEgMCAwIDEgMCAyem0wIDVIMWExIDEgMCAwIDEgMC0yaDE2YTEgMSAwIDAgMSAwIDJ6bTAgNUgxYTEgMSAwIDAgMSAwLTJoMTZhMSAxIDAgMCAxIDAgMnoiLz48L3N2Zz4=\");mask-image:url(\"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iODAwIiBoZWlnaHQ9IjgwMCIgdmlld0JveD0iMCAwIDE4IDE4IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGZpbGw9IiM0OTRjNGUiIGQ9Ik0xNyA1SDFhMSAxIDAgMCAxIDAtMmgxNmExIDEgMCAwIDEgMCAyem0wIDVIMWExIDEgMCAwIDEgMC0yaDE2YTEgMSAwIDAgMSAwIDJ6bTAgNUgxYTEgMSAwIDAgMSAwLTJoMTZhMSAxIDAgMCAxIDAgMnoiLz48L3N2Zz4=\");vertical-align:middle;width:22px}@media (max-width:1199.98px){div.abtasty-search-widget-container div.abtasty-search-widget-search-result-container.visible:not(.no-results) div.abtasty-search-widget-search-result-list{grid-template-columns:repeat(4,minmax(0,1fr))}}@media (max-width:991.98px){div.abtasty-search-widget-container div.abtasty-search-widget-search-result-container.visible:not(.no-results) div.abtasty-search-widget-search-result-list{grid-template-columns:repeat(3,minmax(0,1fr))}}@media (max-width:767.98px){div.abtasty-search-widget-container div.abtasty-search-widget-search-result-container.visible:not(.no-results) div.abtasty-search-widget-search-result-list{grid-template-columns:repeat(2,minmax(0,1fr))}div.abtasty-search-widget-container div.abtasty-search-widget-search-result{height:300px}div.abtasty-search-widget-container div.abtasty-search-widget-search-result img{height:50%}}@media (max-width:575.98px){div.abtasty-search-widget-container div.abtasty-search-widget-search-bar-container{padding:22.5px}div.abtasty-search-widget-container button.abtasty-search-widget-close-icon-container{-webkit-transform:translateX(15%);transform:translateX(15%)}div.abtasty-search-widget-container div.abtasty-search-widget-search-result-container.visible div.abtasty-search-widget-search-result-list-container{width:100vw}div.abtasty-search-widget-container div.abtasty-search-widget-search-result-container.visible:not(.no-results) div.abtasty-search-widget-search-result-list{grid-template-columns:repeat(1,minmax(0,1fr))}div.abtasty-search-widget-container div.abtasty-search-widget-search-sort-facet{display:-webkit-box;display:-ms-flexbox;display:flex}div.abtasty-search-widget-container div.abtasty-search-widget-search-sort{display:none}div.abtasty-search-widget-container button.abtasty-search-widget-filters-button,div.abtasty-search-widget-container button.abtasty-search-widget-search-filters-button{display:block}div.abtasty-search-widget-container div.abtasty-search-widget-search-facets-list{background-color:#fff;bottom:0;left:0;max-height:unset!important;min-width:unset;overflow-x:hidden;position:absolute;top:0;-webkit-transition:.5s;transition:.5s;width:0;z-index:1}div.abtasty-search-widget-container div.abtasty-search-widget-search-facets-list button.abtasty-search-widget-search-facets-list-bottom-close-button,div.abtasty-search-widget-container div.abtasty-search-widget-search-facets-list button.abtasty-search-widget-search-facets-list-close-button{display:-webkit-box;display:-ms-flexbox;display:flex}div.abtasty-search-widget-container div.abtasty-search-widget-search-facets-list-overlay{display:block}div.abtasty-search-widget-container div.abtasty-search-widget-search-facets-list.open{width:240px}}@media (max-width:374.98px){div.abtasty-search-widget-container div.abtasty-search-widget-search-facets-list.open{width:100%}}");return e.appendChild(r),e.textContent+=[a,s,i].join(""),t.insertAdjacentElement("afterbegin",e),t}}(()=>{const{elementReferrer:t}=DATA;return(t=>{const a=(()=>{if(e()||(()=>{const t=!!document.getElementById("ABTastyPreviewBar"),e=location.href.includes("ab_project=preview");return t||e})())return!1;const t=ABTasty.getTestsOnPage()[TEST_ID];return!!t&&Object.keys(t.targetings.qaParameters).length>0})(),s=window.document.cookie.includes("abTastyDebug=")||!0===window.abTastyDebug;if(a||s){const e=(()=>{const t=(()=>{const{type:t}=DATA;return`${PACKAGE.replace("@abtasty/","")}${t?`_${t}`:""}`})();return`${t.charAt(0).toUpperCase()}${t.slice(1)}`.split("-").join(" ")})();window.console.log(`%c${e} - ${a?"QA":"Debug"} Mode for campaign ${TEST_ID} %c ${t}`,"background-color: #D6FF01; color: #3100be; padding: 3px 0 3px 10px; border-radius: 5px 0 0 5px; font-weight: bold;","background-color: #3100be; color: white; padding: 3px 10px 3px 0; border-radius: 0 5px 5px 0;")}})("Widget launch"),(()=>{const t=[{name:DATA.facetTitleFontName,style:DATA.facetTitleFontStyle},{name:DATA.searchBarTitleFontName,style:DATA.searchBarTitleFontStyle},{name:DATA.searchBarInputFontName,style:DATA.searchBarInputFontStyle},{name:DATA.facetSectionTitleFontName,style:DATA.facetSectionTitleFontStyle},{name:DATA.searchResultNameFontName,style:DATA.searchResultNameFontStyle},{name:DATA.searchResultPriceFontName,style:DATA.searchResultPriceFontStyle}];for(const{name:e,style:a}of t){if(!e||"inherit"===e||!/otf|ttf/g.test(a))continue;const t=document.createElement("style"),s=a.match(q)?a.match(q)[1]:"";t.innerHTML=`@font-face { font-family: '${e}_${s}'; src: url('${a}'); font-display: swap; }`,document.head.appendChild(t)}})(),new Promise(s=>{r(t,()=>{const i=a(t),r=i.getRootNode();i.style.position="relative";const n=document.createElement("div");n.style.position="absolute",n.style.top="0",n.style.left="0",n.style.right="0",n.style.bottom="0",n.style.backgroundColor="transparent",n.style.cursor="pointer",n.onclick=t=>{t?.preventDefault?.(),t?.stopPropagation?.(),new G({target:i,rootElement:r}).openSearchWidget()},i.appendChild(n),e()&&n.onclick(),s()})})})().then(()=>{})}();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@abtasty/search",
3
3
  "description": "Search Widget MVP",
4
- "version": "0.0.2-1",
4
+ "version": "0.0.2-11",
5
5
  "form": "dist/form.js",
6
6
  "main": "dist/main.js",
7
7
  "type": "module",
@@ -44,5 +44,5 @@
44
44
  "rollup": "^4.12.0",
45
45
  "rollup-plugin-postcss": "^4.0.2"
46
46
  },
47
- "stableVersion": "0.0.2-0"
47
+ "stableVersion": "0.0.2-10"
48
48
  }