; (self.AMP=self.AMP||[]).push({m:0,v:"2605071401000",n:"amp-selector",ev:"0.1",l:!0,f:function(t,e){!function(){var e;function i(){return e||(e=Promise.resolve(void 0))}function n(t,e){return(n=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function r(t){return(r=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function s(t,e){if(e&&("object"===o(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function u(t){return t?Array.prototype.slice.call(t):[]}function c(t,e){if(t.length!==e.length)return!1;for(var i=0;i=0,"'index' must be greater than 0"),j(e.index"),e&&void 0!==e.index?o.NF(e.index,e.value,i):Promise.reject("'index' must be specified")}),h),this.oe.addToAllowlist(R,["clear","selectDown","selectUp","toggle"],["email"]),this.element.addEventListener("amp:dom-update",this.Zq.bind(this))},g.mutatedAttributesCallback=function(t){var e=t.selected;void 0!==e&&this.dJ(e);var i=t.disabled;void 0!==i&&(i?this.element.setAttribute("aria-disabled","true"):this.element.removeAttribute("aria-disabled"))},g.dJ=function(t){var e=Array.isArray(t)?t:[t];if(null!==t&&0!=e.length){if(this.ZB||(e=e.slice(0,1)),!c(this.bJ().sort(),e.sort())){for(var i=e.reduce((function(t,e){return t[e]=!0,t}),Object.create(null)),n=0;n0&&n>0?i%n:(i%n+n)%n),s=this.Nt[o];this.yJ(s);var u=this.Nt[r];u&&this.wJ(u),this.kJ(),this.OJ(s,e)},g.Wq=function(t){if(this.element.hasAttribute("disabled"))return i();switch(t.key){case f:case d:case v:case p:case b:case m:return this.Qq!=A?this.xJ(t):i();case l:case" ":return this.EJ(t),i()}return i()},g.xJ=function(t){var e=this,n=this.win.document,r=0;switch(t.key){case f:r=y(n)?1:-1;break;case d:r=-1;break;case v:r=y(n)?-1:1;break;case p:case b:r=1;break;case m:r=-1;break;default:return i()}return t.preventDefault(),this.Nt[this.Nq].tabIndex=-1,this.RJ().then((function(i){var n,o,s,u,c=e.Nq;switch(t.key){case b:e.Nq=e.Nt.length-1;break;case m:e.Nq=0}do{e.Nq=(e.Nq+r)%e.Nt.length,e.Nq<0&&(e.Nq=e.Nq+e.Nt.length)}while(n=e.Nt[e.Nq],s=(o=i[e.Nq]).height,u=o.width,(n.hidden||0==u||0==s)&&e.Nq!=c);var a=e.Nt[e.Nq];a.tabIndex=0,function(t){try{t.focus()}catch(t){}}(a);var h=e.Nt[e.Nq];e.Qq==S&&e.jJ(h)}))},g.EJ=function(t){var e=t.key;if((" "==e||e==l)&&this.Nt.includes(t.target)){t.preventDefault();var i=t.target;this.jJ(i)}},g.wJ=function(t){t.removeAttribute("selected"),t.setAttribute("aria-selected","false");var e=this.Kq.indexOf(t);-1!==e&&this.Kq.splice(e,1)},g.Vq=function(){for(;this.Kq.length>0;){var t=this.Kq.pop();this.wJ(t)}this.kJ()},g.yJ=function(t){this.Kq.includes(t)||(this.ZB||this.Vq(),t.setAttribute("selected",""),t.setAttribute("aria-selected","true"),this.Kq.push(t))},g.getElementsForTesting=function(){return this.Nt},g.getSelectedElementsForTesting=function(){return this.Kq},g.RJ=function(){var t=this;return this.measureElement((function(){return t.Nt.map((function(t){return t.getBoundingClientRect()}))}))},w}(t.BaseElement);t.registerElement(R,U,"amp-selector [option]{cursor:pointer}amp-selector [option][selected]{cursor:auto;outline:1px solid rgba(0,0,0,.7)}amp-selector[multiple] [option][selected]{cursor:pointer;outline:1px solid rgba(0,0,0,.7)}amp-selector [disabled][option],amp-selector [selected][disabled],amp-selector[disabled] [option],amp-selector[disabled] [selected]{cursor:auto;outline:none}\n/*# sourceURL=/extensions/amp-selector/0.1/amp-selector.css*/")}(); /*! https://mths.be/cssescape v1.5.1 by @mathias | MIT license */}}); //# sourceMappingURL=amp-selector-0.1.js.map