PageSourceSearch

https://www.mous.co/cdn/shop/t/300/assets/mous-drawer.min.js?v=19925750686313774721790765136

js mous.co collected 2026-10-01 10:21:31 UTC 18,959 bytes, 1 lines download raw bytes

1(()=>{var e;function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}function r(e){return function(e){if(Array.isArray(e))return n(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||a(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var i,a,n,o,l=[],d=!0,c=!1;try{if(n=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;d=!1}else for(;!(d=(i=n.call(r)).done)&&(l.push(i.value),l.length!==t);d=!0);}catch(e){c=!0,a=e}finally{try{if(!d&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(c)throw a}}return l}}(e,t)||a(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){if(e){if("string"==typeof e)return n(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}}function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,u(i.key),i)}}function d(e,t,r){return t&&l(e.prototype,t),r&&l(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function c(e,t,r){return(t=u(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function u(e){var r=function(e,r){if("object"!=t(e)||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,r||"default");if("object"!=t(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==t(r)?r:r+""}var s=function(){return d((function e(){o(this,e)}),null,[{key:"register",value:function(e){this.stack=this.stack.filter((function(t){return t.id!==e.id})),this.stack.push(e),e.id&&this.activeIds.add(e.id),this.update()}},{key:"unregister",value:function(e){this.stack=this.stack.filter((function(t){return t.id!==e.id})),e.id&&this.activeIds.delete(e.id),this.update()}},{key:"top",value:function(){return this.stack.at(-1)}},{key:"shouldBeOpen",value:function(e){return this.activeIds.has(e)}},{key:"cleanupDeadDrawers",value:function(){this.stack=this.stack.filter((function(e){return document.body.contains(e.drawer)}))}},{key:"closeAll",value:function(){this.stack.slice().forEach((function(e){return e.close({force:!0})}))}},{key:"update",value:function(){if(this.cleanupDeadDrawers(),this.stack.forEach((function(e,t){e.setZIndex(1e3+t)})),this.overlay){var e=this.stack.length>0;this.overlay.classList.toggle("is-active",e),e&&(this.overlay.style.zIndex=999+this.stack.length)}document.body.classList.toggle("fixed",this.stack.length>0)}}])}();c(s,"stack",[]),c(s,"activeIds",new Set),c(s,"overlay",document.querySelector("[data-drawer-overlay]"));var v=function(){return d((function e(t){var n,l=this;if(o(this,e),c(this,"open",(function(e){var t=null==e?void 0:e.dataset.preSelected,r="true"===(null==e?void 0:e.dataset.devices),i=!(null==e||!e.getAttribute("data-variant-selection")),a=t?l.findPreselectedLevel(t):null;l.preselectedOpen=Boolean(a),l.deviceFilter=l.parseDeviceFilter(e),l.drawer.classList.toggle("is-preselected",l.preselectedOpen),l.drawer.querySelectorAll(".device-tag__upgrade").forEach((function(e){e.hidden=!1})),a?(r="devices"===a.groupType,l.currentLevel=a.level):l.currentLevel=l.initialLevel,l.toggleGroup("[data-devices]",r),l.toggleGroup("[data-variants]",!r);var n=l.levelMap.get(l.initialLevel);n&&a&&(n.hidden=!0),l.history=[],l.direction="forward",l.productLevelActive=!1,l._variantImages=[],a?(l.drawer.classList.add("no-level-transition"),l.updateVisibility(),l.collectionDeviceOptions&&l.updateDevices(l.collectionDeviceOptions),l.applyDeviceFilter(),requestAnimationFrame((function(){l.drawer.classList.remove("no-level-transition")}))):!a&&i?(l.drawer.classList.add("no-level-transition"),l.showProductLevel(e),requestAnimationFrame((function(){l.drawer.classList.remove("no-level-transition")}))):l.updateVisibility(),l.drawer.classList.add("is-open"),l.drawer.setAttribute("aria-hidden","false"),l.updateScrollbarWidth(),s.register(l)})),c(this,"close",(function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).force,t=void 0!==e&&e;"help"!==l.currentLevel?(t||s.top()===l)&&(setTimeout(l.resetDeviceSelection,300),l.drawer.classList.remove("is-open","is-open-no-animate","is-back"),l.drawer.setAttribute("aria-hidden","true"),l.updateScrollbarWidth(),s.unregister(l),setTimeout(l.resetLevels,300)):l.goBackLevel(new Event("click"))}
1)),c(this,"setTitle",(function(e){e&&l.titleElements.forEach((function(t){t.textContent=e}))})),c(this,"restoreTitle",(function(){l.titleElements.forEach((function(e,t){e.textContent=l.originalTitles[t]||e.textContent}))})),c(this,"findPreselectedLevel",(function(e){var t=(e||"").trim();if(!t)return null;var n,o=t.replace(/\s+/g," ").toLowerCase(),d=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=a(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var i=0,n=function(){};return{s:n,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,l=!0,d=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return l=e.done,e},e:function(e){d=!0,o=e},f:function(){try{l||null==r.return||r.return()}finally{if(d)throw o}}}}(l.levelMap);try{for(d.s();!(n=d.n()).done;){var c=i(n.value,2),u=c[0],s=c[1];if(u&&"initial"!==u&&"product"!==u&&"help"!==u)if(r(s.querySelectorAll(".drawer__item button[data-href]")).find((function(e){var t,r,i=(null===(t=e.querySelector(".device-name"))||void 0===t||null===(t=t.textContent)||void 0===t?void 0:t.trim().replace(/\s+/g," ").toLowerCase())||"",a=(null===(r=e.getAttribute("data-href"))||void 0===r?void 0:r.trim().toLowerCase())||"";return i===o||a===o})))return{level:u,groupType:s.hasAttribute("data-variants")?"variants":"devices"}}}catch(e){d.e(e)}finally{d.f()}return null})),c(this,"parseDeviceFilter",(function(e){if(!e)return null;var t=document.querySelector('script[type="application/json"][data-device-filter]');if(!t)return null;try{var r=JSON.parse(t.textContent||"");return Array.isArray(r)?r.map((function(e){return"".concat(e).trim()})).filter(Boolean):null}catch(e){return null}})),c(this,"applyDeviceFilter",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:l.deviceFilter;if(Array.isArray(e)&&e.length){var t=e.map((function(e){return"".concat(e).trim().toLowerCase()}));l.levelMap.forEach((function(e){r(e.querySelectorAll(".drawer__item")).forEach((function(e){var r,i,a=e.querySelector("button[data-href]");if(a){var n=(null===(r=a.getAttribute("data-href"))||void 0===r?void 0:r.trim().toLowerCase())||"",o=(null===(i=a.textContent)||void 0===i?void 0:i.trim().toLowerCase())||"";t.some((function(e){return n===e||o===e}))||(e.hidden=!0)}}))}))}})),c(this,"handleDeviceSelection",(function(e){if(s.top()===l){var t=e.currentTarget,r=t.getAttribute("data-href");if(l.productLevelActive){l.showProductLevel(t);var i=t.getAttribute("data-image");if(i){var a,n=null===(a=l.productCard)||void 0===a?void 0:a.querySelector(".image img");n&&(n.src=i)}}else document.dispatchEvent(new CustomEvent("device-selection",{detail:{selection:r}})),window.QF.selected_device=r,s.closeAll()}})),c(this,"showProductLevel",(function(e){l.direction="forward",l.currentLevel="product",l.productLevelActive=!0,l.updateVisibility();var t,r=e.getAttribute("data-image");if(r){var i,a=null===(i=l.productCard)||void 0===i?void 0:i.querySelector(".image img");a&&(a.src=r)}if(e.getAttribute("data-reset"))return l.productCard.removeAttribute("data-selected-device"),null===(t=l.productCard.querySelector(".selected-device"))||void 0===t||t.removeAttribute("data-variant"),l.productCard.querySelector(".selected-device span").textContent="",l.addToCart.removeAttribute("data-id"),l.addToCart.setAttribute("disabled",""),l.preorderText.textContent="",void(l.preorderText.hidden=!0);var n=e.closest(".product-card");if(n){var o,d,c=null===(o=n.querySelector(".product-main-info"))||void 0===o?void 0:o.innerHTML,u=null===(d=n.querySelector(".product-image img"))||void 0===d?void 0:d.src;if(c&&(l.productCard.querySelector(".product-main-info").innerHTML=c),u){var s=new URL(u);s.searchParams.set("width",250),l.productCard.querySelector(".image img").src=s.toString()}var v=e.parentElement.querySelector("[data-variants]");if(v){var f=JSON.parse(v.innerHTML);"true"===(null==e?void 0:e.dataset.devices)||l.renderVariants(f);var p=f.map((function(e){return e.title})),h=f.map((function(e){return e.id})),m=f.map((function(e){return e.preorder})),y=f.map((function(e){return e.preorder_text})),b=f.map((function(e){return e.available})),g=f.map((function(e){return e.price}));l._variantImages=f.map((function(e){return e.image})),l.updateDevices(p,h,m,b,y,g)}}else if(e.getAttribute("data-href")){var w,A=e.getAttribute("data-href"),L=e.getAttribute("data-variant-id"),S=e.getAttribute("data-pre-order"),C=e.getAttribute("data-pre-order-text"),k=e.getAttribute("data-price");l.productCard.setAttribute("data-selected-device",!0),null===(w=l.productCard.querySelector(".selected-device"))||void 0===w||w.setAttribute("data-variant",L),l.productCard.querySelector(".selected-device span").textContent=A,l.productCard.querySelector(".product-price").innerHTML=k,l.addToCart.setAttribute("data-id",L),l.addToCart.setAttribute("data-pre-order",S),"true"===S?(l.addToCart.setAttribute("data-property-name","Preorder"),l.addToCart.setAttribute("data-property-value",C||" ")):(l.addToCart.removeAttribute("data-property-name"),l.addToCart.removeAttribute("data-property-value")),"true"==S&&C?(l.preorderText.textContent=C,l.preorderText.hidden=!1):l.preorderText.hidden=!0,l.addToCart.removeAttribute("disabled")}})),c(this,"resetDeviceSelection",(function(){var e,t,r,i,a;null===(e=l.productCard)||void 0===e||e.removeAttribute("data-selected-device");var n=null===(t=l.productCard)||void 0===t?void 0:t.querySelector(".selected-device");null==n||n.removeAttribute("data-variant");var o=null==n?void 0:n.querySelector("span");o&&(o.textContent=""),null===(r=l.addToCart)||void 0===r||r.removeAttribute("data-id"),null===(i=l.addToCart)||void 0===i||i.removeAttribute("data-pre-order"),null===(a=l.addToCart)||void 0===a||a.setAttribute("disabled",""),l.preorderText&&(l.preorderText.hidden=!0,l.preorderText.textContent="")})),c(this,"renderVariants",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=l.drawer.querySelector("[data-level][data-variants]"),i=null==t?void 0:t.querySelector(".drawer__list");t&&i&&(i.innerHTML="",e.forEach((function(e){var t=document.createElement("li");t.className="drawer__item";var r=document.createElement("button");if(r.className="drawer__link",r.setAttribute("data-href",e.title),r.setAttribute("data-variant-id",e.id),r.setAttribute("data-available",e.available),e.preorder){r.setAttribute("data-pre-order",e.preorder);var a=document.createElement("span");a.textContent=window.variantStrings.preorder,r.appendChild(a)}e.image&&r.setAttribute("data-image",e.image),r.textContent=e.title,t.appendChild(r),i.appendChild(t)})),l.selections=r(l.drawer.querySelectorAll(".drawer__item button[data-href]")),l.selections.forEach((function(e){return e.addEventListener("click",l.handleDeviceSelection)})))})),c(this,"goBackLevel",(function(e){e.preventDefault(),s.top()===l&&((!l.preselectedOpen||0!==l.history.length||l.currentLevel===l.initialLevel||l.productLevelActive)&&(l.currentLevel!==l.initialLevel||l.productLevelActive)?(l.leavingLevel=l.currentLevel,l.direction="back",l.currentLevel=l.history.pop()||l.initialLevel,l.updateVisibility()):l.close())})),c(this,"resetLevels",(function(){l.history=[],l.currentLevel=l.initialLevel,l.productLevelActive=!1,l.direction="forward",l.preselectedOpen=!1,l.deviceFilter=null,l._variantImages=[],l.drawer.classList.remove("is-preselected");var e=l.levelMap.get(l.initialLevel);e&&(e.hidden=!1),l.updateVisibility(),l.updateDevices()})),c(this,"updateVisibility",(function(){var e=l.history[l.history.length-1],t="back"===l.direction?l.leavingLevel:null;if(l.drawer.classList.toggle("is-back","back"===l.direction),l.levels.forEac
1h((function(r){var i=r.getAttribute("data-level");r.classList.remove("is-active","is-prev","is-next"),i!==l.currentLevel?i!==e?i!==t||r.classList.add("is-next"):r.classList.add("is-prev"):r.classList.add("is-active")})),"help"===l.currentLevel)l.setTitle(l.helpTitleText);else{var r,i=null===(r=l.levelMap.get(l.currentLevel))||void 0===r?void 0:r.getAttribute("data-drawer-title");i?l.setTitle(i):l.restoreTitle()}l.leavingLevel=null,l.backBtn&&(l.backBtn.hidden="product"===l.currentLevel),l.helpArea&&l.helpArea.classList.toggle("is-active","help"===l.currentLevel)})),c(this,"updateDevices",(function(e,t,i,a,n,o){var d;if(!Array.isArray(e))return l.selections.forEach((function(e){e.disabled=!1,e.parentElement.hidden=!1,e.parentElement.removeAttribute("disabled"),e.setAttribute("data-variant-id",""),e.setAttribute("data-pre-order",""),e.removeAttribute("data-available"),e.removeAttribute("data-image")})),l.drawer.querySelectorAll("[data-next-level]").forEach((function(e){e.hidden=!1})),void(null===(d=l.addToCart)||void 0===d||d.setAttribute("disabled",""));void 0===t&&(l.collectionDeviceOptions=e),l.selections.forEach((function(r){var d=r.getAttribute("data-href"),c=e.indexOf(d),u=-1!==c;if(r.parentElement.hidden=!u,u){t&&r.setAttribute("data-variant-id",t[c]),i&&r.setAttribute("data-pre-order",i[c]),n&&r.setAttribute("data-pre-order-text",n[c]),o&&r.setAttribute("data-price",o[c]),l._variantImages.length&&r.setAttribute("data-image",l._variantImages[c]);var s=!a||!1!==a[c];r.toggleAttribute("disabled",!s),r.parentElement.toggleAttribute("disabled",!s),a?r.setAttribute("data-available",s):r.removeAttribute("data-available")}})),l.drawer.querySelectorAll("[data-next-level]:not(.device-select)").forEach((function(e){var t=e.getAttribute("data-next-level"),i=l.levelMap.get(t);if(i){var a=r(i.querySelectorAll(".drawer__item")).some((function(e){return!e.hidden}));e.hidden=!a}}))})),t){if(t._drawerInstance)return t._drawerInstance;t._drawerInstance=this,this.drawer=t,this.id=t.getAttribute("data-drawer-id"),this.closeBtns=t.querySelectorAll("[data-drawer-close]"),this.backBtn=t.querySelector("[data-drawer-back]"),this.levels=r(t.querySelectorAll(".drawer__level")),this.selections=r(t.querySelectorAll(".drawer__item button[data-href]")),this.resetSelection=t.querySelector("[data-reset]"),this.deviceOptions=this.selections.map((function(e){return e.getAttribute("data-href")})),this.productCard=t.querySelector("[data-product-card]"),this.addToCart=t.querySelector("[quick-add-qf]"),this.preorderText=t.querySelector(".pre-order-text"),this.helpArea=t.querySelector("[data-help-area]"),this.titleElements=r(t.querySelectorAll(".drawer__title")),this.originalTitles=this.titleElements.map((function(e){var t;return(null===(t=e.textContent)||void 0===t?void 0:t.trim())||""})),this.helpTitleText=(null===(n=t.querySelector(".drawer__help-text"))||void 0===n||null===(n=n.textContent)||void 0===n?void 0:n.trim())||"Help",this.productLevelActive=!1,this.preselectedOpen=!1,this.deviceFilter=null,this.collectionDeviceOptions=null,this.levelMap=new Map(this.levels.map((function(e){return[e.getAttribute("data-level"),e]})).filter((function(e){return i(e,1)[0]}))),this.initialLevel="initial",this.currentLevel=this.initialLevel,this.history=[],this.leavingLevel=null,this.direction="forward",this._variantImages=[],this.init()}}),[{key:"init",value:function(){var e,t,r=this;this.drawer.addEventListener("click",(function(e){if(s.top()===r){var t=e.target.closest("[data-next-level]");if(t){e.preventDefault();var i=t.getAttribute("data-next-level");r.levelMap.has(i)&&(r.currentLevel!==i&&(r.history.push(r.currentLevel),r.direction="forward",r.currentLevel=i),r.updateVisibility())}}})),null===(e=this.backBtn)||void 0===e||e.addEventListener("click",this.goBackLevel),this.closeBtns.forEach((function(e){return e.addEventListener("click",r.close)})),this.selections.forEach((function(e){return e.addEventListener("click",r.handleDeviceSelection)})),null===(t=this.resetSelection)||void 0===t||t.addEventListener("click",this.handleDeviceSelection),window.addEventListener("cart_changed",this.close),this.updateVisibility(),this.id&&s.shouldBeOpen(this.id)&&(this.drawer.classList.add("is-open-no-animate"),this.drawer.setAttribute("aria-hidden","false"),s.register(this))}},{key:"toggleGroup",value:function(e,t){this.drawer.querySelectorAll(e).forEach((function(e){e.hidden=!t}))}},{key:"updateScrollbarWidth",value:function(){var e=window.innerWidth-document.documentElement.clientWidth;document.documentElement.style.setProperty("--scrollbar-width","".concat(e,"px"))}},{key:"setZIndex",value:function(e){this.drawer.style.zIndex=e}}])}();window.Drawer=v,window.DrawerManager=s,null===(e=document.querySelector("[data-drawer-overlay]"))||void 0===e||e.addEventListener("click",(function(){var e=s.top();e&&e.close()})),window.initDrawers=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=e.length?e.map((function(e){return'[data-drawer-id="'.concat(e,'"]')})).join(","):".drawer";document.querySelectorAll(t).forEach((function(e){var t=e._drawerInstance||new v(e);t.id&&s.shouldBeOpen(t.id)&&(t.drawer.classList.add("is-open-no-animate"),t.drawer.setAttribute("aria-hidden","false"),s.register(t))}))},document.addEventListener("click",(function(e){var t=e.target.closest("[data-drawer-toggle]");if(t){e.preventDefault(),e.stopPropagation();var r=t.getAttribute("data-drawer-toggle"),i=document.querySelector('[data-drawer-id="'.concat(r,'"]'));if(null!=i&&i._drawerInstance){var a=i._drawerInstance;a.drawer.classList.contains("is-open")||a.drawer.classList.contains("is-open-no-animate")?a.close({force:!0}):a.open(t)}}})),window.initDrawers(["variant-drawer","filter-drawer","upgrade-drawer"])})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.