define(["exports","./../../layoutmanager.js"],function(_exports,_layoutmanager){function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(_isNativeReflectConstruct=function(){return!!t})()}function getLabel(select){for(var elem=select.parentElement.previousSibling;elem&&"LABEL"!==elem.tagName;)elem=elem.previousSibling;return elem}function onFocus(e){var label=getLabel(this);label&&label.classList.add("selectLabelFocused")}function onBlur(e){var label=getLabel(this);label&&label.classList.remove("selectLabelFocused")}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,require(["css!modules/emby-elements/emby-multilineselect/emby-multilineselect.css"]);var inputId=0;function onInit(){this.hasInit||(this.hasInit=!0,this.id||(this.id="emby-multilineselect"+inputId,inputId++),this.classList.add("emby-select-withcolor"),this.classList.add("emby-multilineselect-withcolor"),_layoutmanager.default.tv&&this.classList.add("emby-multilineselect-tv-withcolor"),_layoutmanager.default.tv&&(this.classList.add("emby-multilineselect-focusscale"),this.classList.add("emby-multilineselect-tv"),this.classList.contains("emby-multilineselect-inline"))&&this.classList.add("emby-multilineselect-tv-inline"),this.addEventListener("focus",onFocus),this.addEventListener("blur",onBlur))}var EmbyMultiLineSelect=function(_HTMLSelectElement){function EmbyMultiLineSelect(){babelHelpers.classCallCheck(this,EmbyMultiLineSelect),t=this,o=EmbyMultiLineSelect,o=babelHelpers.getPrototypeOf(o);var o,e,t=o=babelHelpers.possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],babelHelpers.getPrototypeOf(t).constructor):o.apply(t,e));return onInit.call(t),babelHelpers.possibleConstructorReturn(o,t)}return babelHelpers.inherits(EmbyMultiLineSelect,_HTMLSelectElement),babelHelpers.createClass(EmbyMultiLineSelect,[{key:"connectedCallback",value:function(){onInit.call(this),function(){var wrapper,container,label,insertLabel,labelText;this.classList.contains("emby-multilineselect")||(this.parentElement.classList.contains("emby-select-wrapper")?(container=(wrapper=this.parentElement).parentElement,this.classList.add("emby-multilineselect"),labelText=this.getAttribute("label")||"",(label=this.closest("label"))?(label.insertAdjacentHTML("afterbegin",'<div class="selectLabelText">'+labelText+"</div>"),label.classList.add("selectLabel")):((label=this.ownerDocument.createElement("label")).classList.add("selectLabel","selectLabelText"),label.innerHTML=labelText,label.htmlFor=this.id,insertLabel=!0),labelText="selectArrowContainer",this.classList.contains("emby-multilineselect-inline")&&(label.classList.add("selectLabel2-inline"),labelText+=" selectArrowContainer-inline"),insertLabel&&container.insertBefore(label,wrapper),this.classList.contains("emby-multilineselect-withcolor")&&this.parentNode.insertAdjacentHTML("beforeend",'<div class="'+labelText+'"><i class="selectArrow md-icon">&#xe313;</i></div>')):((insertLabel=document.createElement("div")).classList.add("emby-select-wrapper"),this.parentNode.replaceChild(insertLabel,this),insertLabel.appendChild(this)))}.call(this)}},{key:"setLabel",value:function(){!function(text){this.parentNode.parentNode.querySelector("label").innerHTML=text}.apply(this,arguments)}}])}(babelHelpers.wrapNativeSuper(HTMLSelectElement));customElements.define("emby-multilineselect",EmbyMultiLineSelect,{extends:"select"}),_exports.default=EmbyMultiLineSelect});