; (self.AMP=self.AMP||[]).push({m:0,v:"2305252018001",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.TF(e.index,e.value,i):Promise.reject("'index' must be specified")}),h),this.Gr.addToAllowlist(R,["clear","selectDown","selectUp","toggle"],["email"]),this.element.addEventListener("amp:dom-update",this.WB.bind(this))},g.mutatedAttributesCallback=function(t){var e=t.selected;void 0!==e&&this.XB(e);var i=t.disabled;void 0!==i&&(i?this.element.setAttribute("aria-disabled","true"):this.element.removeAttribute("aria-disabled"))},g.XB=function(t){var e=Array.isArray(t)?t:[t];if(null!==t&&0!=e.length){if(this.UB||(e=e.slice(0,1)),!c(this.YB().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.Et[o];this.ZB(s);var u=this.Et[r];u&&this.$B(u),this.fH(),this.vH(s,e)},g.QB=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.JB!=A?this.pH(t):i();case l:case" ":return this.bH(t),i()}return i()},g.pH=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.Et[this.GB].tabIndex=-1,this.mH().then((function(i){var n,o,s,u,c=e.GB;switch(t.key){case b:e.GB=e.Et.length-1;break;case m:e.GB=0}do{e.GB=(e.GB+r)%e.Et.length,e.GB<0&&(e.GB=e.GB+e.Et.length)}while(n=e.Et[e.GB],s=(o=i[e.GB]).height,u=o.width,(n.hidden||0==u||0==s)&&e.GB!=c);var a=e.Et[e.GB];a.tabIndex=0,function(t){try{t.focus()}catch(t){}}(a);var h=e.Et[e.GB];e.JB==S&&e.dH(h)}))},g.bH=function(t){var e=t.key;if((" "==e||e==l)&&this.Et.includes(t.target)){t.preventDefault();var i=t.target;this.dH(i)}},g.$B=function(t){t.removeAttribute("selected"),t.setAttribute("aria-selected","false");var e=this.HB.indexOf(t);-1!==e&&this.HB.splice(e,1)},g.KB=function(){for(;this.HB.length>0;){var t=this.HB.pop();this.$B(t)}this.fH()},g.ZB=function(t){this.HB.includes(t)||(this.UB||this.KB(),t.setAttribute("selected",""),t.setAttribute("aria-selected","true"),this.HB.push(t))},g.getElementsForTesting=function(){return this.Et},g.getSelectedElementsForTesting=function(){return this.HB},g.mH=function(){var t=this;return this.measureElement((function(){return t.Et.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,0.7)}amp-selector[multiple] [option][selected]{cursor:pointer;outline:1px solid rgba(0,0,0,0.7)}amp-selector [disabled][option],amp-selector[disabled] [option],amp-selector[disabled] [selected],amp-selector [selected][disabled]{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