UNPKG

@syncfusion/ej2-buttons

Version:

A package of feature-rich Essential JS 2 components such as Button, CheckBox, RadioButton and Switch.

10 lines 106 kB
/*! * filename: ej2-buttons.min.js * version : 29.2.5 * 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. */ this.ej=this.ej||{},this.ej.buttons=function(e,t){"use strict";function i(e,i,s,n,o,r){var l=n;if(n.tagName===i){var a=t.getValue("ej2_instances",n);l=e("input",{attrs:{type:s}});for(var p=["change","cssClass","label","labelPosition","id"],c=0,h=n.attributes.length;c<h;c++)-1===p.indexOf(n.attributes[c].nodeName)&&l.setAttribute(n.attributes[c].nodeName,n.attributes[c].nodeValue);t.attributes(n,{class:o}),n.appendChild(l),n.classList.add(r),n.classList.remove(r),t.setValue("ej2_instances",a,l),t.deleteObject(n,"ej2_instances")}return l}function s(e){for(var t,i=e.childNodes,s=0;s<i.length;s++)if(3===(t=i[s]).nodeType)return t;return null}function n(e,i,s){"INPUT"===s?(i.parentNode.insertBefore(e.element,i),t.detach(i),e.element.checked=!1,["name","value","disabled"].forEach(function(t){e.element.removeAttribute(t)})):(["role","aria-checked","class"].forEach(function(e){i.removeAttribute(e)}),i.innerHTML="",e.element=i)}function o(e,s,n,o,r){o=i(e.createElement,s,"checkbox",o,n,r),e.element=o,"checkbox"!==e.element.getAttribute("type")&&e.element.setAttribute("type","checkbox"),e.element.id||(e.element.id=t.getUniqueID("e-"+r))}function r(e,i,s){void 0===i&&(i=!1),void 0===s&&(s={});var n=e("div",{className:"e-checkbox-wrapper e-css"});if(s.cssClass&&t.addClass([n],s.cssClass.split(" ")),s.enableRtl&&n.classList.add("e-rtl"),i){var o=e("span",{className:"e-ripple-container"});t.rippleEffect(o,{isCenterRipple:!0,duration:400}),n.appendChild(o)}var r=e("span",{className:"e-frame e-icons"});if(s.checked&&r.classList.add("e-check"),n.appendChild(r),s.label){var l=e("span",{className:"e-label"});s.disableHtmlEncode?l.textContent=s.label:l.innerHTML=s.label,n.appendChild(l)}return n}function l(e,t){if(t){var i=document.createEvent("MouseEvents");i.initEvent(e.type,!1,!0),t.dispatchEvent(i)}}function a(e,t){e.element.getAttribute("ejs-for")&&t.appendChild(e.createElement("input",{attrs:{name:e.name||e.element.name,value:"false",type:"hidden"}}))}var p=function(){function e(){}return e}(),c=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function s(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(s.prototype=i.prototype,new s)}}(),h=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;l>=0;l--)(n=e[l])&&(r=(o<3?n(r):o>3?n(t,i,r):n(t,i))||r);return o>3&&r&&Object.defineProperty(t,i,r),r};!function(e){e.Left="Left",e.Right="Right",e.Top="Top",e.Bottom="Bottom"}(e.IconPosition||(e.IconPosition={}));var d=new t.Observer,u={RTL:"e-rtl",BUTTON:"e-btn",PRIMARY:"e-primary",ICONBTN:"e-icon-btn"},f=function(e){function i(t,i){return e.call(this,t,i)||this}return c(i,e),i.prototype.preRender=function(){},i.prototype.render=function(){this.initialize(),this.removeRippleEffect=t.rippleEffect(this.element,{selector:"."+u.BUTTON}),this.renderComplete()},i.prototype.initialize=function(){if(this.cssClass&&t.addClass([this.element],this.cssClass.replace(/\s+/g," ").trim().split(" ")),this.isPrimary&&this.element.classList.add(u.PRIMARY),!t.isBlazor()||t.isBlazor()&&"progress-btn"!==this.getModuleName()){if(this.content){var e=this.enableHtmlSanitizer?t.SanitizeHtmlHelper.sanitize(this.content):this.content;this.element.innerHTML=e}this.setIconCss()}this.enableRtl&&this.element.classList.add(u.RTL),this.disabled?this.controlStatus(this.disabled):this.wireEvents()},i.prototype.controlStatus=function(e){this.element.disabled=e},i.prototype.setIconCss=function(){if(this.iconCss){var 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(u.ICONBTN);var t=this.element.childNodes[0];!t||"Left"!==this.iconPosition&&"Top"!==this.iconPosition?this.element.appendChild(e):this.element.insertBefore(e,t)}},i.prototype.wireEvents=function(){this.isToggle&&t.EventHandler.add(this.element,"click",this.btnClickHandler,this)},i.prototype.unWireEvents=function(){this.isToggle&&t.EventHandler.remove(this.element,"click",this.btnClickHandler)},i.prototype.btnClickHandler=function(){this.element.classList.contains("e-active")?this.element.classList.remove("e-active"):this.element.classList.add("e-active")},i.prototype.destroy=function(){var i=[u.PRIMARY,u.RTL,u.ICONBTN,"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"];this.cssClass&&(i=i.concat(this.cssClass.split(/\s+/).filter(function(e){return e.length>0}))),e.prototype.destroy.call(this),t.removeClass([this.element],i),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,""));var s=this.element.querySelector("span.e-btn-icon");s&&t.detach(s),this.unWireEvents(),t.isRippleEnabled&&this.removeRippleEffect()},i.prototype.getModuleName=function(){return"btn"},i.prototype.getPersistData=function(){return this.addOnPersist([])},i.Inject=function(){},i.prototype.onPropertyChanged=function(e,i){for(var n=this.element.querySelector("span.e-btn-icon"),o=0,r=Object.keys(e);o<r.length;o++)switch(r[o]){case"isPrimary":e.isPrimary?this.element.classList.add(u.PRIMARY):this.element.classList.remove(u.PRIMARY);break;case"disabled":this.controlStatus(e.disabled);break;case"iconCss":(n=this.element.querySelector("span.e-btn-icon"))?e.iconCss?(n.className="e-btn-icon "+e.iconCss,this.element.textContent.trim()&&("Left"===this.iconPosition?n.classList.add("e-icon-left"):n.classList.add("e-icon-right"))):t.detach(n):this.setIconCss();break;case"iconPosition":t.removeClass([this.element],["e-top-icon-btn","e-bottom-icon-btn"]),(n=this.element.querySelector("span.e-btn-icon"))&&t.detach(n),this.setIconCss();break;case"cssClass":i.cssClass&&t.removeClass([this.element],i.cssClass.split(/\s+/).filter(function(e){return e.length>0})),e.cssClass&&t.addClass([this.element],e.cssClass.replace(/\s+/g," ").trim().split(" "));break;case"enableRtl":e.enableRtl?this.element.classList.add(u.RTL):this.element.classList.remove(u.RTL);break;case"content":s(this.element)||this.element.classList.remove(u.ICONBTN),(!t.isBlazor()||t.isBlazor()&&!this.isServerRendered&&"progress-btn"!==this.getModuleName())&&(this.enableHtmlSanitizer&&(e.content=t.SanitizeHtmlHelper.sanitize(e.content)),this.element.innerHTML=e.content,this.setIconCss());break;case"isToggle":e.isToggle?t.EventHandler.add(this.element,"click",this.btnClickHandler,this):(t.EventHandler.remove(this.element,"click",this.btnClickHandler),t.removeClass([this.element],["e-active"]))}},i.prototype.click=function(){this.element.click()},i.prototype.focusIn=function(){this.element.focus()},h([t.Property("Left")],i.prototype,"iconPosition",void 0),h([t.Property("")],i.prototype,"iconCss",void 0),h([t.Property(!1)],i.prototype,"disabled",void 0),h([t.Property(!1)],i.prototype,"isPrimary",void 0),h([t.Property("")],i.prototype,"cssClass",void 0),h([t.Property("")],i.prototype,"content",void 0),h([t.Property(!1)],i.prototype,"isToggle",void 0),h([t.Property()],i.prototype,"locale",void 0),h([t.Property(!0)],i.prototype,"enableHtmlSanitizer",void 0),h([t.Event()],i.prototype,"created",void 0),i=h([t.NotifyPropertyChanges],i)}(t.Component),m=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function s(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(s.prototype=i.prototype,new s)}}(),v=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;l>=0;l--)(n=e[l])&&(r=(o<3?n(r):o>3?n(t,i,r):n(t,i))||r);return o>3&&r&&Object.defineProperty(t,i,r),r},y="e-frame",g="e-ripple-container",b="e-checkbox-wrapper",E=["title","class","style","disabled","readonly","name","value","id","tabindex","aria-label","required"],C=function(e){function s(t,i){var s=e.call(this,t,i)||this;return s.isFocused=!1,s.isMouseClick=!1,s.clickTriggered=!1,s.validCheck=!0,s.type="checkbox",s}return m(s,e),s.prototype.changeState=function(e,i,s){var n=this.getWrapper(),o=null,r=null;n&&(r=n.getElementsByClassName(y)[0],t.isRippleEnabled&&(o=n.getElementsByClassName(g)[0])),"check"===e?(r&&(r.classList.remove("e-stop"),r.classList.add("e-check")),o&&(o.classList.remove("e-ripple-stop"),o.classList.add("e-ripple-check")),this.element.checked=!0,(this.element.required||t.closest(this.element,"form")&&t.closest(this.element,"form").classList.contains("e-formvalidator"))&&this.validCheck&&!i&&s?(this.element.checked=!1,this.validCheck=!1):(this.element.required||t.closest(this.element,"form")&&t.closest(this.element,"form").classList.contains("e-formvalidator"))&&(this.validCheck=!0)):"uncheck"===e?(r&&t.removeClass([r],["e-check","e-stop"]),o&&t.removeClass([o],["e-ripple-check","e-ripple-stop"]),this.element.checked=!1,(this.element.required||t.closest(this.element,"form")&&t.closest(this.element,"form").classList.contains("e-formvalidator"))&&this.validCheck&&!i&&s?(this.element.checked=!0,this.validCheck=!1):(this.element.required||t.closest(this.element,"form")&&t.closest(this.element,"form").classList.contains("e-formvalidator"))&&(this.validCheck=!0)):(r&&(r.classList.remove("e-check"),r.classList.add("e-stop")),o&&(o.classList.remove("e-ripple-check"),o.classList.add("e-ripple-stop")),this.element.indeterminate=!0,this.indeterminate=!0)},s.prototype.clickHandler=function(e){if("INPUT"===e.target.tagName&&this.clickTriggered)return this.changeState(this.checked?"check":"uncheck"),void(this.clickTriggered=!1);("SPAN"===e.target.tagName||"LABEL"===e.target.tagName||t.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);var i={checked:this.updateVueArrayModel(!1),event:e};this.trigger("change",i),e.stopPropagation()},s.prototype.destroy=function(){var i=this,s=this.getWrapper();e.prototype.destroy.call(this),this.wrapper&&(s=this.wrapper,this.disabled||this.unWireEvents(),"INPUT"===this.tagName?(this.getWrapper()&&s.parentNode&&s.parentNode.insertBefore(this.element,s),t.detach(s),this.element.checked=!1,this.indeterminate&&(this.element.indeterminate=!1),["name","value","disabled"].forEach(function(e){i.element.removeAttribute(e)})):(["class"].forEach(function(e){s.removeAttribute(e)}),s.innerHTML="",this.element=s,this.refreshing&&(["e-control","e-checkbox","e-lib"].forEach(function(e){i.element.classList.add(e)}),t.setValue("ej2_instances",[this],this.element))))},s.prototype.focusHandler=function(){this.isFocused=!0},s.prototype.focusOutHandler=function(){var e=this.getWrapper();e&&e.classList.remove("e-focus"),this.isFocused=!1},s.prototype.getModuleName=function(){return"checkbox"},s.prototype.getPersistData=function(){return this.addOnPersist(["checked","indeterminate"])},s.prototype.getWrapper=function(){return this.element&&this.element.parentElement?this.element.parentElement.parentElement:null},s.prototype.getLabel=function(){return this.element?this.element.parentElement:null},s.prototype.initialize=function(){t.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()},s.prototype.initWrapper=function(){var e=this.element.parentElement;e.classList.contains(b)||(e=this.createElement("div",{className:b}),this.element.parentNode&&this.element.parentNode.insertBefore(e,this.element));var i=this.createElement("label",{attrs:{for:this.htmlAttributes.id?this.htmlAttributes.id:this.element.id}}),s=this.createElement("span",{className:"e-icons "+y});if(e.classList.add("e-wrapper"),this.enableRtl&&e.classList.add("e-rtl"),this.cssClass&&t.addClass([e],this.cssClass.replace(/\s+/g," ").trim().split(" ")),e.appendChild(i),i.appendChild(this.element),a(this,i),i.appendChild(s),t.isRippleEnabled){var n=this.createElement("span",{className:g});"Before"===this.labelPosition?i.appendChild(n):i.insertBefore(n,s),t.rippleEffect(n,{duration:400,isCenterRipple:!0})}this.label&&this.setText(this.label)},s.prototype.keyUpHandler=function(){this.isFocused&&this.getWrapper().classList.add("e-focus")},s.prototype.labelMouseDownHandler=function(e){this.isMouseClick=!0,l(e,this.getWrapper().getElementsByClassName(g)[0])},s.prototype.labelMouseLeaveHandler=function(e){var t=this.getLabel().getElementsByClassName(g)[0];if(t){for(var i=t.querySelectorAll(".e-ripple-element").length-1;i>0;i--)t.removeChild(t.childNodes[i]);l(e,t)}},s.prototype.labelMouseUpHandler=function(e){this.isMouseClick=!0;var t=this.getWrapper().getElementsByClassName(g)[0];if(t){for(var i=t.querySelectorAll(".e-ripple-element"),s=0;s<i.length-1;s++)t.removeChild(t.childNodes[s]);l(e,t)}},s.prototype.onPropertyChanged=function(e,i){for(var s=this.getWrapper(),n=0,o=Object.keys(e);n<o.length;n++)switch(o[n]){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,s.classList.remove("e-checkbox-disabled"),s.setAttribute("aria-disabled","false"),this.wireEvents());break;case"cssClass":i.cssClass&&t.removeClass([s],i.cssClass.split(/\s+/).filter(function(e){return e.length>0})),e.cssClass&&t.addClass([s],e.cssClass.replace(/\s+/g," ").trim().split(" "));break;case"enableRtl":e.enableRtl?s.classList.add("e-rtl"):s.classList.remove("e-rtl");break;case"label":this.setText(e.label);break;case"labelPosition":var r=s.getElementsByClassName("e-label")[0],l=s.getElementsByTagName("label")[0];t.detach(r),"After"===e.labelPosition?l.appendChild(r):l.insertBefore(r,s.getElementsByClassName(y)[0]);break;case"name":this.element.setAttribute("name",e.name);break;case"value":if(this.isVue&&"object"==typeof e.value)break;this.element.setAttribute("value",e.value);break;case"htmlAttributes":this.updateHtmlAttributeToWrapper()}},s.prototype.preRender=function(){var e=this.element;this.tagName=this.element.tagName,e=i(this.createElement,"EJS-CHECKBOX","checkbox",e,b,"checkbox"),this.element=e,"checkbox"!==this.element.getAttribute("type")&&this.element.setAttribute("type","checkbox"),this.element.id||(this.element.id=t.getUniqueID("e-"+this.getModuleName()))},s.prototype.render=function(){this.initWrapper(),this.initialize(),this.disabled||this.wireEvents(),this.updateHtmlAttributeToWrapper(),this.updateVueArrayModel(!0),this.renderComplete(),this.wrapper=this.getWrapper()},s.prototype.setDisabled=function(){var e=this.getWrapper();this.element.disabled=!0,e.classList.add("e-checkbox-disabled"),e.setAttribute("aria-disabled","true")},s.prototype.setText=function(e){var i=this.getWrapper();if(i){var s=i.getElementsByClassName("e-label")[0];if(s)s.innerHTML=this.enableHtmlSanitizer?t.SanitizeHtmlHelper.sanitize(e):e;else{e=this.enableHtmlSanitizer?t.SanitizeHtmlHelper.sanitize(e):e,s=this.createElement("span",{className:"e-label",innerHTML:e});var n=i.getElementsByTagName("label")[0];"Before"===this.labelPosition?n.insertBefore(s,i.getElementsByClassName(y)[0]):n.appendChild(s)}}},s.prototype.changeHandler=function(e){e.stopPropagation()},s.prototype.formResetHandler=function(){this.checked=this.initialCheckedValue,this.element.checked=this.initialCheckedValue},s.prototype.unWireEvents=function(){var e=this.wrapper;if(t.EventHandler.remove(this.element,"keyup",this.keyUpHandler),t.EventHandler.remove(this.element,"focus",this.focusHandler),t.EventHandler.remove(this.element,"focusout",this.focusOutHandler),e){t.EventHandler.remove(e,"click",this.clickHandler);var i=e.getElementsByTagName("label")[0];i&&(t.EventHandler.remove(i,"mousedown",this.labelMouseDownHandler),t.EventHandler.remove(i,"mouseup",this.labelMouseUpHandler),t.EventHandler.remove(i,"mouseleave",this.labelMouseLeaveHandler))}var s=t.closest(this.element,"form");s&&t.EventHandler.remove(s,"reset",this.formResetHandler),"EJS-CHECKBOX"===this.tagName&&t.EventHandler.remove(this.element,"change",this.changeHandler)},s.prototype.wireEvents=function(){var e=this.getWrapper();t.EventHandler.add(e,"click",this.clickHandler,this),t.EventHandler.add(this.element,"keyup",this.keyUpHandler,this),t.EventHandler.add(this.element,"focus",this.focusHandler,this),t.EventHandler.add(this.element,"focusout",this.focusOutHandler,this);var i=e.getElementsByTagName("label")[0];t.EventHandler.add(i,"mousedown",this.labelMouseDownHandler,this),t.EventHandler.add(i,"mouseup",this.labelMouseUpHandler,this),t.EventHandler.add(i,"mouseleave",this.labelMouseLeaveHandler,this);var s=t.closest(this.element,"form");s&&t.EventHandler.add(s,"reset",this.formResetHandler,this),"EJS-CHECKBOX"===this.tagName&&t.EventHandler.add(this.element,"change",this.changeHandler,this)},s.prototype.updateVueArrayModel=function(e){if(this.isVue&&"object"==typeof this.value){var t=this.element.value;if(t&&this.value){if(!e){var i=this.value.indexOf(t);return this.checked?i<0&&this.value.push(t):i>-1&&this.value.splice(i,1),this.value}for(var s=0;s<this.value.length;s++)t===this.value[s]&&(this.changeState("check"),this.setProperties({checked:!0},!0))}}return this.validCheck?this.element.checked:!this.element.checked},s.prototype.updateHtmlAttributeToWrapper=function(){if(!t.isNullOrUndefined(this.htmlAttributes))for(var e=0,i=Object.keys(this.htmlAttributes);e<i.length;e++){var s=i[e],n=this.getWrapper();E.indexOf(s)>-1?"class"===s?t.addClass([n],this.htmlAttributes[""+s].split(" ")):"title"===s?n.setAttribute(s,this.htmlAttributes[""+s]):"style"===s?this.getWrapper().getElementsByClassName(y)[0].setAttribute(s,this.htmlAttributes[""+s]):"disabled"===s?("true"===this.htmlAttributes[""+s]&&this.setDisabled(),this.element.setAttribute(s,this.htmlAttributes[""+s])):this.element.setAttribute(s,this.htmlAttributes[""+s]):n.setAttribute(s,this.htmlAttributes[""+s])}},s.prototype.click=function(){this.element.click()},s.prototype.focusIn=function(){this.element.focus()},v([t.Event()],s.prototype,"change",void 0),v([t.Event()],s.prototype,"created",void 0),v([t.Property(!1)],s.prototype,"checked",void 0),v([t.Property("")],s.prototype,"cssClass",void 0),v([t.Property(!1)],s.prototype,"disabled",void 0),v([t.Property(!1)],s.prototype,"indeterminate",void 0),v([t.Property("")],s.prototype,"label",void 0),v([t.Property("After")],s.prototype,"labelPosition",void 0),v([t.Property("")],s.prototype,"name",void 0),v([t.Property("")],s.prototype,"value",void 0),v([t.Property(!0)],s.prototype,"enableHtmlSanitizer",void 0),v([t.Property({})],s.prototype,"htmlAttributes",void 0),s=v([t.NotifyPropertyChanges],s)}(t.Component),k=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function s(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(s.prototype=i.prototype,new s)}}(),L=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;l>=0;l--)(n=e[l])&&(r=(o<3?n(r):o>3?n(t,i,r):n(t,i))||r);return o>3&&r&&Object.defineProperty(t,i,r),r},P="e-ripple-container",A=["title","class","style","disabled","readonly","name","value","id"],H=function(e){function s(t,i){var s=e.call(this,t,i)||this;return s.isFocused=!1,s.type="radio",s}k(s,e),n=s,s.prototype.changeHandler=function(e){this.checked=!0,this.dataBind();var t=this.element.getAttribute("value");t=this.isVue&&t?this.element.value:this.value;var i=typeof this.value;this.isVue&&"boolean"===i&&(t="true"===t),this.trigger("change",{value:t,event:e}),this.isAngular&&e.stopPropagation()},s.prototype.updateChange=function(){for(var e,i,s=this.getRadioGroup(),o=0;o<s.length;o++)(e=s[o])!==this.element&&((i=t.getInstance(e,n)).checked=!1,"EJS-RADIOBUTTON"===this.tagName&&(i.angularValue=this.value))},s.prototype.destroy=function(){var i=this,s=this.wrapper;e.prototype.destroy.call(this),s&&(this.disabled||this.unWireEvents(),"INPUT"===this.tagName?(s.parentNode&&s.parentNode.insertBefore(this.element,s),t.detach(s),this.element.checked=!1,["name","value","disabled"].forEach(function(e){i.element.removeAttribute(e)})):(["role","aria-checked","class"].forEach(function(e){s.removeAttribute(e)}),s.innerHTML="",this.element=this.wrapper,this.refreshing&&(["e-control","e-radio","e-lib"].forEach(function(e){i.element.classList.add(e)}),t.setValue("ej2_instances",[this],this.element))))},s.prototype.focusHandler=function(){this.isFocused=!0},s.prototype.focusOutHandler=function(){var e=this.getLabel();e&&e.classList.remove("e-focus")},s.prototype.getModuleName=function(){return"radio"},s.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""},s.prototype.getRadioGroup=function(){return document.querySelectorAll('input.e-radio[name="'+this.element.getAttribute("name")+'"]')},s.prototype.getPersistData=function(){return this.addOnPersist(["checked"])},s.prototype.getWrapper=function(){return this.element.parentElement?this.element.parentElement:null},s.prototype.getLabel=function(){return this.element.nextElementSibling?this.element.nextElementSibling:null},s.prototype.initialize=function(){t.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"),i=typeof this.value;this.isVue&&"boolean"===i&&(e="true"===e),(this.isVue?this.value&&"boolean"!==i&&!e:this.value)&&this.element.setAttribute("value",this.value),this.checked&&(this.element.checked=!0),this.disabled&&this.setDisabled()},s.prototype.initWrapper=function(){var e,i=this.element.parentElement;i.classList.contains("e-radio-wrapper")||(i=this.createElement("div",{className:"e-radio-wrapper"}),this.element.parentNode&&this.element.parentNode.insertBefore(i,this.element));var s=this.createElement("label",{attrs:{for:this.element.id}});i.appendChild(this.element),i.appendChild(s),t.isRippleEnabled&&(e=this.createElement("span",{className:P}),s.appendChild(e),t.rippleEffect(e,{duration:400,isCenterRipple:!0})),i.classList.add("e-wrapper"),this.enableRtl&&s.classList.add("e-rtl"),this.cssClass&&t.addClass([i],this.cssClass.replace(/\s+/g," ").trim().split(" ")),this.label&&this.setText(this.label)},s.prototype.keyUpHandler=function(){this.isFocused&&this.getLabel().classList.add("e-focus")},s.prototype.labelMouseDownHandler=function(e){l(e,this.getLabel().getElementsByClassName(P)[0])},s.prototype.labelMouseLeaveHandler=function(e){var t=this.getLabel().getElementsByClassName(P)[0];if(t){for(var i=t.querySelectorAll(".e-ripple-element").length-1;i>0;i--)t.removeChild(t.childNodes[i]);l(e,t)}},s.prototype.labelMouseUpHandler=function(e){var t=this.getLabel().getElementsByClassName(P)[0];if(t){for(var i=t.querySelectorAll(".e-ripple-element").length-1;i>0;i--)t.removeChild(t.childNodes[i]);l(e,t)}},s.prototype.formResetHandler=function(){this.checked=this.initialCheckedValue,this.initialCheckedValue&&t.attributes(this.element,{checked:"true"})},s.prototype.onPropertyChanged=function(e,i){for(var s=this.getWrapper(),n=this.getLabel(),o=0,r=Object.keys(e);o<r.length;o++)switch(r[o]){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":i.cssClass&&t.removeClass([s],i.cssClass.split(/\s+/).filter(function(e){return e.length>0})),e.cssClass&&t.addClass([s],e.cssClass.replace(/\s+/g," ").trim().split(" "));break;case"enableRtl":e.enableRtl?n.classList.add("e-rtl"):n.classList.remove("e-rtl");break;case"label":this.setText(e.label);break;case"labelPosition":"Before"===e.labelPosition?n.classList.add("e-right"):n.classList.remove("e-right");break;case"name":this.element.setAttribute("name",e.name);break;case"value":var l=typeof this.htmlAttributes.value;if(!t.isNullOrUndefined(this.htmlAttributes)&&(this.htmlAttributes.value||"boolean"===l&&!this.htmlAttributes.value))break;this.element.setAttribute("value",e.value);break;case"htmlAttributes":this.updateHtmlAttribute()}},s.prototype.preRender=function(){var e=this.element;if(this.formElement=t.closest(this.element,"form"),this.tagName=this.element.tagName,e=i(this.createElement,"EJS-RADIOBUTTON","radio",e,"e-radio-wrapper","radio"),this.element=e,"radio"!==this.element.getAttribute("type")&&this.element.setAttribute("type","radio"),this.element.id||(this.element.id=t.getUniqueID("e-"+this.getModuleName())),"EJS-RADIOBUTTON"===this.tagName){var s=this.element.getAttribute("formcontrolname");s&&(this.setProperties({name:s},!0),this.element.setAttribute("name",s))}},s.prototype.render=function(){this.initialize(),this.disabled||this.wireEvents(),this.renderComplete(),this.wrapper=this.getWrapper()},s.prototype.setDisabled=function(){this.element.disabled=!0},s.prototype.setText=function(e){var i=this.getLabel(),s=i.getElementsByClassName("e-label")[0];s?s.textContent=e:(e=this.enableHtmlSanitizer?t.SanitizeHtmlHelper.sanitize(e):e,s=this.createElement("span",{className:"e-label",innerHTML:e}),i.appendChild(s)),"Before"===this.labelPosition?this.getLabel().classList.add("e-right"):this.getLabel().classList.remove("e-right")},s.prototype.updateHtmlAttribute=function(){if(!t.isNullOrUndefined(this.htmlAttributes))for(var e=0,i=Object.keys(this.htmlAttributes);e<i.length;e++){var s=i[e],n=this.element.parentElement;A.indexOf(s)>-1?"class"===s?t.addClass([n],this.htmlAttributes[""+s].replace(/\s+/g," ").trim().split(" ")):"title"===s||"style"===s?n.setAttribute(s,this.htmlAttributes[""+s]):this.element.setAttribute(s,this.htmlAttributes[""+s]):n.setAttribute(s,this.htmlAttributes[""+s])}},s.prototype.unWireEvents=function(){var e=this.wrapper;if(t.EventHandler.remove(this.element,"change",this.changeHandler),t.EventHandler.remove(this.element,"focus",this.focusHandler),t.EventHandler.remove(this.element,"focusout",this.focusOutHandler),t.EventHandler.remove(this.element,"keyup",this.keyUpHandler),e){var i=e.getElementsByTagName("label")[0];i&&(t.EventHandler.remove(i,"mousedown",this.labelMouseDownHandler),t.EventHandler.remove(i,"mouseup",this.labelMouseUpHandler),t.EventHandler.remove(i,"mouseleave",this.labelMouseLeaveHandler))}this.formElement&&t.EventHandler.remove(this.formElement,"reset",this.formResetHandler)},s.prototype.wireEvents=function(){var e=this.getLabel();t.EventHandler.add(this.element,"change",this.changeHandler,this),t.EventHandler.add(this.element,"keyup",this.keyUpHandler,this),t.EventHandler.add(this.element,"focus",this.focusHandler,this),t.EventHandler.add(this.element,"focusout",this.focusOutHandler,this);var i=e.getElementsByClassName("e-label")[0];i&&(t.EventHandler.add(i,"mousedown",this.labelMouseDownHandler,this),t.EventHandler.add(i,"mouseup",this.labelMouseUpHandler,this),t.EventHandler.add(i,"mouseleave",this.labelMouseLeaveHandler,this)),this.formElement&&t.EventHandler.add(this.formElement,"reset",this.formResetHandler,this)},s.prototype.click=function(){this.element.click()},s.prototype.focusIn=function(){this.element.focus()};var n;return L([t.Event()],s.prototype,"change",void 0),L([t.Event()],s.prototype,"created",void 0),L([t.Property(!1)],s.prototype,"checked",void 0),L([t.Property("")],s.prototype,"cssClass",void 0),L([t.Property(!1)],s.prototype,"disabled",void 0),L([t.Property("")],s.prototype,"label",void 0),L([t.Property("After")],s.prototype,"labelPosition",void 0),L([t.Property("")],s.prototype,"name",void 0),L([t.Property("")],s.prototype,"value",void 0),L([t.Property(!0)],s.prototype,"enableHtmlSanitizer",void 0),L([t.Property({})],s.prototype,"htmlAttributes",void 0),s=n=L([t.NotifyPropertyChanges],s)}(t.Component),w=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function s(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(s.prototype=i.prototype,new s)}}(),R=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;l>=0;l--)(n=e[l])&&(r=(o<3?n(r):o>3?n(t,i,r):n(t,i))||r);return o>3&&r&&Object.defineProperty(t,i,r),r},x="e-ripple-container",T=["title","class","style","disabled","readonly","name","value","aria-label","id","role","tabindex"],S=function(e){function i(t,i){var s=e.call(this,t,i)||this;return s.isFocused=!1,s.isDrag=!1,s.isWireEvents=!1,s}return w(i,e),i.prototype.changeState=function(e){var i=null,s=this.getWrapper(),n=s.querySelector(".e-switch-inner"),o=s.querySelector(".e-switch-handle");t.isRippleEnabled&&(i=s.getElementsByClassName(x)[0]),e?(t.addClass([n,o],"e-switch-active"),this.element.checked=!0,this.checked=!0,i&&t.addClass([i],["e-ripple-check"])):(t.removeClass([n,o],"e-switch-active"),this.element.checked=!1,this.checked=!1,i&&t.removeClass([i],["e-ripple-check"]))},i.prototype.clickHandler=function(e){if(!e||!this.element.closest("label")||e.target===this.element){this.isDrag=!1,this.focusOutHandler();var t={event:e,cancel:!1,checked:this.checked};if(this.trigger("beforeChange",t),!t.cancel){this.changeState(!t.checked),this.element.focus();var i={checked:this.element.checked,event:e};this.trigger("change",i)}}},i.prototype.destroy=function(){var i=this;e.prototype.destroy.call(this),this.disabled||this.unWireEvents(),this.formElement&&t.EventHandler.remove(this.formElement,"reset",this.formResetHandler),this.getWrapper()&&n(this,this.getWrapper(),this.tagName),this.refreshing&&(["e-control","e-switch","e-lib"].forEach(function(e){i.element.classList.add(e)}),t.setValue("ej2_instances",[this],this.element))},i.prototype.focusHandler=function(){this.isFocused=!0},i.prototype.focusOutHandler=function(){this.getWrapper().classList.remove("e-focus")},i.prototype.getModuleName=function(){return"switch"},i.prototype.getPersistData=function(){return this.addOnPersist(["checked"])},i.prototype.getWrapper=function(){return this.element.parentElement?this.element.parentElement:null},i.prototype.initialize=function(){this.element.setAttribute("role","switch"),t.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)},i.prototype.initWrapper=function(){var e=this.element.parentElement;e.classList.contains("e-switch-wrapper")||(e=this.createElement("div",{className:"e-switch-wrapper"}),this.element.parentNode.insertBefore(e,this.element));var i=this.createElement("span",{className:"e-switch-inner"}),s=this.createElement("span",{className:"e-switch-on"}),n=this.createElement("span",{className:"e-switch-off"}),o=this.createElement("span",{className:"e-switch-handle"});if(e.appendChild(this.element),a(this,e),i.appendChild(s),i.appendChild(n),e.appendChild(i),e.appendChild(o),t.isRippleEnabled){var r=this.createElement("span",{className:x});o.appendChild(r),t.rippleEffect(r,{duration:400,isCenterRipple:!0})}e.classList.add("e-wrapper"),this.enableRtl&&e.classList.add("e-rtl"),this.cssClass&&t.addClass([e],this.cssClass.replace(/\s+/g," ").trim().split(" "))},i.prototype.onPropertyChanged=function(e,i){for(var s=this.getWrapper(),n=0,o=Object.keys(e);n<o.length;n++)switch(o[n]){case"checked":this.changeState(e.checked);break;case"disabled":e.disabled?(this.setDisabled(),this.unWireEvents(),this.isWireEvents=!1):(this.element.disabled=!1,s.classList.remove("e-switch-disabled"),s.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?s.classList.add("e-rtl"):s.classList.remove("e-rtl");break;case"cssClass":i.cssClass&&t.removeClass([s],i.cssClass.split(/\s+/).filter(function(e){return e.length>0})),e.cssClass&&t.addClass([s],e.cssClass.replace(/\s+/g," ").trim().split(" "));break;case"htmlAttributes":this.updateHtmlAttribute()}},i.prototype.preRender=function(){var e=this.element;this.formElement=t.closest(this.element,"form"),this.tagName=this.element.tagName,o(this,"EJS-SWITCH","e-switch-wrapper",e,this.getModuleName())},i.prototype.render=function(){this.initWrapper(),this.initialize(),this.disabled||this.wireEvents(),this.formElement&&t.EventHandler.add(this.formElement,"reset",this.formResetHandler,this),this.renderComplete(),this.updateHtmlAttribute()},i.prototype.rippleHandler=function(e){l(e,this.getWrapper().getElementsByClassName(x)[0]),"mousedown"===e.type&&e.currentTarget.classList.contains("e-switch-wrapper")&&1===e.which&&(this.isDrag=!0,this.isFocused=!1)},i.prototype.mouseLeaveHandler=function(e){var t=this.element.parentElement.getElementsByClassName(x)[0];if(t){for(var i=t.querySelectorAll(".e-ripple-element").length-1;i>0;i--)t.removeChild(t.childNodes[i]);l(e,t)}},i.prototype.rippleTouchHandler=function(e){var t=this.getWrapper().getElementsByClassName(x)[0];if(t){var i=document.createEvent("MouseEvents");i.initEvent(e,!1,!0),t.dispatchEvent(i)}},i.prototype.setDisabled=function(){var e=this.getWrapper();this.element.disabled=!0,e.classList.add("e-switch-disabled"),e.setAttribute("aria-disabled","true")},i.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)},i.prototype.updateHtmlAttribute=function(){if(!t.isNullOrUndefined(this.htmlAttributes))for(var e=0,i=Object.keys(this.htmlAttributes);e<i.length;e++){var s=i[e],n=this.getWrapper();T.indexOf(s)>-1?"class"===s?t.addClass([n],this.htmlAttributes[""+s].split(" ")):"title"===s?n.setAttribute(s,this.htmlAttributes[""+s]):"style"===s?n.setAttribute(s,this.htmlAttributes[""+s]):"disabled"===s?("true"===this.htmlAttributes[""+s]&&this.setDisabled(),this.element.setAttribute(s,this.htmlAttributes[""+s])):this.element.setAttribute(s,this.htmlAttributes[""+s]):n.setAttribute(s,this.htmlAttributes[""+s])}},i.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())},i.prototype.switchMouseUp=function(e){var t=0,i=0,s=0,n=0,o=e.target;"touchmove"===e.type&&(e.preventDefault(),s=e.changedTouches[0].clientX,t=e.changedTouches[0].clientY,n=this.bTouchX-s,i=this.bTouchY-t,Math.abs(n)<Math.abs(i)?(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,i=this.bTouchY-e.changedTouches[0].clientY,Math.abs(n)>=Math.abs(i)&&(this.clickHandler(e),this.rippleTouchHandler("mouseup"),e.preventDefault()))},i.prototype.formResetHandler=function(){this.checked=this.initialSwitchCheckedValue,this.element.checked=this.initialSwitchCheckedValue},i.prototype.toggle=function(){this.clickHandler()},i.prototype.wireEvents=function(){var e=this.getWrapper();this.delegateMouseUpHandler=this.switchMouseUp.bind(this),this.delegateKeyUpHandler=this.switchFocusHandler.bind(this),t.EventHandler.add(e,"click",this.clickHandler,this),t.EventHandler.add(this.element,"focus",this.focusHandler,this),t.EventHandler.add(this.element,"focusout",this.focusOutHandler,this),t.EventHandler.add(this.element,"mouseup",this.delegateMouseUpHandler,this),t.EventHandler.add(this.element,"keyup",this.delegateKeyUpHandler,this),t.EventHandler.add(e,"mousedown mouseup",this.rippleHandler,this),t.EventHandler.add(e,"mouseleave",this.mouseLeaveHandler,this),t.EventHandler.add(e,"touchstart touchmove touchend",this.switchMouseUp,this)},i.prototype.unWireEvents=function(){var e=this.getWrapper();e&&(t.EventHandler.remove(e,"click",this.clickHandler),t.EventHandler.remove(e,"mousedown mouseup",this.rippleHandler),t.EventHandler.remove(e,"mouseleave",this.mouseLeaveHandler),t.EventHandler.remove(e,"touchstart touchmove touchend",this.switchMouseUp)),this.element&&(t.EventHandler.remove(this.element,"focus",this.focusHandler),t.EventHandler.remove(this.element,"focusout",this.focusOutHandler),t.EventHandler.remove(this.element,"mouseup",this.delegateMouseUpHandler),t.EventHandler.remove(this.element,"keyup",this.delegateKeyUpHandler))},i.prototype.click=function(){this.element.click()},i.prototype.focusIn=function(){this.element.focus()},R([t.Event()],i.prototype,"beforeChange",void 0),R([t.Event()],i.prototype,"change",void 0),R([t.Event()],i.prototype,"created",void 0),R([t.Property(!1)],i.prototype,"checked",void 0),R([t.Property("")],i.prototype,"cssClass",void 0),R([t.Property(!1)],i.prototype,"disabled",void 0),R([t.Property("")],i.prototype,"name",void 0),R([t.Property("")],i.prototype,"onLabel",void 0),R([t.Property("")],i.prototype,"offLabel",void 0),R([t.Property("")],i.prototype,"value",void 0),R([t.Property({})],i.prototype,"htmlAttributes",void 0),i=R([t.NotifyPropertyChanges],i)}(t.Component),O=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function s(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(s.prototype=i.prototype,new s)}}(),N=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;l>=0;l--)(n=e[l])&&(r=(o<3?n(r):o>3?n(t,i,r):n(t,i))||r);return o>3&&r&&Object.defineProperty(t,i,r),r},I={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"},M=function(e){function i(t,i){var s=e.call(this,t,i)||this;return s.multiSelectedChip=[],s}O(i,e),s=i,i.prototype.preRender=function(){},i.prototype.chipType=function(){return this.chips&&this.chips.length&&this.chips.length>0},i.prototype.render=function(){this.type=!t.isNullOrUndefined(this.chips)&&this.chips.length?"chipset":this.text||this.element.innerText?"chip":"chipset",this.setAttributes(),this.createChip(),this.setRtl(),this.select(this.selectedChips),this.wireEvent(!1),this.rippleFunction=t.rippleEffect(this.element,{selector:"."+I.chip}),this.renderComplete(),this.dragCollection=[],this.allowDragAndDrop&&this.enableDraggingChips()},i.prototype.enableDraggingChips=function(){var e,i=this;this.element.querySelectorAll("."+I.chip).forEach(function(s,n){i.dragObj=new t.Draggable(s,{preventDefault:!1,clone:!0,dragArea:i.dragArea,helper:function(){return(e=s.cloneNode(!0)).classList.add(I.cloneChip),i.element.appendChild(e),e},dragStart:function(s){i.dragIndicator=i.createElement("div",{className:I.dragIndicator}),document.body.appendChild(i.dragIndicator);var o=i.find(s.element),r={cancel:!1,event:s.event,draggedItem:s.element,draggedItemData:o,dropTarget:null};i.trigger("dragStart",r,function(){t.isNullOrUndefined(r.cancel)&&(r.cancel=!1)}),r.cancel?i.dragObj.intDestroy(s.event):e.setAttribute("drag-indicator-index",n.toString())},drag:function(s){var n=i.find(s.element),o={event:s.event,draggedItem:s.element,draggedItemData:n,dropTarget:null};i.trigger("dragging",o);var r=e.querySelector("."+I.chipDrag);t.isNullOrUndefined(r)&&(r=i.createElement("span",{className:I.customIcon+" "+I.dragAndDrop+" "+I.chipDrag}),e.prepend(r)),i.allowExternalDragging(s,e,r)},dragStop:function(s){var n=i.find(s.element),o={cancel:!1,event:s.event,draggedItem:s.element,draggedItemData:n,dropTarget:s.target};i.trigger("dragStop",o,function(){t.isNullOrUndefined(o.cancel)&&(o.cancel=!1)}),o.cancel||i.allowExternalDrop(s,e),t.isNullOrUndefined(i.dragIndicator)||t.remove(i.dragIndicator),t.isNullOrUndefined(e)||e.remove()}}),-1===i.dragCollection.indexOf(i.dragObj)&&i.dragCollection.push(i.dragObj)})},i.prototype.checkInstance=function(e,i){var s=!t.isNullOrUndefined(e.target.closest("."+I.chipList))&&e.target.closest("."+I.chipList).id!==i.element.id;return s&&(this.updatedInstance=e.target.closest("."+I.chipList)),s},i.prototype.setIcons=function(e,t,i,s,n){var o=e.element.contains(i),r=i.closest(".e-droppable");!o&&!r||n?(t.classList.remove(I.dragAndDrop),t.classList.add(I.dropRestricted),s.style.display="none"):(t.classList.add(I.dragAndDrop),t.classList.remove(I.dropRestricted),r&&(s.style.display="none"))},i.prototype.allowExternalDragging=function(e,t,i){var s,n=null,o=1/0,r=-1,l=!1;if(this.checkInstance(e,this)){if(this.dragIndicator.style.display="none",s=this.getCurrentInstance(e),s.dragIndicator=this.dragIndicator,!s.allowDragAndDrop)return}else s=this;var a=s.dragIndicator;a.style.display="inline",l=this.dragAreaCheck(this.dragArea,e.target,l,i,a),this.setIcons(s,i,e.target,a,l),s.element.appendChild(t);var p=t.getBoundingClientRect(),c=Array.from(s.element.querySelectorAll("."+I.chip));c.forEach(function(e,i){if(e!==t){var s=e.getBoundingClientRect(),l=Math.sqrt(Math.pow(p.left-s.left,2)+Math.pow(p.top-s.top,2));l<o&&(o=l,n=e,r=i)}}),-1===r&&(r=c.length);var h,d=this.getChipsDistance(s),u=t.getBoundingClientRect();(n||c.length>0)&&(h=(n||c[c.length-1]).getBoundingClientRect(),a.style.top=h.top+window.scrollY+"px",a.style.left=s.enableRtl?h.right+d+"px":h.left-d+window.scrollX+"px"),s.enableRtl?u.left<h.left-h.width/2&&u.top>h.top&&(a.style.left=h.left-d+window.scrollX+"px"):u.left>h.left+h.width/2&&u.top>h.top&&(a.style.left=h.left+h.width+d+window.scrollX+"px")},i.prototype.dragAreaCheck=function(e,i,s,n,o){if(t.isNullOrUndefined(e))return!1;var r="string"==typeof e,l=e instanceof HTMLElement,a=r?document.querySelector(e):e;return t.isNullOrUndefined(a)||!r&&!l||a.contains(i)||(s=!0,o.style.display="none",n.classList.add(I.dropRestricted),n.classList.remove(I.dragAndDrop)),s},i.prototype.getChipsDistance=function(e){if(e.chips.length<=1)return 4;var t=e.find(0).element.getBoundingClientRect(),i=e.find(1).element.getBoundingClientRect(),s=t.left;if(e.enableRtl){var n=i.right;return s<n?4:(s-n)/2}var o=t.width,r=i.left;return r<s+o?4:(r-(s+o))/2},i.prototype.getCurrentInstance=function(e){var i=e.target.closest("."+I.chipList);if(!t.isNullOrUndefined(i)&&!t.isNullOrUndefined(i.ej2_instances))for(var n=0;n<i.ej2_instances.length;n++)if(i.ej2_instances[parseInt(n.toString(),10)]instanceof s)return i.ej2_instances[n];return null},i.prototype.allowExternalDrop=function(e,t){var i,s=parseInt(t.getAttribute("drag-indicator-index"),10),n=!1,o=!1;if(this.checkInstance(e,this)){if(o=!0,!(i=this.getCurrentInstance(e)).allowDragAndDrop)return}else i=this;var r=i.dragIndicator;if(r.style.display="inline",i.element.contains(e.target)&&!(n=this.dragAreaCheck(this.dragArea,e.target,n,t.querySelector("."+I.chipDrag),r))){for(var l=r.getBoundingClientRect(),a=Array.from(i.element.querySelectorAll("."+I.chip)),p=-1,c=!1,h=!1,d=!1,u=0;u<a.length;u++)if(a[u]!==t){var f=a[u].getBoundingClientRect();if(c=l.top<f.top+f.height/2,h=l.left<f.left+f.width/2,d=l.left>f.left+f.width/2,!i.enableRtl&&c&&h||i.enableRtl&&c&&d){p=u,u>s&&!o&&(p=u-1);break}}if(-1===p){for(var m=void 0,u=0;u<a.length;u++)if((f=a[u].getBoundingClientRect()).top>l.top||f.top===l.top&&f.left>l.left){m=u;break}p=m!==a.length?m:a.length}var v=Array.from(this.chips);o?this.dropChip(v,s,i,p,!0):p!==s&&this.dropChip(v,s,i,p,!1)}},i.prototype.dropChip=function(e,t,i,s,n){var o=e.splice(t,1)[0];if(n){var r=Array.from(i.chips);r.splice(s,0,o),i.chips=r}else e.splice(s,0,o),i.chips=e;this.chips=e,i.dataBind(),this.dataBind(),i.enableDraggingChips()},i.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.innerText:this.text]:this.chips)},i.prototype.setAttributes=function(){"chip"===this.type?(this.enabled&&(this.element.tabIndex=0),this.element.setAttribute("role","button")):(this.element.classList.add(I.chipSet),this.element.setAttribute("role","listbox"),"Multiple"===this.selection?(this.element.classList.add(I.multiSelection),this.element.setAttribute("aria-multiselectable","true")):"Single"===this.selection?(this.element.classList.add(I.singleSelection),this.element.setAttribute("aria-multiselectable","false")):this.element.setAttribute("aria-multiselectable","false"))},i.prototype.setRtl=function(){this.element.classList[this.enableRtl?"add":"remove"](I.rtl)},i.prototype.renderTemplates=function(){this.isReact&&this.renderReactTemplates()},i.prototype.templateParser=function(e){if(e)try{return"function"!=typeof e&&document.querySelectorAll(e).length?t.compile(document.querySelector(e).innerHTML.trim()):t.compile(e)}catch(i){return t.compile(e)}},i.prototype.chipCreation=function(e){if(!t.isNullOrUndefined(e)){for(var i=[],s=[],n=0;n<e.length;n++){var o=this.getFieldValues(e[n]),r=o.htmlAttributes;s.push(r);var l=this.elementCreation(o),a=(I.chip+" "+(o.enabled?" ":I.disabled)+" "+(o.avatarIconCss||o.avatarText?I.chipWrapper:o.leadingIconCss?I.iconWrapper:" ")+" "+o.cssClass).split(" ").filter(function(e){return e});if(this.chipType()&&"chip"!==this.type){var p=this.createElement("DIV",{className:a.join(" "),attrs:{tabIndex:"0",role:"option","aria-label":o.text,"aria-selected":"false"}});if(this.enableDelete&&p.setAttribute("aria-keyshortcuts","Press delete or backspace key to delete"),o.value&&p.setAttribute("data-value",o.value.toString()),o.enabled?p.setAttribute("aria-disabled","false"):(p.removeAttribute("tabindex"),p.setAttribute("aria-disabled","true")),!t.isNullOrUndefined(s[n])&&s.length>n&&Object.keys(s[n]).length){var c=[];c=Object.keys(s[n]);for(var h=0;h<c.length;h++)p.setAttribute(c[h],s[n][c[h]])}t.append(l,p),i.push(p)}else i=l,t.addClass([this.element],a),this.element.setAttribute("aria-label",o.text),o.value&&this.element.setAttribute("data-value",o.value.toString())}t.append(i,this.element)}},i.prototype.getFieldValues=function(e){var t=!("false"===this.enabled.toString());return{text:"object"==typeof e?e.text?e.text.toString():this.text.toString():this.chipType()?e.toString():this.innerText?this.innerText:this.text.toString(),cssClass:"object"==typeof e&&e.cssClass?e.cssClass.toString():this.cssClass.toString(),leadingIconCss:"object"==typeof e&&e.leadingIconCss?e.leadingIconCss.toString():this.leadingIconCss.toString(),avatarIconCss:"object"==typeof e&&e.avatarIconCss?e.avatarIconCss.toString():this.avatarIconCss.toString(),avatarText:"object"==typeof e&&e.avatarText?e.avatarText.toString():this.avatarText.toString(),trailingIconCss:"object"==typeof e&&e.trailingIconCss?e.trailingIconCss.toString():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.leadingIco