@syncfusion/ej2-buttons
Version:
A package of feature-rich Essential JS 2 components such as Button, CheckBox, RadioButton and Switch.
10 lines • 104 kB
JavaScript
/*!
* filename: ej2-buttons.umd.min.js
* version : 29.1.33
* Copyright Syncfusion Inc. 2001 - 2024. All rights reserved.
* Use of this code is subject to the terms of our license.
* A copy of the current license can be obtained at any time by e-mailing
* licensing@syncfusion.com. Any infringement will be prosecuted under
* applicable laws.
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@syncfusion/ej2-base")):"function"==typeof define&&define.amd?define(["exports","@syncfusion/ej2-base"],t):t((e=e||self).ej={},e.ej2Base)}(this,function(e,c){"use strict";function o(e,t,i,s,n,o){var r=s;if(s.tagName===t){for(var t=c.getValue("ej2_instances",s),r=e("input",{attrs:{type:i}}),l=["change","cssClass","label","labelPosition","id"],a=0,p=s.attributes.length;a<p;a++)-1===l.indexOf(s.attributes[a].nodeName)&&r.setAttribute(s.attributes[a].nodeName,s.attributes[a].nodeValue);c.attributes(s,{class:n}),s.appendChild(r),s.classList.add(o),s.classList.remove(o),c.setValue("ej2_instances",t,r),c.deleteObject(s,"ej2_instances")}return r}function D(e){for(var t,i=e.childNodes,s=0;s<i.length;s++)if(3===(t=i[s]).nodeType)return t;return null}function B(t,i,e){"INPUT"===e?(i.parentNode.insertBefore(t.element,i),c.detach(i),t.element.checked=!1,["name","value","disabled"].forEach(function(e){t.element.removeAttribute(e)})):(["role","aria-checked","class"].forEach(function(e){i.removeAttribute(e)}),i.innerHTML="",t.element=i)}function j(e,t,i,s,n){s=o(e.createElement,t,"checkbox",s,i,n),e.element=s,"checkbox"!==e.element.getAttribute("type")&&e.element.setAttribute("type","checkbox"),e.element.id||(e.element.id=c.getUniqueID("e-"+n))}function n(e,t){var i;t&&((i=document.createEvent("MouseEvents")).initEvent(e.type,!1,!0),t.dispatchEvent(i))}function F(e,t){e.element.getAttribute("ejs-for")&&t.appendChild(e.createElement("input",{attrs:{name:e.name||e.element.name,value:"false",type:"hidden"}}))}function U(){}_=function(e,t){return(_=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])}))(e,t)};var _,i,t=function(e,t){function i(){this.constructor=e}_(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},s=function(e,t,i,s){var n,o=arguments.length,r=o<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,s);else for(var l=e.length-1;0<=l;l--)(n=e[l])&&(r=(o<3?n(r):3<o?n(t,i,r):n(t,i))||r);return 3<o&&r&&Object.defineProperty(t,i,r),r},r=((r=e.IconPosition||(e.IconPosition={})).Left="Left",r.Right="Right",r.Top="Top",r.Bottom="Bottom",new c.Observer),l="e-rtl",W="e-btn",V="e-primary",q="e-icon-btn",t=(i=c.Component,t(a,i),a.prototype.preRender=function(){},a.prototype.render=function(){this.initialize(),this.removeRippleEffect=c.rippleEffect(this.element,{selector:"."+W}),this.renderComplete()},a.prototype.initialize=function(){var e;this.cssClass&&c.addClass([this.element],this.cssClass.replace(/\s+/g," ").trim().split(" ")),this.isPrimary&&this.element.classList.add(V),(!c.isBlazor()||c.isBlazor()&&"progress-btn"!==this.getModuleName())&&(this.content&&(e=this.enableHtmlSanitizer?c.SanitizeHtmlHelper.sanitize(this.content):this.content,this.element.innerHTML=e),this.setIconCss()),this.enableRtl&&this.element.classList.add(l),this.disabled?this.controlStatus(this.disabled):this.wireEvents()},a.prototype.controlStatus=function(e){this.element.disabled=e},a.prototype.setIconCss=function(){var e,t;this.iconCss&&(e=this.createElement("span",{className:"e-btn-icon "+this.iconCss}),this.element.textContent.trim()?(e.classList.add("e-icon-"+this.iconPosition.toLowerCase()),"Top"!==this.iconPosition&&"Bottom"!==this.iconPosition||this.element.classList.add("e-"+this.iconPosition.toLowerCase()+"-icon-btn")):this.element.classList.add(q),!(t=this.element.childNodes[0])||"Left"!==this.iconPosition&&"Top"!==this.iconPosition?this.element.appendChild(e):this.element.insertBefore(e,t))},a.prototype.wireEvents=function(){this.isToggle&&c.EventHandler.add(this.element,"click",this.btnClickHandler,this)},a.prototype.unWireEvents=function(){this.isToggle&&c.EventHandler.remove(this.element,"click",this.btnClickHandler)},a.prototype.btnClickHandler=function(){this.element.classList.contains("e-active")?this.element.classList.remove("e-active"):this.element.classList.add("e-active")},a.prototype.destroy=function(){var e=[V,l,q,"e-success","e-info","e-danger","e-warning","e-flat","e-outline","e-small","e-bigger","e-active","e-round","e-top-icon-btn","e-bottom-icon-btn"],e=(this.cssClass&&(e=e.concat(this.cssClass.split(/\s+/).filter(function(e){return 0<e.length}))),i.prototype.destroy.call(this),c.removeClass([this.element],e),this.element.getAttribute("class")||this.element.removeAttribute("class"),this.disabled&&this.element.removeAttribute("disabled"),this.content&&(this.element.innerHTML=this.element.innerHTML.replace(this.content,"")),this.element.querySelector("span.e-btn-icon"));e&&c.detach(e),this.unWireEvents(),c.isRippleEnabled&&this.removeRippleEffect()},a.prototype.getModuleName=function(){return"btn"},a.prototype.getPersistData=function(){return this.addOnPersist([])},a.Inject=function(){},a.prototype.onPropertyChanged=function(e,t){for(var i=this.element.querySelector("span.e-btn-icon"),s=0,n=Object.keys(e);s<n.length;s++)switch(n[s]){case"isPrimary":e.isPrimary?this.element.classList.add(V):this.element.classList.remove(V);break;case"disabled":this.controlStatus(e.disabled);break;case"iconCss":(i=this.element.querySelector("span.e-btn-icon"))?e.iconCss?(i.className="e-btn-icon "+e.iconCss,this.element.textContent.trim()&&("Left"===this.iconPosition?i.classList.add("e-icon-left"):i.classList.add("e-icon-right"))):c.detach(i):this.setIconCss();break;case"iconPosition":c.removeClass([this.element],["e-top-icon-btn","e-bottom-icon-btn"]),(i=this.element.querySelector("span.e-btn-icon"))&&c.detach(i),this.setIconCss();break;case"cssClass":t.cssClass&&c.removeClass([this.element],t.cssClass.split(/\s+/).filter(function(e){return 0<e.length})),e.cssClass&&c.addClass([this.element],e.cssClass.replace(/\s+/g," ").trim().split(" "));break;case"enableRtl":e.enableRtl?this.element.classList.add(l):this.element.classList.remove(l);break;case"content":D(this.element)||this.element.classList.remove(q),c.isBlazor()&&(!c.isBlazor()||this.isServerRendered||"progress-btn"===this.getModuleName())||(this.enableHtmlSanitizer&&(e.content=c.SanitizeHtmlHelper.sanitize(e.content)),this.element.innerHTML=e.content,this.setIconCss());break;case"isToggle":e.isToggle?c.EventHandler.add(this.element,"click",this.btnClickHandler,this):(c.EventHandler.remove(this.element,"click",this.btnClickHandler),c.removeClass([this.element],["e-active"]))}},a.prototype.click=function(){this.element.click()},a.prototype.focusIn=function(){this.element.focus()},s([c.Property("Left")],a.prototype,"iconPosition",void 0),s([c.Property("")],a.prototype,"iconCss",void 0),s([c.Property(!1)],a.prototype,"disabled",void 0),s([c.Property(!1)],a.prototype,"isPrimary",void 0),s([c.Property("")],a.prototype,"cssClass",void 0),s([c.Property("")],a.prototype,"content",void 0),s([c.Property(!1)],a.prototype,"isToggle",void 0),s([c.Property()],a.prototype,"locale",void 0),s([c.Property(!0)],a.prototype,"enableHtmlSanitizer",void 0),s([c.Event()],a.prototype,"created",void 0),s([c.NotifyPropertyChanges],a));function a(e,t){return i.call(this,e,t)||this}z=function(e,t){return(z=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])}))(e,t)};var z,K,s=function(e,t){function i(){this.constructor=e}z(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},p=function(e,t,i,s){var n,o=arguments.length,r=o<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,s);else for(var l=e.length-1;0<=l;l--)(n=e[l])&&(r=(o<3?n(r):3<o?n(t,i,r):n(t,i))||r);return 3<o&&r&&Object.defineProperty(t,i,r),r},X="e-check",Y="e-checkbox-disabled",h="e-frame",J="e-stop",G="e-label",d="e-ripple-container",Z="e-ripple-check",Q="e-ripple-stop",$="e-rtl",ee="e-checkbox-wrapper",te=["title","class","style","disabled","readonly","name","value","id","tabindex","aria-label","required"],s=(K=c.Component,s(u,K),u.prototype.changeState=function(e,t,i){var s=this.getWrapper(),n=null,o=null;s&&(o=s.getElementsByClassName(h)[0],c.isRippleEnabled)&&(n=s.getElementsByClassName(d)[0]),"check"===e?(o&&(o.classList.remove(J),o.classList.add(X)),n&&(n.classList.remove(Q),n.classList.add(Z)),this.element.checked=!0,(this.element.required||c.closest(this.element,"form")&&c.closest(this.element,"form").classList.contains("e-formvalidator"))&&this.validCheck&&!t&&i?(this.element.checked=!1,this.validCheck=!1):(this.element.required||c.closest(this.element,"form")&&c.closest(this.element,"form").classList.contains("e-formvalidator"))&&(this.validCheck=!0)):"uncheck"===e?(o&&c.removeClass([o],[X,J]),n&&c.removeClass([n],[Z,Q]),this.element.checked=!1,(this.element.required||c.closest(this.element,"form")&&c.closest(this.element,"form").classList.contains("e-formvalidator"))&&this.validCheck&&!t&&i?(this.element.checked=!0,this.validCheck=!1):(this.element.required||c.closest(this.element,"form")&&c.closest(this.element,"form").classList.contains("e-formvalidator"))&&(this.validCheck=!0)):(o&&(o.classList.remove(X),o.classList.add(J)),n&&(n.classList.remove(Z),n.classList.add(Q)),this.element.indeterminate=!0,this.indeterminate=!0)},u.prototype.clickHandler=function(e){var t;"INPUT"===e.target.tagName&&this.clickTriggered?(this.changeState(this.checked?"check":"uncheck"),this.clickTriggered=!1):("SPAN"!==e.target.tagName&&"LABEL"!==e.target.tagName&&!c.closest(e.target,".e-label")||(this.clickTriggered=!0),this.isMouseClick&&(this.focusOutHandler(),this.isMouseClick=!1),this.indeterminate?(this.changeState(this.checked?"check":"uncheck",!1,!0),this.indeterminate=!1,this.element.indeterminate=!1):this.checked?(this.changeState("uncheck",!1,!0),this.checked=!1):(this.changeState("check",!1,!0),this.checked=!0),t={checked:this.updateVueArrayModel(!1),event:e},this.trigger("change",t),e.stopPropagation())},u.prototype.destroy=function(){var t=this,i=this.getWrapper();K.prototype.destroy.call(this),this.wrapper&&(i=this.wrapper,this.disabled||this.unWireEvents(),"INPUT"===this.tagName?(this.getWrapper()&&i.parentNode&&i.parentNode.insertBefore(this.element,i),c.detach(i),this.element.checked=!1,this.indeterminate&&(this.element.indeterminate=!1),["name","value","disabled"].forEach(function(e){t.element.removeAttribute(e)})):(["class"].forEach(function(e){i.removeAttribute(e)}),i.innerHTML="",this.element=i,this.refreshing&&(["e-control","e-checkbox","e-lib"].forEach(function(e){t.element.classList.add(e)}),c.setValue("ej2_instances",[this],this.element))))},u.prototype.focusHandler=function(){this.isFocused=!0},u.prototype.focusOutHandler=function(){var e=this.getWrapper();e&&e.classList.remove("e-focus"),this.isFocused=!1},u.prototype.getModuleName=function(){return"checkbox"},u.prototype.getPersistData=function(){return this.addOnPersist(["checked","indeterminate"])},u.prototype.getWrapper=function(){return this.element&&this.element.parentElement?this.element.parentElement.parentElement:null},u.prototype.getLabel=function(){return this.element?this.element.parentElement:null},u.prototype.initialize=function(){c.isNullOrUndefined(this.initialCheckedValue)&&(this.initialCheckedValue=this.checked),this.name&&this.element.setAttribute("name",this.name),this.element.setAttribute("tabindex","0"),this.value&&(this.element.setAttribute("value",this.value),this.isVue)&&"boolean"==typeof this.value&&!0===this.value&&this.setProperties({checked:!0},!0),this.checked&&this.changeState("check",!0),this.indeterminate&&this.changeState(),this.disabled&&this.setDisabled()},u.prototype.initWrapper=function(){var e=this.element.parentElement,t=(e.classList.contains(ee)||(e=this.createElement("div",{className:ee}),this.element.parentNode&&this.element.parentNode.insertBefore(e,this.element)),this.createElement("label",{attrs:{for:this.htmlAttributes.id||this.element.id}})),i=this.createElement("span",{className:"e-icons "+h});e.classList.add("e-wrapper"),this.enableRtl&&e.classList.add($),this.cssClass&&c.addClass([e],this.cssClass.replace(/\s+/g," ").trim().split(" ")),e.appendChild(t),t.appendChild(this.element),F(this,t),t.appendChild(i),c.isRippleEnabled&&(e=this.createElement("span",{className:d}),"Before"===this.labelPosition?t.appendChild(e):t.insertBefore(e,i),c.rippleEffect(e,{duration:400,isCenterRipple:!0})),this.label&&this.setText(this.label)},u.prototype.keyUpHandler=function(){this.isFocused&&this.getWrapper().classList.add("e-focus")},u.prototype.labelMouseDownHandler=function(e){this.isMouseClick=!0,n(e,this.getWrapper().getElementsByClassName(d)[0])},u.prototype.labelMouseLeaveHandler=function(e){var t=this.getLabel().getElementsByClassName(d)[0];if(t){for(var i=t.querySelectorAll(".e-ripple-element").length-1;0<i;i--)t.removeChild(t.childNodes[i]);n(e,t)}},u.prototype.labelMouseUpHandler=function(e){this.isMouseClick=!0;var t=this.getWrapper().getElementsByClassName(d)[0];if(t){for(var i=t.querySelectorAll(".e-ripple-element"),s=0;s<i.length-1;s++)t.removeChild(t.childNodes[s]);n(e,t)}},u.prototype.onPropertyChanged=function(e,t){for(var i=this.getWrapper(),s=0,n=Object.keys(e);s<n.length;s++)switch(n[s]){case"checked":this.indeterminate=!1,this.element.indeterminate=!1,this.changeState(e.checked?"check":"uncheck");break;case"indeterminate":e.indeterminate?this.changeState():(this.element.indeterminate=!1,this.changeState(this.checked?"check":"uncheck"));break;case"disabled":e.disabled?(this.setDisabled(),this.wrapper=this.getWrapper(),this.unWireEvents()):(this.element.disabled=!1,i.classList.remove(Y),i.setAttribute("aria-disabled","false"),this.wireEvents());break;case"cssClass":t.cssClass&&c.removeClass([i],t.cssClass.split(/\s+/).filter(function(e){return 0<e.length})),e.cssClass&&c.addClass([i],e.cssClass.replace(/\s+/g," ").trim().split(" "));break;case"enableRtl":e.enableRtl?i.classList.add($):i.classList.remove($);break;case"label":this.setText(e.label);break;case"labelPosition":var o=i.getElementsByClassName(G)[0],r=i.getElementsByTagName("label")[0];c.detach(o),"After"===e.labelPosition?r.appendChild(o):r.insertBefore(o,i.getElementsByClassName(h)[0]);break;case"name":this.element.setAttribute("name",e.name);break;case"value":this.isVue&&"object"==typeof e.value||this.element.setAttribute("value",e.value);break;case"htmlAttributes":this.updateHtmlAttributeToWrapper()}},u.prototype.preRender=function(){var e=this.element;this.tagName=this.element.tagName,e=o(this.createElement,"EJS-CHECKBOX","checkbox",e,ee,"checkbox"),this.element=e,"checkbox"!==this.element.getAttribute("type")&&this.element.setAttribute("type","checkbox"),this.element.id||(this.element.id=c.getUniqueID("e-"+this.getModuleName()))},u.prototype.render=function(){this.initWrapper(),this.initialize(),this.disabled||this.wireEvents(),this.updateHtmlAttributeToWrapper(),this.updateVueArrayModel(!0),this.renderComplete(),this.wrapper=this.getWrapper()},u.prototype.setDisabled=function(){var e=this.getWrapper();this.element.disabled=!0,e.classList.add(Y),e.setAttribute("aria-disabled","true")},u.prototype.setText=function(e){var t,i=this.getWrapper();i&&((t=i.getElementsByClassName(G)[0])?t.innerHTML=this.enableHtmlSanitizer?c.SanitizeHtmlHelper.sanitize(e):e:(e=this.enableHtmlSanitizer?c.SanitizeHtmlHelper.sanitize(e):e,t=this.createElement("span",{className:G,innerHTML:e}),e=i.getElementsByTagName("label")[0],"Before"===this.labelPosition?e.insertBefore(t,i.getElementsByClassName(h)[0]):e.appendChild(t)))},u.prototype.changeHandler=function(e){e.stopPropagation()},u.prototype.formResetHandler=function(){this.checked=this.initialCheckedValue,this.element.checked=this.initialCheckedValue},u.prototype.unWireEvents=function(){var e=this.wrapper,e=(c.EventHandler.remove(e,"click",this.clickHandler),c.EventHandler.remove(this.element,"keyup",this.keyUpHandler),c.EventHandler.remove(this.element,"focus",this.focusHandler),c.EventHandler.remove(this.element,"focusout",this.focusOutHandler),e.getElementsByTagName("label")[0]),e=(e&&(c.EventHandler.remove(e,"mousedown",this.labelMouseDownHandler),c.EventHandler.remove(e,"mouseup",this.labelMouseUpHandler),c.EventHandler.remove(e,"mouseleave",this.labelMouseLeaveHandler)),c.closest(this.element,"form"));e&&c.EventHandler.remove(e,"reset",this.formResetHandler),"EJS-CHECKBOX"===this.tagName&&c.EventHandler.remove(this.element,"change",this.changeHandler)},u.prototype.wireEvents=function(){var e=this.getWrapper(),e=(c.EventHandler.add(e,"click",this.clickHandler,this),c.EventHandler.add(this.element,"keyup",this.keyUpHandler,this),c.EventHandler.add(this.element,"focus",this.focusHandler,this),c.EventHandler.add(this.element,"focusout",this.focusOutHandler,this),e.getElementsByTagName("label")[0]),e=(c.EventHandler.add(e,"mousedown",this.labelMouseDownHandler,this),c.EventHandler.add(e,"mouseup",this.labelMouseUpHandler,this),c.EventHandler.add(e,"mouseleave",this.labelMouseLeaveHandler,this),c.closest(this.element,"form"));e&&c.EventHandler.add(e,"reset",this.formResetHandler,this),"EJS-CHECKBOX"===this.tagName&&c.EventHandler.add(this.element,"change",this.changeHandler,this)},u.prototype.updateVueArrayModel=function(e){if(this.isVue&&"object"==typeof this.value){var t=this.element.value;if(t&&this.value){if(!e)return e=this.value.indexOf(t),this.checked?e<0&&this.value.push(t):-1<e&&this.value.splice(e,1),this.value;for(var i=0;i<this.value.length;i++)t===this.value[i]&&(this.changeState("check"),this.setProperties({checked:!0},!0))}}return this.validCheck?this.element.checked:!this.element.checked},u.prototype.updateHtmlAttributeToWrapper=function(){if(!c.isNullOrUndefined(this.htmlAttributes))for(var e=0,t=Object.keys(this.htmlAttributes);e<t.length;e++){var i=t[e],s=this.getWrapper();-1<te.indexOf(i)?"class"===i?c.addClass([s],this.htmlAttributes[""+i].split(" ")):("title"===i?s:"style"===i?this.getWrapper().getElementsByClassName(h)[0]:("disabled"===i&&"true"===this.htmlAttributes[""+i]&&this.setDisabled(),this.element)).setAttribute(i,this.htmlAttributes[""+i]):s.setAttribute(i,this.htmlAttributes[""+i])}},u.prototype.click=function(){this.element.click()},u.prototype.focusIn=function(){this.element.focus()},p([c.Event()],u.prototype,"change",void 0),p([c.Event()],u.prototype,"created",void 0),p([c.Property(!1)],u.prototype,"checked",void 0),p([c.Property("")],u.prototype,"cssClass",void 0),p([c.Property(!1)],u.prototype,"disabled",void 0),p([c.Property(!1)],u.prototype,"indeterminate",void 0),p([c.Property("")],u.prototype,"label",void 0),p([c.Property("After")],u.prototype,"labelPosition",void 0),p([c.Property("")],u.prototype,"name",void 0),p([c.Property("")],u.prototype,"value",void 0),p([c.Property(!0)],u.prototype,"enableHtmlSanitizer",void 0),p([c.Property({})],u.prototype,"htmlAttributes",void 0),p([c.NotifyPropertyChanges],u));function u(e,t){e=K.call(this,e,t)||this;return e.isFocused=!1,e.isMouseClick=!1,e.clickTriggered=!1,e.validCheck=!0,e.type="checkbox",e}ie=function(e,t){return(ie=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])}))(e,t)};var ie,se,ne,p=function(e,t){function i(){this.constructor=e}ie(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},f=function(e,t,i,s){var n,o=arguments.length,r=o<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,s);else for(var l=e.length-1;0<=l;l--)(n=e[l])&&(r=(o<3?n(r):3<o?n(t,i,r):n(t,i))||r);return 3<o&&r&&Object.defineProperty(t,i,r),r},oe="e-label",re="e-ripple-container",le="e-rtl",ae="e-radio-wrapper",pe=["title","class","style","disabled","readonly","name","value","id"],p=(se=c.Component,p(m,se),(ne=m).prototype.changeHandler=function(e){this.checked=!0,this.dataBind();var t=this.element.getAttribute("value"),t=(this.isVue&&t?this.element:this).value,i=typeof this.value;this.isVue&&"boolean"==i&&(t="true"===t),this.trigger("change",{value:t,event:e}),this.isAngular&&e.stopPropagation()},m.prototype.updateChange=function(){for(var e,t=this.getRadioGroup(),i=0;i<t.length;i++)(e=t[i])!==this.element&&((e=c.getInstance(e,ne)).checked=!1,"EJS-RADIOBUTTON"===this.tagName)&&(e.angularValue=this.value)},m.prototype.destroy=function(){var t=this,i=this.wrapper;se.prototype.destroy.call(this),i&&(this.disabled||this.unWireEvents(),"INPUT"===this.tagName?(i.parentNode&&i.parentNode.insertBefore(this.element,i),c.detach(i),this.element.checked=!1,["name","value","disabled"].forEach(function(e){t.element.removeAttribute(e)})):(["role","aria-checked","class"].forEach(function(e){i.removeAttribute(e)}),i.innerHTML="",this.element=this.wrapper,this.refreshing&&(["e-control","e-radio","e-lib"].forEach(function(e){t.element.classList.add(e)}),c.setValue("ej2_instances",[this],this.element))))},m.prototype.focusHandler=function(){this.isFocused=!0},m.prototype.focusOutHandler=function(){var e=this.getLabel();e&&e.classList.remove("e-focus")},m.prototype.getModuleName=function(){return"radio"},m.prototype.getSelectedValue=function(){for(var e,t=this.getRadioGroup(),i=0,s=t.length;i<s;i++)if((e=t[i]).checked)return e.value;return""},m.prototype.getRadioGroup=function(){return document.querySelectorAll('input.e-radio[name="'+this.element.getAttribute("name")+'"]')},m.prototype.getPersistData=function(){return this.addOnPersist(["checked"])},m.prototype.getWrapper=function(){return this.element.parentElement||null},m.prototype.getLabel=function(){return this.element.nextElementSibling||null},m.prototype.initialize=function(){c.isNullOrUndefined(this.initialCheckedValue)&&(this.initialCheckedValue=this.checked),this.initWrapper(),this.updateHtmlAttribute(),this.name&&this.element.setAttribute("name",this.name);var e=this.element.getAttribute("value"),t=typeof this.value;this.isVue&&"boolean"==t&&(e="true"===e),(this.isVue?this.value&&"boolean"!=t&&!e:this.value)&&this.element.setAttribute("value",this.value),this.checked&&(this.element.checked=!0),this.disabled&&this.setDisabled()},m.prototype.initWrapper=function(){var e,t=this.element.parentElement,i=(t.classList.contains(ae)||(t=this.createElement("div",{className:ae}),this.element.parentNode&&this.element.parentNode.insertBefore(t,this.element)),this.createElement("label",{attrs:{for:this.element.id}}));t.appendChild(this.element),t.appendChild(i),c.isRippleEnabled&&(e=this.createElement("span",{className:re}),i.appendChild(e),c.rippleEffect(e,{duration:400,isCenterRipple:!0})),t.classList.add("e-wrapper"),this.enableRtl&&i.classList.add(le),this.cssClass&&c.addClass([t],this.cssClass.replace(/\s+/g," ").trim().split(" ")),this.label&&this.setText(this.label)},m.prototype.keyUpHandler=function(){this.isFocused&&this.getLabel().classList.add("e-focus")},m.prototype.labelMouseDownHandler=function(e){n(e,this.getLabel().getElementsByClassName(re)[0])},m.prototype.labelMouseLeaveHandler=function(e){var t=this.getLabel().getElementsByClassName(re)[0];if(t){for(var i=t.querySelectorAll(".e-ripple-element").length-1;0<i;i--)t.removeChild(t.childNodes[i]);n(e,t)}},m.prototype.labelMouseUpHandler=function(e){var t=this.getLabel().getElementsByClassName(re)[0];if(t){for(var i=t.querySelectorAll(".e-ripple-element").length-1;0<i;i--)t.removeChild(t.childNodes[i]);n(e,t)}},m.prototype.formResetHandler=function(){this.checked=this.initialCheckedValue,this.initialCheckedValue&&c.attributes(this.element,{checked:"true"})},m.prototype.onPropertyChanged=function(e,t){for(var i=this.getWrapper(),s=this.getLabel(),n=0,o=Object.keys(e);n<o.length;n++)switch(o[n]){case"checked":e.checked&&this.updateChange(),this.element.checked=e.checked;break;case"disabled":e.disabled?(this.setDisabled(),this.unWireEvents()):(this.element.disabled=!1,this.wireEvents());break;case"cssClass":t.cssClass&&c.removeClass([i],t.cssClass.split(/\s+/).filter(function(e){return 0<e.length})),e.cssClass&&c.addClass([i],e.cssClass.replace(/\s+/g," ").trim().split(" "));break;case"enableRtl":e.enableRtl?s.classList.add(le):s.classList.remove(le);break;case"label":this.setText(e.label);break;case"labelPosition":"Before"===e.labelPosition?s.classList.add("e-right"):s.classList.remove("e-right");break;case"name":this.element.setAttribute("name",e.name);break;case"value":var r=typeof this.htmlAttributes.value;!c.isNullOrUndefined(this.htmlAttributes)&&(this.htmlAttributes.value||"boolean"==r&&!this.htmlAttributes.value)||this.element.setAttribute("value",e.value);break;case"htmlAttributes":this.updateHtmlAttribute()}},m.prototype.preRender=function(){var e=this.element;this.formElement=c.closest(this.element,"form"),this.tagName=this.element.tagName,e=o(this.createElement,"EJS-RADIOBUTTON","radio",e,ae,"radio"),this.element=e,"radio"!==this.element.getAttribute("type")&&this.element.setAttribute("type","radio"),this.element.id||(this.element.id=c.getUniqueID("e-"+this.getModuleName())),"EJS-RADIOBUTTON"===this.tagName&&(e=this.element.getAttribute("formcontrolname"))&&(this.setProperties({name:e},!0),this.element.setAttribute("name",e))},m.prototype.render=function(){this.initialize(),this.disabled||this.wireEvents(),this.renderComplete(),this.wrapper=this.getWrapper()},m.prototype.setDisabled=function(){this.element.disabled=!0},m.prototype.setText=function(e){var t=this.getLabel(),i=t.getElementsByClassName(oe)[0];i?i.textContent=e:(e=this.enableHtmlSanitizer?c.SanitizeHtmlHelper.sanitize(e):e,i=this.createElement("span",{className:oe,innerHTML:e}),t.appendChild(i)),"Before"===this.labelPosition?this.getLabel().classList.add("e-right"):this.getLabel().classList.remove("e-right")},m.prototype.updateHtmlAttribute=function(){if(!c.isNullOrUndefined(this.htmlAttributes))for(var e=0,t=Object.keys(this.htmlAttributes);e<t.length;e++){var i=t[e],s=this.element.parentElement;-1<pe.indexOf(i)?"class"===i?c.addClass([s],this.htmlAttributes[""+i].replace(/\s+/g," ").trim().split(" ")):("title"===i||"style"===i?s:this.element).setAttribute(i,this.htmlAttributes[""+i]):s.setAttribute(i,this.htmlAttributes[""+i])}},m.prototype.unWireEvents=function(){var e=this.wrapper,e=(c.EventHandler.remove(this.element,"change",this.changeHandler),c.EventHandler.remove(this.element,"focus",this.focusHandler),c.EventHandler.remove(this.element,"focusout",this.focusOutHandler),c.EventHandler.remove(this.element,"keyup",this.keyUpHandler),e.getElementsByTagName("label")[0]);e&&(c.EventHandler.remove(e,"mousedown",this.labelMouseDownHandler),c.EventHandler.remove(e,"mouseup",this.labelMouseUpHandler),c.EventHandler.remove(e,"mouseleave",this.labelMouseLeaveHandler)),this.formElement&&c.EventHandler.remove(this.formElement,"reset",this.formResetHandler)},m.prototype.wireEvents=function(){var e=this.getLabel(),e=(c.EventHandler.add(this.element,"change",this.changeHandler,this),c.EventHandler.add(this.element,"keyup",this.keyUpHandler,this),c.EventHandler.add(this.element,"focus",this.focusHandler,this),c.EventHandler.add(this.element,"focusout",this.focusOutHandler,this),e.getElementsByClassName(oe)[0]);e&&(c.EventHandler.add(e,"mousedown",this.labelMouseDownHandler,this),c.EventHandler.add(e,"mouseup",this.labelMouseUpHandler,this),c.EventHandler.add(e,"mouseleave",this.labelMouseLeaveHandler,this)),this.formElement&&c.EventHandler.add(this.formElement,"reset",this.formResetHandler,this)},m.prototype.click=function(){this.element.click()},m.prototype.focusIn=function(){this.element.focus()},f([c.Event()],m.prototype,"change",void 0),f([c.Event()],m.prototype,"created",void 0),f([c.Property(!1)],m.prototype,"checked",void 0),f([c.Property("")],m.prototype,"cssClass",void 0),f([c.Property(!1)],m.prototype,"disabled",void 0),f([c.Property("")],m.prototype,"label",void 0),f([c.Property("After")],m.prototype,"labelPosition",void 0),f([c.Property("")],m.prototype,"name",void 0),f([c.Property("")],m.prototype,"value",void 0),f([c.Property(!0)],m.prototype,"enableHtmlSanitizer",void 0),f([c.Property({})],m.prototype,"htmlAttributes",void 0),ne=f([c.NotifyPropertyChanges],m));function m(e,t){e=se.call(this,e,t)||this;return e.isFocused=!1,e.type="radio",e}ce=function(e,t){return(ce=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])}))(e,t)};var ce,he,f=function(e,t){function i(){this.constructor=e}ce(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},y=function(e,t,i,s){var n,o=arguments.length,r=o<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,s);else for(var l=e.length-1;0<=l;l--)(n=e[l])&&(r=(o<3?n(r):3<o?n(t,i,r):n(t,i))||r);return 3<o&&r&&Object.defineProperty(t,i,r),r},de="e-switch-disabled",v="e-ripple-container",ue="e-ripple-check",fe="e-rtl",me="e-switch-wrapper",ye="e-switch-active",ve=["title","class","style","disabled","readonly","name","value","aria-label","id","role","tabindex"],f=(he=c.Component,f(g,he),g.prototype.changeState=function(e){var t=null,i=this.getWrapper(),s=i.querySelector(".e-switch-inner"),n=i.querySelector(".e-switch-handle");c.isRippleEnabled&&(t=i.getElementsByClassName(v)[0]),e?(c.addClass([s,n],ye),this.element.checked=!0,this.checked=!0,t&&c.addClass([t],[ue])):(c.removeClass([s,n],ye),this.element.checked=!1,this.checked=!1,t&&c.removeClass([t],[ue]))},g.prototype.clickHandler=function(e){this.isDrag=!1,this.focusOutHandler();var t={event:e,cancel:!1,checked:this.checked};this.trigger("beforeChange",t),t.cancel||(this.changeState(!t.checked),this.element.focus(),t={checked:this.element.checked,event:e},this.trigger("change",t))},g.prototype.destroy=function(){var t=this;he.prototype.destroy.call(this),this.disabled||this.unWireEvents(),this.formElement&&c.EventHandler.remove(this.formElement,"reset",this.formResetHandler),B(this,this.getWrapper(),this.tagName),this.refreshing&&(["e-control","e-switch","e-lib"].forEach(function(e){t.element.classList.add(e)}),c.setValue("ej2_instances",[this],this.element))},g.prototype.focusHandler=function(){this.isFocused=!0},g.prototype.focusOutHandler=function(){this.getWrapper().classList.remove("e-focus")},g.prototype.getModuleName=function(){return"switch"},g.prototype.getPersistData=function(){return this.addOnPersist(["checked"])},g.prototype.getWrapper=function(){return this.element.parentElement||null},g.prototype.initialize=function(){this.element.setAttribute("role","switch"),c.isNullOrUndefined(this.initialSwitchCheckedValue)&&(this.initialSwitchCheckedValue=this.checked),this.name&&this.element.setAttribute("name",this.name),this.value&&this.element.setAttribute("value",this.value),this.checked&&this.changeState(!0),this.disabled&&this.setDisabled(),(this.onLabel||this.offLabel)&&this.setLabel(this.onLabel,this.offLabel)},g.prototype.initWrapper=function(){var e=this.element.parentElement,t=(e.classList.contains(me)||(e=this.createElement("div",{className:me}),this.element.parentNode.insertBefore(e,this.element)),this.createElement("span",{className:"e-switch-inner"})),i=this.createElement("span",{className:"e-switch-on"}),s=this.createElement("span",{className:"e-switch-off"}),n=this.createElement("span",{className:"e-switch-handle"});e.appendChild(this.element),F(this,e),t.appendChild(i),t.appendChild(s),e.appendChild(t),e.appendChild(n),c.isRippleEnabled&&(i=this.createElement("span",{className:v}),n.appendChild(i),c.rippleEffect(i,{duration:400,isCenterRipple:!0})),e.classList.add("e-wrapper"),this.enableRtl&&e.classList.add(fe),this.cssClass&&c.addClass([e],this.cssClass.replace(/\s+/g," ").trim().split(" "))},g.prototype.onPropertyChanged=function(e,t){for(var i=this.getWrapper(),s=0,n=Object.keys(e);s<n.length;s++)switch(n[s]){case"checked":this.changeState(e.checked);break;case"disabled":e.disabled?(this.setDisabled(),this.unWireEvents(),this.isWireEvents=!1):(this.element.disabled=!1,i.classList.remove(de),i.setAttribute("aria-disabled","false"),this.isWireEvents||(this.wireEvents(),this.isWireEvents=!0));break;case"value":this.element.setAttribute("value",e.value);break;case"name":this.element.setAttribute("name",e.name);break;case"onLabel":case"offLabel":this.setLabel(e.onLabel,e.offLabel);break;case"enableRtl":e.enableRtl?i.classList.add(fe):i.classList.remove(fe);break;case"cssClass":t.cssClass&&c.removeClass([i],t.cssClass.split(/\s+/).filter(function(e){return 0<e.length})),e.cssClass&&c.addClass([i],e.cssClass.replace(/\s+/g," ").trim().split(" "));break;case"htmlAttributes":this.updateHtmlAttribute()}},g.prototype.preRender=function(){var e=this.element;this.formElement=c.closest(this.element,"form"),this.tagName=this.element.tagName,j(this,"EJS-SWITCH",me,e,this.getModuleName())},g.prototype.render=function(){this.initWrapper(),this.initialize(),this.disabled||this.wireEvents(),this.formElement&&c.EventHandler.add(this.formElement,"reset",this.formResetHandler,this),this.renderComplete(),this.updateHtmlAttribute()},g.prototype.rippleHandler=function(e){n(e,this.getWrapper().getElementsByClassName(v)[0]),"mousedown"===e.type&&e.currentTarget.classList.contains("e-switch-wrapper")&&1===e.which&&(this.isDrag=!0,this.isFocused=!1)},g.prototype.mouseLeaveHandler=function(e){var t=this.element.parentElement.getElementsByClassName(v)[0];if(t){for(var i=t.querySelectorAll(".e-ripple-element").length-1;0<i;i--)t.removeChild(t.childNodes[i]);n(e,t)}},g.prototype.rippleTouchHandler=function(e){var t,i=this.getWrapper().getElementsByClassName(v)[0];i&&((t=document.createEvent("MouseEvents")).initEvent(e,!1,!0),i.dispatchEvent(t))},g.prototype.setDisabled=function(){var e=this.getWrapper();this.element.disabled=!0,e.classList.add(de),e.setAttribute("aria-disabled","true")},g.prototype.setLabel=function(e,t){var i=this.getWrapper();e&&(i.querySelector(".e-switch-on").textContent=e),t&&(i.querySelector(".e-switch-off").textContent=t)},g.prototype.updateHtmlAttribute=function(){if(!c.isNullOrUndefined(this.htmlAttributes))for(var e=0,t=Object.keys(this.htmlAttributes);e<t.length;e++){var i=t[e],s=this.getWrapper();-1<ve.indexOf(i)?"class"===i?c.addClass([s],this.htmlAttributes[""+i].split(" ")):("title"===i||"style"===i?s:("disabled"===i&&"true"===this.htmlAttributes[""+i]&&this.setDisabled(),this.element)).setAttribute(i,this.htmlAttributes[""+i]):s.setAttribute(i,this.htmlAttributes[""+i])}},g.prototype.switchFocusHandler=function(e){this.isFocused&&this.getWrapper().classList.add("e-focus"),e&&"keyup"===e.type&&"Space"===e.code&&this.isAngular&&(this.clickHandler(e),e.stopPropagation(),e.preventDefault())},g.prototype.switchMouseUp=function(e){var t,i,s=0,n=0,o=e.target;"touchmove"===e.type&&(e.preventDefault(),i=e.changedTouches[0].clientX,t=e.changedTouches[0].clientY,n=this.bTouchX-i,s=this.bTouchY-t,Math.abs(n)<Math.abs(s)?(this.isDrag=!1,this.rippleTouchHandler("mouseup")):this.isDrag=!0),"touchstart"===e.type&&(this.bTouchX=e.changedTouches[0].clientX,this.bTouchY=e.changedTouches[0].clientY,this.isDrag=!0,this.rippleTouchHandler("mousedown")),this.isDrag&&("mouseup"===e.type&&o.className.indexOf("e-switch")<0||"touchend"===e.type)&&(n=this.bTouchX-e.changedTouches[0].clientX,s=this.bTouchY-e.changedTouches[0].clientY,Math.abs(n)>=Math.abs(s))&&(this.clickHandler(e),this.rippleTouchHandler("mouseup"),e.preventDefault())},g.prototype.formResetHandler=function(){this.checked=this.initialSwitchCheckedValue,this.element.checked=this.initialSwitchCheckedValue},g.prototype.toggle=function(){this.clickHandler()},g.prototype.wireEvents=function(){var e=this.getWrapper();this.delegateMouseUpHandler=this.switchMouseUp.bind(this),this.delegateKeyUpHandler=this.switchFocusHandler.bind(this),c.EventHandler.add(e,"click",this.clickHandler,this),c.EventHandler.add(this.element,"focus",this.focusHandler,this),c.EventHandler.add(this.element,"focusout",this.focusOutHandler,this),c.EventHandler.add(this.element,"mouseup",this.delegateMouseUpHandler,this),c.EventHandler.add(this.element,"keyup",this.delegateKeyUpHandler,this),c.EventHandler.add(e,"mousedown mouseup",this.rippleHandler,this),c.EventHandler.add(e,"mouseleave",this.mouseLeaveHandler,this),c.EventHandler.add(e,"touchstart touchmove touchend",this.switchMouseUp,this)},g.prototype.unWireEvents=function(){var e=this.getWrapper();c.EventHandler.remove(e,"click",this.clickHandler),c.EventHandler.remove(this.element,"focus",this.focusHandler),c.EventHandler.remove(this.element,"focusout",this.focusOutHandler),c.EventHandler.remove(this.element,"mouseup",this.delegateMouseUpHandler),c.EventHandler.remove(this.element,"keyup",this.delegateKeyUpHandler),c.EventHandler.remove(e,"mousedown mouseup",this.rippleHandler),c.EventHandler.remove(e,"mouseleave",this.mouseLeaveHandler),c.EventHandler.remove(e,"touchstart touchmove touchend",this.switchMouseUp)},g.prototype.click=function(){this.element.click()},g.prototype.focusIn=function(){this.element.focus()},y([c.Event()],g.prototype,"beforeChange",void 0),y([c.Event()],g.prototype,"change",void 0),y([c.Event()],g.prototype,"created",void 0),y([c.Property(!1)],g.prototype,"checked",void 0),y([c.Property("")],g.prototype,"cssClass",void 0),y([c.Property(!1)],g.prototype,"disabled",void 0),y([c.Property("")],g.prototype,"name",void 0),y([c.Property("")],g.prototype,"onLabel",void 0),y([c.Property("")],g.prototype,"offLabel",void 0),y([c.Property("")],g.prototype,"value",void 0),y([c.Property({})],g.prototype,"htmlAttributes",void 0),y([c.NotifyPropertyChanges],g));function g(e,t){e=he.call(this,e,t)||this;return e.isFocused=!1,e.isDrag=!1,e.isWireEvents=!1,e}ge=function(e,t){return(ge=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])}))(e,t)};var ge,be,Ee,y=function(e,t){function i(){this.constructor=e}ge(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},b=function(e,t,i,s){var n,o=arguments.length,r=o<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,s);else for(var l=e.length-1;0<=l;l--)(n=e[l])&&(r=(o<3?n(r):3<o?n(t,i,r):n(t,i))||r);return 3<o&&r&&Object.defineProperty(t,i,r),r},E={chipSet:"e-chip-set",chip:"e-chip",avatar:"e-chip-avatar",text:"e-chip-text",icon:"e-chip-icon",delete:"e-chip-delete",deleteIcon:"e-dlt-btn",multiSelection:"e-multi-selection",singleSelection:"e-selection",active:"e-active",chipWrapper:"e-chip-avatar-wrap",iconWrapper:"e-chip-icon-wrap",focused:"e-focused",disabled:"e-disabled",rtl:"e-rtl",template:"e-chip-template",chipList:"e-chip-list",customIcon:"e-icons",chipDrag:"e-chip-drag",dragAndDrop:"e-drag-and-drop",dropRestricted:"e-error-treeview",cloneChip:"e-clone-chip",dragIndicator:"e-drag-indicator"},y=(be=c.Component,y(C,be),(Ee=C).prototype.preRender=function(){},C.prototype.chipType=function(){return this.chips&&this.chips.length&&0<this.chips.length},C.prototype.render=function(){this.type=(c.isNullOrUndefined(this.chips)||!this.chips.length)&&(this.text||this.element.innerText)?"chip":"chipset",this.setAttributes(),this.createChip(),this.setRtl(),this.select(this.selectedChips),this.wireEvent(!1),this.rippleFunction=c.rippleEffect(this.element,{selector:"."+E.chip}),this.renderComplete(),this.dragCollection=[],this.allowDragAndDrop&&this.enableDraggingChips()},C.prototype.enableDraggingChips=function(){var n,o=this;this.element.querySelectorAll("."+E.chip).forEach(function(e,s){o.dragObj=new c.Draggable(e,{preventDefault:!1,clone:!0,dragArea:o.dragArea,helper:function(){return(n=e.cloneNode(!0)).classList.add(E.cloneChip),o.element.appendChild(n),n},dragStart:function(e){o.dragIndicator=o.createElement("div",{className:E.dragIndicator}),document.body.appendChild(o.dragIndicator);var t=o.find(e.element),i={cancel:!1,event:e.event,draggedItem:e.element,draggedItemData:t,dropTarget:null};o.trigger("dragStart",i,function(){c.isNullOrUndefined(i.cancel)&&(i.cancel=!1)}),i.cancel?o.dragObj.intDestroy(e.event):n.setAttribute("drag-indicator-index",s.toString())},drag:function(e){var t=o.find(e.element),t={event:e.event,draggedItem:e.element,draggedItemData:t,dropTarget:null},t=(o.trigger("dragging",t),n.querySelector("."+E.chipDrag));c.isNullOrUndefined(t)&&(t=o.createElement("span",{className:E.customIcon+" "+E.dragAndDrop+" "+E.chipDrag}),n.prepend(t)),o.allowExternalDragging(e,n,t)},dragStop:function(e){var t=o.find(e.element),i={cancel:!1,event:e.event,draggedItem:e.element,draggedItemData:t,dropTarget:e.target};o.trigger("dragStop",i,function(){c.isNullOrUndefined(i.cancel)&&(i.cancel=!1)}),i.cancel||o.allowExternalDrop(e,n),c.isNullOrUndefined(o.dragIndicator)||c.remove(o.dragIndicator),c.isNullOrUndefined(n)||n.remove()}}),-1===o.dragCollection.indexOf(o.dragObj)&&o.dragCollection.push(o.dragObj)})},C.prototype.checkInstance=function(e,t){t=!c.isNullOrUndefined(e.target.closest("."+E.chipList))&&e.target.closest("."+E.chipList).id!==t.element.id;return t&&(this.updatedInstance=e.target.closest("."+E.chipList)),t},C.prototype.setIcons=function(e,t,i,s,n){e=e.element.contains(i),i=i.closest(".e-droppable");!e&&!i||n?(t.classList.remove(E.dragAndDrop),t.classList.add(E.dropRestricted),s.style.display="none"):(t.classList.add(E.dragAndDrop),t.classList.remove(E.dropRestricted),i&&(s.style.display="none"))},C.prototype.allowExternalDragging=function(e,s,t){var i,n=null,o=1/0,r=-1;if(this.checkInstance(e,this)){if(this.dragIndicator.style.display="none",(i=this.getCurrentInstance(e)).dragIndicator=this.dragIndicator,!i.allowDragAndDrop)return}else i=this;var l,a=i.dragIndicator,p=(a.style.display="inline",c=this.dragAreaCheck(this.dragArea,e.target,!1,t,a),this.setIcons(i,t,e.target,a,c),i.element.appendChild(s),s.getBoundingClientRect()),t=Array.from(i.element.querySelectorAll("."+E.chip)),e=(t.forEach(function(e,t){var i;e!==s&&(i=e.getBoundingClientRect(),(i=Math.sqrt(Math.pow(p.left-i.left,2)+Math.pow(p.top-i.top,2)))<o)&&(o=i,n=e,r=t)}),-1===r&&(r=t.length),this.getChipsDistance(i)),c=s.getBoundingClientRect();(n||0<t.length)&&(l=(n||t[t.length-1]).getBoundingClientRect(),a.style.top=l.top+window.scrollY+"px",a.style.left=i.enableRtl?l.right+e+"px":l.left-e+window.scrollX+"px"),i.enableRtl?c.left<l.left-l.width/2&&c.top>l.top&&(a.style.left=l.left-e+window.scrollX+"px"):c.left>l.left+l.width/2&&c.top>l.top&&(a.style.left=l.left+l.width+e+window.scrollX+"px")},C.prototype.dragAreaCheck=function(e,t,i,s,n){var o,r;return!c.isNullOrUndefined(e)&&(o="string"==typeof e,r=e instanceof HTMLElement,e=o?document.querySelector(e):e,c.isNullOrUndefined(e)||!o&&!r||e.contains(t)||(i=!0,n.style.display="none",s.classList.add(E.dropRestricted),s.classList.remove(E.dragAndDrop)),i)},C.prototype.getChipsDistance=function(e){var t,i,s;return e.chips.length<=1?4:(s=e.find(0).element.getBoundingClientRect(),t=e.find(1).element.getBoundingClientRect(),i=s.left,e.enableRtl?i<(e=t.right)?4:(i-e)/2:(e=s.width,(s=t.left)<i+e?4:(s-(i+e))/2))},C.prototype.getCurrentInstance=function(e){var t=e.target.closest("."+E.chipList);if(!c.isNullOrUndefined(t)&&!c.isNullOrUndefined(t.ej2_instances))for(var i=0;i<t.ej2_instances.length;i++)if(t.ej2_instances[parseInt(i.toString(),10)]instanceof Ee)return t.ej2_instances[i];return null},C.prototype.allowExternalDrop=function(e,t){var i,s=parseInt(t.getAttribute("drag-indicator-index"),10),n=!1;if(this.checkInstance(e,this)){if(n=!0,!(i=this.getCurrentInstance(e)).allowDragAndDrop)return}else i=this;var o=i.dragIndicator;if(o.style.display="inline",i.element.contains(e.target)&&!this.dragAreaCheck(this.dragArea,e.target,!1,t.querySelector("."+E.chipDrag),o)){for(var r=o.getBoundingClientRect(),l=Array.from(i.element.querySelectorAll("."+E.chip)),a=-1,p=0;p<l.length;p++)if(l[p]!==t){var c=l[p].getBoundingClientRect(),h=r.top<c.top+c.height/2,d=r.left<c.left+c.width/2,u=r.left>c.left+c.width/2;if(!i.enableRtl&&h&&d||i.enableRtl&&h&&u){s<(a=p)&&!n&&(a=p-1);break}}if(-1===a){for(var f=void 0,p=0;p<l.length;p++)if((c=l[p].getBoundingClientRect()).top>r.top||c.top===r.top&&c.left>r.left){f=p;break}a=f!==l.length?f:l.length}e=Array.from(this.chips);n?this.dropChip(e,s,i,a,!0):a!==s&&this.dropChip(e,s,i,a,!1)}},C.prototype.dropChip=function(e,t,i,s,n){t=e.splice(t,1)[0];n?((n=Array.from(i.chips)).splice(s,0,t),i.chips=n):(e.splice(s,0,t),i.chips=e),this.chips=e,i.dataBind(),this.dataBind(),i.enableDraggingChips()},C.prototype.createChip=function(){this.innerText=this.element.innerText&&0!==this.element.innerText.length?this.element.innerText.trim():this.element.innerText,this.element.innerHTML="",this.chipCreation("chip"===this.type?[this.innerText||this.text]:this.chips)},C.prototype.setAttributes=function(){"chip"===this.type?(this.enabled&&(this.element.tabIndex=0),this.element.setAttribute("role","button")):(this.element.classList.add(E.chipSet),this.element.setAttribute("role","listbox"),"Multiple"===this.selection?(this.element.classList.add(E.multiSelection),this.element.setAttribute("aria-multiselectable","true")):("Single"===this.selection&&this.element.classList.add(E.singleSelection),this.element.setAttribute("aria-multiselectable","false")))},C.prototype.setRtl=function(){this.element.classList[this.enableRtl?"add":"remove"](E.rtl)},C.prototype.renderTemplates=function(){this.isReact&&this.renderReactTemplates()},C.prototype.templateParser=function(t){if(t)try{return"function"!=typeof t&&document.querySelectorAll(t).length?c.compile(document.querySelector(t).innerHTML.trim()):c.compile(t)}catch(e){return c.compile(t)}},C.prototype.chipCreation=function(e){if(!c.isNullOrUndefined(e)){for(var t=[],i=[],s=0;s<e.length;s++){var n=this.getFieldValues(e[s]),o=n.htmlAttributes,o=(i.push(o),this.elementCreation(n)),r=(E.chip+" "+(n.enabled?" ":E.disabled)+" "+(n.avatarIconCss||n.avatarText?E.chipWrapper:n.leadingIconCss?E.iconWrapper:" ")+" "+n.cssClass).split(" ").filter(function(e){return e});if(this.chipType()&&"chip"!==this.type){var l=this.createElement("DIV",{className:r.join(" "),attrs:{tabIndex:"0",role:"option","aria-label":n.text,"aria-selected":"false"}});if(this.enableDelete&&l.setAttribute("aria-keyshortcuts","Press delete or backspace key to delete"),n.value&&l.setAttribute("data-value",n.value.toString()),n.enabled?l.setAttribute("aria-disabled","false"):(l.removeAttribute("tabindex"),l.setAttribute("aria-disabled","true")),!c.isNullOrUndefined(i[s])&&s<i.length&&Object.keys(i[s]).length)for(var a=Object.keys(i[s]),p=0;p<a.length;p++)l.setAttribute(a[p],i[s][a[p]]);c.append(o,l),t.push(l)}else t=o,c.addClass([this.element],r),this.element.setAttribute("aria-label",n.text),n.value&&this.element.setAttribute("data-value",n.value.toString())}c.append(t,this.element)}},C.prototype.getFieldValues=function(e){var t=!("false"===this.enabled.toString());return{text:"object"==typeof e?(e.text?e:this).text.toString():this.chipType()?e.toString():this.innerText||this.text.toString(),cssClass:("object"==typeof e&&e.cssClass?e:this).cssClass.toString(),leadingIconCss:("object"==typeof e&&e.leadingIconCss?e:this).leadingIconCss.toString(),avatarIconCss:("object"==typeof e&&e.avatarIconCss?e:this).avatarIconCss.toString(),avatarText:("object"==typeof e&&e.avatarText?e:this).avatarText.toString(),trailingIconCss:("object"==typeof e&&e.trailingIconCss?e:this).trailingIconCss.toString(),enabled:"object"==typeof e&&void 0!==e.enabled?"false"!==e.enabled.toString():t,value:"object"==typeof e&&e.value?e.value.toString():null,leadingIconUrl:"object"==typeof e&&e.leadingIconUrl?e.leadingIconUrl.toString():this.leadingIconUrl,trailingIconUrl:"object"==typeof e&&e.trailingIconUrl?e.trailingIconUrl.toString():this.trailingIconUrl,htmlAttributes:"object"==typeof e&&e.htmlAttributes||this.htmlAttributes,template:"object"==typeof e&&e.template||null}},C.prototype.elementCreation=function(e){var t,i,s=[],n=(e.avatarText||e.avatarIconCss?(t=(E.avatar+" "+e.avatarIconCss).trim(),(n=this.createElement("span",{className:t})).innerText=e.avatarText,s.push(n)):e.leadingIconCss?(t=(E.icon+" "+e.leadingIconCss).trim(),i=this.createElement("span",{className:t}),s.push(i)):e.leadingIconUrl&&(t=(E.avatar+" image-url").trim(),(i=this.createElement("span",{className:t})).style.backgroundImage="url("+e.leadingIconUrl+")",s.push(i)),this.createElement("span",{className:E.text}));return n.innerText=e.text,s.push(n),e.template&&(i=this.createElement("div",{className:E.template}),n=this.templateParser(e.template)(e,this,"template",this.element.id+"_template",!1),c.append(n,i),s.push(i),this.renderTemplates()),e.trailingIconCss||this.chipType()&&this.enableDelete?(t=(E.delete+" "+(e.trailingIconCss||E.deleteIcon)).trim(),n=this.createElement("span",{className:t}),s.push(n)):e.trailingIconUrl&&(t="trailing-icon-url".trim(),(i=this.createElement("span",{className:t})).style.backgroundImage="url("+e.trailingIconUrl+")",s.push(i)),s},C.prototype.find=function(e){var t,i={text:"",index:-1,element:this.element,data:""},e=e instanceof HTMLElement?e:this.element.querySelectorAll("."+E.chip)[e];return e&&this.chipType()&&(i.index=Array.prototype.slice.call(this.element.querySelectorAll("."+E.chip)).indexOf(e),"object"==typeof(t=this.chips[i.index])&&null!==t?void 0!==t.text&&(i.text=t.text.toString()):void 0!==t&&(i.text=t.toString()),i.data=t,i.element=e),i},C.prototype.add=function(e){var t;"chip"!==this.type&&(e=e instanceof Array?e:[e],this.chips=(t=[].slice.call(this.chips)).concat.app