@syncfusion/ej2-querybuilder 31.2.12 → 31.2.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ej2-querybuilder.min.js +2 -2
- package/dist/ej2-querybuilder.umd.min.js +2 -2
- package/dist/ej2-querybuilder.umd.min.js.map +1 -1
- package/dist/es6/ej2-querybuilder.es2015.js +9 -2
- package/dist/es6/ej2-querybuilder.es2015.js.map +1 -1
- package/dist/es6/ej2-querybuilder.es5.js +9 -2
- package/dist/es6/ej2-querybuilder.es5.js.map +1 -1
- package/dist/global/ej2-querybuilder.min.js +2 -2
- package/dist/global/ej2-querybuilder.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +4 -4
- package/src/query-builder/query-builder.js +9 -2
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* filename: ej2-querybuilder.min.js
|
|
3
|
-
* version : 31.2.
|
|
3
|
+
* version : 31.2.15
|
|
4
4
|
* Copyright Syncfusion Inc. 2001 - 2025. All rights reserved.
|
|
5
5
|
* Use of this code is subject to the terms of our license.
|
|
6
6
|
* A copy of the current license can be obtained at any time by e-mailing
|
|
7
7
|
* licensing@syncfusion.com. Any infringement will be prosecuted under
|
|
8
8
|
* applicable laws.
|
|
9
9
|
*/
|
|
10
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("SyncfusionBase"),require("SyncfusionButtons"),require("SyncfusionDropdowns"),require("SyncfusionData"),require("SyncfusionInputs"),require("SyncfusionCalendars"),require("SyncfusionSplitbuttons"),require("SyncfusionPopups")):"function"==typeof define&&define.amd?define(["SyncfusionBase","SyncfusionButtons","SyncfusionDropdowns","SyncfusionData","SyncfusionInputs","SyncfusionCalendars","SyncfusionSplitbuttons","SyncfusionPopups"],t):"object"==typeof exports?exports.SyncfusionQuerybuilder=t(require("SyncfusionBase"),require("SyncfusionButtons"),require("SyncfusionDropdowns"),require("SyncfusionData"),require("SyncfusionInputs"),require("SyncfusionCalendars"),require("SyncfusionSplitbuttons"),require("SyncfusionPopups")):e.SyncfusionQuerybuilder=t(e.SyncfusionBase,e.SyncfusionButtons,e.SyncfusionDropdowns,e.SyncfusionData,e.SyncfusionInputs,e.SyncfusionCalendars,e.SyncfusionSplitbuttons,e.SyncfusionPopups)}(self,(e,t,l,n,r,i,o,s)=>(()=>{"use strict";var a={766:t=>{t.exports=e},741:e=>{e.exports=t},570:e=>{e.exports=i},74:e=>{e.exports=n},778:e=>{e.exports=l},323:e=>{e.exports=r},197:e=>{e.exports=s},295:e=>{e.exports=o}},u={};function d(e){var t=u[e];if(void 0!==t)return t.exports;var l=u[e]={exports:{}};return a[e](l,l.exports,d),l.exports}d.d=(e,t)=>{for(var l in t)d.o(t,l)&&!d.o(e,l)&&Object.defineProperty(e,l,{enumerable:!0,get:t[l]})},d.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),d.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var c={};return(()=>{d.r(c),d.d(c,{Columns:()=>m,QueryBuilder:()=>y,QueryLibrary:()=>b,Rule:()=>g,ShowButtons:()=>v,Value:()=>f});var e,t=d(766),l=d(741),n=d(778),r=d(74),i=d(323),o=d(570),s=d(295),a=d(197),u=(e=function(t,l){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var l in t)t.hasOwnProperty(l)&&(e[l]=t[l])},e(t,l)},function(t,l){function n(){this.constructor=t}e(t,l),t.prototype=null===l?Object.create(l):(n.prototype=l.prototype,new n)}),p=function(){return p=Object.assign||function(e){for(var t,l=1,n=arguments.length;l<n;l++)for(var r in t=arguments[l])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},p.apply(this,arguments)},h=function(e,t,l,n){var r,i=arguments.length,o=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,l):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,l,n);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(o=(i<3?r(o):i>3?r(t,l,o):r(t,l))||o);return i>3&&o&&Object.defineProperty(t,l,o),o},m=function(e){function l(){return null!==e&&e.apply(this,arguments)||this}return u(l,e),h([(0,t.Property)(null)],l.prototype,"field",void 0),h([(0,t.Property)(null)],l.prototype,"label",void 0),h([(0,t.Property)(null)],l.prototype,"type",void 0),h([(0,t.Property)(null)],l.prototype,"values",void 0),h([(0,t.Property)(null)],l.prototype,"operators",void 0),h([(0,t.Property)()],l.prototype,"ruleTemplate",void 0),h([(0,t.Property)(null)],l.prototype,"template",void 0),h([(0,t.Property)({isRequired:!0,min:0,max:Number.MAX_VALUE})],l.prototype,"validation",void 0),h([(0,t.Property)(null)],l.prototype,"format",void 0),h([(0,t.Property)(null)],l.prototype,"step",void 0),h([(0,t.Property)(null)],l.prototype,"value",void 0),h([(0,t.Property)(null)],l.prototype,"category",void 0),h([(0,t.Property)(null)],l.prototype,"columns",void 0),l}(t.ChildProperty),g=function(e){function l(){return null!==e&&e.apply(this,arguments)||this}return u(l,e),h([(0,t.Property)(null)],l.prototype,"condition",void 0),h([(0,t.Collection)([],l)],l.prototype,"rules",void 0),h([(0,t.Property)(null)],l.prototype,"field",void 0),h([(0,t.Property)(null)],l.prototype,"label",void 0),h([(0,t.Property)(null)],l.prototype,"type",void 0),h([(0,t.Property)(null)],l.prototype,"operator",void 0),h([(0,t.Property)(null)],l.prototype,"value",void 0),h([(0,t.Property)(!1)],l.prototype,"not",void 0),h([(0,t.Property)(null)],l.prototype,"isLocked",void 0),l}(t.ChildProperty),f=function(e){function l(){return null!==e&&e.apply(this,arguments)||this}return u(l,e),h([(0,t.Property)(null)],l.prototype,"numericTextBoxModel",void 0),h([(0,t.Property)(null)],l.prototype,"multiSelectModel",void 0),h([(0,t.Property)(null)],l.prototype,"datePickerModel",void 0),h([(0,t.Property)(null)],l.prototype,"textBoxModel",void 0),h([(0,t.Property)(null)],l.prototype,"radioButtonModel",void 0),l}(t.ChildProperty),v=function(e){function l(){return null!==e&&e.apply(this,arguments)||this}return u(l,e),h([(0,t.Property)(!1)],l.prototype,"cloneRule",void 0),h([(0,t.Property)(!1)],l.prototype,"cloneGroup",void 0),h([(0,t.Property)(!1)],l.prototype,"lockRule",void 0),h([(0,t.Property)(!1)],l.prototype,"lockGroup",void 0),h([(0,t.Property)(!0)],l.prototype,"ruleDelete",void 0),h([(0,t.Property)(!0)],l.prototype,"groupInsert",void 0),h([(0,t.Property)(!0)],l.prototype,"groupDelete",void 0),l}(t.ChildProperty),y=function(e){function d(t,l){var r=e.call(this,t,l)||this;return r.isReadonly=!0,r.fields={text:"label",value:"field"},r.updatedRule={not:!1,condition:"and",isLocked:!1},r.isLocale=!1,r.isRefreshed=!1,r.isNotified=!1,r.isAddSuccess=!1,r.isNotValueChange=!1,r.isFieldChange=!1,r.isFieldClose=!1,r.isDestroy=!1,r.isGetNestedData=!1,r.isCustomOprCols=[],r.groupCounter=0,r.lockItems=[],r.groupIndex=-1,r.ruleIndex=-1,r.isLastGroup=!1,r.cloneGrpBtnClick=!1,r.isMiddleGroup=!1,r.cloneRuleBtnClick=!1,r.isValueEmpty=!1,r.isPropChange=!1,r.isRuleClicked=!1,n.MultiSelect.Inject(n.CheckBoxSelection),r}return u(d,e),d.prototype.getPersistData=function(){return this.addOnPersist(["rule"])},d.prototype.reset=function(){this.isImportRules=!1;var e=this.element.querySelector(".e-group-body"),l=this.element.querySelectorAll("input.e-control"),n=0,r=function(){for(var e=Math.min(n+20,l.length),i=n;i<e;i++){var o=l[i];try{if(o.className.indexOf("e-tooltip")>-1)(s=(0,t.getComponent)(o,"tooltip"))&&s.destroy();else if(o.parentElement&&o.parentElement.className.indexOf("e-tooltip")>-1){var s;(s=(0,t.getComponent)(o.parentElement,"tooltip"))&&s.destroy()}}catch(e){console.warn("Error destroying tooltip:",e)}}(n=e)<l.length&&requestAnimationFrame(r)};if(l.length>0&&r(),e)e.textContent="";else{var i=document.createDocumentFragment(),o=this.createElement("div",{attrs:{class:"e-group-container"}}),s=this.createElement("div",{attrs:{class:"e-group-header"}}),a=this.createElement("div",{attrs:{class:"e-group-body"}});o.appendChild(s),o.appendChild(a),i.appendChild(o),this.element.appendChild(i),e=this.element.querySelector(".e-group-body")}if(this.headerTemplate&&this.isRoot&&(this.element.textContent="",this.isRoot=!1),this.enableNotCondition)for(var u=this.element.querySelectorAll(".e-qb-toggle"),d=0;d<u.length;d++)(0,t.removeClass)([u[d]],"e-active-toggle");e&&e.appendChild(this.createElement("div",{attrs:{class:"e-rule-list"}})),this.levelColl[this.element.id+"_group0"]=[0],this.setProperties({rule:{condition:"and",not:!1,rules:[]}},!0),e&&e.parentElement&&this.disableRuleCondition(e.parentElement)},d.prototype.getWrapper=function(){return this.element},d.prototype.getModuleName=function(){return"query-builder"},d.prototype.requiredModules=function(){var e=[];return e.push({member:"query-library",args:[this]}),e},d.prototype.GetRootColumnName=function(e){return(0,t.isNullOrUndefined)(e)?"":this.separator?e.split(this.separator)[0]:e},d.prototype.initialize=function(){var e=this;if(this.dataColl.length){var t,l,n=Object.keys(this.dataColl[0]),r=[],i=[],o=!1,s=!1,a={isRequired:!0,min:0,max:Number.MAX_VALUE};if(this.columns.length){this.columnSort(),this.columns.forEach(function(r){e.updateCustomOperator(r,"initial"),r.type||(n.indexOf(r.field)>-1&&(l=e.dataColl[0][r.field],"string"===(t=typeof l)?s=!isNaN(Date.parse(l)):"object"===t&&(s=l instanceof Date&&!isNaN(l.getTime()),t="string"),r.type=t,s=!1),t="string"),r.validation||(r.validation=a),r.category?o=!0:r.category=e.l10n.getConstant("OtherFields"),i.indexOf(r.category)<0&&i.push(r.category),(!r.operators||e.isLocale&&-1===e.isCustomOprCols.indexOf(r.field))&&(r.operators=e.customOperators[r.type+"Operator"])}),o&&(i.length>1||i[0]!==this.l10n.getConstant("OtherFields"))&&(this.fields={text:"label",value:"field",groupBy:"category"}),this.updateSubFieldsFromColumns(this.columns)}else{for(var u=0,d=n.length;u<d;u++)l=this.dataColl[0][n[u]],"string"===(t=typeof l)?s=!isNaN(Date.parse(l)):"object"!==t||Object.keys(l).length||(s=l instanceof Date&&!isNaN(l.getTime()),t="string"),r[u]={field:n[u],label:n[u],type:s?"date":t,validation:a},s=!1,r[u].operators=this.customOperators[r[u].type+"Operator"],"object"===t&&this.updateSubFields(l,r[u]);this.columns=r}}else this.columns&&this.columns.length&&("Default"!==this.sortDirection&&this.columnSort(),this.processColumnsInBatches(),this.columns.length>50?setTimeout(function(){e.updateSubFieldsFromColumns(e.columns)},0):this.updateSubFieldsFromColumns(this.columns));this.trigger("dataBound",{type:"dataBound"})},d.prototype.processColumnsInBatches=function(){var e=this,t=this.columns,l=0,n=function(){for(var r=Math.min(l+10,t.length),i=l;i<r;i++)t[i].category&&t[i].category!==e.l10n.getConstant("OtherFields")?e.fields={text:"label",value:"field",groupBy:"category"}:t[i].category=e.l10n.getConstant("OtherFields"),e.updateCustomOperator(t[i],"initial"),(!t[i].operators||e.isLocale&&-1===e.isCustomOprCols.indexOf(t[i].field))&&(t[i].operators=e.customOperators[t[i].type+"Operator"]);(l=r)<t.length&&requestAnimationFrame(n)};n()},d.prototype.updateSubFieldsFromColumns=function(e,t){if(e.length>50)this.updateSubFieldsLarge(e,t);else for(var l=0;l<e.length;l++)""!==this.separator&&e[l].field.indexOf(this.separator)<0&&(e[l].field=t?t+this.separator+e[l].field:e[l].field),e[l].operators?this.updateCustomOperator(e[l]):e[l].type&&"object"!==e[l].type&&(e[l].operators=this.customOperators[e[l].type+"Operator"]),e[l].columns&&(e[l].type="object",this.updateSubFieldsFromColumns(e[l].columns,e[l].field))},d.prototype.updateSubFieldsLarge=function(e,t){var l=this,n=0,r=e.length,i=function(){for(var o=Math.min(n+10,r);n<o;n++)""!==l.separator&&e[n].field.indexOf(l.separator)<0&&(e[n].field=t?t+l.separator+e[n].field:e[n].field),e[n].operators?l.updateCustomOperator(e[n]):e[n].type&&"object"!==e[n].type&&(e[n].operators=l.customOperators[e[n].type+"Operator"]);n<r?requestAnimationFrame(i):setTimeout(function(){for(var t=0;t<r;t++)e[t].columns&&(e[t].type="object",l.updateSubFieldsFromColumns(e[t].columns,e[t].field))},0)};i()},d.prototype.updateSubFields=function(e,t,l){var n;t.columns=[];var r,i,o=Object.keys(e);l=l||this.dataColl[0];for(var s=0,a=o.length;s<a;s++){var u=t.field.split(".");i=l?l[u[u.length-1]][o[s]]:this.dataColl[0][t.field][o[s]];var d=l[t.field.split(this.separator)[t.field.split(this.separator).length-1]];r=typeof i,n={field:t.field+this.separator+o[s],label:o[s],type:r="object"!==r||isNaN(Date.parse(i))?r:"date"},"object"!==r&&(n.operators=this.customOperators[r+"Operator"]),t.columns.push(n),"object"===r&&this.updateSubFields(i,n,d)}},d.prototype.updateCustomOperator=function(e,l){if(e.operators){this.isLocale||"initial"!==l||(0,t.isNullOrUndefined)(this.isCustomOprCols)||this.isCustomOprCols.push(e.field);for(var n=function(t){var l=Object.keys(e.operators[t]).indexOf("sqlOperator");if(l>-1){var n=e.operators[t],i=Object.keys(n),o=i.map(function(e){return n[""+e]}).join(",").split(","),s=i.indexOf("value");r.operators[o[s]]=o[l]}},r=this,i=0;i<e.operators.length;i++)n(i)}},d.prototype.focusEventHandler=function(e){this.target=e.target},d.prototype.clickEventHandler=function(e){var l,n,r=this,i=e.target;if(this.isImportRules=!1,"SPAN"===i.tagName&&(i=i.parentElement),"string"==typeof i.className&&i.className.indexOf("e-collapse-rule")>-1){var o=new t.Animation({duration:1e3,delay:0});this.element.querySelectorAll(".e-summary-content").length<1&&this.renderSummary();var s=document.getElementById(this.element.id+"_summary_content"),a=s.querySelector(".e-summary-text");o.animate(".e-query-builder",{name:"SlideLeftIn"}),(d=this.element.querySelector(".e-group-container")).style.display="none",a.textContent=this.getSqlFromRules(this.rule),s.style.display="block",a.style.height=a.scrollHeight+"px"}if("BUTTON"===i.tagName&&"string"==typeof i.className&&i.className.indexOf("e-qb-toggle")<0){o=new t.Animation({duration:1e3,delay:0});switch(!0){case i.className.indexOf("e-removerule")>-1:this.actionButton=i,this.deleteRule(i);break;case i.className.indexOf("e-clone-rule-btn")>-1:this.actionButton=i,this.cloneRuleBtnClick=!0,this.isRuleClicked=!0,this.ruleClone(i);break;case i.className.indexOf("e-lock-rule-btn")>-1:this.actionButton=i,this.ruleLock(i);break;case i.className.indexOf("e-lock-grp-btn")>-1:this.actionButton=i,this.groupLock(i);break;case i.className.indexOf("e-clone-grp-btn")>-1:this.actionButton=i,this.cloneGrpBtnClick=!0,this.isRuleClicked=!0,this.groupClone((0,t.closest)(i,".e-group-container"));break;case i.className.indexOf("e-deletegroup")>-1:this.actionButton=i,this.deleteGroup((0,t.closest)(i,".e-group-container"));break;case i.className.indexOf("e-edit-rule")>-1:if(o.animate(".e-query-builder",{name:"SlideLeftIn"}),document.getElementById(this.element.id+"_summary_content").style.display="none",this.element.querySelectorAll(".e-group-container").length<1){this.addGroupElement(!1,this.element,this.rule.condition,!1,this.rule.not);var u=(0,t.extend)({},this.rule,{},!0);this.setGroupRules(u),this.renderSummaryCollapse()}else{var d;(d=this.element.querySelector(".e-group-container")).querySelectorAll(".e-collapse-rule").length<1&&this.renderSummaryCollapse(),d.style.display="block"}}}else if("LABEL"===i.tagName&&i.parentElement.className.indexOf("e-btn-group")>-1||"string"==typeof i.className&&i.className.indexOf("e-qb-toggle")>-1){var c=(0,t.closest)(i,".e-group-container");if(!this.headerTemplate){var p=i.getAttribute("for"),h=void 0;p?h=document.getElementById(p).getAttribute("value"):this.enableSeparateConnector&&(h=i.classList.contains("e-btngroup-or-lbl")?"or":i.classList.contains("e-btngroup-and-lbl")?"and":i.textContent),n=c.id.replace(this.element.id+"_","");var m=this.getGroup(n),g=void 0;if(this.enableNotCondition)if(i.className.indexOf("e-qb-toggle")>-1){var f=c.getElementsByClassName("e-qb-toggle")[0];f.className.indexOf("e-active-toggle")>-1?((0,t.removeClass)([f],"e-active-toggle"),g=!1):((0,t.addClass)([f],"e-active-toggle"),g=!0),h=m.condition}else g=m.not;l={groupID:n,cancel:!1,type:"condition",value:h.toLowerCase()},this.enableNotCondition&&(l={groupID:n,cancel:!1,type:"condition",value:h.toLowerCase(),not:g})}this.isImportRules?this.beforeSuccessCallBack(l,i):this.trigger("beforeChange",l,function(e){r.beforeSuccessCallBack(e,i)}),this.target=i}},d.prototype.beforeSuccessCallBack=function(e,l){if(e&&!e.cancel){var n=(0,t.closest)(l,".e-group-container"),r=n.id.replace(this.element.id+"_",""),i=this.getValidRules(this.rule),o=this.getParentGroup(n);if(this.enableSeparateConnector){var s=(n=(0,t.isNullOrUndefined)((0,t.closest)(l,".e-rule-container"))&&n.classList.contains("e-group-container")?null!==l.parentElement.previousElementSibling?l.parentElement.previousElementSibling:n:(0,t.closest)(l,".e-rule-container")).id.replace(this.element.id+"_","");n.classList.contains("e-rule-container")?(o=this.getRule(n)).condition=e.value:n.classList.contains("e-group-container")&&((o=this.getGroup(n)).condition=e.value),this.enableNotCondition&&(o.not=e.not),this.isImportRules||this.trigger("change",{groupID:r,ruleID:s,type:"condition",value:o.condition})}else o.condition=e.value,this.enableNotCondition&&(o.not=e.not),this.isImportRules||this.trigger("change",{groupID:r,type:"condition",value:o.condition});if(this.filterRules(i,this.getValidRules(this.rule),"condition"),this.enableSeparateConnector){var a=l.parentElement.querySelector(".e-btngroup-and"),u=l.parentElement.querySelector(".e-btngroup-or");a&&u&&("and"===e.value?(a.checked=!0,u.checked=!1):"or"===e.value&&(u.checked=!0,a.checked=!1))}}},d.prototype.selectBtn=function(e,l){"beforeOpen"===l.name?this.showButtons.groupInsert||(0,t.isNullOrUndefined)(this.showButtons.groupInsert)?(this.element.querySelectorAll(".e-group-container").length>=this.maxGroupCount+1?(0,t.addClass)([l.element.querySelector("li span.e-addgroup").parentElement],"e-button-hide"):(0,t.removeClass)([l.element.querySelector("li span.e-addgroup").parentElement],"e-button-hide"),this.enableRtl&&(0,t.addClass)([l.element.querySelector("li").parentElement],"e-rtl")):(0,t.addClass)([l.element.querySelector("li span.e-addgroup").parentElement],"e-button-hide"):l.element.children[0].className.indexOf("e-addrule")>-1?(this.isRuleClicked=!0,this.addRuleElement((0,t.closest)(e,".e-group-container"),{})):l.element.children[0].className.indexOf("e-addgroup")>-1&&(this.isRuleClicked=!0,this.addGroupElement(!0,(0,t.closest)(e,".e-group-container"),"",!0))},d.prototype.appendRuleElem=function(e,l,n,r,i,o){var s,a,u,d=e&&e.querySelector(".e-rule-list");if("change"===n)s=(0,t.select)("#"+r,e);else{if((s=this.createElement("div",{attrs:{class:"e-rule-container"}})).setAttribute("id",e.id+"_rule"+this.ruleIdCounter),this.showButtons.cloneRule&&this.cloneRuleBtnClick){if(this.ruleIndex<0)d.appendChild(s);else if(this.enableSeparateConnector){for(var c=-1,p=this.ruleIndex+1,h=0;h<p&&h!==d.children.length;h++)d.children[h].classList.contains("e-rule-container")&&(p++,c++);d.insertBefore(s,d.children[this.ruleIndex+c+1])}else d.insertBefore(s,d.children[this.ruleIndex+1]);this.cloneRuleBtnClick=!1}else d.appendChild(s);this.ruleIdCounter++}if(l&&l.ruleTemplate&&o){u={requestType:"template-initialize",ruleID:s.id,action:i,fields:this.fields,rule:o},this.trigger("actionBegin",u),this.ruleTemplateFn=this.templateParser(l.ruleTemplate);var m=this.element.id+l.field;if(u.fields=this.fields,u.columns=this.columns,""===o.field&&(o.field=l.field),u.operators=this.getOperators(o.field),u.operatorFields={text:"key",value:"value"},this.isReact)(a=this.ruleTemplateFn(u,this,s.id,m)[0]).className+=" e-rule-field",s.appendChild(a);else if(this.isAngular){var g=this.ruleTemplateFn(u,this,s.id,m);(a=3===g[0].nodeType?g[1]:g[0]).className+=" e-rule-field",s.appendChild(a)}else this.isVue3?(a=this.ruleTemplateFn(u,this,"Template",m),(0,t.append)(a,s),s.children.length&&(s.children[s.children.length-1].className+=" e-rule-field")):((a=this.ruleTemplateFn(u,this,"Template",m)[0]).className+=" e-rule-field",s.appendChild(a))}else a=this.ruleElem.querySelector(".e-rule-field").cloneNode(!0),s.appendChild(a);return this.showButtons.lockGroup&&(0,t.removeClass)(s.querySelectorAll(".e-lock-grp-btn"),"e-button-hide"),this.showButtons.lockRule&&(0,t.removeClass)(s.querySelectorAll(".e-lock-rule-btn"),"e-button-hide"),this.showButtons.cloneGroup&&(0,t.removeClass)(s.querySelectorAll(".e-clone-grp-btn"),"e-button-hide"),this.showButtons.cloneRule&&(0,t.removeClass)(s.querySelectorAll(".e-clone-rule-btn"),"e-button-hide"),this.showButtons.ruleDelete&&(0,t.removeClass)(s.querySelectorAll(".e-lock-grp-btn"),"e-button-hide"),this.allowDragAndDrop&&(0,t.removeClass)(s.querySelectorAll(".e-drag-qb-rule"),"e-hidden"),l&&l.ruleTemplate&&o&&this.renderReactTemplates(),s},d.prototype.addRuleElement=function(e,t,l,n,r,i){var o=this;if(e){var s={groupID:e.id.replace(this.element.id+"_",""),cancel:!1,type:"insertRule"};this.isImportRules||this.isInitialLoad||this.prvtEvtTgrDaD?(this.isInitialLoad=!1,this.addRuleSuccessCallBack(s,e,t,l,n,r,i)):this.trigger("beforeChange",s,function(s){o.addRuleSuccessCallBack(s,e,t,l,n,r,i)})}},d.prototype.addRuleSuccessCallBack=function(e,l,n,r,i,o,s){var a,u,d,c=this,p=this.element.className.indexOf("e-device")>-1||"Vertical"===this.displayMode,h=p?"250px":"200px",m=n&&n.field?this.getColumn(n.field):r||this.columns[0],g={label:"",field:"",type:"",operator:""};if(!e.cancel){if(m&&m.ruleTemplate&&n.field){this.selectedColumn=m,u=this.selectedColumn.operators,g={label:m.label,field:m.field,type:m.type,operator:u[0].value};var f=Object.keys(n).length?n:g,v={requestType:"template-initialize",ruleID:(d=this.appendRuleElem(l,m,i,o,"field",f)).id,action:"insert-rule",fields:this.fields,rule:f};this.trigger("actionBegin",v),setTimeout(function(){var e={requestType:"template-create",ruleID:d.id,action:"insert-rule",fields:c.fields,rule:f};c.trigger("actionBegin",e)},0)}else{(d=this.appendRuleElem(l,m,i,o,"field")).querySelector(".e-filter-input").setAttribute("id",d.id+"_filterkey");var y=d.querySelector(".e-rule-delete");if(this.element.className.indexOf("e-device")>-1||"Vertical"===this.displayMode)y.textContent=this.l10n.getConstant("Remove"),(0,t.addClass)([y],"e-flat"),(0,t.addClass)([y],"e-primary");else{(0,t.addClass)([y],"e-round"),(0,t.addClass)([y],"e-icon-btn"),y.setAttribute("title",this.l10n.getConstant("DeleteRule"));var b=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-delete-icon"}});y.appendChild(b)}this.showButtons.ruleDelete||y.classList.add("e-button-hide")}d.className="e-rule-container "+(p?"e-vertical-mode":"e-horizontal-mode");var C=d.previousElementSibling;this.processAdjacentElements(d,C,n),this.isImportRules||this.updateAddedRule(l,n,g,s,o,!!this.enableSeparateConnector||null),""===this.rule.condition&&(this.isRuleClicked||this.rule.rules.length>1)&&(this.rule.condition="and"),this.isRuleClicked=!1;var S=this.rule.rules.length;if(m&&(!m||m.ruleTemplate)&&n.field||(S>20?setTimeout(function(){c.applyFieldComponent(d,n,h)},0):this.applyFieldComponent(d,n,h)),a=d.id.replace(this.element.id+"_",""),n&&n.isLocked){var x=d.querySelector(".e-lock-rule-btn");this.ruleLock(x)}this.isImportRules||this.prvtEvtTgrDaD||this.trigger("change",{groupID:l.id.replace(this.element.id+"_",""),ruleID:a,type:"insertRule"})}this.enableSeparateConnector&&(0,t.isNullOrUndefined)(n.condition)&&a&&(n=this.getRule(a)),this.enableSeparateConnector&&this.processConnectorElements(d)},d.prototype.processAdjacentElements=function(e,l,n){if(this.enableSeparateConnector){if(l&&l.classList.contains("e-group-container")){var r=l.querySelectorAll(".e-rule-container");l=r[r.length-1]}if(l&&l.classList.contains("e-rule-container")){var i=this.getRule(l);this.headerTemplate&&this.headerTemplateFn(l,!1,i.condition,i,l.id)}else(0,t.isNullOrUndefined)(l)&&e.id!==this.element.id+"_group0_rule0"&&this.handleOrphanedRuleElement(e,n)}else l&&l.className.indexOf("e-rule-container")>-1&&(e.classList.add("e-joined-rule"),l.classList.add("e-prev-joined-rule"));l&&l.className.indexOf("e-group-container")>-1&&e.className.indexOf("e-separate-rule")<0&&(e.className+=" e-separate-rule")},d.prototype.handleOrphanedRuleElement=function(e,t){var l=e.closest(".e-group-container");if(l&&l.previousElementSibling){var n=l.previousElementSibling,r=n.querySelectorAll(".e-rule-container");if(n.classList.contains("e-group-container")&&(n=r[r.length-1]),n.classList.contains("e-rule-container")){var i=this.getRule(n);this.headerTemplateFn(n,!1,i.condition,i,n.id,!0)}}else this.headerTemplateFn(e,!1,t.condition,t,e.id,!0)},d.prototype.processConnectorElements=function(e){for(var l,n=e.previousElementSibling;n&&!n.classList.contains("e-rule-container");){if(n.classList.contains("e-group-container")){l=n.querySelectorAll(".e-rule-container"),n=l[l.length-1];break}n=n.previousElementSibling}if(this.headerTemplate&&n){var r=this.getRule(n),i={requestType:"rule-template-create",ruleID:n.id,condition:r.condition,notCondition:!!this.enableNotCondition||void 0};this.trigger("actionBegin",i)}else(0,t.isNullOrUndefined)(n)&&e.id!==this.element.id+"_group0_rule0"&&this.handleOrphanedConnectorElement(e);this.setMultiConnector(e)},d.prototype.handleOrphanedConnectorElement=function(e){var t=e.closest(".e-group-container");if(t&&t.previousElementSibling&&t.previousElementSibling.previousElementSibling){var l=t.previousElementSibling.previousElementSibling;if(l.classList.contains("e-group-container")){var n=l.querySelectorAll(".e-rule-container");l=n[n.length-1]}if(l.classList.contains("e-rule-container")){var r=this.getRule(l),i={requestType:"rule-template-create",ruleID:l.id,condition:r.condition,notCondition:!!this.enableNotCondition||void 0};this.trigger("actionBegin",i)}}},d.prototype.applyFieldComponent=function(e,t,l){"Default"===this.fieldMode?this.applyDropdownListComponent(e,t,l):this.applyDropdownTreeComponent(e,t,l)},d.prototype.applyDropdownListComponent=function(e,t,l){var r,i;i=this.separator&&t.field||this.autoSelectField||this.isImportRules?this.GetRootColumnName(t.field):t.field,r={dataSource:this.columns,fields:this.fields,placeholder:this.l10n.getConstant("SelectField"),popupHeight:this.columns.length>5?l:"auto",close:this.fieldClose.bind(this,e.id+"_filterkey"),change:this.changeField.bind(this),value:t?i:null,open:this.popupOpen.bind(this,!0),cssClass:"qb-dropdownlist"},this.fieldModel&&(r=p({},r,this.fieldModel));var o,s=new n.DropDownList(r);s.appendTo("#"+e.id+"_filterkey"),o=this.separator&&t.field||this.isImportRules?this.GetRootColumnName(t.field):s.value,this.selectedColumn=s.getDataByValue(o),Object.keys(t).length&&this.changeRule(t,{element:s.element,itemData:this.selectedColumn})},d.prototype.applyDropdownTreeComponent=function(e,l,r){var i,o=(this.isImportRules,l.field);this.dummyDropdownTreeDs=(0,t.extend)([],this.columns,[],!0),this.updateDropdowntreeDS(this.dummyDropdownTreeDs),i={fields:{dataSource:this.dummyDropdownTreeDs,value:"field",text:"label",child:"columns",expanded:"expanded",selectable:"selectable"},placeholder:this.l10n.getConstant("SelectField"),showClearButton:!1,popupHeight:this.columns.length>5?r:"auto",changeOnBlur:!1,change:this.changeField.bind(this),value:(0,t.isNullOrUndefined)(o)?null:[o],open:this.popupOpen.bind(this,!1),treeSettings:{expandOn:"Click"},cssClass:"e-qb-ddt",filtering:this.dropdownTreeFiltering.bind(this),close:this.dropdownTreeClose.bind(this)},this.fieldModel&&(i=p({},i,this.fieldModel));var s=new n.DropDownTree(i);if(s.appendTo("#"+e.id+"_filterkey"),!(0,t.isNullOrUndefined)(s.value)){var a=this.getLabelFromColumn(s.value[0]);s.element.value=a}var u=(0,t.isNullOrUndefined)(l.field)?s.value:this.GetRootColumnName(l.field);this.selectedColumn=this.getColumn(u),Object.keys(l).length&&this.changeRule(l,{element:s.element,itemData:this.selectedColumn})},d.prototype.dropdownTreeFiltering=function(e){var l,n=this,r=this,i=e.event.srcElement;l=(i.classList.contains("e-clear-icon")?i.parentElement.querySelector(".e-textbox"):i).id.split("_filterkey")[0];var o=document.getElementById(l);this.ddTree=(0,t.getComponent)(o.querySelector("input.e-dropdowntree"),"dropdowntree");var s=(0,t.extend)([],this.columns,[],!0);if(e.cancel=!0,""===e.text)this.changeDataSource(s);else{var a=s.map(function(t){return n.nestedChildFilter(e.text,t)}).filter(function(e){return null!==e});this.changeDataSource(a),setTimeout(function(){(0,t.isNullOrUndefined)(r.ddTree)||(0,t.isNullOrUndefined)(r.ddTree.treeObj)||r.ddTree.treeObj.expandAll()},100)}},d.prototype.changeDataSource=function(e){this.updateDropdowntreeDS(e),this.ddTree.treeObj.fields={dataSource:e,value:"field",text:"label",child:"columns",expanded:"expanded"},this.ddTree.treeObj.refresh()},d.prototype.nestedChildFilter=function(e,t){var l=this,n=t[this.ddTree.fields.child];if(!n)return this.isMatchedNode(e,t)?t:null;var r=n.map(function(t){return l.nestedChildFilter(e,t)}).filter(function(e){return null!==e});return r.length?(t[this.ddTree.fields.child]=r,t):(t[this.ddTree.fields.child]=n,this.isMatchedNode(e,t)?t:null)},d.prototype.isMatchedNode=function(e,t){var l=t[this.ddTree.fields.text].toLowerCase();return e=e?e.toLowerCase():"",-1!==l.indexOf(e)},d.prototype.dropdownTreeClose=function(){this.ddTree&&this.changeDataSource((0,t.extend)([],this.columns,[],!0)),this.ddTree=null},d.prototype.updateDropdowntreeDS=function(e){for(var t=0;t<e.length;t++)"object"===e[parseInt(t.toString(),10)].type?(this.isAngular&&e[parseInt(t.toString(),10)].template&&delete e[parseInt(t.toString(),10)].template,e[parseInt(t.toString(),10)].selectable=!1,this.updateDropdowntreeDS(e[parseInt(t.toString(),10)].columns)):this.isAngular&&e[parseInt(t.toString(),10)].template&&delete e[parseInt(t.toString(),10)].template},d.prototype.updateAddedRule=function(e,l,n,r,i,o){var s,a,u,d=0;if(r){for(s=(0,t.select)("#"+i,e),a=(0,t.closest)(e,".e-group-container"),u=this.getParentGroup(a);s&&null!==s.previousElementSibling;){s=s.previousElementSibling;var c=this.enableSeparateConnector&&(!this.headerTemplate&&!s.classList.contains("e-btn-group")||this.headerTemplate&&(s.classList.contains("e-rule-container")||s.classList.contains("e-group-container")));this.enableSeparateConnector&&!c||d++}u.rules[d]=l}else{a=(0,t.closest)(e,".e-group-container"),u=this.getParentGroup(a);var p=l.custom;Object.keys(l).length?this.ruleIndex<0?(u.rules.push({field:l.field,type:l.type,label:l.label,operator:l.operator,value:l.value}),p&&(u.rules[u.rules.length-1].custom=p),this.enableSeparateConnector&&(u.rules[u.rules.length-1].condition=l.condition?l.condition:n.condition)):(u.rules.splice(this.ruleIndex+1,0,{field:l.field,type:l.type,label:l.label,operator:l.operator,value:l.value}),p&&(u.rules[this.ruleIndex+1].custom=p),this.enableSeparateConnector&&(u.rules[this.ruleIndex+1].condition=l.condition?l.condition:n.condition)):(p&&(n.custom=p),this.autoSelectField&&(l.field=n.field=this.rule.rules[0].field),u.rules.push(n))}this.disableRuleCondition(e,u,o)},d.prototype.changeRuleTemplate=function(e,l){if(!e||!e.ruleTemplate){var n=(0,t.closest)(l,".e-group-container"),r=(0,t.closest)(l,".e-rule-container").id;if(this.previousColumn&&this.previousColumn.ruleTemplate&&((0,t.detach)(l.closest('[id="'+r+'"]').querySelector(".e-rule-field")),this.clearQBTemplate([r])),e){var i=this.selectedColumn.operators,o={field:e.field,label:e.label,operator:i[0].value,value:""};this.addRuleElement(n,o,e,"change",r,!0)}else{o={field:"",label:"",operator:"",value:""};this.addRuleElement(n,o,e,"change",r,!0)}}},d.prototype.renderToolTip=function(e){var t=new a.Tooltip({content:this.l10n.getConstant("ValidationMessage"),isSticky:!0,position:"BottomCenter",cssClass:"e-querybuilder-error",afterClose:function(){t.destroy()},beforeOpen:function(e){var t=e.element.querySelector(".e-tooltip-close");t&&(t.style.display="none")}});t.appendTo(e),t.open(e)},d.prototype.validateFields=function(){var e,l=!0;if(this.allowValidation){var n,r=["isnull","isnotnull","isempty","isnotempty"],i=void 0,o=void 0,s=void 0,a=[],u=void 0,d=void 0,c=void 0,p=void 0,h=void 0,m=this.element.querySelectorAll(".e-rule-container");for(i=0,n=m.length;i<n;i++){var g=void 0;if(u=(0,t.closest)(m[i],".e-group-container"),h=this.getParentGroup(u),d=0,s=p=m[i],"DropdownTree"===this.fieldMode?(e=(0,t.getComponent)(m[i].querySelector(".e-rule-filter input.e-dropdowntree"),"dropdowntree"))&&e.value&&e.value.length&&(this.selectedColumn=this.getColumn(e.value[0]),g=this.selectedColumn.validation):(c=(0,t.getComponent)(m[i].querySelector(".e-rule-filter input.e-dropdownlist"),"dropdownlist"))&&c.value&&(this.selectedColumn=c.getDataByValue(c.value),g=!(0,t.isNullOrUndefined)(c.value)&&this.selectedColumn.validation),o=p.querySelector(".e-rule-field input.e-control"),g&&g.isRequired){for(;s&&null!==s.previousElementSibling;){s=s.previousElementSibling;var f=this.enableSeparateConnector&&(!this.headerTemplate&&!s.classList.contains("e-btn-group")||this.headerTemplate&&(s.classList.contains("e-rule-container")||s.classList.contains("e-group-container")));this.enableSeparateConnector&&!f||d++}if(o=p.querySelector(".e-rule-operator .e-control"),h.rules[d].operator||(o.parentElement.className.indexOf("e-tooltip")<0&&o.className.indexOf("e-tooltip")<0&&this.renderToolTip(o.parentElement),l=!1),h.rules[d].value instanceof Array&&(a=h.rules[d].value),r.indexOf(h.rules[d].operator)<-1&&(0,t.isNullOrUndefined)(h.rules[d].value)&&"date"!==h.rules[d].type||""===h.rules[d].value||null===h.rules[d].value||h.rules[d].value instanceof Array&&a.length<1){var v=p.querySelectorAll(".e-rule-value .e-control");r.indexOf(h.rules[d].operator)<0&&(l=!1);for(var y=0,b=v.length;y<b;y++){var C=v[y],S=void 0;C.parentElement.className.indexOf("e-searcher")>-1?(S=(0,t.closest)(C,".e-multi-select-wrapper")).className.indexOf("e-tooltip")<0&&this.renderToolTip(S):v[y].parentElement.className.indexOf("e-tooltip")<0&&v[y].className.indexOf("e-tooltip")<0&&this.renderToolTip(v[y].parentElement),y++}}else if("date"===h.rules[d].type&&(null===h.rules[d].value||h.rules[d].value.indexOf(null)>-1)){v=p.querySelectorAll(".e-rule-value .e-control");r.indexOf(h.rules[d].operator)<0&&(l=!1);for(y=0,b=v.length;y<b;y++)v[y].parentElement.className.indexOf("e-tooltip")<0&&v[y].className.indexOf("e-tooltip")<0&&((0,t.isNullOrUndefined)(h.rules[d].value)||null==h.rules[d].value[y])&&this.renderToolTip(v[y].parentElement)}}else(c&&c.element&&(0,t.isNullOrUndefined)(c.value)||e&&e.element&&((0,t.isNullOrUndefined)(e.value)||e.value.length<1))&&(o.parentElement.className.indexOf("e-tooltip")<0&&this.renderToolTip(o.parentElement),l=!1)}}return l},d.prototype.refreshLevelColl=function(){this.levelColl={};var e=this.element.querySelector(".e-group-container");if(e){this.levelColl[e.id]=[0];var t={groupElement:e,level:[0]};this.refreshLevel(t)}},d.prototype.refreshLevel=function(e){var l,n,r=e.groupElement.querySelector(".e-rule-list").children,i=e.groupElement,o=r.length,s=0;for(n=0;n<o;n++)(l=r[n]).className.indexOf("e-group-container")>-1&&(e.level.push(s),this.levelColl[l.id]=e.level.slice(),s++,e.groupElement=l,e=this.refreshLevel(e));var a=(0,t.closest)(i,".e-rule-list");return e.groupElement=a?(0,t.closest)(a,".e-group-container"):i,e.level=this.levelColl[e.groupElement.id].slice(),e},d.prototype.groupTemplate=function(e){var t,l,n,r,i,o,s=this.createElement("div",{attrs:{class:"e-group-container"}}),a=this.createElement("div",{attrs:{class:"e-group-header"}}),u=this.createElement("div",{attrs:{class:"e-group-body"}}),d=this.createElement("div",{attrs:{class:"e-rule-list"}});if(s.appendChild(a),u.appendChild(d),s.appendChild(u),!this.headerTemplate){n=this.allowDragAndDrop?"e-icons e-drag-qb-rule":"e-icons e-drag-qb-rule e-hidden";var c=this.createElement("span",{attrs:{class:n,"aria-label":"drag handle",title:"drag handle"}});a.appendChild(c);var p=this.enableSeparateConnector&&!e?"e-lib e-btn-group e-qb-toggle-btn":"e-lib e-btn-group";t=this.createElement("div",{attrs:{class:p,role:"group"}}),this.enableSeparateConnector&&t.classList.add("e-multi-connector"),this.enableNotCondition&&(l=this.enableSeparateConnector?this.createElement("input",{attrs:{type:"checkbox",class:"e-qb-toggle"}}):this.createElement("button",{attrs:{type:"button",class:"e-qb-toggle"}}),t.appendChild(l)),l=this.createElement("input",{attrs:{type:"radio",class:"e-btngroup-and",value:"AND"}}),t.appendChild(l),r=this.createElement("label",{attrs:{class:"e-lib e-btn e-btngroup-and-lbl e-small"},innerHTML:this.l10n.getConstant("AND")}),t.appendChild(r),l=this.createElement("input",{attrs:{type:"radio",class:"e-btngroup-or",value:"OR"}}),t.appendChild(l),r=this.createElement("label",{attrs:{class:"e-lib e-btn e-btngroup-or-lbl e-small"},innerHTML:this.l10n.getConstant("OR")}),t.appendChild(r),a.appendChild(t),i=this.createElement("div",{attrs:{class:"e-group-action"}}),this.enableSeparateConnector?(o=this.createElement("button",{attrs:{type:"button",class:"e-add-condition-btn"}}),i.appendChild(o),o=this.createElement("button",{attrs:{type:"button",class:"e-add-group-btn"}}),i.appendChild(o)):(o=this.createElement("button",{attrs:{type:"button",class:"e-add-btn"}}),i.appendChild(o)),a.appendChild(i)}return s},d.prototype.ruleTemplate=function(){var e,l,n,r,i,o=this.createElement("div"),s=this.createElement("div",{attrs:{class:"e-rule-field"}});e=this.createElement("div",{attrs:{class:"e-rule-filter"}}),i=this.allowDragAndDrop?"e-icons e-drag-qb-rule":"e-icons e-drag-qb-rule e-hidden";var a=this.createElement("span",{attrs:{class:i,"aria-label":"drag handle",title:"drag handle"}});s.appendChild(a);var u=this.createElement("input",{attrs:{type:"text",class:"e-filter-input"}});e.appendChild(u),s.appendChild(e),e=this.createElement("div",{attrs:{class:"e-rule-operator"}}),s.appendChild(e),e=this.createElement("div",{attrs:{class:"e-rule-value"}}),s.appendChild(e),e=this.createElement("div",{attrs:{class:"e-rule-value-delete"}}),n=this.showButtons.cloneRule?"e-clone-rule-btn e-clone-rule e-css e-btn e-small e-round e-icon-btn":"e-clone-rule-btn e-clone-rule e-css e-btn e-small e-round e-icon-btn e-button-hide",r=this.showButtons.lockRule?"e-lock-rule-btn e-lock-rule e-css e-btn e-small e-round e-icons e-icon-btn":"e-lock-rule-btn e-lock-rule e-css e-btn e-small e-round e-icons e-icon-btn e-button-hide";var d=this.createElement("button",{attrs:{title:this.l10n.getConstant("CloneRule"),type:"button",class:n}}),c=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-copy"}});d.appendChild(c);var p=this.createElement("button",{attrs:{title:this.l10n.getConstant("LockRule"),type:"button",class:r}});c=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-unlock"}}),p.appendChild(c),l=this.showButtons.ruleDelete||(0,t.isNullOrUndefined)(this.showButtons.ruleDelete)?"e-removerule e-rule-delete e-css e-btn e-small":"e-removerule e-rule-delete e-css e-btn e-small e-button-hide";var h=this.createElement("button",{attrs:{type:"button",class:l}});return e.appendChild(d),e.appendChild(p),e.appendChild(h),s.appendChild(e),o.appendChild(s),o},d.prototype.addGroupElement=function(e,t,l,n,r,i,o){var s=this,a={groupID:t.id.replace(this.element.id+"_",""),cancel:!1,type:"insertGroup"};this.isImportRules||this.isInitialLoad||this.prvtEvtTgrDaD?(this.isInitialLoad=!1,this.addGroupSuccess(a,e,t,l,n,r,i,o)):this.trigger("beforeChange",a,function(a){s.addGroupSuccess(a,e,t,l,n,r,i,o)})},d.prototype.addGroupSuccess=function(e,n,r,i,o,a,u,d){var c=this;if(!e.cancel&&this.element.querySelectorAll(".e-group-container").length<=this.maxGroupCount){var p=r,h=void 0,m="";m=p.className.indexOf("e-group-container")<0?p.querySelector(".e-group-container")&&p.querySelector(".e-group-container").id:p.id,this.enableSeparateConnector&&(this.groupElem=this.groupTemplate());var g=this.groupElem.cloneNode(!0);if(g.setAttribute("id",this.element.id+"_group"+this.groupIdCounter),0===this.groupIdCounter&&this.allowDragAndDrop&&g.querySelector(".e-drag-qb-rule")&&(g&&g.children[0]&&g.children[0].classList.add("e-parent-header"),(0,t.addClass)([g.querySelector(".e-drag-qb-rule")],"e-hidden")),this.headerTemplate&&(u?(n=!1,g.setAttribute("id",this.element.id+"_group0"),this.headerTemplateFn(g,a,i,d,m),this.groupIdCounter=0):this.headerTemplateFn(g,a,i,d,m)),this.groupIdCounter++,!this.headerTemplate){var f=g.querySelector(".e-btngroup-and"),v=g.querySelector(".e-btngroup-or"),y=g.querySelector(".e-btngroup-and-lbl"),b=g.querySelector(".e-btngroup-or-lbl");f.setAttribute("id",this.element.id+"_and"+this.btnGroupId),v.setAttribute("id",this.element.id+"_or"+this.btnGroupId),f.setAttribute("name",this.element.id+"_and"+this.btnGroupId),v.setAttribute("name",this.element.id+"_and"+this.btnGroupId),y.setAttribute("for",this.element.id+"_and"+this.btnGroupId),b.setAttribute("for",this.element.id+"_or"+this.btnGroupId),this.btnGroupId++}if(n){var C=void 0;C=this.showButtons.groupDelete||(0,t.isNullOrUndefined)(this.showButtons.groupDelete)?"e-deletegroup":"e-deletegroup e-button-hide",h=this.createElement("button",{attrs:{type:"button",class:C}}),new l.Button({iconCss:"e-icons e-delete-icon",cssClass:"e-small e-round"}).appendTo(h),h.setAttribute("title",this.l10n.getConstant("DeleteGroup")),(0,t.rippleEffect)(h,{selector:".deletegroup"});for(var S=p.querySelector(".e-rule-list"),x=S.children,E=0,q=0,O=x.length;q<O;q++)x[q].className.indexOf("e-group-container")>-1&&(E+=1);if(this.showButtons.cloneGroup&&this.cloneGrpBtnClick)if(this.groupIndex===x.length-1)S.appendChild(g),this.isLastGroup=!0;else{if(this.enableSeparateConnector){for(var k=0,w=this.groupIndex+1,N=0;N<w;N++)x[N].classList.contains("e-rule-container")&&(w++,k++);k>0&&k--,x[L=this.groupIndex+k+1].parentNode.insertBefore(g,x[L])}else{var L;x[L=this.groupIndex+1].parentNode.insertBefore(g,x[L])}this.isMiddleGroup=!0}else S.appendChild(g);var R=this.levelColl[p.id].slice(0);if(R.push(E),this.levelColl[g.id]=R,this.groupIndex>-1&&this.refreshLevelColl(),this.isImportRules||(this.isAddSuccess=!0,this.addGroups([],p.id.replace(this.element.id+"_","")),this.isAddSuccess=!1,o&&this.addRuleToNewGroups&&this.addRuleElement(g,{})),!this.headerTemplate){var D="";D=this.showButtons.cloneGroup?"e-clone-grp-btn e-css e-btn e-small e-round e-icons e-icon-btn":"e-clone-grp-btn e-css e-btn e-small e-round e-icons e-icon-btn e-button-hide";var T=this.createElement("button",{attrs:{title:this.l10n.getConstant("CloneGroup"),type:"button",class:D}}),I=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-copy"}});T.appendChild(I),g.querySelector(".e-group-action").appendChild(T),D=this.showButtons.lockGroup?"e-lock-grp-btn e-css e-btn e-small e-round e-icons e-icon-btn":"e-lock-grp-btn e-css e-btn e-small e-round e-icons e-icon-btn e-button-hide";var B=this.createElement("button",{attrs:{title:this.l10n.getConstant("LockGroup"),type:"button",class:D}}),A=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-unlock"}});B.appendChild(A),g.querySelector(".e-group-action").appendChild(B),g.querySelector(".e-group-action").appendChild(h)}}else{if(!this.headerTemplate){D="";D=this.showButtons.lockGroup?"e-lock-grp-btn e-css e-btn e-small e-round e-icons e-icon-btn":"e-lock-grp-btn e-css e-btn e-small e-round e-icons e-icon-btn e-button-hide";B=this.createElement("button",{attrs:{title:this.l10n.getConstant("LockGroup"),type:"button",class:D}}),I=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-unlock"}});B.appendChild(I),g.querySelector(".e-group-action").appendChild(B)}p.appendChild(g),this.levelColl[g.id]=[0]}if(this.enableNotCondition&&!this.headerTemplate){var P=g.querySelector(".e-qb-toggle");(this.enableSeparateConnector?new l.CheckBox({label:this.l10n.getConstant("NOT"),cssClass:"e-qb-toggle"}):new l.Button({content:this.l10n.getConstant("NOT"),cssClass:"e-btn e-small"})).appendTo(P),g.querySelector(".e-btngroup-and-lbl").classList.add("e-not"),this.updatedRule&&this.updatedRule.not&&(0,t.addClass)([P],"e-active-toggle")}if(this.enableSeparateConnector&&!this.headerTemplate){var M=g.querySelector(".e-btngroup-and"),G=g.querySelector(".e-btngroup-or"),V=g.querySelector(".e-btn-group");for(N=0;N<V.childNodes.length;N++)"not"===g.querySelector(".e-btn-group").childNodes[N].textContent.toLowerCase()&&this.enableNotCondition?V.childNodes[N].classList.add("e-multiconnector"):V.childNodes[N].style.display="none";if(g.previousElementSibling){if((0,t.isNullOrUndefined)(this.headerTemplate))g.parentElement.insertBefore(this.groupTemplate(!0).querySelector(".e-btn-group"),g),(P=g.previousElementSibling.childNodes[0]).classList.contains("e-qb-toggle")&&(P.style.display="none");if(!this.isImportRules){var F=g.previousElementSibling,U=F.querySelector(".e-btngroup-and"),_=F.querySelector(".e-btngroup-or");if(M.checked||G.checked)this.enableSeparateConnector&&(M.checked&&(U.checked=!0),G.checked&&(_.checked=!0));else{var j=g.nextElementSibling;j&&j.classList.contains("e-btn-group")&&(M=j.querySelector(".e-btngroup-and"),G=j.querySelector(".e-btngroup-or"),U.checked=M.checked,_.checked=G.checked)}}}}if(this.updatedRule=null,this.headerTemplate){var $={requestType:"header-template-create",ruleID:g.id,condition:i,notCondition:this.enableNotCondition?a:void 0};this.trigger("actionBegin",$)}else if(this.enableSeparateConnector){var Q=g.querySelector(".e-add-condition-btn");(W=new l.Button({cssClass:this.element.id+"_addConditionbtn",content:this.l10n.getConstant("AddCondition")})).appendTo(Q),W.element.onclick=function(){c.addRuleElement((0,t.closest)(Q,".e-group-container"),{})};var H=g.querySelector(".e-add-group-btn");(W=new l.Button({cssClass:this.element.id+"_addGroupbtn",content:this.l10n.getConstant("AddGroup")})).appendTo(H),W.element.onclick=function(){c.addGroupElement(!0,(0,t.closest)(H,".e-group-container"),"",!0)}}else{var W,z=g.querySelector(".e-add-btn");(W=new s.DropDownButton({items:this.items,cssClass:"e-round e-small e-caret-hide e-addrulegroup",iconCss:"e-icons e-add-icon",beforeOpen:this.selectBtn.bind(this,z),select:this.selectBtn.bind(this,z)})).appendTo(z),z.setAttribute("title",this.l10n.getConstant("AddButton"))}if(!this.isImportRules&&!this.prvtEvtTgrDaD){var Y=p.id.replace(this.element.id+"_",""),K=g.id.replace(this.element.id+"_","");this.trigger("change",{groupID:Y,type:"insertGroup",childGroupID:K})}}},d.prototype.setMultiConnector=function(e){if(this.enableSeparateConnector&&!this.headerTemplate&&e.previousElementSibling){var t=this.groupTemplate(!0).querySelector(".e-btn-group");if(t){e.parentElement.insertBefore(t,e);var l=e.previousElementSibling.childNodes[0];l.classList.contains("e-qb-toggle")&&(l.style.display="none"),this.addHeaderDiv(e)}}},d.prototype.addHeaderDiv=function(e){var l,n=e.previousElementSibling.previousElementSibling;if(n){l=n.id.indexOf("rule")>-1?this.getRule(n):this.getGroup(n),!(0,t.isNullOrUndefined)(l)&&(0,t.isNullOrUndefined)(l.condition)&&(l.condition="and");var r=e.previousElementSibling.querySelector(".e-btngroup-or"),i=e.previousElementSibling.querySelector(".e-btngroup-and");r.disabled=!1,i.disabled=!1,(0,t.isNullOrUndefined)(l)||"or"!==l.condition?i.checked=!0:r.checked=!0}},d.prototype.headerTemplateFn=function(e,l,n,r,i,o){var s,a,u=this.element.id+"_header",d=e.querySelector(".e-group-header");if(this.enableSeparateConnector&&-1!==e.id.indexOf("rule")&&(d=e),this.headerTemplate){if(a={requestType:"header-template-initialize",ruleID:e.id,notCondition:this.enableNotCondition?l:void 0,condition:n,rule:this.getRuleCollection(r,!1),groupID:i},this.trigger("actionBegin",a),this.enableSeparateConnector&&-1!==e.id.indexOf("rule")&&(a.requestType="rule-template-create"),this.headerFn=this.templateParser(this.headerTemplate),this.isReact)s=this.headerFn(a,this,e.id,u)[0],this.enableSeparateConnector&&o?this.enableSeparateConnectorInitialRule(e,s):this.enableSeparateConnector&&-1!==e.id.indexOf("rule")?d.parentElement.insertBefore(s,d.nextElementSibling):d.appendChild(s);else if(this.isAngular){var c=this.headerFn(a,this,e.id,u);s=3===c[0].nodeType?c[1]:c[0],this.enableSeparateConnector&&o?this.enableSeparateConnectorInitialRule(e,s):this.enableSeparateConnector&&-1!==e.id.indexOf("rule")?d.parentElement.insertBefore(s,d.nextElementSibling):d.appendChild(s)}else if(this.isVue3){if(s=this.headerFn(a,this,e.id,u),this.enableSeparateConnector&&(o||-1!==e.id.indexOf("rule")))for(var p=0;p<s.length;p++)if("DIV"===s[p].nodeName){s=s[p];break}this.enableSeparateConnector&&o?this.enableSeparateConnectorInitialRule(e,s):this.enableSeparateConnector&&-1!==e.id.indexOf("rule")?d.parentElement.insertBefore(s,d.nextElementSibling):(0,t.append)(s,d)}else s=this.headerFn(a,this,"Template",u)[0],this.enableSeparateConnector&&o?this.enableSeparateConnectorInitialRule(e,s):this.enableSeparateConnector&&-1!==e.id.indexOf("rule")?d.parentElement.insertBefore(s,d.nextElementSibling):d.appendChild(s);this.renderReactTemplates()}return e},d.prototype.enableSeparateConnectorInitialRule=function(e,t){var l=(e.nextElementSibling?e.nextElementSibling:e).closest(".e-group-container");!e.nextElementSibling&&l&&(l=l.nextElementSibling?l.nextElementSibling:l),l&&l.parentElement.insertBefore(t,l)},d.prototype.notifyChange=function(e,l,n){var r=(0,t.closest)(l,".e-group-container"),i=this.getParentGroup(r),o=(0,t.closest)(l,".e-rule-container"),s=0;if("not"!==n)if("condition"!==n){for(;o&&null!==o.previousElementSibling;)o=o.previousElementSibling,(!this.enableSeparateConnector||this.enableSeparateConnector&&(!this.headerTemplate&&!o.classList.contains("e-btn-group")||this.headerTemplate&&(o.classList.contains("e-rule-container")||o.classList.contains("e-group-container"))))&&s++;var a=i.rules[s],u=this.getColumn(a.field),d=this.getFormat(u.format);if("date"===u.type)if(e instanceof Date)e=this.intl.formatDate(e,d);else if(e instanceof Array)for(var c=0;c<e.length;c++)e[c]&&e[c]instanceof Date&&(e[c]=this.intl.formatDate(e[c],d));u.ruleTemplate?this.templateChange(l,e,n):(this.isNotified=!0,this.updateRules(l,e),this.isNotified=!1)}else this.enableSeparateConnector?((o=l.parentElement.previousElementSibling)&&o.classList.contains("e-group-container")&&(o=o.querySelectorAll(".e-rule-container")[o.querySelectorAll(".e-rule-container").length-1]),o&&o.classList.contains("e-rule-container")&&(i=this.getRule(o)),i.condition=e):i.condition=e;else i.not=e},d.prototype.templateChange=function(e,l,n){var r,i=(0,t.closest)(e,".e-group-container"),o=i&&this.getParentGroup(i),s=(0,t.closest)(e,".e-rule-container"),a=0;for(this.allowValidation&&this.validateValue(o,s);s&&null!==s.previousElementSibling;)s=s.previousElementSibling,(!this.enableSeparateConnector||this.enableSeparateConnector&&(!this.headerTemplate&&!s.classList.contains("e-btn-group")||this.headerTemplate&&(s.classList.contains("e-rule-container")||s.classList.contains("e-group-container"))))&&a++;var u,d=o&&o.rules[a];"field"===n?this.selectedColumn=this.getColumn(l):d&&(this.selectedColumn=this.getColumn(d.field)),this.previousColumn=d&&this.getColumn(d.field);var c=this.getValidRules(this.rule);this.selectedColumn&&(u=this.selectedColumn.operators?this.selectedColumn.operators:this.customOperators[this.selectedColumn.type+"Operator"]);var p,h=["in","notin","between","notbetween"];switch(n){case"field":if((0,t.isNullOrUndefined)(l)){if((0,t.isNullOrUndefined)(d))return;d.field="",d.label="",d.type="",d.value="",d.operator=""}else d.field=l,d.label=this.selectedColumn.label,d.type=this.selectedColumn.type,d.value="",d.operator=u[0].value;break;case"operator":p=d.operator,d.operator=l,h.indexOf(d.operator)>-1?d.value=[]:h.indexOf(p)>-1&&(d.value="");break;case"value":d.value=l}if(this.changeRuleTemplate(this.selectedColumn,e),this.filterRules(c,this.getValidRules(this.rule),n),this.selectedColumn&&this.selectedColumn.ruleTemplate&&("field"===n||"operator"===n)){var m=(0,t.closest)(e,".e-rule-container");this.destroyControls(m,!0),(0,t.detach)(m.querySelector(".e-rule-field"));var g=this.appendRuleElem((0,t.closest)(m,".e-group-container"),this.selectedColumn,"change",m.id,n,d);"Vertical"===this.displayMode||this.element.className.indexOf("e-device")>-1?g.className="e-rule-container e-vertical-mode":g.className="e-rule-container e-horizontal-mode",this.enableSeparateConnector||g.previousElementSibling&&g.previousElementSibling.className.indexOf("e-rule-container")>-1&&(g.className.indexOf("e-joined-rule")<0&&(g.className+=" e-joined-rule"),g.previousElementSibling.className.indexOf("e-prev-joined-rule")<0&&(g.previousElementSibling.className+=" e-prev-joined-rule")),g.previousElementSibling&&g.previousElementSibling.className.indexOf("e-group-container")>-1&&g.className.indexOf("e-separate-rule")<0&&(g.className+=" e-separate-rule");var f={requestType:"template-create",action:n,ruleID:m.id,fields:this.fields,rule:d};r={groupID:i.id.replace(this.element.id+"_",""),ruleID:m.id.replace(this.element.id+"_",""),value:d.field,type:"field"},this.trigger("actionBegin",f),this.trigger("change",r)}},d.prototype.changeValue=function(e,l){var n,r=this;if(this.isNumInput&&"number"==typeof l.value||"input"===l.type&&l.target&&l.target.classList.contains("e-numerictextbox")&&this.selectedColumn.validation&&(this.selectedColumn.validation.max!==Number.MAX_VALUE||this.selectedColumn.validation.min>0))this.isNumInput=!1;else{if(l.element&&l.element.classList.contains("e-multiselect"))n=l.element;else n=l.event?l.event.target:"input"===l.type&&l.target&&l.target.classList.contains("e-numerictextbox")?l.currentTarget:l.element;if(n){if(n.className.indexOf("e-day")>-1||n.className.indexOf("e-today")>-1||n.className.indexOf("e-cell")>-1)n=l.element;var o,s,a,u=(0,t.closest)(n,".e-group-container"),d=(0,t.closest)(n,".e-rule-container"),c=u&&u.id.replace(this.element.id+"_",""),p=d.id.replace(this.element.id+"_",""),h=l;if(h.element&&h.element.className.indexOf("e-datepicker")>-1&&(n=h.element,(o=(0,t.getComponent)((0,t.closest)(n,".e-rule-container").querySelector(".e-filter-input"),"dropdownlist"))&&(this.selectedColumn=o.getDataByValue(o.value)),(o=(0,t.getComponent)((0,t.closest)(n,".e-rule-container").querySelector(".e-filter-input"),"dropdowntree"))&&(this.selectedColumn=this.getColumn(o.value[0]))),n.className.indexOf("e-radio")>-1)if(a=parseInt(n.id.split("valuekey")[1],10),"Default"===this.fieldMode?(o=(0,t.getComponent)((0,t.closest)(n,".e-rule-container").querySelector(".e-filter-input"),"dropdownlist"),this.selectedColumn=o.getDataByValue(o.value),this.selectedColumn.columns&&(o=(0,t.getComponent)((0,t.closest)(n,".e-rule-container").querySelector(".e-rule-sub-filter .e-dropdownlist"),"dropdownlist"),this.selectedColumn=this.getColumn(o.value))):(o=(0,t.getComponent)((0,t.closest)(n,".e-rule-container").querySelector(".e-filter-input"),"dropdowntree"),this.selectedColumn=this.getColumn(o.value[0])),this.selectedColumn.values)s=this.selectedColumn.values[a];else{s=[!0,!1][a]}else if(n.className.indexOf("e-multiselect")>-1)s=(0,t.getComponent)(n,"multiselect").value;else if(s=l.value,"input"===l.type&&l.target&&l.target.classList.contains("e-numerictextbox")){s=Number(l.currentTarget.value);var m=l.currentTarget,g=(0,t.getInstance)(m,i.NumericTextBox),f=(0,t.getValue)("decimal",(0,t.getNumericObject)(this.locale));isNaN(s)&&-1!==m.value.indexOf(f)&&(s=this.intl.getNumberParser({format:"n"})(m.value)),isNaN(s)||(g.value=s),this.isNumInput=!0}"input"===l.name&&this.immediateModeDelay?(window.clearInterval(this.timer),this.timer=window.setInterval(function(){r.filterValue(c,p,s,e,n)},this.immediateModeDelay)):this.filterValue(c,p,s,e,n)}}},d.prototype.filterValue=function(e,t,l,n,r){var i=this,o={groupID:e,ruleID:t,value:l,cancel:!1,type:"value"};window.clearInterval(this.timer),this.isImportRules?this.changeValueSuccessCallBack(o,r,n,e,t):this.trigger("beforeChange",o,function(l){i.changeValueSuccessCallBack(l,r,n,e,t)})},d.prototype.changeValueSuccessCallBack=function(e,t,l,n,r){e.cancel||(this.updateRules(t,e.value,l),this.setSecondDateMinFromFirst(t,l),this.isImportRules||this.trigger("change",{groupID:n,ruleID:r,value:e.value,cancel:!1,type:"value"}))},d.prototype.setSecondDateMinFromFirst=function(e,l){if(0===l){var n=(0,t.closest)(e,".e-rule-container");if(n){var r=n.querySelector(".e-rule-operator .e-dropdownlist");if(r){var i=(0,t.getComponent)(r,"dropdownlist");if(!((i&&i.value?i.value.toString().toLowerCase():"").indexOf("between")<0)){var o=document.getElementById(n.id+"_valuekey0"),s=document.getElementById(n.id+"_valuekey1");if(o&&s){var a=(0,t.getComponent)(o,"datepicker"),u=(0,t.getComponent)(s,"datepicker");if(a&&u&&a.value instanceof Date){var d=new Date(a.value.getTime());d.setDate(d.getDate()+1),u.min=d,u.value instanceof Date&&u.value.getTime()<d.getTime()&&(u.value=d)}}}}}}},d.prototype.fieldClose=function(e){if(!this.isFieldChange&&!this.isDestroy){this.isFieldClose=!0;var l=(0,t.getComponent)(e,"dropdownlist"),n=l.popupObj&&l.popupObj.element.querySelector(".e-active"),r=l.getItemData();l.value=r.value;var i={element:l.element,value:r.value,isInteracted:!0,previousItemData:this.prevItemData,previousItem:null,item:n,itemData:r,event:null,e:null};l.previousValue!==l.value&&this.changeField(i),this.isFieldChange=!1}},d.prototype.changeField=function(e){if(e.isInteracted){if((0,t.isNullOrUndefined)(e.value))return;this.isFieldChange=!0,this.prevItemData=e.itemData;var l=(0,t.closest)(e.element,".e-rule-filter")||(0,t.closest)(e.element,".e-rule-sub-filter"),n="DropdownTree"===this.fieldMode?this.getColumn(e.value[0]):this.getColumn(e.value);if("DropdownTree"===this.fieldMode&&null!==l){var r=l.querySelector(".e-dropdowntree.e-control"),i=(0,t.getComponent)(r,"dropdowntree");if(!n)return;if("object"===n.type){if(i.value=e.oldValue,i.dataBind(),(0,t.isNullOrUndefined)(e.oldValue))r.value="";else{var o=this.getLabelFromColumn(e.oldValue[0]);r.value=o}return}if(!(0,t.isNullOrUndefined)(e.value[0])){i.value=e.value[0],i.dataBind();o=this.getLabelFromColumn(e.value[0]);r.value=o}}if(this.destroySubFields(l),this.subFieldElem=null,this.isNotValueChange=!0,n&&n.ruleTemplate)this.templateChange(e.element,n.field,"field");else if(n&&n.columns&&n.columns[0].ruleTemplate)this.templateChange(e.element,n.columns[0].field,"field");else{for(var s=(0,t.closest)(e.element,".e-group-container"),a=this.getParentGroup(s),u=(0,t.closest)(e.element,".e-rule-container"),d=0;u&&null!==u.previousElementSibling;)u=u.previousElementSibling,(!this.enableSeparateConnector||this.enableSeparateConnector&&(!this.headerTemplate&&!u.classList.contains("e-btn-group")||this.headerTemplate&&(u.classList.contains("e-rule-container")||u.classList.contains("e-group-container"))))&&d++;a.rules[d].value="",this.changeRule(a.rules[d],e)}}},d.prototype.changeRule=function(e,l){if(!l.itemData){if("DropdownTree"!==this.fieldMode)return;if(null==(0,t.getComponent)(l.element,"dropdowntree").value)return}var n=(0,t.closest)(l.element,".e-rule-filter");n=n||(0,t.closest)(l.element,".e-rule-sub-filter");var r=(0,t.getComponent)(l.element,"dropdownlist");"DropdownTree"===this.fieldMode&&null!==n&&(r=(0,t.getComponent)(l.element,"dropdowntree"));var i=(0,t.closest)(l.element,".e-group-container").id.replace(this.element.id+"_","");this.changeFilter(n,r,i,e,{},l)},d.prototype.changeFilter=function(e,l,n,r,i,o){var s=this;if(e){var a=void 0;a="DropdownTree"===this.fieldMode?l.value[0]:this.isImportRules?this.GetRootColumnName(l.value):l.value,this.selectedColumn=this.getColumn(a);var u={groupID:n,ruleID:(0,t.closest)(e,".e-rule-container").id.replace(this.element.id+"_",""),selectedField:"DropdownTree"===this.fieldMode?l.value[0]:l.value,cancel:!1,type:"field"};this.isImportRules||this.prvtEvtTgrDaD?this.fieldChangeSuccess(u,i,e,r,o):this.trigger("beforeChange",u,function(t){s.fieldChangeSuccess(t,i,e,r,o)})}else{var d=(0,t.closest)(o.element,".e-rule-operator");this.changeOperator(e,d,l,n,r,i,o)}},d.prototype.changeOperator=function(e,l,n,r,i,o,s){var a,u=this;l?(a={groupID:r,ruleID:(0,t.closest)(l,".e-rule-container").id.replace(this.element.id+"_",""),selectedIndex:n.index,cancel:!1,type:"operator"},this.isImportRules?this.operatorChangeSuccess(a,e,o,i,s):this.trigger("beforeChange",a,function(t){u.operatorChangeSuccess(t,e,o,i,s)})):this.changeRuleValues(e,i,o,s)},d.prototype.fieldChangeSuccess=function(e,l,n,r,i){for(var o=(0,t.closest)(n,".e-rule-container"),s=(0,t.closest)(i.element,".e-rule-operator"),a=(0,t.closest)(i.element,".e-group-container").id.replace(this.element.id+"_",""),u=(0,t.getComponent)(i.element,"dropdownlist"),d=o.querySelectorAll(".e-tooltip.e-input-group"),c=0;c<d.length;c++)(0,t.getComponent)(d[c],"tooltip").destroy();if(e.cancel)this.changeOperator(n,s,u,a,r,l,i);else{if((0,t.isNullOrUndefined)(this.selectedColumn))return;if(l.type=this.selectedColumn.type,o.querySelector(".e-template")&&(r.value=""),"object"===this.selectedColumn.type&&"Default"===this.fieldMode)for(l.type=this.selectedColumn.columns[0].type;this.selectedColumn.columns;)this.createSubFields(n,r,l,i);else this.destroySubFields(n),this.changeOperator(n,s,u,a,r,l,i)}},d.prototype.destroySubFields=function(e){for(;e&&e.nextElementSibling.classList.contains("e-rule-sub-filter");)this.destroyControls(e),e.nextElementSibling.remove()},d.prototype.createSubFields=function(e,l,r,i){var o=!1,s=(0,t.closest)(e,".e-rule-field"),a=this.createElement("div",{attrs:{class:"e-rule-sub-filter",id:"subfilter"+this.subFilterCounter}});s.insertBefore(a,s.querySelector(".e-rule-operator"));var u=(0,t.closest)(a,".e-rule-container").id,d=this.createElement("input",{attrs:{type:"text",id:u+"_subfilterkey"+this.subFilterCounter}});a.appendChild(d);var c,h=this.element.className.indexOf("e-device")>-1?"250px":"200px";c={dataSource:this.selectedColumn.columns,fields:this.fields,placeholder:this.l10n.getConstant("SelectField"),popupHeight:this.selectedColumn.columns.length>5?h:"auto",change:this.changeField.bind(this),index:0,open:this.popupOpen.bind(this,!1)},this.fieldModel&&(c=p({},c,this.fieldModel));var m=new n.DropDownList(c);if(m.appendTo("#"+u+"_subfilterkey"+this.subFilterCounter),this.isImportRules||this.previousColumn&&this.previousColumn.ruleTemplate&&this.GetRootColumnName(l.field)===this.GetRootColumnName(this.previousColumn.field))for(var g=this.selectedColumn.columns,f=0;f<g.length;f++)if(l.field===g[f].field||l.field.indexOf(g[f].field+this.separator)>-1){m.value=g[f].field,this.selectedColumn=g[f],o=!0;break}this.subFilterCounter++,this.subFieldElem=d,i.itemData=i.itemData,!o&&this.selectedColumn.columns&&(!o&&this.isImportRules&&(m.value=null),this.selectedColumn=this.selectedColumn.columns[0]),this.previousColumn=this.selectedColumn,this.selectedColumn.columns||this.changeRuleValues(a,l,r,i)},d.prototype.operatorChangeSuccess=function(e,l,n,r,i){if(!e.cancel){var o=(0,t.closest)(i.element,".e-rule-operator"),s=o.nextElementSibling,a=(0,t.getComponent)(i.element,"dropdownlist"),u=r.operator?r.operator.toString().toLowerCase():"";n.operator=a.value.toString();var d=n.operator.toLowerCase();if(n.operator.toLowerCase().indexOf("between")>-1||n.operator.toLowerCase().indexOf("in")>-1&&n.operator.toLowerCase().indexOf("contains")<0?(l=o.previousElementSibling,n.type=r.type,(n.operator.toLowerCase().indexOf("in")<0||u.indexOf("in")<0)&&(r.value=[])):"object"==typeof r.value&&null!==r.value&&(r.value=r.value.length>0?r.value[0]:"number"===r.type?0:""),i.previousItemData){var c=i.previousItemData.value.toString().toLowerCase();(c.indexOf("between")>-1||(c.indexOf("in")>-1||c.indexOf("null")>-1||c.indexOf("empty")>-1)&&c.indexOf("contains")<0)&&(l=o.previousElementSibling,n.type=r.type)}if(u.indexOf("in")>-1&&u.indexOf("in")<5&&d.indexOf("in")>-1&&d.indexOf("in")<5&&(l=null),n.operator.indexOf("null")>-1||n.operator.indexOf("empty")>-1){var p=o.parentElement.querySelector(".e-rule-value"),h=p.querySelector(".e-tooltip.e-input-group");(h||u.indexOf("in")>-1&&(h=p.querySelector(".e-tooltip")))&&(0,t.getComponent)(h,"tooltip").destroy(),(0,t.removeClass)([p],"e-show"),(0,t.addClass)([p],"e-hide")}s&&this.getColumn(r.field).template&&(l=o.previousElementSibling),0===s.children.length&&(l=o.previousElementSibling),this.changeRuleValues(l,r,n,i)}},d.prototype.changeRuleValues=function(e,l,r,i){var o,s,a,u,d=(0,t.closest)(i.element,".e-rule-operator");if(e)if(d=e.nextElementSibling,e.classList.contains("e-rule-sub-filter")&&(r.type=this.selectedColumn.type,o=d.classList.contains("e-rule-sub-filter"),d=o?d.nextElementSibling:d),(0,t.addClass)([d],"e-operator"),d.childElementCount){s=(0,t.getComponent)(d.querySelector(".e-dropdownlist"),"dropdownlist"),r.operator=s.value;var c=void 0;c="DropdownTree"===this.fieldMode?(0,t.getComponent)(e.querySelector(".e-dropdowntree"),"dropdowntree"):(0,t.getComponent)(e.querySelector(".e-dropdownlist"),"dropdownlist"),r.type="DropdownTree"===this.fieldMode?this.getColumn(c.value[0]).type:this.getColumn(c.value).type;var h=i.itemData;""!==s.value&&this.renderValues(d,h,i.previousItemData,!0,l,r,i.element)}else{var m=(0,t.closest)(d,".e-rule-container").id;u=this.createElement("input",{attrs:{type:"text",id:m+"_operatorkey"}}),d.appendChild(u),this.selectedColumn.operators?a=this.selectedColumn.operators:i.itemData&&(a=this.customOperators[this.selectedColumn.type+"Operator"]);var g,f=this.element.className.indexOf("e-device")>-1?"250px":"200px";l.operator&&a.forEach(function(e){"value"in e&&"string"==typeof e.value&&e.value.toLowerCase()===l.operator.toLowerCase()&&(g=e.value)});var v=g||a[0].value,y=0;this.autoSelectOperator||(v="",y=-1),(this.isImportRules||this.ruleIndex>-1||this.groupIndex>-1||this.prvtEvtTgrDaD)&&(v=l&&l.operator?l.operator:v);var b=void 0;b={dataSource:a,fields:{text:"key",value:"value"},placeholder:this.l10n.getConstant("SelectOperator"),popupHeight:a.length>5?f:"auto",change:this.changeField.bind(this),index:y,value:v,open:this.popupOpen.bind(this,!1)},this.operatorModel&&(b=p({},b,this.operatorModel)),new n.DropDownList(b).appendTo("#"+m+"_operatorkey"),r.operator=l&&""!==l.operator&&!(0,t.isNullOrUndefined)(l.operator)?l.operator:a[0].value,this.isImportRules&&(r.type=this.selectedColumn.type,r.operator=l.operator),(0,t.isNullOrUndefined)(v)||""===v?this.autoSelectField&&this.autoSelectOperator&&this.renderValues(d,this.selectedColumn,i.previousItemData,!1,l,r,i.element):this.renderValues(d,this.selectedColumn,i.previousItemData,!1,l,r,i.element)}this.isImportRules||this.updateRules(i.element,i.item)},d.prototype.popupOpen=function(e,l){this.enableRtl&&(0,t.addClass)([l.popup.element],"e-rtl"),e&&(this.isFieldClose=!1)},d.prototype.destroyControls=function(e,l){for(var n=l?e:e.nextElementSibling,r=n.querySelectorAll("input.e-control"),i=n.querySelectorAll("div.e-control:not(.e-handle)"),o=this.columns,s=0,a=r.length;s<a;s++){if(r[s].classList.contains("e-textbox"))(0,t.getComponent)(r[s],"textbox").destroy(),(0,t.detach)((0,t.select)("input#"+r[s].id,n));else if(r[s].classList.contains("e-dropdownlist"))this.allowValidation&&r[s].parentElement.className.indexOf("e-tooltip")>-1&&(0,t.getComponent)(r[s].parentElement,"tooltip").destroy(),(0,t.getComponent)(r[s],"dropdownlist").destroy();else if(r[s].classList.contains("e-radio"))(0,t.getComponent)(r[s],"radio").destroy();else if(r[s].classList.contains("e-numerictextbox"))(0,t.getComponent)(r[s],"numerictextbox").destroy(),(0,t.detach)((0,t.select)("input#"+r[s].id,n));else if(r[s].classList.contains("e-datepicker"))(0,t.getComponent)(r[s],"datepicker").destroy();else if(r[s].classList.contains("e-multiselect"))(0,t.getComponent)(r[s],"multiselect").destroy();else if(r[s].className.indexOf("e-template")>-1)for(var u=r[s].className,d=0,c=o.length;d<c;d++)if(o[d].template&&u.indexOf(o[d].field)>-1){this.templateDestroy(o[d],r[s].id);break}document.getElementById(r[s].id)&&(0,t.detach)(r[s])}for(s=0,a=i.length;s<a;s++){if(i[s].className.indexOf("e-template")>-1)for(u=i[s].className,d=0,c=o.length;d<c;d++)if(o[d].template&&u.indexOf(o[d].field)>-1){this.templateDestroy(o[d],i[s].id);break}(0,t.detach)(i[s])}var p=n.querySelectorAll(".e-template:not(.e-control)");for(s=0,a=p.length;s<a;s++)(0,t.detach)(p[s])},d.prototype.templateDestroy=function(e,l){var n;if("string"!=typeof e.template||void 0===e.template.destroy){var r=(n=e.template).destroy;if(n.destroy){var i=void 0;document.getElementById(l)&&(i=(0,t.closest)(document.getElementById(l),".e-rule-field").querySelectorAll(".e-template")),"string"==typeof r?(r=(0,t.getValue)(r,window))({field:e.field,elementId:l,elements:i}):n.destroy({field:e.field,elementId:l,elements:i})}}},d.prototype.getValues=function(e){var t,l={},n=[],r=[];this.separator.length>0&&(r=e.split(this.separator));var i=this.dataColl;if(this.dataColl[1])for(var o=0,s=i.length;o<s;o++){var a={};if(r.length>1)for(var u=i[o],d=void 0,c=0,p=r.length;c<p;c++)d=r[c],r.length===c+1?(t=u[""+d],Number(u[""+d])===u[""+d]&&u[""+d]%1!=0&&(t=u[""+d].toString())):u=u[""+d];else t=i[o][""+e],Number(i[o][""+e])===i[o][""+e]&&i[o][""+e]%1!=0&&(t=i[o][""+e].toString());t in l||(l[""+t]=1,r.length>1?this.createNestedObject(a,r,t):a[""+e]=t,n.push(a))}return n},d.prototype.createNestedObject=function(e,t,l){for(var n,r=t.length-1,i=0;i<r;++i)(n=t[i])in e||(e[""+n]={}),e=e[""+n];e[t[r]]=l},d.prototype.getDistinctValues=function(e,t){for(var l={},n=[],r=[],i="",o=t.indexOf(this.separator),s=function(s,u){i="",0===o?i=e[s][""+t]:(r=t.split(a.separator)).forEach(function(t){i=i?i[""+t]:e[s][""+t]}),Number(e[s][""+t])===e[s][""+t]&&e[s][""+t]%1!=0&&(i=e[s][""+t].toString());var d={};i in l||(l[""+i]=1,0===o?d[""+t]=i:d[r[r.length-1]]=i,n.push(d))},a=this,u=0,d=e.length;u<d;u++)s(u);return n},d.prototype.renderMultiSelect=function(e,t,l,i,o){var s,a,u=!1,d=!1;this.isGetNestedData=!1,this.dataColl[1]&&Object.keys(this.dataColl[1]).indexOf(e.field)>-1&&(u=!0,s=this.getDistinctValues(this.dataColl,e.field)),u=!e.columns&&u,!this.dataColl.length&&o.length&&(d=!0);var c=this.valueModel&&this.valueModel.multiSelectModel&&this.valueModel.multiSelectModel.query?this.valueModel.multiSelectModel.query:null,h=c&&"function"==typeof c.clone?c.clone():new r.Query,m=e.field;m&&h.select([m]);var g=new r.Query([e.field]);d||u||!(this.dataManager instanceof r.DataManager||this.dataSource instanceof r.DataManager)||(g=h),a={dataSource:d?o:u?s:this.dataManager,query:g,fields:{text:this.selectedRule.field,value:this.selectedRule.field},placeholder:this.l10n.getConstant("SelectValue"),value:i,mode:"CheckBox",width:"100%",change:this.changeValue.bind(this,l),close:this.closePopup.bind(this,l),actionBegin:this.multiSelectOpen.bind(this,t+"_valuekey"+l),open:this.popupOpen.bind(this,!1)},this.valueModel&&this.valueModel.multiSelectModel&&(a=p({},a,this.valueModel.multiSelectModel));var f=new n.MultiSelect(a);f.appendTo("#"+t+"_valuekey"+l),this.updateRules(f.element,i,0)},d.prototype.multiSelectOpen=function(e,l){if(this.dataSource instanceof r.DataManager){var n=document.getElementById(e),i=(0,t.getComponent)((0,t.closest)(n,".e-rule-container").querySelector(".e-filter-input"),"DropdownTree"===this.fieldMode?"dropdowntree":"dropdownlist");"DropdownTree"===this.fieldMode?this.selectedColumn=this.getColumn(i.value[0]):this.selectedColumn=i.getDataByValue(i.value);var o=this.selectedColumn.field,s=!1;if(this.dataColl[1])Object.keys(this.dataColl[1]).indexOf(o)>-1&&(s=!0),0!==o.indexOf(this.separator)&&this.isGetNestedData&&(s=!0);s||(l.cancel=!0,this.bindMultiSelectData(n,o))}},d.prototype.bindMultiSelectData=function(e,t){this.getMultiSelectData(e,t)},d.prototype.getMultiSelectData=function(e,l){var n,i=this,o=new r.Deferred,s=this.valueModel&&this.valueModel.multiSelectModel&&this.valueModel.multiSelectModel.query?this.valueModel.multiSelectModel.query:null,u=s&&"function"==typeof s.clone?s.clone():new r.Query;u.select([l]);var d=this.dataManager.executeQuery(u),c=(0,t.getComponent)(e,"multiselect");c.hideSpinner(),this.createSpinner((0,t.closest)(e,".e-multi-select-wrapper").parentElement),(0,a.showSpinner)((0,t.closest)(e,".e-multi-select-wrapper").parentElement),d.then(function(r){n=r.actual&&r.actual.result?r.actual.result:r.result,i.dataColl=(0,t.extend)(i.dataColl,n,[],!0),c.dataSource=i.getDistinctValues(i.dataColl,l),i.isGetNestedData=!0,(0,a.hideSpinner)((0,t.closest)(e,".e-multi-select-wrapper").parentElement)}).catch(function(e){o.reject(e)})},d.prototype.createSpinner=function(e){var l=this.createElement("span",{attrs:{class:"e-qb-spinner"}});e.appendChild(l),(0,a.createSpinner)({target:l,width:t.Browser.isDevice?"16px":"14px"})},d.prototype.closePopup=function(e,l){var n=document.getElementById(l.popup.element.id.replace("_popup",""));if(n){var r=(0,t.getComponent)(n,"multiselect");if(r){var i=r.value;this.updateRules(n,i,e)}}},d.prototype.processTemplate=function(e,l,n,r){var i=(0,t.closest)(e,".e-rule-container"),o=i.querySelectorAll(".e-template"),s=i.querySelector(".e-rule-filter .e-filter-input"),a="DropdownTree"===this.fieldMode?(0,t.getComponent)(s,"dropdowntree"):(0,t.getComponent)(i.querySelector(".e-rule-filter .e-filter-input"),"dropdownlist"),u="DropdownTree"===this.fieldMode?this.getColumn(a.value[0]):this.getColumn(a.value);e&&e.nextElementSibling&&(e.nextElementSibling.style.position="relative",e.nextElementSibling.classList.add("e-querybuilder-spinner"));var d=function(){e&&e.nextElementSibling&&e.nextElementSibling.classList.contains("e-querybuilder-spinner")&&e.nextElementSibling.classList.remove("e-querybuilder-spinner")};if("string"==typeof l.template||void 0===l.template.write){var c={rule:n,ruleID:i.id,operator:r.operator,field:u.field,requestType:"value-template-create"};this.trigger("actionBegin",c),d()}else{var p=l.template,h={elements:o.length>1?o:o[0],values:n.value,operator:r.operator,field:u.field,dataSource:u.values,onComplete:d},m=void 0;"string"==typeof p.write?m=(0,t.getValue)(p.write,window)(h):"function"!=typeof l.template&&(m=l.template.write(h)),m&&"function"==typeof m.then?m.then(function(){return d()}):setTimeout(function(){return d()},100)}},d.prototype.getItemData=function(e){var l=(0,t.getComponent)(document.getElementById(e+"_filterkey"),"dropdownlist"),n=this.element.querySelector("#"+e);if("DropdownTree"===this.fieldMode)l=(0,t.getComponent)(document.getElementById(e+"_filterkey"),"dropdowntree");else if(n){var r=n.querySelectorAll(".e-rule-sub-filter");if(r.length>0){var i=r[r.length-1].querySelector(".e-dropdownlist");l=(0,t.getComponent)(i,"dropdownlist")}}return"DropdownTree"===this.fieldMode?this.getColumn(l.value[0]):this.getColumn(l.value)},d.prototype.setDefaultValue=function(e,l,n){var r=this.getItemData(e);if((0,t.isNullOrUndefined)(r.value))return n?l?[0,0]:0:l?[]:"";if(l){if(!(r.value instanceof Array))return[r.value]}else if(r.value instanceof Array)return r.value[0];return r.value},d.prototype.renderStringValue=function(e,t,l,n,r){var o,s,a=this.getItemData(e),u="string"==typeof a.template;if(s=this.isImportRules||this.ruleIndex>-1||this.groupIndex>-1||this.isPublic||u||""!==t.value?t.value:this.setDefaultValue(e,!1,!1),"in"!==l&&"notin"!==l||!this.dataColl.length&&!a.values){"in"!==l&&"notin"!==l||(s=(o=this.isImportRules||this.ruleIndex>-1||this.groupIndex>-1?t.value:this.setDefaultValue(e,!0,!1)).join(",")),"between"!==l&&"notbetween"!==l||s.length>1&&(s=s[n]);var d=void 0;d={placeholder:this.l10n.getConstant("SelectValue"),input:this.changeValue.bind(this,n)},this.valueModel&&this.valueModel.textBoxModel&&(d=p({},d,this.valueModel.textBoxModel));var c=new i.TextBox(d);c.appendTo("#"+e+"_valuekey"+n),c.value=s,c.dataBind()}else o=this.isImportRules||this.ruleIndex>-1||this.groupIndex>-1||this.isPublic?t.value:this.setDefaultValue(e,!0,!1),this.renderMultiSelect(a,e,n,o,a.values),"Vertical"===this.displayMode||this.element.className.indexOf("e-device")>-1?r.style.width="100%":(r.style.width=null,r.style.minWidth="200px")},d.prototype.renderNumberValue=function(e,t,l,n,r,o,s){var a=this.getItemData(e),u="string"==typeof a.template,d=this.isImportRules||this.ruleIndex>-1||this.groupIndex>-1||this.isPublic||u||"number"==typeof t.value?t.value:this.setDefaultValue(e,!1,!0);if("in"!==l&&"notin"!==l||!this.dataColl.length&&!a.values)if("in"===l||"notin"===l){var c=(d=this.isImportRules||this.ruleIndex>-1||this.groupIndex>-1?t.value:this.setDefaultValue(e,!0,!1)).join(","),h=void 0;h={placeholder:this.l10n.getConstant("SelectValue"),input:this.changeValue.bind(this,n)},this.valueModel&&this.valueModel.textBoxModel&&(h=p({},h,this.valueModel.textBoxModel));var m=new i.TextBox(h);m.appendTo("#"+e+"_valuekey"+n),m.value=c,m.dataBind()}else{var g=(o=a).validation&&o.validation.min?o.validation.min:0,f=o.validation&&o.validation.max?o.validation.max:Number.MAX_VALUE,v=o.format?o.format:"n";s>1&&t&&(d=t.value[n]?t.value[n]:this.setDefaultValue(e,!0,!0));var y=void 0;y={value:d instanceof Array?d[n]:d,format:v,min:g,max:f,width:"100%",step:o.step?o.step:1,change:this.changeValue.bind(this,n)},this.valueModel&&this.valueModel.numericTextBoxModel&&(y=p({},y,this.valueModel.numericTextBoxModel));var b=new i.NumericTextBox(y);b.appendTo("#"+e+"_valuekey"+n),b.element.setAttribute("aria-label",o.label+" Value"),b.element.oninput=this.changeValue.bind(this,n)}else d=this.isImportRules||this.ruleIndex>-1||this.groupIndex>-1||this.isPublic?t.value:this.setDefaultValue(e,!0,!1),this.renderMultiSelect(a,e,n,d,a.values),this.element.className.indexOf("e-device")>-1||"Vertical"===this.displayMode?r.style.width="100%":(r.style.minWidth="200px",r.style.width=null)},d.prototype.processValueString=function(e,t){var l=[],n=e.split(",");if("string"===t)return n;for(var r=0,i=n.length;r<i;r++)l.push(Number(n[r]));return l},d.prototype.parseDate=function(e,l){var n,r;if(l){var i=this.intl.getDateParser({skeleton:"full",type:"dateTime"});n=this.getFormat(l),r=i(e),(0,t.isNullOrUndefined)(r)&&(r=this.intl.parseDate(e,n))}else r=new Date(e);return r},d.prototype.renderControls=function(e,l,n,r,i){if((0,t.addClass)([e.parentElement.querySelector(".e-rule-value")],"e-value"),(0,t.removeClass)([e.parentElement.querySelector(".e-rule-value")],"e-hide"),(0,t.addClass)([e.parentElement.querySelector(".e-rule-value")],"e-show"),l.template&&(l.template.create||i))this.processTemplate(e,l,n,r);else{var s;s="boolean"===r.type?this.selectedColumn.values?this.selectedColumn.values.length:2:r.operator&&r.operator.toString().toLowerCase().indexOf("between")>-1?2:1;var a=(0,t.closest)(e,".e-rule-container").id,u=void 0,d=r.operator.toString();if(e.className.indexOf("e-rule-operator")>-1||e.className.indexOf("e-rule-filter")>-1){u=e.parentElement.querySelector(".e-rule-value"),this.element.className.indexOf("e-device")>-1||"Vertical"===this.displayMode?u.style.width="100%":"in"!==d&&"notin"!==d?(0,t.addClass)([u],"e-custom-value"):(0,t.removeClass)([u],"e-custom-value");for(var c=0;c<s;c++)switch(r.type){case"string":this.renderStringValue(a,n,d,c,u);break;case"number":this.renderNumberValue(a,n,d,c,u,l,s);break;case"boolean":this.processBoolValues(l,n,a,c);break;case"date":var h=new Date,m=void 0,g=void 0,f=l.format,v=void 0,y=void 0,b=this.l10n.getConstant("SelectValue"),C="string"==typeof l.template;if(n.value&&!(0,t.isNullOrUndefined)(f)&&(m=s>1?n.value[c]:n.value,h=this.parseDate(m,f)||new Date),!(0,t.isNullOrUndefined)(l)&&l.value&&!C)(x=this.parseDate(l.value.toString(),l.format))&&!isNaN(x.getTime())&&(h=x);if(l.field||l.key||!l.value||(h=l.value instanceof Date?l.value:this.parseDate(l.value,l.format)),!l.format&&n&&""!==n.field&&(f=(g=this.getColumn(n.field)).format),(this.isImportRules||this.isPublic||C)&&n&&(f=(g=this.getColumn(n.field)).format,n.value?(m=s>1?n.value[c]:n.value,h=this.parseDate(m,g.format)):h=n.value),f){var S=this.getFormat(f);if(S.skeleton)y={locale:this.getLocale(),value:h,placeholder:b,format:S,change:this.changeValue.bind(this,c)},this.valueModel&&this.valueModel.datePickerModel&&(y=p({},y,this.valueModel.datePickerModel)),v=new o.DatePicker(y);else{if(y={value:h,locale:this.getLocale(),placeholder:b,format:S.format,change:this.changeValue.bind(this,c)},!(0,t.isNullOrUndefined)(g)&&!(0,t.isNullOrUndefined)(g.values)&&g.values.length>0){var x=this.parseDate(g.values[c],f);if(!(0,t.isNullOrUndefined)(x)&&x instanceof Date&&(y.value=x,1===c)){var E=this.parseDate(g.values[0],f);E instanceof Date&&!isNaN(E.getTime())&&(E.setDate(E.getDate()+1),y.min=E)}}this.valueModel&&this.valueModel.datePickerModel&&(y=p({},y,this.valueModel.datePickerModel)),v=new o.DatePicker(y)}}else y={locale:this.getLocale(),value:h,placeholder:b,change:this.changeValue.bind(this,c)},this.valueModel&&this.valueModel.datePickerModel&&(y=p({},y,this.valueModel.datePickerModel)),v=new o.DatePicker(y);if(v.appendTo("#"+a+"_valuekey"+c),!n.value){var q=document.getElementById(a+"_valuekey"+c);this.updateRules(q,h,null,this.isNotValueChange),this.isNotValueChange=!1}}}}},d.prototype.processBoolValues=function(e,n,r,i){var o,s,a,u,d=!1;if((0,t.isNullOrUndefined)(n.type)&&e&&(n.type=e.type),e.values){var c=e.values;"boolean"!==n.type||(0,t.isNullOrUndefined)(n.value)?e.value?d=c[i].toLowerCase()===e.value.toString().toLowerCase():0===i&&(d=!0):d=c[i].toLowerCase()===n.value.toString().toLowerCase(),s=o=a=c[i]}else{c=[!0,!1];"boolean"!==n.type||(0,t.isNullOrUndefined)(n.value)?e.value?d=c[i].toString().toLowerCase()===e.value.toString().toLowerCase():0===i&&(d="boolean"!=typeof n.value||!!n.value):d=c[i].toString().toLowerCase()===n.value.toString().toLowerCase(),"boolean"==typeof n.value&&1===i&&(d=!n.value),o=c[i].toString(),s=c[i],a=this.l10n.getConstant(["True","False"][i])}u={label:a,name:r+"default",checked:d,value:o,change:this.changeValue.bind(this,i)},this.valueModel&&this.valueModel.radioButtonModel&&(u=p({},u,this.valueModel.radioButtonModel));var h=new l.RadioButton(u);h.appendTo("#"+r+"_valuekey"+i),d&&this.updateRules(h.element,s,0,!0)},d.prototype.getOperatorIndex=function(e,t){var l,n=e.dataSource.length;for(l=0;l<n;l++)if(t.operator===e.dataSource[l].value)return l;return 0},d.prototype.getPreviousItemData=function(e,t){return this.isFieldClose&&e&&(e=this.getColumn(e.value?e.value:e.field)),t&&t.template&&e&&Object.keys(e).length<4&&(e.template=t.template),e},d.prototype.renderValues=function(e,l,n,r,i,o,s){var a=e.previousElementSibling.getElementsByTagName("input")[0],u="DropdownTree"===this.fieldMode?(0,t.getComponent)(a,"dropdowntree"):(0,t.getComponent)(a,"dropdownlist"),d="DropdownTree"===this.fieldMode?this.getColumn(u.value[0]):this.getColumn(u.value);this.selectedRule=d;var c=(0,t.getComponent)(e.querySelector("input"),"dropdownlist");r&&(l=s.id.indexOf("operator")>-1?l:this.selectedRule).operators&&(c.value=null,c.dataBind(),c.dataSource=l.operators,c.index=this.getOperatorIndex(c,i),c.value=o.operator=c.dataSource[c.index].value,this.autoSelectOperator?c.dataBind():(c.index=-1,o.operator=c.value=""));var p=o.operator.toString(),h=!1;if(p.indexOf("null")>-1||p.indexOf("isempty")>-1||p.indexOf("isnotempty")>-1){(f=e.parentElement.querySelector(".e-rule-value"))&&((0,t.removeClass)([f],"e-show"),(0,t.addClass)([f],"e-hide"))}else{var m=(0,t.closest)(e,".e-rule-container").id;if((n=this.getPreviousItemData(n,d))&&void 0===n.template?n.columns&&(n=this.getColumn(i.field)):"DropdownTree"===this.fieldMode&&void 0===n&&(n=this.getColumn(i.field)),n&&n.template){this.templateDestroy(n,m+"_valuekey0");var g=(0,t.select)("#"+m+"_valuekey0",e.nextElementSibling);g&&!g.classList.contains("e-control")&&(0,t.detach)((0,t.select)("#"+m+"_valuekey0",e.nextElementSibling)),"string"!=typeof n.template&&void 0!==n.template.create||(e.nextElementSibling.classList.contains("e-template-value")&&this.clearQBTemplate([m]),e.nextElementSibling.innerHTML=""),this.isAngular&&!(0,t.isNullOrUndefined)(n.key)&&"DropdownTree"===this.fieldMode&&delete n.template}if(r&&(this.validateValue(i,(0,t.closest)(e,".e-rule-container")),this.destroyControls(e)),this.isImportRules||c&&""!==c.value){if(d&&(l.template=d.template),l.template&&((0,t.addClass)([e.nextElementSibling],"e-template-value"),l.template=d.template,h=this.setColumnTemplate(l,m,d.field,l.value||p,e,i)),h){var f=e.parentElement.querySelector(".e-rule-value");this.element.className.indexOf("e-device")>-1||"Vertical"===this.displayMode?f.style.width="100%":f.style.width="200px"}else{(0,t.removeClass)([e.nextElementSibling],"e-template-value");var v=1;v="boolean"===o.type?this.selectedColumn.values?this.selectedColumn.values.length:2:p&&p.toLowerCase().indexOf("between")>-1?2:1;for(var y=0;y<v;y++){var b=this.createElement("input",{attrs:{type:"text",id:m+"_valuekey"+y}});e.nextElementSibling.appendChild(b)}}this.renderControls(e,l,i,o,h),this.isAngular&&!(0,t.isNullOrUndefined)(l.key)&&l.template&&"DropdownTree"===this.fieldMode&&delete l.template}}},d.prototype.setColumnTemplate=function(e,l,n,r,i,o){var s,a=this,u=!0;if(e.template){if("string"==typeof e.template||void 0===e.template.create)return s={requestType:"value-template-initialize",ruleID:l,field:n,operator:r,rule:o,renderTemplate:!0},this.trigger("actionBegin",s,function(t){u=a.actionBeginSuccessCallBack(t,e,l,n,i)}),u;var d=void 0,c=e.template;if((d="string"==typeof c.create?(0,t.getValue)(c.create,window)({field:n,operator:r}):c.create({field:n,operator:r}))instanceof Element)d.id=l+"_valuekey0",(0,t.addClass)([d],"e-template"),i.nextElementSibling.appendChild(d),n.indexOf(" ")<0&&(0,t.addClass)([d],"e-"+n);else if(d instanceof Array){(0,t.addClass)(d,"e-template");for(var p=0,h=d.length;p<h;p++)d[p].id=l+"_valuekey"+p,i.nextElementSibling.appendChild(d[p])}return(0,t.addClass)([i.nextElementSibling],"e-template-value"),!0}return!0},d.prototype.actionBeginSuccessCallBack=function(e,l,n,r,i){if(e.renderTemplate){var o=void 0;this.columnTemplateFn=this.templateParser((l.template,l.template));var s=this.element.id+r;if(this.isReact)o=this.columnTemplateFn(e,this,n,s)[0],i.nextElementSibling.appendChild(o);else if(this.isAngular){var a=this.columnTemplateFn(e,this,n,s);o=3===a[0].nodeType?a[1]:a[0],i.nextElementSibling.appendChild(o)}else this.isVue3?(o=this.columnTemplateFn(e,this,"Template",s),(0,t.append)(o,i.nextElementSibling)):(o=this.columnTemplateFn(e,this,"Template",s)[0],i.nextElementSibling.appendChild(o));return(0,t.addClass)([i.nextElementSibling],"e-template-value"),this.renderReactTemplates(),!0}return!1},d.prototype.updateValues=function(e,l){var n=1;e.className.indexOf("e-template")>-1&&(n=3);var r,i,o,s,a,u,d=e.className.split(" e-")[n],c=parseInt(e.id.slice(-1),2);switch(d){case"checkbox":s=(0,t.getComponent)(e,d).value,l.value=""!==s?s:void 0;break;case"textbox":u=(0,t.getComponent)(e,d).value,l.operator.indexOf("between")>-1?("string"==typeof l.value&&(l.value=[]),l.value[c]=u):["in","notin"].some(function(e){return-1!==l.operator.indexOf(e)})&&-1===l.operator.indexOf("contains")?l.value=u?"string"===l.type?u.split(",").map(function(e){return e.trim()}):u.split(",").map(Number):[]:l.value=u;break;case"dropdownlist":case"multiselect":l.value=(0,t.getComponent)(e,d).value;break;case"radio":(a=(0,t.getComponent)(e,d)).checked&&("boolean"==typeof l.value?l.value="true"===a.value:this.getColumn(l.field).values?l.value=a.value:l.value="true"===a.value),a.refresh();break;case"numerictextbox":l.operator.indexOf("between")>-1?("string"==typeof l.value&&(l.value=[]),l.value[c]=(0,t.getComponent)(e,d).value):l.value=(0,t.getComponent)(e,d).value;break;case"datepicker":r=this.getColumn(l.field),i=this.getFormat(r.format),o=(0,t.getComponent)(e,d).value,l.operator.indexOf("between")>-1?("string"==typeof l.value&&(l.value=[]),l.value[c]=this.intl.formatDate(o,i)):(0,t.isNullOrUndefined)(i.format)&&o?l.value=this.intl.formatDate(o):l.value=o?this.intl.formatDate(o,i):o}},d.prototype.updateRules=function(e,l,n,r){for(var i,o,s=(0,t.closest)(e,".e-group-container"),a=this.getParentGroup(s),u=(0,t.closest)(e,".e-rule-container"),d=0,c=s.id.replace(this.element.id+"_",""),p=this.getValidRules(this.rule);u&&null!==u.previousElementSibling;)u=u.previousElementSibling,(!this.enableSeparateConnector||this.enableSeparateConnector&&(!this.headerTemplate&&!u.classList.contains("e-btn-group")||this.headerTemplate&&(u.classList.contains("e-rule-container")||u.classList.contains("e-group-container"))))&&d++;var h=a.rules[d].operator?a.rules[d].operator.toString():"",m=(u=(0,t.closest)(e,".e-rule-container")).id.replace(this.element.id+"_","");if((0,t.closest)(e,".e-rule-filter")||(0,t.closest)(e,".e-rule-sub-filter")){this.subFieldElem&&(e=this.subFieldElem),i="DropdownTree"===this.fieldMode?(0,t.getComponent)(e,"dropdowntree"):(0,t.getComponent)(e,"dropdownlist");var g="DropdownTree"===this.fieldMode?this.getColumn(i.value[0]):this.getColumn(i.value);!this.isImportRules&&a.rules[d].field&&a.rules[d].field.toLowerCase()!==g.field.toLowerCase()&&(!u.querySelectorAll(".e-template")&&!(h.indexOf("null")>-1)||h.indexOf("empty")>-1)&&(a.rules[d].value=""),this.selectedColumn=this.getColumn(this.selectedColumn.field),a.rules[d].field=this.selectedColumn.field,a.rules[d].type=this.selectedColumn.type,a.rules[d].label=this.selectedColumn.label;var f=(0,t.closest)(e,".e-rule-filter"),v=(f=f||(0,t.closest)(e,".e-rule-sub-filter")).nextElementSibling.querySelector("input.e-control");v=v||f.nextElementSibling.nextElementSibling.querySelector("input.e-control"),h=(0,t.getComponent)(v,"dropdownlist").value.toString(),a.rules[d].operator=h;var y=f.nextElementSibling.nextElementSibling,b=y.querySelectorAll("input.e-control");b.length<1&&(b=y.querySelectorAll("div.e-control")),b.length<1&&(b=y.querySelectorAll(".e-template")),o={groupID:c,ruleID:m,value:a.rules[d].field,type:"field"};for(var C=0;C<b.length;C++)h.indexOf("null")>-1||h.indexOf("empty")>-1?a.rules[d].value=null:this.updateValues(b[C],a.rules[d]);this.isImportRules||this.prvtEvtTgrDaD||this.trigger("change",o),this.allowValidation&&a.rules[d].field&&e.parentElement.className.indexOf("e-tooltip")>-1&&(0,t.getComponent)(e.parentElement,"tooltip").destroy(),this.filterRules(p,this.getValidRules(this.rule),"field")}else if((0,t.closest)(e,".e-rule-operator")){i=(0,t.getComponent)(e,"dropdownlist"),a.rules[d].operator=i.value.toString();var S=u.querySelectorAll(".e-rule-value input.e-control");o={groupID:c,ruleID:m,value:i.value,type:"operator"},this.allowValidation&&a.rules[d].operator&&e.parentElement.className.indexOf("e-tooltip")>-1&&(0,t.getComponent)(e.parentElement,"tooltip").destroy(),S.length>1&&!(S[0].className.indexOf("e-template")>-1)&&(a.rules[d].value=[]);for(var x=0;x<S.length;x++)a.rules[d].operator.indexOf("null")>-1||a.rules[d].operator.indexOf("empty")>-1?a.rules[d].value=null:S[x].classList.contains("e-template")||this.updateValues(S[x],a.rules[d]);this.isImportRules||this.trigger("change",o),this.filterRules(p,this.getValidRules(this.rule),"operator")}else(0,t.closest)(e,".e-rule-value")&&(this.ruleValueUpdate(e,l,a,d,s,u,n),r||this.filterRules(p,this.getValidRules(this.rule),"value"))},d.prototype.filterRules=function(e,t,l){JSON.stringify({condition:e.condition,not:e.not,rule:e.rules})!==JSON.stringify({condition:t.condition,not:t.not,rule:t.rules})&&(this.isImportRules||this.prvtEvtTgrDaD||this.trigger("ruleChange",{previousRule:e,rule:t,type:l}))},d.prototype.ruleValueUpdate=function(e,t,l,n,r,i,o){var s,a,u=["in","between","notin","notbetween"];if(l.rules[n].operator&&(a=l.rules[n].operator.toString().toLowerCase()),null!==t){if(e.className.indexOf("e-multiselect")>-1&&"number"===l.rules[n].type&&!this.isNotified){for(var d=[],c=t,p=0,h=c.length;p<h;p++)"string"==typeof c[p]&&d.push(parseFloat(c[p]));d.length&&(t=d)}if(this.isNotified)l.rules[n].value=t,s={groupID:r.id,ruleID:i.id,value:l.rules[n].value,type:"value"},this.isImportRules||this.trigger("change",s);else if(e.className.indexOf("e-spin")>-1||e.className.indexOf("e-numeric")>-1)u.indexOf(a)>-1?l.rules[n].value[o]=t:l.rules[n].value=t;else if(e.className.indexOf("e-radio")>-1)l.rules[n].value=t;else if(e.className.indexOf("e-multiselect")>-1)l.rules[n].value=t;else if(e.className.indexOf("e-textbox")>-1)"in"===a||"notin"===a?(l.rules[n].type,l.rules[n].value=this.processValueString(t,l.rules[n].type)):"between"===a||"notbetween"===a?("string"==typeof l.rules[n].value&&(l.rules[n].value=[]),l.rules[n].value[o]=t):l.rules[n].value=t;else if(e.className.indexOf("e-datepicker")>-1){var m=this.getFormat(this.getColumn(this.selectedColumn.field).format);m.type&&(u.indexOf(a)>-1?("string"==typeof l.rules[n].value&&(l.rules[n].value=[]),l.rules[n].value[o]=this.intl.formatDate(t,m)):l.rules[n].value=this.intl.formatDate(t,m))}this.validateValue(l,i,n)}else e.className.indexOf("e-datepicker")>-1&&u.indexOf(a)>-1?("string"==typeof l.rules[n].value&&(l.rules[n].value=[]),l.rules[n].value[o]=t):l.rules[n].value=t},d.prototype.validateValue=function(e,l,n){if(!(0,t.isNullOrUndefined)(e)||!(0,t.isNullOrUndefined)(l)){(0,t.isNullOrUndefined)(n)||(e=e.rules[n]);var r="object"==typeof e.value;if(this.allowValidation&&((0,t.isNullOrUndefined)(n)||(r?e.value.length>0:e.value))){var i=l.querySelectorAll(".e-rule-value .e-control");i.length>0&&(i[0].className.indexOf("e-tooltip")>-1?(0,t.getComponent)(i[0],"tooltip").destroy():i[0].parentElement.className.indexOf("e-tooltip")>-1&&(0,t.getComponent)(i[0].parentElement,"tooltip").destroy(),i[1]&&i[1].parentElement.className.indexOf("e-tooltip")>-1&&(0,t.getComponent)(i[1].parentElement,"tooltip").destroy(),i[2]&&i[2].parentElement.className.indexOf("e-tooltip")>-1&&(0,t.getComponent)(i[2].parentElement,"tooltip").destroy())}}},d.prototype.getFormat=function(e){var t;return e?"string"==typeof e?(t={type:"dateTime"},"short"===e||"yMd"===e?(t.type="date",t.skeleton=e):t.format=e):t={type:"dateTime",skeleton:e.skeleton}:t={type:"date",skeleton:"yMd"},t},d.prototype.findGroupByIdx=function(e,t,l){var n=t.rules,r=[];if(!l){for(var i=0,o=n.length;i<o;i++)(t=n[i]).rules&&r.push(t);return r[e]}return t},d.prototype.destroy=function(){if(this.isDestroy=!0,this.element){var l,n,r,i;for(e.prototype.destroy.call(this),r=(l=this.element.querySelectorAll(".e-addrulegroup")).length,n=0;n<r;n++)(0,t.getComponent)(l[n],"dropdown-btn").destroy(),(0,t.detach)(l[n]);for(i=this.element.querySelectorAll(".e-rule-filter .e-control.e-tooltip"),n=0;n<i.length;n++)(0,t.getComponent)(i[n],"tooltip").destroy();for(r=(l=this.element.querySelectorAll(".e-rule-filter .e-control:not(.e-tooltip)")).length,n=0;n<r;n++)(0,t.getComponent)(l[n],"dropdownlist")?(0,t.getComponent)(l[n],"dropdownlist").destroy():(0,t.getComponent)(l[n],"dropdowntree").destroy(),(0,t.detach)(l[n]);for(i=this.element.querySelectorAll(".e-rule-operator .e-control.e-tooltip"),n=0;n<i.length;n++)(0,t.getComponent)(i[n],"tooltip").destroy();for(r=(l=this.element.querySelectorAll(".e-rule-operator .e-control:not(.e-tooltip)")).length,n=0;n<r;n++)(0,t.getComponent)(l[n],"dropdownlist")&&((0,t.getComponent)(l[n],"dropdownlist").destroy(),(0,t.detach)(l[n]));for(i=this.element.querySelectorAll(".e-rule-value .e-control.e-tooltip"),n=0;n<i.length;n++)(0,t.getComponent)(i[n],"tooltip").destroy();this.isImportRules=!1,this.unWireEvents(),this.levelColl[this.element.id+"_group0"]=[0],this.element.innerHTML="",this.portals&&this.portals.length&&this.clearQBTemplate();var o=document.querySelectorAll(".qb-dropdownlist.e-popup");if(o)for(n=0;n<o.length;n++)o[n].remove();(0,t.classList)(this.element,[],["e-rtl","e-responsive","e-device"]),this.isDestroy=!1,e.prototype.destroy.call(this)}},d.prototype.addRules=function(e,t){t=this.element.id+"_"+t,this.isPublic=!0;for(var l=0,n=e.length;l<n;l++)this.addRuleElement(document.getElementById(t),e[l]);this.isPublic=!1},d.prototype.addGroups=function(e,t){if(this.isAddSuccess||this.element.querySelectorAll(".e-group-container").length<=this.maxGroupCount){t=this.element.id+"_"+t;var l=document.getElementById(t),n=this.getParentGroup(l);if(e.length){this.isPublic=!0;for(var r=0,i=e.length;r<i;r++)this.updatedRule={isLocked:e[r].isLocked,condition:e[r].condition,not:e[r].not},this.importRules(e[r],l,!1,e[r].not);this.isPublic=!1}else{var o="and",s=!1,a=!1;this.updatedRule&&(o=this.updatedRule.condition,s=this.updatedRule.not,a=this.updatedRule.isLocked),this.groupIndex<0?this.enableNotCondition?n.rules.push({condition:o,not:s,rules:[]}):n.rules.push({condition:o,rules:[]}):this.enableNotCondition?n.rules.splice(this.groupIndex+1,0,{condition:o,not:s,rules:[],isLocked:a}):n.rules.splice(this.groupIndex+1,0,{condition:o,rules:[],isLocked:a})}this.headerTemplate||this.disableRuleCondition(l,n,null,!!this.enableSeparateConnector||null)}},d.prototype.initWrapper=function(){if(this.isInitialLoad=!0,this.cssClass&&(0,t.addClass)([this.element],this.cssClass.replace(/\s+/g," ").trim().split(" ")),this.enableSeparateConnector&&(0,t.addClass)([this.element],"e-multi-connector"),this.enableRtl&&(0,t.addClass)([this.element],"e-rtl"),this.width&&(this.element.style.width=this.width),this.height&&(this.element.style.height=this.height),this.rule.rules.length?this.isImportRules=!0:this.addGroupElement(!1,this.element),t.Browser.isDevice||window.innerWidth<768&&!this.isPropChange||"Vertical"===this.displayMode?((t.Browser.isDevice||window.innerWidth<768)&&(this.element.style.width="100%",this.element.classList.add("e-device")),(0,t.removeClass)(this.element.querySelectorAll(".e-rule-container"),"e-horizontal-mode"),(0,t.addClass)(this.element.querySelectorAll(".e-rule-container"),"e-vertical-mode"),this.displayMode="Vertical"):this.displayMode="Horizontal",this.summaryView)this.isImportRules?this.renderSummary():this.renderSummaryCollapse();else{if(this.columns&&this.columns.length&&this.isImportRules){this.addGroupElement(!1,this.element,this.rule.condition,!1,this.rule.not,!1,this.rule);var e=(0,t.extend)({},this.rule,{},!0);this.isRefreshed=!0,this.setGroupRules(e),this.isRefreshed=!1}else this.columns&&this.columns.length&&this.addRuleElement(this.element.querySelector(".e-group-container"),{});this.notGroupRtl(),this.readonly&&this.enableReadonly();for(var l=this.element.querySelectorAll("label.e-btn"),n=void 0,r=0;r<l.length;r++)n=l.item(r),(0,t.rippleEffect)(n,{selector:".e-btn"})}},d.prototype.renderSummary=function(){var e=this.createElement("div",{attrs:{class:"e-summary-content",id:this.element.id+"_summary_content"}}),t=this.createElement("textarea",{attrs:{class:"e-summary-text",readonly:"true"},styles:"max-height:500px"}),l=this.createElement("button",{attrs:{type:"button",class:"e-edit-rule e-css e-btn e-small e-flat e-primary"}}),n=this.createElement("div",{attrs:{class:"e-summary-btndiv"}});e.appendChild(t),t.textContent=this.getSqlFromRules(this.rule),l.textContent=this.l10n.getConstant("Edit"),n.appendChild(l),e.appendChild(n),this.element.appendChild(e)},d.prototype.renderSummaryCollapse=function(){var e=this.createElement("div",{attrs:{class:"e-collapse-rule e-icons",title:this.l10n.getConstant("SummaryViewTitle")}});this.element.querySelector(".e-group-header").appendChild(e)},d.prototype.columnSort=function(){this.sortDirection&&"descending"===this.sortDirection.toLowerCase()?this.columns=new r.DataManager(this.columns).executeLocal((new r.Query).sortByDesc("field")):this.sortDirection&&"ascending"===this.sortDirection.toLowerCase()&&(this.columns=new r.DataManager(this.columns).executeLocal((new r.Query).sortBy("field")))},d.prototype.onChangeNotGroup=function(){if(this.element.innerHTML="",this.groupIdCounter=0,!this.headerTemplate)if(this.enableNotCondition){var e=this.createElement("button",{attrs:{type:"button",class:"e-qb-toggle"}});this.groupElem.querySelector(".e-btn-group")&&this.groupElem.querySelector(".e-btn-group").insertBefore(e,this.groupElem.querySelector(".e-btngroup-and"))}else this.groupElem.querySelector(".e-qb-toggle").remove();this.setProperties({rule:this.checkNotGroup(this.rule)},!0),this.initWrapper()},d.prototype.notGroupRtl=function(){this.enableRtl?(0,t.addClass)(this.element.querySelectorAll(".e-btn-group"),"e-rtl"):(0,t.removeClass)(this.element.querySelectorAll(".e-btn-group"),"e-rtl")},d.prototype.checkNotGroup=function(e){var l;if(e.rules)for(var n=0;n<e.rules.length;n++)l=e.rules[n],l=this.checkNotGroup(l),e.rules[n]=l;return(0,t.isNullOrUndefined)(e.not)?this.enableNotCondition&&!(0,t.isNullOrUndefined)(e.condition)&&(e.not=!1):(this.enableNotCondition&&(e.not=!1),delete e.not),e},d.prototype.onPropertyChanged=function(e,l){var n=Object.keys(e);this.isPropChange=!0;for(var r=this.element.querySelector(".e-group-container"),i=this.element.querySelector(".e-summary-content"),o=0,s=n;o<s.length;o++){switch(s[o]){case"summaryView":e.summaryView?(r.style.display="none",this.element.querySelectorAll(".e-summary-content").length<1?(this.renderSummary(),i=this.element.querySelector(".e-summary-content")):this.element.querySelector(".e-summary-text").textContent=this.getSqlFromRules(this.rule),i.style.display="block"):(r.querySelectorAll(".e-collapse-rule").length>-1&&this.renderSummaryCollapse(),r.style.display="block",i.style.display="none");break;case"displayMode":this.refresh();break;case"showButtons":(0,t.isNullOrUndefined)(e.showButtons.lockGroup)||(e.showButtons.lockGroup?(0,t.removeClass)(this.element.querySelectorAll(".e-lock-grp-btn"),"e-button-hide"):(0,t.addClass)(this.element.querySelectorAll(".e-lock-grp-btn"),"e-button-hide")),(0,t.isNullOrUndefined)(e.showButtons.lockRule)||(e.showButtons.lockRule?(0,t.removeClass)(this.element.querySelectorAll(".e-lock-rule-btn"),"e-button-hide"):(0,t.addClass)(this.element.querySelectorAll(".e-lock-rule-btn"),"e-button-hide")),(0,t.isNullOrUndefined)(e.showButtons.cloneGroup)||(e.showButtons.cloneGroup?(0,t.removeClass)(this.element.querySelectorAll(".e-clone-grp-btn"),"e-button-hide"):(0,t.addClass)(this.element.querySelectorAll(".e-clone-grp-btn"),"e-button-hide")),(0,t.isNullOrUndefined)(e.showButtons.cloneRule)||(e.showButtons.cloneRule?(0,t.removeClass)(this.element.querySelectorAll(".e-clone-rule-btn"),"e-button-hide"):(0,t.addClass)(this.element.querySelectorAll(".e-clone-rule-btn"),"e-button-hide")),(0,t.isNullOrUndefined)(e.showButtons.ruleDelete)||(e.showButtons.ruleDelete?(0,t.removeClass)(this.element.querySelectorAll(".e-rule-delete"),"e-button-hide"):(0,t.addClass)(this.element.querySelectorAll(".e-rule-delete"),"e-button-hide")),(0,t.isNullOrUndefined)(e.showButtons.groupDelete)||(e.showButtons.groupDelete?(0,t.removeClass)(this.element.querySelectorAll(".e-deletegroup"),"e-button-hide"):(0,t.addClass)(this.element.querySelectorAll(".e-deletegroup"),"e-button-hide"));break;case"cssClass":l.cssClass&&(0,t.removeClass)([this.element],l.cssClass.split(" ")),e.cssClass&&(0,t.addClass)([this.element],e.cssClass.replace(/\s+/g," ").trim().split(" "));break;case"enableRtl":e.enableRtl?((0,t.addClass)([this.element],"e-rtl"),this.notGroupRtl()):((0,t.removeClass)([this.element],"e-rtl"),this.notGroupRtl());break;case"enablePersistence":this.enablePersistence=e.enablePersistence;break;case"dataSource":this.dataSource=e.dataSource,this.refresh();break;case"columns":this.columns=e.columns,this.columnSort(),this.updateSubFieldsFromColumns(this.columns);break;case"sortDirection":this.sortDirection=e.sortDirection,this.columnSort();break;case"maxGroupCount":this.maxGroupCount=e.maxGroupCount;break;case"height":this.height=e.height,this.element.style.height=this.height;break;case"rule":0!==this.rule.rules.length||(0,t.isNullOrUndefined)(this.rule)||this.reset(),this.setProperties({rule:e.rule},!0),e.rule=this.getRuleCollection(this.rule,!1),this.setRules(this.rule);break;case"width":this.width=e.width,this.element.style.width=this.width;break;case"locale":this.locale=e.locale,this.intl=new t.Internationalization(this.locale),this.isLocale=!0,this.refresh(),this.isLocale=!1;break;case"enableNotCondition":this.onChangeNotGroup();break;case"readonly":this.isReadonly=e.readonly,this.enableReadonly();break;case"allowDragAndDrop":this.allowDragAndDrop=e.allowDragAndDrop,this.refresh();break;case"enableSeparateConnector":this.enableSeparateConnector=e.enableSeparateConnector,this.refresh()}}this.isPropChange=!1},d.prototype.preRender=function(){this.element.id=this.element.id||(0,t.getUniqueID)("ej2-querybuilder"),this.defaultLocale={StartsWith:"Starts With",DoesNotStartWith:"Does Not Start With",EndsWith:"Ends With",DoesNotEndWith:"Does Not End With",Contains:"Contains",DoesNotContain:"Does Not Contain",NotLike:"Not Like",Like:"Like",Equal:"Equal",NotEqual:"Not Equal",LessThan:"Less Than",LessThanOrEqual:"Less Than Or Equal",GreaterThan:"Greater Than",GreaterThanOrEqual:"Greater Than Or Equal",Between:"Between",NotBetween:"Not Between",In:"In",NotIn:"Not In",Remove:"REMOVE",SelectField:"Select a field",SelectOperator:"Select operator",DeleteRule:"Remove this condition",DeleteGroup:"Delete group",AddGroup:"Add Group",AddCondition:"Add Condition",Edit:"EDIT",ValidationMessage:"This field is required",SummaryViewTitle:"Summary View",OtherFields:"Other Fields",AND:"AND",OR:"OR",NOT:"NOT",SelectValue:"Enter Value",IsEmpty:"Is Empty",IsNotEmpty:"Is Not Empty",IsNull:"Is Null",IsNotNull:"Is Not Null",True:"true",False:"false",AddButton:"Add Group/Condition",CloneGroup:"Clone Group",LockGroup:"Lock Group",CloneRule:"Clone Rule",LockRule:"Lock Rule",UnlockRule:"Unlock Rule",UnlockGroup:"Unlock Group"},this.l10n=new t.L10n("querybuilder",this.defaultLocale,this.locale),this.intl=new t.Internationalization(this.locale),this.groupIdCounter=0,this.subFilterCounter=0,this.ruleIdCounter=0,this.btnGroupId=0,this.isImportRules=!1,this.parser=[],this.customOperators={stringOperator:[{value:"startswith",key:this.l10n.getConstant("StartsWith")},{value:"notstartswith",key:this.l10n.getConstant("DoesNotStartWith")},{value:"endswith",key:this.l10n.getConstant("EndsWith")},{value:"notendswith",key:this.l10n.getConstant("DoesNotEndWith")},{value:"contains",key:this.l10n.getConstant("Contains")},{value:"notcontains",key:this.l10n.getConstant("DoesNotContain")},{value:"equal",key:this.l10n.getConstant("Equal")},{value:"notequal",key:this.l10n.getConstant("NotEqual")},{value:"in",key:this.l10n.getConstant("In")},{value:"notin",key:this.l10n.getConstant("NotIn")},{value:"isempty",key:this.l10n.getConstant("IsEmpty")},{value:"isnotempty",key:this.l10n.getConstant("IsNotEmpty")}],dateOperator:[{value:"equal",key:this.l10n.getConstant("Equal")},{value:"greaterthan",key:this.l10n.getConstant("GreaterThan")},{value:"greaterthanorequal",key:this.l10n.getConstant("GreaterThanOrEqual")},{value:"lessthan",key:this.l10n.getConstant("LessThan")},{value:"lessthanorequal",key:this.l10n.getConstant("LessThanOrEqual")},{value:"notequal",key:this.l10n.getConstant("NotEqual")},{value:"between",key:this.l10n.getConstant("Between")},{value:"notbetween",key:this.l10n.getConstant("NotBetween")}],booleanOperator:[{value:"equal",key:this.l10n.getConstant("Equal")},{value:"notequal",key:this.l10n.getConstant("NotEqual")}],numberOperator:[{value:"equal",key:this.l10n.getConstant("Equal")},{value:"greaterthanorequal",key:this.l10n.getConstant("GreaterThanOrEqual")},{value:"greaterthan",key:this.l10n.getConstant("GreaterThan")},{value:"between",key:this.l10n.getConstant("Between")},{value:"lessthan",key:this.l10n.getConstant("LessThan")},{value:"notbetween",key:this.l10n.getConstant("NotBetween")},{value:"lessthanorequal",key:this.l10n.getConstant("LessThanOrEqual")},{value:"notequal",key:this.l10n.getConstant("NotEqual")},{value:"in",key:this.l10n.getConstant("In")},{value:"notin",key:this.l10n.getConstant("NotIn")}]},this.operators={equal:"=",notequal:"!=",greaterthan:">",greaterthanorequal:">=",lessthan:"<",in:"IN",notin:"NOT IN",lessthanorequal:"<=",startswith:"LIKE",endswith:"LIKE",between:"BETWEEN",notbetween:"NOT BETWEEN",contains:"LIKE",isnull:"IS NULL",isnotnull:"IS NOT NULL",isempty:"IS EMPTY",isnotempty:"IS NOT EMPTY",notstartswith:"NOT LIKE",notendswith:"NOT LIKE",notcontains:"NOT LIKE"},this.sqlOperators={equal:"=",notequal:"!=",greaterthan:">",greaterthanorequal:">=",lessthan:"<",in:this.l10n.getConstant("In").toUpperCase(),notin:this.l10n.getConstant("NotIn").toUpperCase(),lessthanorequal:"<=",startswith:this.l10n.getConstant("Like").toUpperCase(),endswith:this.l10n.getConstant("Like").toUpperCase(),between:this.l10n.getConstant("Between").toUpperCase(),notbetween:this.l10n.getConstant("NotBetween").toUpperCase(),contains:this.l10n.getConstant("Like").toUpperCase(),isnull:this.l10n.getConstant("IsNull").toUpperCase(),isnotnull:this.l10n.getConstant("IsNotNull").toUpperCase(),isempty:this.l10n.getConstant("IsEmpty").toUpperCase(),isnotempty:this.l10n.getConstant("IsNotEmpty").toUpperCase(),notstartswith:this.l10n.getConstant("NotLike").toUpperCase(),notendswith:this.l10n.getConstant("NotLike").toUpperCase(),notcontains:this.l10n.getConstant("NotLike").toUpperCase()},this.fields||(this.fields={text:"label",value:"field"})},d.prototype.render=function(){this.levelColl={},this.items=[{text:this.l10n.getConstant("AddGroup"),iconCss:"e-icons e-add-icon e-addgroup"},{text:this.l10n.getConstant("AddCondition"),iconCss:"e-icons e-add-icon e-addrule"}],this.ruleElem=this.ruleTemplate(),this.groupElem=this.groupTemplate();var e=[{value:"isnull",key:this.l10n.getConstant("IsNull")},{value:"isnotnull",key:this.l10n.getConstant("IsNotNull")}],t=[{value:"isnull",key:this.l10n.getConstant("IsNull")},{value:"isnotnull",key:this.l10n.getConstant("IsNotNull")}];this.customOperators.stringOperator=this.customOperators.stringOperator.concat(e),this.customOperators.numberOperator=this.customOperators.numberOperator.concat(t),this.dataSource instanceof r.DataManager?(this.dataManager=this.dataSource,this.executeDataManager((new r.Query).take(1))):(this.dataManager=new r.DataManager(this.dataSource),this.dataColl=this.dataManager.executeLocal(new r.Query),this.initControl()),this.renderComplete(),this.allowDragAndDrop&&this.initializeDrag()},d.prototype.initializeDrag=function(){this.draggable=new t.Draggable(this.element,{dragTarget:".e-drag-qb-rule",distance:5,helper:this.helper.bind(this),dragStart:this.dragStartHandler.bind(this),drag:this.dragHandler.bind(this),dragStop:this.dragStopHandler.bind(this),isReplaceDragEle:!0,isPreventSelect:!1,abort:".e-parent-header",isDragScroll:!0})},d.prototype.helper=function(e){var l=this.draggable.currentStateTarget;if(!l.classList.contains("e-drag-qb-rule")||l.classList.contains("e-drag-qb-rule")&&(0,t.closest)(l,".e-disable"))return!1;var n,r=this.createElement("div",{className:"e-cloneproperties e-draganddrop e-dragclone",styles:'height:"auto", z-index:2, width:'+this.element.offsetWidth});if(this.draggable.currentStateTarget.parentElement.classList.contains("e-group-header"))n=(0,t.closest)(l,".e-group-container").cloneNode(!0),(0,t.closest)(l,".e-group-container").classList.add("e-qb-dragging-rule");else{r.classList.add("e-group-body"),n=this.createElement("div",{className:"e-rule-container"});var i=(0,t.closest)(l,".e-rule-field").cloneNode(!0);n.appendChild(i),(0,t.closest)(l,".e-rule-field").classList.add("e-qb-dragging-rule")}return r.appendChild(n),r.querySelectorAll("*").forEach(function(e){e.removeAttribute("id")}),this.element.appendChild(r),r},d.prototype.dragStartHandler=function(e){this.draggedRule=e.target,this.isDragEventPrevent=!1,document.body.classList.add("e-prevent-select"),this.dragElement=e.dragElement;var l=(0,t.closest)(e.target,".e-rule-container"),n=(0,t.closest)(e.target,".e-group-container"),r={dragRuleID:null!==l?l.id:n.id,dragGroupID:n.id,cancel:!1};this.trigger("dragStart",r),this.isDragEventPrevent=r.cancel},d.prototype.dragHandler=function(e){if(!this.isDragEventPrevent){var l=this.element.querySelectorAll(".e-drag-rule-bottom-line");if(l.forEach(function(e){e.classList.remove("e-drag-rule-bottom-line")}),(l=this.element.querySelectorAll(".e-drag-rule-top-line")).forEach(function(e){e.classList.remove("e-drag-rule-top-line")}),!(0,t.isNullOrUndefined)(e.target))if("HTML"===e.target.nodeName||(0,t.closest)(e.target,".e-qb-dragging-rule")||(0,t.closest)(e.target,".e-group-header")||!(0,t.closest)(e.target,"#"+this.element.id)||(0,t.closest)(e.target,".e-disable")||e.target.parentElement&&e.target.parentElement.classList.contains("e-btn-group")&&this.enableSeparateConnector)this.dragElement.classList.add("e-notallowedcur");else{this.dragElement.classList.remove("e-notallowedcur");var n=(0,t.closest)(e.target,".e-rule-container"),r=(0,t.closest)(e.target,".e-group-container");if(n){var i=n.getBoundingClientRect(),o=(u=e.event.clientY||e.event.changedTouches[0].clientY)-i.top,s=i.bottom-u;o<(a=20)?n.classList.add("e-drag-rule-top-line"):s<a&&n.classList.add("e-drag-rule-bottom-line")}else if(e.target.classList.contains("e-rule-list")&&0===e.target.children.length)e.target.classList.add("e-drag-rule-bottom-line");else if(e.target.classList.contains("e-rule-list")&&e.target.children[0].classList.contains("e-group-container")){i=e.target.children[0].getBoundingClientRect();(o=(u=e.event.clientY||e.event.changedTouches[0].clientY)-i.top)<(a=20)&&e.target.classList.add("e-drag-rule-top-line")}else if(((0,t.closest)(e.target,".e-group-container")||e.target.classList.contains("e-group-container"))&&(r||(r=e.target),r.id.indexOf("group0")>-1)){i=e.target.getBoundingClientRect();var a,u=e.event.clientY||e.event.changedTouches[0].clientY;(s=i.bottom-u)<(a=20)&&e.target.classList.add("e-drag-rule-bottom-line")}var d={dragRuleID:null!==n?n.id:null!==r?r.id:null,dragGroupID:null!==r?r.id:null,cancel:!1};this.trigger("drag",d),this.isDragEventPrevent=d.cancel}}},d.prototype.dragStopHandler=function(e){var l=this;if(!this.isDragEventPrevent){var n,r,i=(0,t.closest)(e.target,".e-rule-container");if((0,t.isNullOrUndefined)(i)&&e.target.parentElement&&e.target.parentElement.classList.contains("e-btn-group")&&this.enableSeparateConnector&&(i=(0,t.closest)(e.target.parentElement.previousElementSibling,".e-rule-container")),(0,t.isNullOrUndefined)(e.helper)||(n=(0,t.closest)(e.helper,".e-notallowedcur")),!n){var o=(0,t.closest)(e.target,".e-group-container"),s={cancel:!1,dropRuleID:null!==i?i.id:null!==o?o.id:null,dropGroupID:null!==o?o.id:null};this.trigger("drop",s),s.cancel&&(n=!0),r=this.getValidRules()}this.prvtEvtTgrDaD=!0;var a=this.enableSeparateConnector&&e.target.parentElement&&e.target.parentElement.classList.contains("e-btn-group")?e.target.parentElement.previousElementSibling:e.target;if(i&&!n){var u=i.id.split(this.element.id+"_")[1].split("_")[0];if(this.draggable.currentStateTarget.parentElement.classList.contains("e-rule-field")||this.draggable.currentStateTarget.parentElement.classList.contains("e-group-header")){var d=void 0;this.draggable.currentStateTarget.parentElement.classList.contains("e-group-header")?(d=this.getGroup(this.draggedRule),this.deleteGroup((0,t.closest)(this.draggedRule,".e-group-container"))):(d=this.getRule(this.draggedRule),this.deleteRule(this.draggedRule)),(v=(0,t.extend)([],this.getGroup(i),[],!0)).properties&&(v=v.properties),(f=(0,t.closest)(i,".e-group-container")).querySelectorAll(".e-group-container").forEach(function(e){l.element.querySelector("#"+e.id)&&l.deleteGroup(e)});for(var c=f.querySelectorAll(".e-rule-container"),p=[],h=void 0,m=0;m<c.length;m++)(c[m].classList.contains("e-drag-rule-top-line")||c[m].classList.contains("e-drag-rule-bottom-line"))&&(h=m),p.push(c[m].id.split(this.element.id+"_")[1]);this.deleteRules(p),i.classList.contains("e-drag-rule-top-line")?v.rules.splice(h,0,d):v.rules.splice(h+1,0,d),v.rules.forEach(function(e){l.enableSeparateConnector?e.rules?l.addGroups([e],u):l.addRules([e],u):e.condition?l.addGroups([e],u):l.addRules([e],u)})}}else if(a.classList.contains("e-rule-list")&&0===a.children.length&&!n){var g=(f=(0,t.closest)(a,".e-group-container")).id.split(this.element.id+"_")[1].split("_")[0];d=void 0;this.draggable.currentStateTarget.parentElement.classList.contains("e-group-header")?(d=this.getGroup(this.draggedRule),this.deleteGroup((0,t.closest)(this.draggedRule,".e-group-container"))):(d=this.getRule(this.draggedRule),this.deleteRule(this.draggedRule)),this.enableSeparateConnector?d.rules?this.addGroups([d],g):this.addRules([d],g):d.condition?this.addGroups([d],g):this.addRules([d],g)}else if(a.classList.contains("e-rule-list")&&a.children[0].classList.contains("e-group-container")&&!n){var f,v,y=(f=(0,t.closest)(a,".e-group-container")).id.split(this.element.id+"_")[1].split("_")[0];d=void 0;this.draggable.currentStateTarget.parentElement.classList.contains("e-group-header")?(d=this.getGroup(this.draggedRule),this.deleteGroup((0,t.closest)(this.draggedRule,".e-group-container"))):(d=this.getRule(this.draggedRule),this.deleteRule(this.draggedRule)),(v=(0,t.extend)([],this.getGroup(a),[],!0)).properties&&(v=v.properties),a.querySelectorAll(".e-group-container").forEach(function(e){l.element.querySelector("#"+e.id)&&l.deleteGroup(e)}),(c=f.querySelectorAll(".e-rule-container")).forEach(function(e){l.element.querySelector("#"+e.id)&&l.deleteRule(e)}),this.draggable.currentStateTarget.parentElement.classList.contains("e-group-header")?this.addGroups([d],y):this.addRules([d],y),v.rules.forEach(function(e){l.enableSeparateConnector?e.rules?l.addGroups([e],y):l.addRules([e],y):e.condition?l.addGroups([e],y):l.addRules([e],y)})}else if(((0,t.closest)(e.target,".e-group-container")||e.target.classList.contains("e-group-container"))&&!n){d=void 0;!(i=(0,t.closest)(e.target,".e-group-container"))&&e.target.classList.contains("e-group-container")&&(i=e.target),"group0"===(g=i.id.split(this.element.id+"_")[1].split("_")[0])&&(this.draggable.currentStateTarget.parentElement.classList.contains("e-group-header")?(d=this.getGroup(this.draggedRule),this.deleteGroup((0,t.closest)(this.draggedRule,".e-group-container"))):(d=this.getRule(this.draggedRule),this.deleteRule(this.draggedRule)),this.enableSeparateConnector?d.rules?this.addGroups([d],g):this.addRules([d],g):d.condition?this.addGroups([d],g):this.addRules([d],g))}n||this.trigger("ruleChange",{previousRule:r,rule:this.getValidRules(),type:"drag-and-drop"}),this.prvtEvtTgrDaD=!1,document.body.classList.remove("e-prevent-select");var b=this.element.querySelectorAll(".e-drag-rule-bottom-line");b.forEach(function(e){e.classList.remove("e-drag-rule-bottom-line")}),(b=this.element.querySelectorAll(".e-drag-rule-top-line")).forEach(function(e){e.classList.remove("e-drag-rule-top-line")}),(b=this.element.querySelectorAll(".e-qb-dragging-rule")).forEach(function(e){e.classList.remove("e-qb-dragging-rule")}),e.helper&&e.helper.classList.contains("e-cloneproperties")&&document.querySelector("."+e.helper.classList[0])&&(0,t.remove)(e.helper),this.enableSeparateConnector&&this.refresh()}},d.prototype.templateParser=function(e){if(e)try{return"function"!=typeof e&&document.querySelectorAll(e).length?(0,t.compile)(document.querySelector(e).innerHTML.trim()):(0,t.compile)(e)}catch(l){return(0,t.compile)(e)}},d.prototype.executeDataManager=function(e){var t=this,l=this.dataManager.executeQuery(e),n=new r.Deferred;l.then(function(e){e.actual&&e.actual.result?t.dataColl=e.actual.result:t.dataColl=e.result,t.initControl()}).catch(function(e){n.reject(e)})},d.prototype.initControl=function(){this.initialize(),this.initWrapper(),this.wireEvents()},d.prototype.wireEvents=function(){var e=this.getWrapper();t.EventHandler.add(e,"click",this.clickEventHandler,this),t.EventHandler.add(e,"focusout",this.focusEventHandler,this),t.EventHandler.add(e,"focusin",this.focusEventHandler,this),t.EventHandler.add(this.element,"keydown",this.keyBoardHandler,this),this.allowDragAndDrop&&t.EventHandler.add(document,"keydown",this.keyBoardHandler,this),window.addEventListener("resize",this.windowResizeHandler.bind(this))},d.prototype.unWireEvents=function(){var e=this.getWrapper();t.EventHandler.remove(e,"click",this.clickEventHandler),t.EventHandler.remove(e,"focusout",this.focusEventHandler),t.EventHandler.remove(e,"focusin",this.focusEventHandler),t.EventHandler.remove(this.element,"keydown",this.keyBoardHandler),t.EventHandler.remove(document,"keydown",this.keyBoardHandler),window.removeEventListener("resize",this.windowResizeHandler)},d.prototype.getParentGroup=function(e,t){for(var l=e instanceof Element?this.levelColl[e.id]:this.levelColl[""+e],n=t?l.length-1:l.length,r=this.rule,i=0;i<n;i++)r=this.findGroupByIdx(l[i],r,0===i);return r},d.prototype.deleteGroup=function(e){var t,l=this,n=e;if("string"==typeof e?(t=this.element.id+"_"+e,e=document.getElementById(t),t=t.replace(this.element.id+"_","")):t=n.id.replace(this.element.id+"_",""),"group0"!==t&&e){var r={groupID:t,cancel:!1,type:"deleteGroup"};this.isImportRules||this.prvtEvtTgrDaD?this.deleteGroupSuccessCallBack(r,e):this.trigger("beforeChange",r,function(t){l.deleteGroupSuccessCallBack(t,e)})}},d.prototype.deleteGroupSuccessCallBack=function(e,l){if(!e.cancel){var n=l,r=this.getParentGroup(n,!0),i=0,o=void 0,s=void 0,a=this.getValidRules(this.rule),u=n.nextElementSibling,d=n.previousElementSibling,c=n.querySelectorAll(".e-group-container"),p=n.querySelectorAll(".e-tooltip");for(s=p.length,o=0;o<s;o++)(0,t.getComponent)(p[o],"tooltip").destroy();for(o=0,s=c.length;o<s;o++)delete this.levelColl[c[o].id];for(;null!==n.previousElementSibling;)n=n.previousElementSibling,(!this.enableSeparateConnector||this.enableSeparateConnector&&(!this.headerTemplate&&!n.classList.contains("e-btn-group")||this.headerTemplate&&(n.classList.contains("e-rule-container")||n.classList.contains("e-group-container"))))&&i++;this.enableSeparateConnector||u&&u.className.indexOf("e-separate-rule")>-1&&((0,t.removeClass)([u],"e-separate-rule"),(0,t.addClass)([u],"e-joined-rule"),d&&d.className.indexOf("e-rule-container")>-1&&(0,t.addClass)([d],"e-prev-joined-rule"));var h=n.parentElement.parentElement.parentElement,m=[];if(this.isReact||this.isAngular){var g=r.rules[i],f=l.querySelectorAll(".e-rule-container");if(g&&g.rules)for(var v=0;v<g.rules.length;v++){var y=this.getColumn(g.rules[v].field);if(f[v]){var b=f[v].querySelector(".e-template-value");y&&(y.ruleTemplate||this.isPlatformTemplate(y)&&b)&&m.push(f[v].id)}}}(0,t.detach)(l),this.headerTemplate&&this.clearQBTemplate([l.id]),m.length&&this.clearQBTemplate(m),r.rules.splice(i,1),delete this.levelColl[e.groupID],this.refreshLevelColl(),this.disableRuleCondition(h,r),this.enableSeparateConnector&&d&&(!this.headerTemplate&&d.classList.contains("e-btn-group")||this.headerTemplate&&d.classList.contains("e-custom-group-btn"))&&(0,t.detach)(d),this.isImportRules||this.prvtEvtTgrDaD||this.trigger("change",e),this.filterRules(a,this.getValidRules(this.rule),"deleteGroup")}},d.prototype.isPlatformTemplate=function(e){return e.template&&("string"==typeof e.template||void 0===e.template.create)},d.prototype.deleteRule=function(e){var l=this,n={groupID:(0,t.closest)(e,".e-group-container").id.replace(this.element.id+"_",""),ruleID:(0,t.closest)(e,".e-rule-container").id.replace(this.element.id+"_",""),cancel:!1,type:"deleteRule"};this.isImportRules||this.prvtEvtTgrDaD?this.deleteRuleSuccessCallBack(n,e):this.trigger("beforeChange",n,function(t){l.deleteRuleSuccessCallBack(t,e)})},d.prototype.deleteRuleSuccessCallBack=function(e,l){if(!e.cancel){var n=(0,t.closest)(l,".e-group-container"),r=this.getParentGroup(n),i=(0,t.closest)(l,".e-rule-container"),o=this.getValidRules(this.rule),s=i.previousElementSibling,a=0,u=i,d=i.nextElementSibling,c=i.querySelectorAll(".e-tooltip"),p=void 0,h=c.length;for(p=0;p<h;p++)(0,t.getComponent)(c[p],"tooltip").destroy();for(;null!==i.previousElementSibling;)i=i.previousElementSibling,(!this.enableSeparateConnector||this.enableSeparateConnector&&(!this.headerTemplate&&!i.classList.contains("e-btn-group")||this.headerTemplate&&(i.classList.contains("e-rule-container")||i.classList.contains("e-group-container"))))&&a++;var m=this.getColumn(r.rules[a].field);m&&m.template&&u.querySelector(".e-template")&&this.templateDestroy(m,u.querySelector(".e-template").id),(!s||s.className.indexOf("e-rule-container")<0)&&d&&(0,t.removeClass)([d],"e-joined-rule"),(!d||d.className.indexOf("e-rule-container")<0)&&s&&(0,t.removeClass)([s],"e-prev-joined-rule");var g=u.querySelector(".e-template-value");try{if(this.enableSeparateConnector&&(u.previousElementSibling||u.nextElementSibling)){var f=u.previousElementSibling,v=u.nextElementSibling;if((0,t.isNullOrUndefined)(v)&&(!this.headerTemplate&&f.classList.contains("e-btn-group")||this.headerTemplate&&f.classList.contains("e-custom-group-btn"))){if(f&&f.previousElementSibling&&f.previousElementSibling.classList.contains("e-rule-container"))this.getRule(f.previousElementSibling).condition=null;(0,t.detach)(f)}else(!this.headerTemplate&&v.classList.contains("e-btn-group")||this.headerTemplate&&v.classList.contains("e-custom-group-btn"))&&(0,t.detach)(v)}(0,t.detach)(u)}catch(e){return}m&&m.ruleTemplate&&this.clearQBTemplate([u.id]),m&&this.isPlatformTemplate(m)&&g&&this.clearQBTemplate([u.id]),r.rules.splice(a,1),r.rules[0]&&r.rules[0].rules||this.disableRuleCondition(n,r,!!this.enableSeparateConnector);for(var y=this.element.querySelectorAll(".e-tooltip"),b=0;b<y.length;b++)(0,t.getComponent)(y[b],"tooltip").refresh(y[b]);this.isImportRules||this.prvtEvtTgrDaD||this.trigger("change",e),this.filterRules(o,this.getValidRules(this.rule),"deleteRule")}},d.prototype.setGroupRules=function(e,t){if(this.headerTemplate&&t&&(this.isRoot=!0),this.reset(),this.groupIdCounter=1,this.ruleIdCounter=0,this.isImportRules=!0,this.setProperties({rule:e},!0),e=this.getRuleCollection(this.rule,!1),this.importRules(this.rule,this.element.querySelector(".e-group-container"),!0,this.rule.not,t),e.isLocked){var l=this.element.querySelector(".e-group-container").querySelector(".e-lock-grp-btn");this.groupLock(l)}this.isImportRules=!1},d.prototype.keyBoardHandler=function(e){if(e.currentTarget!==this.element||!this.readonly||38!==e.keyCode&&40!==e.keyCode&&13!==e.keyCode){if("Escape"===e.code&&this.allowDragAndDrop){this.isDragEventPrevent=!0,document.body.classList.remove("e-prevent-select");var l=this.element.querySelectorAll(".e-drag-rule-bottom-line");l.forEach(function(e){e.classList.remove("e-drag-rule-bottom-line")}),(l=this.element.querySelectorAll(".e-drag-rule-top-line")).forEach(function(e){e.classList.remove("e-drag-rule-top-line")}),(l=this.element.querySelectorAll(".e-qb-dragging-rule")).forEach(function(e){e.classList.remove("e-qb-dragging-rule")});var n=this.element.querySelector(".e-cloneproperties");n&&(0,t.remove)(n),this.enableSeparateConnector&&this.refresh()}}else e.preventDefault()},d.prototype.windowResizeHandler=function(){t.Browser.isDevice||window.innerWidth<768?this.displayMode="Vertical":this.displayMode="Horizontal"},d.prototype.clearQBTemplate=function(e){(this.isReact||this.isAngular)&&this.clearTemplate(e)},d.prototype.disableRuleCondition=function(e,l,n,r){if(!this.headerTemplate){if(this.readonly)return;var i=e.querySelector(".e-rule-list").childElementCount,o=e.querySelector(".e-btngroup-and"),s=e.querySelector(".e-btngroup-or");if(i>1)if(o.disabled=!1,s.disabled=!1,(s.nextElementSibling.classList.contains("e-btn-disable")||o.nextElementSibling.classList.contains("e-btn-disable"))&&(s.nextElementSibling.classList.remove("e-btn-disable"),o.nextElementSibling.classList.remove("e-btn-disable")),this.enableSeparateConnector&&!n){for(var a=0,u=void 0;;){var d=e.parentElement.querySelectorAll(".e-btngroup-and"),c=e.parentElement.querySelectorAll(".e-btngroup-or");if(o=d[d.length-(1+a)],s=c[c.length-(1+a)],!(u=d[d.length-(1+a)])||!u.parentElement||"none"!==u.parentElement.style.display)break;a++}for(var p=e.previousElementSibling;p&&!p.classList.contains("e-rule-container");){if(p.classList.contains("e-group-container")){p=p.querySelectorAll(".e-rule-container")[p.querySelectorAll(".e-rule-container").length-1];break}p=p.previousElementSibling}if(r&&e.classList.contains("e-group-container"))p=e,"or"===this.getGroup(p).condition?s.checked=!0:o.checked=!0;else if(p&&p.classList.contains("e-rule-container")){var h=p.id.replace(this.element.id+"_","");"or"===this.getRule(h).condition?s.checked=!0:o.checked=!0}}else n||(l&&"or"===l.condition?s.checked=!0:o.checked=!0);else if(this.enableSeparateConnector&&!n){for(a=0,u=void 0;;){d=e.parentElement.querySelectorAll(".e-btngroup-and"),c=e.parentElement.querySelectorAll(".e-btngroup-or");if(o=d[d.length-(1+a)],s=c[c.length-(1+a)],this.isImportRules&&(o=e.parentElement.querySelector(".e-btn-group.e-multi-connector .e-btngroup-and"),s=e.parentElement.querySelector(".e-btn-group.e-multi-connector .e-btngroup-or")),!(u=d[d.length-(1+a)])||!u.parentElement||"none"!==u.parentElement.style.display)break;a++}p=void 0;for(var m=e.previousElementSibling;m;){if(m.classList.contains("e-group-container")&&(m=m.querySelectorAll(".e-rule-container")[m.querySelectorAll(".e-rule-container").length-1]),m.classList.contains("e-rule-container")){p=m;break}m=m.previousElementSibling}if((0,t.isNullOrUndefined)(p)&&e.querySelectorAll(".e-rule-container")[e.querySelectorAll(".e-rule-container").length-1]&&(p=e.querySelectorAll(".e-rule-container")[e.querySelectorAll(".e-rule-container").length-1]),r&&e.classList.contains("e-group-container"))p=e,"or"===this.getGroup(p).condition?s.checked=!0:o.checked=!0;else if(p){h=p.id.replace(this.element.id+"_","");"or"===this.getRule(h).condition&&s?s.checked=!0:o&&(o.checked=!0)}}else n||(0,t.isNullOrUndefined)(o)||(o.checked=!1,o.disabled=!0,s.checked=!1,s.disabled=!0,l&&(s.nextElementSibling.classList.add("e-btn-disable"),o.nextElementSibling.classList.add("e-btn-disable")))}},d.prototype.getValidRules=function(e){this.isValueEmpty=!0,e||(e=this.getRules());var l=e.condition,n=e.not,r=(0,t.extend)([],e.rules,[],!0),i=(0,t.isNullOrUndefined)(e.isLocked)?this.getRuleCollection({condition:l,rules:r,not:n},!0):this.getRuleCollection({condition:l,rules:r,not:n,isLocked:e.isLocked},!0);return this.isValueEmpty=!1,i},d.prototype.getRuleCollection=function(e,l){if((0,t.isNullOrUndefined)(e))return null;var n;if(e.rules&&e.rules.length&&(Object.keys(e.rules[0]).length>6||l))for(var r=e.rules.length,i=0;i<r;i++)n=e.rules[i],n=this.getRuleCollection(n,l),e.rules[i]=n,Object.keys(n).length<1&&l&&(e.rules.splice(i,1),i--,r--);var o=e.custom;if(e.field&&""!==e.field&&((0,t.isNullOrUndefined)(o)||o&&"question"!==o.type&&"answer"!==o.type))if(e.operator&&(e.operator.toString().indexOf("null")>-1||e.operator.toString().indexOf("empty")>-1)&&(e.value=null),this.isRefreshed&&this.enablePersistence||""!==e.field&&""!==e.operator&&(this.isValueEmpty?""!==e.value&&void 0!==e.value:void 0!==e.value)||o&&o.isQuestion){var s=e.condition,a=e.isLocked;e={label:e.label,field:e.field,operator:e.operator,type:e.type,value:e.value},(0,t.isNullOrUndefined)(a)||(e.isLocked=a),s&&(e.condition=s),o&&(e.custom=o),"in"!==e.operator&&"notin"!==e.operator||!e.value||0!==e.value.length||(e={}),("between"===e.operator||"notbetween"===e.operator)&&Array.isArray(e.value)&&(e.value.length<2||e.value.some(function(e){return""===e||null===e}))&&(e={})}else e={};else if(!o||"question"!==o.type&&"answer"!==o.type)if((0,t.isNullOrUndefined)(e.condition)&&(0,t.isNullOrUndefined)(e.rules))e={};else{var u=e.isLocked;e=this.enableNotCondition?{condition:e.condition,rules:e.rules,not:e.not}:{condition:e.condition,rules:e.rules},(0,t.isNullOrUndefined)(u)||(e.isLocked=u),o&&(e.custom=o),e.rules&&0===e.rules.length&&(e={})}else{var d=e.not;(e={label:e.label,field:e.field,operator:e.operator,type:e.type,value:e.value,condition:e.condition,rules:e.rules}).custom=o,this.enableNotCondition&&(e.not=d)}return e},d.prototype.setRules=function(e){var l=(0,t.extend)({},e,{},!0);this.headerTemplate?this.setGroupRules(l,!0):this.setGroupRules(l)},d.prototype.getRules=function(){var e;return e=this.enableNotCondition?{condition:this.rule.condition,rules:this.rule.rules,not:this.rule.not}:{condition:this.rule.condition,rules:this.rule.rules},(0,t.isNullOrUndefined)(this.rule.isLocked)||(e.isLocked=this.rule.isLocked),this.rule.custom&&(e.custom=this.rule.custom),e},d.prototype.getRule=function(e){var l,n,r=0;if(e instanceof HTMLElement?l=(0,t.closest)(e,".e-rule-container"):(n=this.element.id+"_"+e,l=document.getElementById(n)),(0,t.isNullOrUndefined)(l))return null;for(var i=(0,t.closest)(l,".e-group-container"),o=this.getParentGroup(i);null!==l.previousElementSibling;)l=l.previousElementSibling,(!this.enableSeparateConnector||this.enableSeparateConnector&&(!this.headerTemplate&&!l.classList.contains("e-btn-group")||this.headerTemplate&&(l.classList.contains("e-rule-container")||l.classList.contains("e-group-container"))))&&r++;return o.rules[r]},d.prototype.getGroup=function(e){e instanceof Element&&e.className.indexOf("e-group-container")<1&&(e=(0,t.closest)(e,".e-group-container"));var l=e instanceof Element?e.id:this.element.id+"_"+e;return this.getParentGroup(l)},d.prototype.deleteGroups=function(e){var t,l,n=e.length;for(t=0;t<n;t++)"group0"!==e[t]&&(l=this.element.id+"_"+e[t],this.deleteGroup(document.getElementById(l)))},d.prototype.getFilteredRecords=function(){var e=this.getPredicate(this.getValidRules(this.rule)),l=(0,t.isNullOrUndefined)(e)?new r.Query:(new r.Query).where(e);return this.dataManager.executeQuery(l)},d.prototype.deleteRules=function(e){var t,l,n=e.length;for(t=0;t<n;t++)l=this.element.id+"_"+e[t],this.deleteRule(document.getElementById(l))},d.prototype.getDataManagerQuery=function(e){for(var t=this.getPredicate(e),l=[],n=0,i=Object.keys(this.columns);n<i.length;n++)l.push(this.columns[n].field);return e.rules.length?(new r.Query).select(l).where(t):(new r.Query).select(l)},d.prototype.getPredicate=function(e){var l,n,i,o,s=e.rules,a=!1;if(!s)return l;for(var u=0,d=s.length;u<d;u++){var c=s[u].operator;if("notstartswith"===c?c="doesnotstartwith":"notendswith"===c?c="doesnotendwith":"notcontains"===c&&(c="doesnotcontain"),a=!1,Object.keys(s[u]).indexOf("rules")>-1&&s[u].rules)(n=this.getPredicate(s[u]))&&(l=l?"and"===e.condition?l.and(n):l.or(n):n);else if(!(0,t.isNullOrUndefined)(c)&&!(0,t.isNullOrUndefined)(c.length)){var p=s[u].operator.toLowerCase(),h=!1,m=["equal","notequal","greaterthan","greaterthanorequal","lessthan","lessthanorequal"];if("string"===s[u].type&&(a=!this.matchCase),"date"===s[u].type&&m.indexOf(p)>-1&&(a=!0),o=this.getColumn(s[u].field),p.indexOf("null")>-1||p.indexOf("empty")>-1)s[u].value=null;else if("date"!==s[u].type||s[u].value instanceof Array)i=s[u].value;else{var g=this.getFormat(o.format);(0,t.isNullOrUndefined)(s[u].value)?i=null:(i=this.getDate(s[u].value,g),m.indexOf(p)>-1&&!this.isTime(s[u].value)&&(h=!0))}if(0===u)if(h||(p.indexOf("in")>-1||p.indexOf("between")>-1||p.indexOf("null")>-1||p.indexOf("empty")>-1)&&p.indexOf("contain")<0)l=h?this.datePredicate(s[u],i):this.arrayPredicate(s[u]);else""!==(f=i)&&(l=new r.Predicate(s[u].field,c,i,a));else if(h||(p.indexOf("in")>-1||p.indexOf("between")>-1||p.indexOf("null")>-1||p.indexOf("empty")>-1)&&p.indexOf("contain")<0)l=h?this.datePredicate(s[u],i,l,e.condition):this.arrayPredicate(s[u],l,e.condition);else if("and"===e.condition){var f=i;l&&""!==f?l=l.and(s[u].field,c,i,a):""!==f&&(l=new r.Predicate(s[u].field,c,i,a))}else{f=i;l&&""!==f?l=l.or(s[u].field,c,i,a):""!==f&&(l=new r.Predicate(s[u].field,c,i,a))}}}return this.dataSource instanceof r.DataManager&&((0,t.isNullOrUndefined)(l)||"isnull"!==l.operator&&"isnotnull"!==l.operator||(l.operator="isnull"===l.operator?"equal":"notequal")),l},d.prototype.getLocale=function(){var e=this.locale;return(0,t.getValue)("main."+this.locale+".dates.calendars.gregorian.days.format.short",t.cldrData)||(e="en"),e},d.prototype.getColumn=function(e,t){var l,n=this.columns;n=t||n;for(var r=""!==this.separator?e?e.split(this.separator):[]:[e],i=r&&r.length>0?r[0]:null,o=0;o<n.length;o++)if(n[o].field===e){l=n[o];break}if(!l&&""!==this.separator)for(o=0;o<n.length;o++)if(n[o].field===i){if(n[o].columns){var s=e.substring(i.length+this.separator.length);l=s?this.getColumn(s,n[o].columns):n[o]}else l=n[o];break}if(!l)for(o=0;o<n.length&&(!n[o].columns||!(l=this.getColumn(e,n[o].columns)));o++);return l},d.prototype.getOperators=function(e){return this.getColumn(e).operators},d.prototype.setTime=function(e,t){return t?e.setHours(0,0,0):e.setHours(23,59,59),e},d.prototype.datePredicate=function(e,t,l,n){var i,o=this.setTime(new Date(t.getTime()),!0),s=this.setTime(t);switch(e.operator){case"equal":i=(i=new r.Predicate(e.field,"greaterthanorequal",o)).and(e.field,"lessthanorequal",s);break;case"notequal":i=(i=new r.Predicate(e.field,"lessthan",o)).or(e.field,"greaterthan",s);break;case"greaterthan":i=new r.Predicate(e.field,"greaterthan",s);break;case"greaterthanorequal":i=new r.Predicate(e.field,"greaterthanorequal",o);break;case"lessthan":i=new r.Predicate(e.field,"lessthan",o);break;case"lessthanorequal":i=new r.Predicate(e.field,"lessthanorequal",s)}return i&&(l?"and"===n?l=l.and(i):"or"===n&&(l=l.or(i)):l=i),l},d.prototype.arrayPredicate=function(e,t,l){var n,i=e.value,o=e.operator.toString(),s=e.value,a=this.getColumn(e.field),u=this.getFormat(a.format);if(o.indexOf("null")>-1||o.indexOf("empty")>-1)switch(o){case"isnull":n=new r.Predicate(e.field,"isnull",s);break;case"isnotnull":n=new r.Predicate(e.field,"isnotnull",s);break;case"isempty":n=new r.Predicate(e.field,"equal","");break;case"isnotempty":n=new r.Predicate(e.field,"notequal","")}if(!(o.indexOf("null")>-1||o.indexOf("empty")>-1))for(var d=0,c=i.length;d<c;d++)if(""!==i[d]||("in"===o||"notin"===o)&&"string"===a.type)if(0===d){var p="greaterthanorequal";switch(o){case"between":n="date"!==a.type?new r.Predicate(e.field,p,i[d]):new r.Predicate(e.field,p,i[d]?this.isTime(i[d])?this.getDate(i[d],u):this.setTime(this.getDate(i[d],u),!0):null);break;case"notbetween":n="date"===a.type?new r.Predicate(e.field,"lessthan",i[d]?this.isTime(i[d])?this.getDate(i[d],u):this.setTime(this.getDate(i[d],u),!0):null):new r.Predicate(e.field,"lessthan",i[d]);break;case"in":n=new r.Predicate(e.field,"equal",i[d]);break;case"notin":n=new r.Predicate(e.field,"notequal",i[d])}}else{switch(e.operator){case"between":n="date"===a.type?n.and(e.field,"lessthanorequal",i[d]?this.isTime(i[d])?this.getDate(i[d],u):this.setTime(this.getDate(i[d],u)):i[d]):n.and(e.field,"lessthanorequal",i[d]);break;case"notbetween":n="date"===a.type?n.or(e.field,"greaterthan",i[d]?this.isTime(i[d])?this.getDate(i[d],u):this.setTime(this.getDate(i[d],u)):i[d]):n.or(e.field,"greaterthan",i[d]);break;case"in":n=n.or(e.field,"equal",i[d]);break;case"notin":n=n.and(e.field,"notequal",i[d])}}return n&&(t?"and"===l?t=t.and(n):"or"===l&&(t=t.or(n)):t=n),t},d.prototype.getDate=function(e,t){var l=this.intl.parseDate(e,t);return e.indexOf(":")>-1&&e.indexOf("/")<0&&e.indexOf(",")<0&&e.indexOf("-")<0&&((l=new Date).setHours(parseInt(e.split(":")[0],10)),l.setMinutes(parseInt(e.split(":")[1],10)),e.split(":")[2]&&l.setSeconds(parseInt(e.split(":")[2],10))),l},d.prototype.isTime=function(e){return!!(e&&e.indexOf(":")>-1)},d.prototype.importRules=function(e,l,n,r,i){if(n){if(e.rules&&e.rules.length>1&&!this.headerTemplate){var o=l.querySelector(".e-btngroup-or"),s=l.querySelector(".e-btngroup-and");if(this.enableSeparateConnector&&l.previousElementSibling&&(o=l.previousElementSibling.querySelector(".e-btngroup-or"),s=l.previousElementSibling.querySelector(".e-btngroup-and")),o.disabled=!1,s.disabled=!1,this.enableSeparateConnector){for(var a=l.previousElementSibling;a&&!a.classList.contains("e-rule-container");){if(a.classList.contains("e-group-container")){a=a.querySelectorAll(".e-rule-container")[a.querySelectorAll(".e-rule-container").length-1];break}a=a.previousElementSibling}if(a&&a.classList.contains("e-rule-container")){var u=a.id.replace(this.element.id+"_","");"or"===this.getRule(u).condition?o.checked=!0:s.checked=!0}}else"or"===e.condition?o.checked=!0:s.checked=!0}else this.disableRuleCondition(l);if(this.headerTemplate&&i&&(l=this.renderGroup(e,e.condition,this.element,e.not,i)),this.enableNotCondition&&!this.headerTemplate){var d=l.querySelector(".e-qb-toggle");e.not?((0,t.addClass)([d],"e-active-toggle"),this.enableSeparateConnector&&((0,t.getComponent)(d.querySelector(".e-checkbox"),"checkbox").checked=e.not)):(0,t.removeClass)([d],"e-active-toggle")}}else l=this.renderGroup(e,e.condition,l,r);e.rules&&0===e.rules.length&&this.headerTemplate&&(e.rules[0]={label:"",field:"",operator:"",type:"",value:""});var c=e.rules;if(!(0,t.isNullOrUndefined)(c))for(var p=0,h=c.length;p<h;p++){var m=Object.keys(c[p]);if(!(0,t.isNullOrUndefined)(c[p].rules)&&m.indexOf("rules")>-1&&0!==c[p].rules.length){if(this.element.querySelectorAll(".e-group-container").length>this.maxGroupCount)return null;l=this.renderGroup(c[p],c[p].condition,l,c[p].not),l=this.importRules(c[p],l,!0)}else if((0,t.isNullOrUndefined)(c[p].rules))this.renderRule(c[p],l);else{s=(l=this.renderGroup(c[p],c[p].condition,l,c[p].not)).querySelector(".e-btngroup-and"),o=l.querySelector(".e-btngroup-or");s.disabled=!0,o.disabled=!0}if(!(0,t.isNullOrUndefined)(c[p].rules)&&c[p].isLocked){var g=l.querySelector(".e-rule-list").children[p].querySelector(".e-lock-grp-btn");this.groupLock(g)}}return l&&(l=(0,t.closest)(l,".e-rule-list")),l&&(l=(0,t.closest)(l,".e-group-container")),l},d.prototype.renderGroup=function(e,t,l,n,r){this.addGroupElement(!0,l,t,!1,n,r,e);var i=l.querySelectorAll(".e-group-container"),o=l.querySelector(".e-rule-list").children;if(this.showButtons.cloneGroup&&this.cloneGrpBtnClick&&this.isMiddleGroup){this.isMiddleGroup=!1,this.cloneGrpBtnClick=!1;var s=0,a=this.groupIndex+1;if(this.enableSeparateConnector)for(var u=0;u<a;u++)o[u].classList.contains("e-rule-container")&&(a++,s++);return o[this.groupIndex+s+1]}return this.showButtons.cloneGroup&&this.cloneGrpBtnClick&&this.isLastGroup?(this.isLastGroup=!1,this.cloneGrpBtnClick=!1,o[o.length-1]):i[i.length-1]},d.prototype.renderRule=function(e,t){t.className.indexOf("e-group-container")>-1?this.addRuleElement(t,e):this.addRuleElement(t.querySelector(".e-group-container"),e)},d.prototype.enableReadonly=function(){for(var e=this.element.querySelectorAll(".e-dropdownlist, .e-dropdowntree, .e-numerictextbox, .e-textbox, .e-datepicker, .e-multiselect .e-lib, .e-radio"),r=0;r<e.length;r++){if(e[r].classList.contains("e-dropdownlist"))(0,t.getInstance)(e[r],n.DropDownList).readonly=this.isReadonly;else if(e[r].classList.contains("e-dropdowntree")){(0,t.getComponent)(e[r],"dropdowntree").readonly=this.isReadonly}else if(e[r].classList.contains("e-numerictextbox")){(0,t.getInstance)(e[r],i.NumericTextBox).readonly=this.isReadonly}else if(e[r].classList.contains("e-textbox")){(0,t.getInstance)(e[r],i.TextBox).readonly=this.isReadonly}else if(e[r].classList.contains("e-datepicker")){(0,t.getInstance)(e[r],o.DatePicker).readonly=this.isReadonly}else if(e[r].classList.contains("e-multiselect")){(0,t.getInstance)(e[r],n.MultiSelect).readonly=this.isReadonly}else if(e[r].classList.contains("e-radio")){(0,t.getInstance)(e[r],l.RadioButton).checked||(this.isReadonly?e[r].parentElement.style.display="none":e[r].parentElement.style.display="inherit")}}var s=this.element.querySelectorAll(".e-deletegroup"),a=this.element.querySelectorAll(".e-addrulegroup"),u=this.element.querySelectorAll(".e-removerule");!this.isReadonly&&this.ruleElem.classList.contains("e-readonly")&&this.ruleElem.classList.remove("e-readonly");var d=[s,a,u];for(r=0;r<d.length;r++)d[r].forEach(function(e){e.classList.contains("e-readonly")?e.classList.remove("e-readonly"):e.classList.add("e-readonly")});this.enableBtnGroup()},d.prototype.enableBtnGroup=function(){var e=this,t=this.element.querySelectorAll(".e-btngroup-and-lbl, .e-btngroup-or-lbl, .e-qb-toggle"),l=!1;t.forEach(function(t){!t.classList.contains("e-qb-toggle")||t.classList.contains("e-active-toggle")||t.classList.contains("e-readonly")?t.classList.contains("e-qb-toggle")&&t.classList.contains("e-not-readonly")?t.classList.remove("e-not-readonly"):t.classList.contains("e-qb-toggle")&&t.classList.contains("e-readonly")?t.classList.remove("e-readonly"):t.classList.contains("e-active-toggle")?(t.classList.add("e-not-readonly"),l=!0):t.previousElementSibling.checked||t.classList.contains("e-readonly")?(t.classList.remove("e-readonly"),l?"AND"===t.textContent?t.classList.add("e-readonly-and"):t.classList.add("e-readonly-or"):("AND"===t.textContent&&e.isReadonly?(t.classList.remove("e-not"),t.classList.add("e-readonly-and")):(e.enableNotCondition&&t.classList.add("e-not"),t.classList.remove("e-readonly-and")),"OR"===t.textContent&&e.isReadonly?t.classList.add("e-readonly-or-not"):t.classList.remove("e-readonly-or-not"))):t.classList.contains("e-btn-disable")||t.classList.add("e-readonly"):(t.classList.add("e-readonly"),l=!1)})},d.prototype.isDateFunction=function(e){for(var t=["date","time","day","week","month","year","hour","minute","second","now","quarter","period","extract"],l=0,n=t.length;l<n;l++)if(e.toLowerCase().indexOf(t[l])>-1)return!0;return!1},d.prototype.getSqlString=function(e,t,l,n){var r=this,i=!1;if(l||""===l?l+="(":(l="",i=!0),e.not){var o=n?this.l10n.getConstant("NOT").toUpperCase()+" ":"NOT ";l+=i?o+"(":" "+o+"("}return e.rules&&e.rules.length&&(l+=e.rules.reduce(function(l,i,o){var s="";if(i.rules)s=r.getSqlString(i,t,"",n),r.enableSeparateConnector&&(e.condition=i.condition);else{var a=n?r.sqlOperators[i.operator]:r.operators[i.operator],u="";if(i.value instanceof Array)if(i.operator.toString().indexOf("between")>-1){var d=n?" "+r.l10n.getConstant("AND").toUpperCase()+" ":" AND ";u="date"!==i.type||r.isDateFunction(i.value[0])?""+i.value[0]+d+i.value[1]:'"'+i.value[0]+'"'+d+'"'+i.value[1]+'"'}else{if("string"==typeof i.value[0]&&null!==i.value)u='("'+i.value.join('","')+'")';else u="("+i.value+")"}else u=i.operator.toString().indexOf("startswith")>-1?i.value?'("'+i.value+'%")':"("+i.value+")":i.operator.toString().indexOf("endswith")>-1?i.value?'("%'+i.value+'")':"("+i.value+")":i.operator.toString().indexOf("contains")>-1?i.value?'("%'+i.value+'%")':"("+i.value+")":"number"===i.type||"boolean"==typeof i.value||null===i.value&&i.operator.toString().indexOf("empty")<-1?""+i.value:i.operator.toString().indexOf("empty")>-1?'""':'"'+i.value+'"';var c=i.field;if(t?c="`"+c+"`":c.indexOf(" ")>-1&&(c='"'+c+'"'),i.operator.toString().indexOf("null")>-1)s=c+" "+a;else{var p=a;"isempty"===i.operator?p="=":"isnotempty"===i.operator&&(p="!="),s=c+" "+p+" "+u}}if(o!==e.rules.length-1){var h=e.condition;(""===h||i&&""!==i.condition&&i.custom&&i.custom.isCustom)&&(h=i.condition),h&&(s+=" "+(h=n?r.l10n.getConstant(h.toUpperCase()).toUpperCase():h.toUpperCase())+" ")}return l+s},"")),i||(l+=")"),e.not&&(l+=")"),l},d.prototype.setRulesFromSql=function(e,t){e=e.replace(/`/g,"");var l=this.getRulesFromSql(e,t);this.setRules({condition:l.condition,not:l.not,rules:l.rules})},d.prototype.getRulesFromSql=function(e,t){this.parser=[],this.sqlParser(e,t),this.setProperties({rule:{condition:"and",not:!1,rules:[]}},!0);var l=this.processParser(this.parser,this.rule,[0],t);return this.enableNotCondition?{condition:l.condition,not:l.not,rules:l.rules}:{condition:l.condition,rules:l.rules}},d.prototype.getSqlFromRules=function(e,t,l){return e||(e=this.getValidRules()),e=this.getRuleCollection(e,!1),this.getSqlString(this.getValidRules(e),t,null,l).replace(/"/g,"'")},d.prototype.getParameterizedSql=function(e){if(this.moduleLoader.loadedModules.length){e||(e=this.getValidRules());var t={sql:null};return this.notify("query-library",{prop:"getParameterSql",onPropertyChange:!1,value:{rule:e,obj:t}}),t.sql}return console.warn('[WARNING] :: Module "query-library" is not available in QueryBuilder component! You either misspelled the module name or forgot to load it.'),null},d.prototype.setParameterizedSql=function(e){if(this.moduleLoader.loadedModules.length){var t={sql:null};this.notify("query-library",{prop:"convertParamSqlToSql",onPropertyChange:!1,value:{sql:e,obj:t}});var l=t.sql;if(l){l=l.replace(/`/g,"");var n=this.getRulesFromSql(l);this.setRules({condition:n.condition,not:n.not,rules:n.rules})}}else console.warn('[WARNING] :: Module "query-library" is not available in QueryBuilder component! You either misspelled the module name or forgot to load it.')},d.prototype.getParameterizedNamedSql=function(e){if(this.moduleLoader.loadedModules.length){e||(e=this.getValidRules());var t={sql:null};return this.notify("query-library",{prop:"getNamedParameterSql",onPropertyChange:!1,value:{rule:e,obj:t}}),t.sql}return console.warn('[WARNING] :: Module "query-library" is not available in QueryBuilder component! You either misspelled the module name or forgot to load it.'),null},d.prototype.setParameterizedNamedSql=function(e){if(this.moduleLoader.loadedModules.length){var t={sql:null};this.notify("query-library",{prop:"convertNamedParamSqlToSql",onPropertyChange:!1,value:{sql:e,obj:t}});var l=t.sql;if(l){l=l.replace(/`/g,"");var n=this.getRulesFromSql(l);this.setRules({condition:n.condition,not:n.not,rules:n.rules})}}else console.warn('[WARNING] :: Module "query-library" is not available in QueryBuilder component! You either misspelled the module name or forgot to load it.')},d.prototype.setMongoQuery=function(e,t){this.moduleLoader.loadedModules.length?(this.rule={condition:"and",not:!1,rules:[]},this.notify("query-library",{prop:"mongoParser",onPropertyChange:!1,value:{mongoQuery:JSON.parse(e),rule:this.rule,mongoLocale:t}})):console.warn('[WARNING] :: Module "query-library" is not available in QueryBuilder component! You either misspelled the module name or forgot to load it.')},d.prototype.getMongoQuery=function(e){if(this.moduleLoader.loadedModules.length){e||(e=this.getValidRules());var t={mongoQuery:null};return this.notify("query-library",{prop:"getMongoFromRules",onPropertyChange:!1,value:{rule:e,mongoQuery:"",obj:t}}),t.mongoQuery}return console.warn('[WARNING] :: Module "query-library" is not available in QueryBuilder component! You either misspelled the module name or forgot to load it.'),""},d.prototype.cloneRule=function(e,t,l){var n=this.getRule(e.replace(this.element.id+"_","")),r=this.showButtons.cloneRule;t=t.replace(this.element.id+"_",""),this.ruleIndex=l,this.cloneRuleBtnClick=!0,this.showButtons.cloneRule=!0,this.addRules([{label:n.label,field:n.field,type:n.type,operator:n.operator,value:n.value,condition:n.condition}],t),this.ruleIndex=-1,this.cloneRuleBtnClick=!1,this.showButtons.cloneRule=r,r=!1},d.prototype.cloneGroup=function(e,t,l){t=t.replace(this.element.id+"_","");var n=this.getGroup(t),r=this.showButtons.cloneGroup;e=e.replace(this.element.id+"_",""),this.groupIndex=l,this.cloneGrpBtnClick=!0,this.showButtons.cloneGroup=!0,this.addGroups([{condition:n.condition,not:n.not,rules:n.rules}],e),this.groupIndex=-1,this.cloneGrpBtnClick=!1,this.showButtons.cloneGroup=r,r=!1},d.prototype.lockRule=function(e){e.indexOf(this.element.id)<0&&(e=this.element.id+"_"+e);var t=document.getElementById(e).querySelectorAll(".e-lock-rule-btn")[0];this.ruleLock(t)},d.prototype.lockGroup=function(e){e.indexOf(this.element.id)<0&&(e=this.element.id+"_"+e);var t=document.getElementById(e).querySelectorAll(".e-lock-grp-btn")[0];this.groupLock(t)},d.prototype.sqlParser=function(e,t){var l,n=0;do{l=e.slice(n),n+=this.parseSqlStrings(l,t)}while(""!==l);return this.parser},d.prototype.parseSqlStrings=function(e,t){var l,n,r,i,o=["=","!=","<=",">=","<",">"];l=t?[this.l10n.getConstant("AND").toUpperCase(),this.l10n.getConstant("OR").toUpperCase(),this.l10n.getConstant("NOT").toUpperCase()]:["AND","OR","NOT"],n=t?[this.l10n.getConstant("In").toUpperCase(),this.l10n.getConstant("NotIn").toUpperCase(),this.l10n.getConstant("Like").toUpperCase(),this.l10n.getConstant("NotLike").toUpperCase(),this.l10n.getConstant("Between").toUpperCase(),this.l10n.getConstant("NotBetween").toUpperCase(),this.l10n.getConstant("IsNull").toUpperCase(),this.l10n.getConstant("IsNotNull").toUpperCase(),this.l10n.getConstant("IsEmpty").toUpperCase(),this.l10n.getConstant("IsNotEmpty").toUpperCase()]:["IN","NOT IN","LIKE","NOT LIKE","BETWEEN","NOT BETWEEN","IS NULL","IS NOT NULL","IS EMPTY","IS NOT EMPTY"];for(var s=0,a=o.length;s<a;s++){if(r=/^\w+$/.test(o[s])?"\\b":"",new RegExp("^("+o[s]+")"+r,"ig").exec(e))return this.parser.push(["Operators",o[s].toLowerCase()]),o[s].length}var u=this.parser[this.parser.length-1];if(!u||u&&"Literal"!==u[0])for(s=0,a=l.length;s<a;s++){if(r=/^\w+$/.test(l[s])?"\\b":"",new RegExp("^("+l[s]+")"+r,"ig").exec(e))return this.parser.push(["Conditions",l[s].toLowerCase()]),l[s].length}for(s=0,a=n.length;s<a;s++){if(r=/^\w+$/.test(n[s])?"\\b":"",new RegExp("^("+n[s]+")"+r,"ig").exec(e))return this.parser.push(["SubOperators",n[s].toLowerCase()]),n[s].length}if(/^\(/.exec(e))return this.parser.push(["Left","("]),1;if(/^\)/.exec(e))return this.parser.push(["Right",")"]),1;if(/^(true|false)/.exec(e))return i=/^(true|false)/.exec(e)[0],this.parser.push(["String",i]),i.length;if(/^null/.exec(e))return i=/^null/.exec(e)[0],this.parser.push(["String",null]),i.length;if(/^`?([a-z_][a-z0-9_.\\[\]\\(\\)]{0,}(\\:(number|float|string|date|boolean))?)`?/i.exec(e))return i=/^`?([a-z_][a-z0-9_.\\[\]\\(\\)]{0,}(\\:(number|float|string|date|boolean))?)`?/i.exec(e)[1],this.parser.push(["Literal",i]),i.length;if(this.checkLiteral()&&/^'?([a-z_][a-z0-9 _.\\[\]\\(\\)-]{0,}(\\:(number|float|string|date|boolean))?)'?/i.exec(e))return i=/^'?([a-z_][a-z0-9 _.\\[\]\\(\\)-]{0,}(\\:(number|float|string|date|boolean))?)'?/i.exec(e)[1],this.parser.push(["Literal",i]),i.length+2;if(this.checkNumberLiteral(e,t)){var d=/^[0-9]+(\.[0-9]+)$/.exec(e);if(d)return i=d[0],this.parser.push(["Literal",i]),i.length}var c=this.getSingleQuoteString(e);if(""!==c){if("("===(i=c)[i.length-2])for(var p=!1,h=i.length;h<e.length&&(i+=e[h],")"===e[h]&&(p=!0),!p||"'"!==e[h]);h++);else e[i.length]&&")"!==e[i.length]&&!this.checkCondition(e,i)&&(i=this.combineSingleQuoteString(e,i));return this.parser.push(["String",i]),i.length}var m=this.getDoubleQuoteString(e);return""!==m?(i=m,this.parser.push(["DoubleString",i]),i.length):/^\d*\.?\d+/.exec(e)?(i=/^\d*\.?\d+/.exec(e)[0],this.parser.push(["Number",i]),i.length):/^-?\d*\.?\d+/.exec(e)?(i=/^-?\d*\.?\d+/.exec(e)[0],this.parser.push(["Number",i]),i.length):1},d.prototype.getDoubleQuoteString=function(e){var t=e.indexOf('"');if(0===t){var l=e.indexOf('"',t+1);if(-1!==l)return e.substring(t,l+1)}return""},d.prototype.checkCondition=function(e,t){return"AND"===e.slice(t.length+1,t.length+4)||"OR"===e.slice(t.length+1,t.length+3)},d.prototype.getSingleQuoteString=function(e,t){var l=e.indexOf("'");if(-1!==l&&t||0===l&&!t){var n=e.indexOf("'",l+1);if(-1!==n)return e.substring(l,n+1)}return""},d.prototype.combineSingleQuoteString=function(e,t){if(e[t.length]&&")"!==e[t.length]&&!this.checkCondition(e,t)&&","!==e[t.length]){var l=t.substring(0,t.length-1),n=e.replace(l,""),r=this.getSingleQuoteString(n,!0);if(""!==r)t+=r.substring(1,r.length),t=this.combineSingleQuoteString(e,t)}return t},d.prototype.checkLiteral=function(){var e=this.parser[this.parser.length-1];if(!e)return!0;var t=this.parser[this.parser.length-2],l=this.parser[this.parser.length-3];if("Left"===e[0]&&t&&"Conditions"===t[0])return!0;return!!("Conditions"===e[0]&&l&&l[1].indexOf("between")<0)},d.prototype.checkNumberLiteral=function(e,t){var l=this.parser[this.parser.length-1];if(!l)return!0;if(/^[0-9]+(?:\.[0-9]+)$/.exec(e)){var n=this.parser[this.parser.length-2],r=this.parser[this.parser.length-3];if("Left"===l[0]&&n&&"Conditions"===n[0])return!0;var i=t?this.l10n.getConstant("Between").toLowerCase():"between";if("Conditions"===l[0]&&r&&r[1].indexOf(i)<0)return!0}return!1},d.prototype.getOperator=function(e,t,l){if(l){for(var n=Object.keys(this.sqlOperators),r=0;r<n.length;r++)if(this.sqlOperators[n[r]]===t.toUpperCase())return e&&0===e.indexOf("%")&&"%"===e[e.length-1]?"NOT LIKE"===t.toUpperCase()?"notcontains":"contains":e&&0!==e.indexOf("%")&&e.indexOf("%")===e.length-1?"NOT LIKE"===t.toUpperCase()?"notstartswith":"startswith":e&&0===e.indexOf("%")&&e.indexOf("%")!==e.length-1?"NOT LIKE"===t.toUpperCase()?"notendswith":"endswith":n[r];return null}if(e){if(0===e.indexOf("%")&&"%"===e[e.length-1])return"not like"===t?"notcontains":"contains";if(0!==e.indexOf("%")&&e.indexOf("%")===e.length-1)return"not like"===t?"notstartswith":"startswith";if(0===e.indexOf("%")&&e.indexOf("%")!==e.length-1)return"not like"===t?"notendswith":"endswith"}else{if("not like"===t)return"notequal";if("like"===t)return"equal"}return{"=":"equal","!=":"notequal","<":"lessthan",">":"greaterthan","<=":"lessthanorequal",">=":"greaterthanorequal",in:"in","not in":"notin",between:"between","not between":"notbetween","is empty":"isempty","is null":"isnull","is not null":"isnotnull","is not empty":"isnotempty"}[""+t]},d.prototype.getTypeFromColumn=function(e){var l=this.getColumn(e.field);return(0,t.isNullOrUndefined)(l)?null:l.type},d.prototype.getLabelFromColumn=function(e){var t="",l=0;if(""!==this.separator){for(var n=e.split(this.separator),r=0;r<n.length;r++)t+=this.getLabelFromField(n,r+1),++l<n.length&&(t+=this.separator);return t}return this.getColumn(e).label},d.prototype.getLabelFromField=function(e,t){for(var l="",n=0,r=0;r<t;r++)l+=e[r],++n<t&&(l+=this.separator);return this.getColumn(l)?this.getColumn(l).label:""},d.prototype.processParser=function(e,t,l,n){for(var r,i,o,s,a,u,d,c,p,h,m=[],g=[],f=!1,v=!1,y=0,b=e.length;y<b;y++)if("Literal"===e[y][0]){var C=this.getColumn(e[y][1]);if(o={label:C&&C.label?C.label:e[y][1],field:e[y][1]},"SubOperators"===e[y+1][0]){if(e[y+1][1].indexOf("null")>-1||e[y+1][1].indexOf("empty")>-1)o.operator=this.getOperator(" ",e[y+1][1],n),o.value=null,o.type=this.getTypeFromColumn(o);else if(3===e.length&&"String"===e[2][0]&&-1!==e[2][1].indexOf("%")){var S=e[y+2][1]?e[y+2][1].replace(/'/g,""):e[y+2][1];o.operator=this.getOperator(S,e[y+1][1],n)}else{S=e[y+3][1]?e[y+3][1].replace(/'/g,""):e[y+3][1];o.operator=this.getOperator(S,e[y+1][1],n)}for(h=e[y+1][1],r=++y+1,i=b,n&&"contains"===o.operator||"startswith"===o.operator||"endswith"===o.operator?h="like":n&&"notcontains"===o.operator||"notstartswith"===o.operator||"notendswith"===o.operator?h="not like":n&&(h=o.operator),r=y+1;r<i;r++)if(h.indexOf("between")<0&&"Left"===e[r][0])f=!0;else{if("Right"===e[r][0]&&f){y=r,f=!1;break}if(h.indexOf("null")>-1||h.indexOf("empty")>-1)break;if(h.indexOf("like")>-1&&"String"===e[r][0]){var x=e[r][1];e[r][1]&&"'"===e[r][1][0]&&(x=e[r][1].substring(1,e[r][1].length-1)),x=x?x.replace(/%/g,""):e[r][1],o.value=x,o.type="string"}else if(h.indexOf("between")>-1){if("Literal"===e[r][0]||"Left"===e[r][0])break;if("Number"===e[r][0])m.push(Number(e[r][1]));else if("String"===e[r][0]){x=e[r][1];e[r][1]&&"'"===e[r][1][0]&&(x=e[r][1].substring(1,e[r][1].length-1)),g.push(x)}}else if("Number"===e[r][0])m.push(Number(e[r][1]));else if("String"===e[r][0]){x=e[r][1];e[r][1]&&"'"===e[r][1][0]&&(x=e[r][1].substring(1,e[r][1].length-1)),g.push(x)}o.type=this.getTypeFromColumn(o)}h.indexOf("like")<0&&("Number"===e[r-1][0]?(o.value=m,o.type="number"):"String"===e[r-1][0]?(o.value=g,o.type="string"):h.indexOf("between")>-1&&"Conditions"===e[r-1][0]&&(0!==g.length?(o.value=g,o.type="string"):(o.value=m,o.type="number")),m=[],g=[],o.type=this.getTypeFromColumn(o)),this.enableSeparateConnector&&"Conditions"===e[y+1][0]&&(o.condition=e[y+1][1])}else if("Operators"===e[y+1][0]){if(o.operator=this.getOperator(e[y+2][1],e[y+1][1],n),"equal"===o.operator&&"String"===e[y+2][0]&&"''"===e[y+2][1]?o.operator="isempty":"notequal"===o.operator&&"String"===e[y+2][0]&&"''"===e[y+2][1]&&(o.operator="isnotempty"),"Number"===e[y+2][0])o.type="number",o.value=Number(e[y+2][1]);else o.type="string",(x=e[y+2][1])&&"'"===x[0]&&(x=x.substring(1,x.length-1)),o.value=x;this.enableSeparateConnector&&"Conditions"===e[y+3][0]&&(o.condition=e[y+3][1]),o.type=this.getTypeFromColumn(o)}t.rules.push(o)}else{if("Left"===e[y][0]){if("Left"!==e[0][0]&&("not"===e[y-1][1]||n&&this.l10n.getConstant("NOT").toLowerCase()===e[y-1][1])){v=!0;continue}for(this.parser=e.splice(y+1,b-(y+1)),s=this.enableNotCondition?{condition:"and",rules:[],not:!1}:{condition:"and",rules:[]},p=0,u=t.rules.length,a=0;a<u;a++)t.rules[a].rules&&p++;return l.push(p),t.rules.push(s),s=this.processParser(this.parser,s,l,n),t}if("Conditions"!==e[y][0]||this.enableSeparateConnector){if("Right"===e[y][0]){if(v&&"Right"===e[y+1][0]){v=!1;continue}for(this.parser=e.splice(y+1,b-(y+1)),l.pop(),t=this.rule,c=l.length,d=0;d<c;d++)t=this.findGroupByIdx(l[d],t,0===d);return this.processParser(this.parser,t,l,n)}}else"not"===e[y][1]||n&&this.l10n.getConstant("NOT").toLowerCase()===e[y][1]?t.not=!0:t.condition=e[y][1]}return t},d.prototype.groupClone=function(e){var t=e.closest(".e-rule-list").closest(".e-group-container"),l=e.id.replace(this.element.id+"_",""),n=t.id.replace(this.element.id+"_",""),r=this.getGroup(l);this.groupIndex=Array.prototype.indexOf.call(e.closest(".e-rule-list").children,e.closest(".e-group-container")),this.addGroups([{condition:r.condition,not:r.not,rules:r.rules}],n),this.groupIndex=-1},d.prototype.ruleClone=function(e){for(var l=(0,t.closest)(e,".e-rule-container"),n=e.closest(".e-rule-list").closest(".e-group-container"),r=this.getRule(e),i=n.id.replace(this.element.id+"_",""),o=n.querySelectorAll(".e-rule-container"),s=0,a=o.length;s<a;s++)l.id===o[s].id&&(this.ruleIndex=s);this.enableSeparateConnector?this.addRules([{label:r.label,field:r.field,type:r.type,operator:r.operator,value:r.value,condition:r.condition}],i):this.addRules([{label:r.label,field:r.field,type:r.type,operator:r.operator,value:r.value}],i),this.ruleIndex=-1},d.prototype.ruleLock=function(e){var l=(0,t.closest)(e,".e-rule-container"),n=this.getRule(l.id.replace(this.element.id+"_",""));l.classList.contains("e-disable")?(n.isLocked=!1,this.lockItems=this.lockItems.filter(function(e){return e!==l.id}),l.classList.remove("e-disable"),this.disableRuleControls(e,l,!1),e.children[0].classList.add("e-unlock"),e.children[0].classList.remove("e-lock"),e.setAttribute("title",this.l10n.getConstant("LockRule"))):(n.isLocked=!0,this.lockItems.indexOf(l.id)<0&&this.lockItems.splice(this.lockItems.length-1,0,l.id),l.classList.add("e-disable"),this.disableRuleControls(e,l,!0),e.children[0].classList.add("e-lock"),e.children[0].classList.remove("e-unlock"),e.setAttribute("title",this.l10n.getConstant("UnlockRule")))},d.prototype.groupLock=function(e){var l=(0,t.closest)(e,".e-group-container"),n=this.getGroup(l.id.replace(this.element.id+"_","")),r=l.id.indexOf("group0")>-1;if(l.classList.contains("e-disable")){if(r)(i={}).condition=n.condition,i.not=n.not,i.isLocked=!1,this.setProperties({rule:i},!0);else n.isLocked=!1;this.lockItems=this.lockItems.filter(function(e){return e!==l.id}),l.classList.remove("e-disable"),this.disableHeaderControls(e,l,!1),e.children[0].classList.add("e-unlock"),e.children[0].classList.remove("e-lock"),e.setAttribute("title",this.l10n.getConstant("LockGroup")),this.updateLockItems()}else{var i;if(r)(i={}).condition=n.condition,i.not=n.not,i.isLocked=!0,this.setProperties({rule:i},!0);else n.isLocked=!0;this.lockItems.indexOf(l.id)<0&&this.lockItems.splice(this.lockItems.length-1,0,l.id),l.classList.add("e-disable"),this.disableHeaderControls(e,l,!0),e.children[0].classList.add("e-lock"),e.children[0].classList.remove("e-unlock"),e.setAttribute("title",this.l10n.getConstant("UnlockGroup"))}},d.prototype.updateLockItems=function(){for(var e=0;e<this.lockItems.length;e++){if(this.lockItems[e].split("_").length>2){var l=this.element.querySelector("#"+this.lockItems[e]),n=l.querySelector(".e-lock-rule-btn");(l=(0,t.closest)(n,".e-rule-container")).classList.contains("e-disable")||this.ruleLock(n)}else{var r=this.element.querySelector("#"+this.lockItems[e]);n=r.querySelector(".e-lock-grp-btn");(r=(0,t.closest)(n,".e-group-container")).classList.contains("e-disable")||this.groupLock(n)}}},d.prototype.disableHeaderControls=function(e,t,l){for(var n=t.querySelectorAll(".e-btngroup-and"),r=t.querySelectorAll(".e-btngroup-or"),i=t.querySelectorAll(".e-qb-toggle"),o=t.querySelectorAll(".e-add-btn"),s=t.querySelectorAll(".e-deletegroup"),a=t.querySelectorAll(".e-lock-grp-btn"),u=t.querySelectorAll(".e-clone-grp-btn"),d=t.querySelectorAll(".e-group-container"),c=t.querySelectorAll(".e-add-condition-btn"),p=t.querySelectorAll(".e-add-group-btn"),h=0;h<n.length;h++)l?(d[h]&&d[h].classList.contains("e-disable")&&d[h].classList.add("e-disable"),n[h].disabled=!0,r[h].disabled=!0,o[h]&&(o[h].disabled=!0),c[h]&&(c[h].disabled=!0),p[h]&&(p[h].disabled=!0),i[h]&&(i[h].disabled=!0),s[h]&&(s[h].disabled=!0),u[h]&&(u[h].disabled=!0),n[h].parentElement.classList.add("e-disabled"),a[h]&&a[h]!==e&&(a[h].disabled=!0,a[h].children[0].classList.remove("e-unlock"),a[h].children[0].classList.add("e-lock"))):(d[h]&&d[h].classList.remove("e-disable"),n[h].disabled=!1,r[h].disabled=!1,o[h]&&(o[h].disabled=!1),c[h]&&(c[h].disabled=!1),p[h]&&(p[h].disabled=!1),a[h]&&(a[h].disabled=!1),i[h]&&(i[h].disabled=!1),s[h]&&(s[h].disabled=!1),u[h]&&(u[h].disabled=!1),n[h].parentElement.classList.remove("e-disabled"),a[h]&&a[h].children[0].classList.remove("e-lock"),a[h]&&a[h].children[0].classList.add("e-unlock"));this.disableRuleControls(e,t,l)},d.prototype.disableRuleControls=function(e,l,n){var r=function(e,t,l){e.forEach(function(e){var n=t(e);"enabled"in n?n.enabled=!l:"disabled"in n&&(n.disabled=l)})},i={ddl:l.querySelectorAll(".e-control.e-dropdownlist"),numeric:l.querySelectorAll(".e-control.e-numerictextbox"),text:l.querySelectorAll(".e-control.e-textbox"),date:l.querySelectorAll(".e-control.e-datepicker"),checkbox:l.querySelectorAll(".e-control.e-checkbox"),radio:l.querySelectorAll(".e-control.e-radio"),multiSelect:l.querySelectorAll(".e-control.e-multiselect"),deleteElem:l.querySelectorAll(".e-rule-delete"),lockElem:l.querySelectorAll(".e-lock-rule"),cloneElem:l.querySelectorAll(".e-clone-rule"),ruleElem:l.querySelectorAll(".e-rule-container"),ddTree:l.querySelectorAll(".e-control.e-dropdowntree")};i.deleteElem.forEach(function(t,l){n?(i.ruleElem[l]&&i.ruleElem[l].classList.contains("e-disable")&&i.ruleElem[l].classList.add("e-disable"),i.deleteElem[l].disabled=!0,i.cloneElem[l]&&(i.cloneElem[l].disabled=!0),i.lockElem[l]!==e&&(i.lockElem[l].disabled=!0,i.lockElem[l].children[0].classList.remove("e-unlock"),i.lockElem[l].children[0].classList.add("e-lock"))):(i.ruleElem[l]&&i.ruleElem[l].classList.remove("e-disable"),i.cloneElem[l]&&(i.cloneElem[l].disabled=!1),i.deleteElem[l].disabled=!1,i.lockElem[l].disabled=!1,i.lockElem[l].children[0].classList.remove("e-lock"),i.lockElem[l].children[0].classList.add("e-unlock"))}),r(i.ddl,function(e){return(0,t.getComponent)(e,"dropdownlist")},n),r(i.numeric,function(e){return(0,t.getComponent)(e,"numerictextbox")},n),r(i.text,function(e){return(0,t.getComponent)(e,"textbox")},n),r(i.date,function(e){return(0,t.getComponent)(e,"datepicker")},n),r(i.checkbox,function(e){return(0,t.getComponent)(e,"checkbox")},n),r(i.radio,function(e){return(0,t.getComponent)(e,"radio")},n),r(i.multiSelect,function(e){return(0,t.getComponent)(e,"multiselect")},n),r(i.ddTree,function(e){return(0,t.getComponent)(e,"dropdowntree")},n)},h([(0,t.Event)()],d.prototype,"created",void 0),h([(0,t.Event)()],d.prototype,"destroyed",void 0),h([(0,t.Event)()],d.prototype,"actionBegin",void 0),h([(0,t.Event)()],d.prototype,"beforeChange",void 0),h([(0,t.Event)()],d.prototype,"change",void 0),h([(0,t.Event)()],d.prototype,"dataBound",void 0),h([(0,t.Event)()],d.prototype,"ruleChange",void 0),h([(0,t.Event)()],d.prototype,"dragStart",void 0),h([(0,t.Event)()],d.prototype,"drag",void 0),h([(0,t.Event)()],d.prototype,"drop",void 0),h([(0,t.Complex)({},v)],d.prototype,"showButtons",void 0),h([(0,t.Property)(!1)],d.prototype,"summaryView",void 0),h([(0,t.Property)(!1)],d.prototype,"allowValidation",void 0),h([(0,t.Property)("Default")],d.prototype,"fieldMode",void 0),h([(0,t.Property)([])],d.prototype,"columns",void 0),h([(0,t.Property)(null)],d.prototype,"fieldModel",void 0),h([(0,t.Property)(null)],d.prototype,"operatorModel",void 0),h([(0,t.Property)(null)],d.prototype,"valueModel",void 0),h([(0,t.Property)()],d.prototype,"headerTemplate",void 0),h([(0,t.Property)("")],d.prototype,"cssClass",void 0),h([(0,t.Property)([])],d.prototype,"dataSource",void 0),h([(0,t.Property)("Horizontal")],d.prototype,"displayMode",void 0),h([(0,t.Property)(!1)],d.prototype,"enablePersistence",void 0),h([(0,t.Property)("Default")],d.prototype,"sortDirection",void 0),h([(0,t.Property)(5)],d.prototype,"maxGroupCount",void 0),h([(0,t.Property)("auto")],d.prototype,"height",void 0),h([(0,t.Property)("auto")],d.prototype,"width",void 0),h([(0,t.Property)(!1)],d.prototype,"matchCase",void 0),h([(0,t.Property)(0)],d.prototype,"immediateModeDelay",void 0),h([(0,t.Property)(!1)],d.prototype,"enableNotCondition",void 0),h([(0,t.Property)(!1)],d.prototype,"readonly",void 0),h([(0,t.Property)(!0)],d.prototype,"addRuleToNewGroups",void 0),h([(0,t.Property)(!1)],d.prototype,"autoSelectField",void 0),h([(0,t.Property)(!0)],d.prototype,"autoSelectOperator",void 0),h([(0,t.Property)("")],d.prototype,"separator",void 0),h([(0,t.Property)(!1)],d.prototype,"enableSeparateConnector",void 0),h([(0,t.Complex)({condition:"and",rules:[]},g)],d.prototype,"rule",void 0),h([(0,t.Property)(!1)],d.prototype,"allowDragAndDrop",void 0),d=h([t.NotifyPropertyChanges],d)}(t.Component),b=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.destroy=function(){this.parent.isDestroyed||this.removeEventListener()},e.prototype.addEventListener=function(){this.parent.isDestroyed||(this.parent.on("query-library",this.queryLibrary,this),this.parent.on("destroyed",this.destroy,this))},e.prototype.removeEventListener=function(){this.parent.off("query-library",this.queryLibrary),this.parent.off("destroyed",this.destroy)},e.prototype.queryLibrary=function(e){switch(e.prop){case"getMongoFromRules":e.value.obj.mongoQuery=this.getMongoFromRules(e.value.rule,e.value.mongoQuery);break;case"mongoParser":this.mongoParser(e.value.mongoQuery,e.value.rule,e.value.mongoLocale);break;case"getParameterSql":e.value.obj.sql=this.getParameterSql(e.value.rule);break;case"getNamedParameterSql":e.value.obj.sql=this.getNamedParameterSql(e.value.rule);break;case"convertParamSqlToSql":e.value.obj.sql=this.convertParamSqlToSql(e.value.sql);break;case"convertNamedParamSqlToSql":e.value.obj.sql=this.convertNamedParamSqlToSql(e.value.sql)}},e.prototype.getMongoFromRules=function(e,t){return t="{","or"===e.condition?(t+='"$or":[',t=this.convertMongoQuery(e.rules,t)+"]"):(t+='"$and":[',t=this.convertMongoQuery(e.rules,t)+"]"),t+="}"},e.prototype.getOperatorFromMongoOperator=function(e){var t;switch(e){case"$ne":t="notequal";break;case"$gt":t="greaterthan";break;case"$gte":t="greaterthanorequal";break;case"$lt":t="lessthan";break;case"$lte":t="lessthanorequal";break;case"$nin":t="notin"}return t},e.prototype.convertMongoQuery=function(e,t){var l=this,n=0;return e.forEach(function(r){n++,t+="{",void 0!==r.rules&&("or"===r.condition?(t+=' "$or":[',t=l.convertMongoQuery(r.rules,t)+"]"):(t+=' "$and":[',t=l.convertMongoQuery(r.rules,t)+"]"));var i="string"===r.type&&"in"!==r.operator&&"notin"!==r.operator&&r.value&&""!==r.value.trim()?r.value.replace(/'/g,"\\"):"";"string"!==r.type||"in"!==r.operator&&"notin"!==r.operator||!r.value||1!==r.value.length||(i=r.value[0].replace(/'/g,"\\"));var o=r.field?r.field.substring(0):"";switch(r.operator){case"contains":t+='"'+o+'":{"$regex":"'+i+'"}';break;case"notcontains":t+='"'+o+'":{"$not":{"$regex":"'+r.value+'"}}';break;case"startswith":t+='"'+o+'":{"$regex":"^'+i+'"}';break;case"notstartswith":t+='"'+o+'":{"$not":{"$regex":"^'+r.value+'"}}';break;case"endswith":t+='"'+o+'":{"$regex":"'+i+'$"}';break;case"notendswith":t+='"'+o+'":{"$not":{"$regex":"'+r.value+'$"}}';break;case"isnull":t+='"'+o+'": null';break;case"isnotnull":t+='"'+o+'":{"$ne": null}';break;case"isempty":t+='"'+o+'": ""';break;case"isnotempty":t+='"'+o+'":{"$ne": ""}';break;case"equal":"string"===r.type?t+='"'+o+'":"'+i+'"':"date"===r.type?t+='"'+o+'":"'+r.value+'"':(r.type,t+='"'+o+'":'+r.value);break;case"notequal":"string"===r.type?t+='"'+o+'":{"$ne":"'+i+'"}':"date"===r.type?t+='"'+o+'":{"$ne":"'+r.value+'"}':t+='"'+o+'":{"$ne":'+r.value+"}";break;case"in":if("string"===r.type)if(r.value.length>1)s=(s=r.value.map(function(e,t){return t<r.value.length?'"'+e+'"':""}).toString()).endsWith(",")?s.substring(0,s.length-1):s,t+='"'+o+'": { "$in": ['+s+"]}";else t+='"'+o+'": { "$in": ["'+i+'"]}';else"number"===r.type&&(r.value.length>1?t+='"'+o+'": { "$in": ['+r.value.toString()+"]}":t+='"'+o+'": { "$in": ['+r.value+"]}");break;case"notin":var s;if("string"===r.type)if(r.value.length>1)s=(s=r.value.map(function(e,t){return t<r.value.length?'"'+e+'"':""}).toString()).endsWith(",")?s.substring(0,s.length-1):s,t+='"'+o+'": { "$nin": ['+s+"]}";else t+='"'+o+'": { "$nin": ["'+i+'"]}';else"number"===r.type&&(r.value.length>1?t+='"'+o+'": { "$nin": ['+r.value.toString()+"]}":t+='"'+o+'": { "$nin": ['+r.value+"]}");break;case"greaterthan":"number"===r.type?t+='"'+o+'": { "$gt": '+r.value+"}":t+='"'+o+'": { "$gt": "'+r.value+'"}';break;case"greaterthanorequal":"number"===r.type?t+='"'+o+'": { "$gte": '+r.value+"}":t+='"'+o+'": { "$gte": "'+r.value+'"}';break;case"between":"number"===r.type?t+='"'+o+'": {"$gte":'+r.value[0]+', "$lte":'+r.value[1]+"}":t+='"'+o+'": {"$gte": "'+r.value[0]+'", "$lte": "'+r.value[1]+'"}';break;case"notbetween":"number"===r.type?t+='"$or":[{"'+o+'": {"$lt":'+r.value[0]+'}}, {"'+o+'": {"$gt":'+r.value[1]+"}}]":t+='"$or":[{"'+o+'": {"$lt": "'+r.value[0]+'"}}, {"'+o+'": {"$gt": "'+r.value[1]+'"}}]';break;case"lessthan":"number"===r.type?t+='"'+o+'": { "$lt": '+r.value+"}":t+='"'+o+'": { "$lt": "'+r.value+'"}';break;case"lessthanorequal":"number"===r.type?t+='"'+o+'": { "$lte": '+r.value+"}":t+='"'+o+'": { "$lte": "'+r.value+'"}'}t+="}",e.length!==n&&(t+=",")}),t},e.prototype.mongoParser=function(e,t,l){var n;Object.keys(e).indexOf("$and")>-1?(n=e.$and,t.condition="and"):Object.keys(e).indexOf("$or")>-1&&(n=e.$or,t.condition="or"),t.rules=[],this.mongoRecursion(n,t.rules,l)},e.prototype.mongoRecursion=function(e,l,n){for(var r,i,o,s,a,u,d,c,p,h,m,g,f=0,v=e.length;f<v;f++){var y=[],b=[];if(d=Object.keys(e[f])[0],c=e[f][d],"$and"===d)p=this.parent.enableNotCondition?{condition:d.replace("$",""),rules:[],not:!1}:{condition:d.replace("$",""),rules:[]},l.push(p),this.mongoRecursion(e[f][d],l[l.length-1].rules,n);else if("$or"===d){var C=void 0,S=[],x=[],E=[],q=[],O=[],k=[],w=[];Array.isArray(c)&&2===c.length&&(k=c[(x=Object.keys(c))[0]],w=c[x[1]],"object"==typeof k&&(S=Object.keys(k)[0],E=Object.keys(k[Object.keys(k)[0]])[0],q=Object.keys(w[Object.keys(w)[0]])[0],"$lt"===E&&"$gt"===q&&(r="notbetween",h={field:S,label:S,value:g=[O=k[S][E],w[S][q]],operator:r,type:i="number"==typeof O?"number":"date"},l.push(h),C=!0))),C||(p=this.parent.enableNotCondition?{condition:d.replace("$",""),rules:[],not:!1}:{condition:d.replace("$",""),rules:[]},l.push(p),this.mongoRecursion(e[f][d],l[l.length-1].rules,n))}else{if(null===(c=e[f][d])&&(r="isnull"),"boolean"==typeof c&&(r="equal",i="boolean",g=c),"number"==typeof c)g=c,i="number",r="equal";else if("object"==typeof c&&null!==c){m=Object.keys(c);for(var N=0;N<m.length;N++)if(s=m[N],o=c[m[N]],"$ne"===s&&(0,t.isNullOrUndefined)(o)&&(r="isnotnull",g=null),"$ne"===s&&"boolean"==typeof o&&(r="notequal",g=o,i="boolean"),m.length>=2&&m[N]?("object"==typeof o?(r="notbetween",d=Object.keys(o)[0],a=[Object.keys(o[d])[0]],y.push(o[d][a]),i="number"):(r="between",y.push(o)),"number"==typeof o&&(i="number")):"object"==typeof o&&null!==o?"$not"===s&&"$regex"===Object.keys(o)[0]?o.$regex.indexOf("^")>-1?(r="notstartswith",g=o.$regex.replace("^","")):o.$regex.indexOf("$")>-1?(r="notendswith",g=o.$regex.replace("$","")):(r="notcontains",g=o.$regex):(r="$in"===s?"in":"notin",b=o,i="number"==typeof o[0]?"number":"string"):"number"==typeof o&&(r=this.getOperatorFromMongoOperator(s),i="number",g=o),"string"==typeof o){"$regex"===s&&(r="contains",g=o,i="string"),"$ne"===s&&(null!==o&&o.length>0&&isNaN(Date.parse(o))?(r="notequal",g=o):(0,t.isNullOrUndefined)(o)?(r="isnotnull",g=o):""===o&&(r="isnotempty",g=o),i="string"),o.indexOf("^")>-1&&(r="startswith",g=o.replace("^",""),i="string"),o.indexOf("$")>-1&&"$not"!==s&&(r="endswith",g=o.replace("$",""),i="string");for(var L=0,R=this.parent.columns;L<R.length;L++){var D=R[L];if(D.field===d){u=D.type;break}}isNaN(Date.parse(o))&&"date"!==u||(r=r||this.getOperatorFromMongoOperator(s),i="date",g=o)}}else c&&"string"==typeof c&&!isNaN(Date.parse(c))?(r="equal",g=c,i="date"):"string"==typeof c&&""!==c&&"true"!==c&&"false"!==c?(r="equal",g=c,i="string"):"string"==typeof c&&""===c&&(r="isempty",g=c,i="string");h=y&&y.length>1?{field:d,label:d,value:y,operator:r,type:i}:b&&b.length>1?{field:d,label:d,value:b,operator:r,type:i}:{field:d,label:d,value:g,operator:r,type:i},l.push(h),r=""}}},e.prototype.convertParamSqlToSql=function(e){for(var t=e.sql,l=e.params,n=t.split("?"),r=n[0],i=0;i<l.length;i++)r+="string"==typeof l[i]?"'"+l[i]+"'"+n[i+1]:l[i]+n[i+1];return r.length>=2&&"("===r[0]&&")"===r[r.length-1]&&(r=r.slice(1,-1)),r=r.replace(/!= ''(?! =)/g,"IS NOT EMPTY").replace(/= ''/g,"IS EMPTY")},e.prototype.convertNamedParamSqlToSql=function(e){var t=e.sql,l=e.params,n=t;return Object.keys(l).forEach(function(e){var t=l[e];e=":"+e,n=n.replace(e,"string"==typeof t?"'"+t+"'":String(t))}),n.length>=2&&"("===n[0]&&")"===n[n.length-1]&&(n=n.slice(1,-1)),n=n.replace(/!= ''(?! =)/g,"IS NOT EMPTY").replace(/= ''/g,"IS EMPTY")},e.prototype.getParameterSql=function(e){var l=(0,t.extend)({},e,null,!0),n=this.updateRuleValue(l,!1);return this.getParameterSQLVal(this.parent.getSqlFromRules(l),n.ruleVal)},e.prototype.getNamedParameterSql=function(e){var l=(0,t.extend)({},e,null,!0),n=this.updateRuleValue(l,!0);return this.getNamedParameterSQLVal(this.parent.getSqlFromRules(l),n.namedRuleVal)},e.prototype.getParameterSQLVal=function(e,t){return{sql:"("+e.replace(/[%']/g,"")+")",params:t}},e.prototype.getNamedParameterSQLVal=function(e,t){return{sql:"("+e.replace(/[%']/g,"")+")",params:t}},e.prototype.updateRuleValue=function(e,t){return this.updateValue(e.rules,t,[],{},[])},e.prototype.updateValue=function(e,l,n,r,i){if((0,t.isNullOrUndefined)(e))return{ruleVal:n,namedRuleVal:r};for(var o=0;o<e.length;o++)if(e[o].rules){n=(u=this.updateValue(e[o].rules,l,n,r,i)).ruleVal,r=u.namedRuleVal}else{var s=void 0;if(e[o].value instanceof Array)for(var a=0;a<e[o].value.length;a++)l&&(s=this.getNamedParameter(e[o].field,i)),(0,t.isNullOrUndefined)(e[o].value[a])||("string"===e[o].type||e[o].type,l?r[s]=e[o].value[a]:n.push(e[o].value[a])),e[o].value[a]=l?":"+s:"?";else if(l&&(s=this.getNamedParameter(e[o].field,i)),e[o].operator.indexOf("null")<1&&("string"!==e[o].type||"string"===e[o].type&&(""!==e[o].value||0===e[o].value))){if("string"===e[o].type||"date"===e[o].type)if(e[o].operator.indexOf("empty")<1){var u=e[o].value.toString();switch(e[o].operator){case"startswith":case"notstartswith":u+="%";break;case"endswith":case"notendswith":u="%"+u;break;case"contains":case"notcontains":u="%"+u+"%"}l?r[s]=u:n.push(u)}else l?r[s]="":n.push(""),"isempty"===e[o].operator?e[o].operator="equal":e[o].operator="notequal";else(0,t.isNullOrUndefined)(e[o].value)||(l?r[s]=e[o].value:n.push(e[o].value));e[o].value=l?":"+s:"?"}}return{ruleVal:n,namedRuleVal:r}},e.prototype.getNamedParameter=function(e,t){var l=null;if(t.length>0)for(var n=t.length-1;n>=0;n--){var r=t[n];if(r.indexOf(e)>-1){l=e+"_"+(parseInt(r.split("_")[1],10)+1),t.push(l);break}}return l||(l=e+"_1",t.push(l)),l},e.prototype.getModuleName=function(){return"query-library"},e}()})(),c})());
|
|
10
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("SyncfusionBase"),require("SyncfusionButtons"),require("SyncfusionDropdowns"),require("SyncfusionData"),require("SyncfusionInputs"),require("SyncfusionCalendars"),require("SyncfusionSplitbuttons"),require("SyncfusionPopups")):"function"==typeof define&&define.amd?define(["SyncfusionBase","SyncfusionButtons","SyncfusionDropdowns","SyncfusionData","SyncfusionInputs","SyncfusionCalendars","SyncfusionSplitbuttons","SyncfusionPopups"],t):"object"==typeof exports?exports.SyncfusionQuerybuilder=t(require("SyncfusionBase"),require("SyncfusionButtons"),require("SyncfusionDropdowns"),require("SyncfusionData"),require("SyncfusionInputs"),require("SyncfusionCalendars"),require("SyncfusionSplitbuttons"),require("SyncfusionPopups")):e.SyncfusionQuerybuilder=t(e.SyncfusionBase,e.SyncfusionButtons,e.SyncfusionDropdowns,e.SyncfusionData,e.SyncfusionInputs,e.SyncfusionCalendars,e.SyncfusionSplitbuttons,e.SyncfusionPopups)}(self,(e,t,l,n,r,i,o,s)=>(()=>{"use strict";var a={766:t=>{t.exports=e},741:e=>{e.exports=t},570:e=>{e.exports=i},74:e=>{e.exports=n},778:e=>{e.exports=l},323:e=>{e.exports=r},197:e=>{e.exports=s},295:e=>{e.exports=o}},u={};function d(e){var t=u[e];if(void 0!==t)return t.exports;var l=u[e]={exports:{}};return a[e](l,l.exports,d),l.exports}d.d=(e,t)=>{for(var l in t)d.o(t,l)&&!d.o(e,l)&&Object.defineProperty(e,l,{enumerable:!0,get:t[l]})},d.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),d.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var c={};return(()=>{d.r(c),d.d(c,{Columns:()=>m,QueryBuilder:()=>y,QueryLibrary:()=>b,Rule:()=>g,ShowButtons:()=>v,Value:()=>f});var e,t=d(766),l=d(741),n=d(778),r=d(74),i=d(323),o=d(570),s=d(295),a=d(197),u=(e=function(t,l){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var l in t)t.hasOwnProperty(l)&&(e[l]=t[l])},e(t,l)},function(t,l){function n(){this.constructor=t}e(t,l),t.prototype=null===l?Object.create(l):(n.prototype=l.prototype,new n)}),p=function(){return p=Object.assign||function(e){for(var t,l=1,n=arguments.length;l<n;l++)for(var r in t=arguments[l])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},p.apply(this,arguments)},h=function(e,t,l,n){var r,i=arguments.length,o=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,l):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,l,n);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(o=(i<3?r(o):i>3?r(t,l,o):r(t,l))||o);return i>3&&o&&Object.defineProperty(t,l,o),o},m=function(e){function l(){return null!==e&&e.apply(this,arguments)||this}return u(l,e),h([(0,t.Property)(null)],l.prototype,"field",void 0),h([(0,t.Property)(null)],l.prototype,"label",void 0),h([(0,t.Property)(null)],l.prototype,"type",void 0),h([(0,t.Property)(null)],l.prototype,"values",void 0),h([(0,t.Property)(null)],l.prototype,"operators",void 0),h([(0,t.Property)()],l.prototype,"ruleTemplate",void 0),h([(0,t.Property)(null)],l.prototype,"template",void 0),h([(0,t.Property)({isRequired:!0,min:0,max:Number.MAX_VALUE})],l.prototype,"validation",void 0),h([(0,t.Property)(null)],l.prototype,"format",void 0),h([(0,t.Property)(null)],l.prototype,"step",void 0),h([(0,t.Property)(null)],l.prototype,"value",void 0),h([(0,t.Property)(null)],l.prototype,"category",void 0),h([(0,t.Property)(null)],l.prototype,"columns",void 0),l}(t.ChildProperty),g=function(e){function l(){return null!==e&&e.apply(this,arguments)||this}return u(l,e),h([(0,t.Property)(null)],l.prototype,"condition",void 0),h([(0,t.Collection)([],l)],l.prototype,"rules",void 0),h([(0,t.Property)(null)],l.prototype,"field",void 0),h([(0,t.Property)(null)],l.prototype,"label",void 0),h([(0,t.Property)(null)],l.prototype,"type",void 0),h([(0,t.Property)(null)],l.prototype,"operator",void 0),h([(0,t.Property)(null)],l.prototype,"value",void 0),h([(0,t.Property)(!1)],l.prototype,"not",void 0),h([(0,t.Property)(null)],l.prototype,"isLocked",void 0),l}(t.ChildProperty),f=function(e){function l(){return null!==e&&e.apply(this,arguments)||this}return u(l,e),h([(0,t.Property)(null)],l.prototype,"numericTextBoxModel",void 0),h([(0,t.Property)(null)],l.prototype,"multiSelectModel",void 0),h([(0,t.Property)(null)],l.prototype,"datePickerModel",void 0),h([(0,t.Property)(null)],l.prototype,"textBoxModel",void 0),h([(0,t.Property)(null)],l.prototype,"radioButtonModel",void 0),l}(t.ChildProperty),v=function(e){function l(){return null!==e&&e.apply(this,arguments)||this}return u(l,e),h([(0,t.Property)(!1)],l.prototype,"cloneRule",void 0),h([(0,t.Property)(!1)],l.prototype,"cloneGroup",void 0),h([(0,t.Property)(!1)],l.prototype,"lockRule",void 0),h([(0,t.Property)(!1)],l.prototype,"lockGroup",void 0),h([(0,t.Property)(!0)],l.prototype,"ruleDelete",void 0),h([(0,t.Property)(!0)],l.prototype,"groupInsert",void 0),h([(0,t.Property)(!0)],l.prototype,"groupDelete",void 0),l}(t.ChildProperty),y=function(e){function d(t,l){var r=e.call(this,t,l)||this;return r.isReadonly=!0,r.fields={text:"label",value:"field"},r.updatedRule={not:!1,condition:"and",isLocked:!1},r.isLocale=!1,r.isRefreshed=!1,r.isNotified=!1,r.isAddSuccess=!1,r.isNotValueChange=!1,r.isFieldChange=!1,r.isFieldClose=!1,r.isDestroy=!1,r.isGetNestedData=!1,r.isCustomOprCols=[],r.groupCounter=0,r.lockItems=[],r.groupIndex=-1,r.ruleIndex=-1,r.isLastGroup=!1,r.cloneGrpBtnClick=!1,r.isMiddleGroup=!1,r.cloneRuleBtnClick=!1,r.isValueEmpty=!1,r.isPropChange=!1,r.isRuleClicked=!1,n.MultiSelect.Inject(n.CheckBoxSelection),r}return u(d,e),d.prototype.getPersistData=function(){return this.addOnPersist(["rule"])},d.prototype.reset=function(){this.isImportRules=!1;var e=this.element.querySelector(".e-group-body"),l=this.element.querySelectorAll("input.e-control"),n=0,r=function(){for(var e=Math.min(n+20,l.length),i=n;i<e;i++){var o=l[i];try{if(o.className.indexOf("e-tooltip")>-1)(s=(0,t.getComponent)(o,"tooltip"))&&s.destroy();else if(o.parentElement&&o.parentElement.className.indexOf("e-tooltip")>-1){var s;(s=(0,t.getComponent)(o.parentElement,"tooltip"))&&s.destroy()}}catch(e){console.warn("Error destroying tooltip:",e)}}(n=e)<l.length&&requestAnimationFrame(r)};if(l.length>0&&r(),e)e.textContent="";else{var i=document.createDocumentFragment(),o=this.createElement("div",{attrs:{class:"e-group-container"}}),s=this.createElement("div",{attrs:{class:"e-group-header"}}),a=this.createElement("div",{attrs:{class:"e-group-body"}});o.appendChild(s),o.appendChild(a),i.appendChild(o),this.element.appendChild(i),e=this.element.querySelector(".e-group-body")}if(this.headerTemplate&&this.isRoot&&(this.element.textContent="",this.isRoot=!1),this.enableNotCondition)for(var u=this.element.querySelectorAll(".e-qb-toggle"),d=0;d<u.length;d++)(0,t.removeClass)([u[d]],"e-active-toggle");e&&e.appendChild(this.createElement("div",{attrs:{class:"e-rule-list"}})),this.levelColl[this.element.id+"_group0"]=[0],this.setProperties({rule:{condition:"and",not:!1,rules:[]}},!0),e&&e.parentElement&&this.disableRuleCondition(e.parentElement)},d.prototype.getWrapper=function(){return this.element},d.prototype.getModuleName=function(){return"query-builder"},d.prototype.requiredModules=function(){var e=[];return e.push({member:"query-library",args:[this]}),e},d.prototype.GetRootColumnName=function(e){return(0,t.isNullOrUndefined)(e)?"":this.separator?e.split(this.separator)[0]:e},d.prototype.initialize=function(){var e=this;if(this.dataColl.length){var t,l,n=Object.keys(this.dataColl[0]),r=[],i=[],o=!1,s=!1,a={isRequired:!0,min:0,max:Number.MAX_VALUE};if(this.columns.length){this.columnSort(),this.columns.forEach(function(r){e.updateCustomOperator(r,"initial"),r.type||(n.indexOf(r.field)>-1&&(l=e.dataColl[0][r.field],"string"===(t=typeof l)?s=!isNaN(Date.parse(l)):"object"===t&&(s=l instanceof Date&&!isNaN(l.getTime()),t="string"),r.type=t,s=!1),t="string"),r.validation||(r.validation=a),r.category?o=!0:r.category=e.l10n.getConstant("OtherFields"),i.indexOf(r.category)<0&&i.push(r.category),(!r.operators||e.isLocale&&-1===e.isCustomOprCols.indexOf(r.field))&&(r.operators=e.customOperators[r.type+"Operator"])}),o&&(i.length>1||i[0]!==this.l10n.getConstant("OtherFields"))&&(this.fields={text:"label",value:"field",groupBy:"category"}),this.updateSubFieldsFromColumns(this.columns)}else{for(var u=0,d=n.length;u<d;u++)l=this.dataColl[0][n[u]],"string"===(t=typeof l)?s=!isNaN(Date.parse(l)):"object"!==t||Object.keys(l).length||(s=l instanceof Date&&!isNaN(l.getTime()),t="string"),r[u]={field:n[u],label:n[u],type:s?"date":t,validation:a},s=!1,r[u].operators=this.customOperators[r[u].type+"Operator"],"object"===t&&this.updateSubFields(l,r[u]);this.columns=r}}else this.columns&&this.columns.length&&("Default"!==this.sortDirection&&this.columnSort(),this.processColumnsInBatches(),this.columns.length>50?setTimeout(function(){e.updateSubFieldsFromColumns(e.columns)},0):this.updateSubFieldsFromColumns(this.columns));this.trigger("dataBound",{type:"dataBound"})},d.prototype.processColumnsInBatches=function(){var e=this,t=this.columns,l=0,n=function(){for(var r=Math.min(l+10,t.length),i=l;i<r;i++)t[i].category&&t[i].category!==e.l10n.getConstant("OtherFields")?e.fields={text:"label",value:"field",groupBy:"category"}:t[i].category=e.l10n.getConstant("OtherFields"),e.updateCustomOperator(t[i],"initial"),(!t[i].operators||e.isLocale&&-1===e.isCustomOprCols.indexOf(t[i].field))&&(t[i].operators=e.customOperators[t[i].type+"Operator"]);(l=r)<t.length&&requestAnimationFrame(n)};n()},d.prototype.updateSubFieldsFromColumns=function(e,t){if(e.length>50)this.updateSubFieldsLarge(e,t);else for(var l=0;l<e.length;l++)""!==this.separator&&e[l].field.indexOf(this.separator)<0&&(e[l].field=t?t+this.separator+e[l].field:e[l].field),e[l].operators?this.updateCustomOperator(e[l]):e[l].type&&"object"!==e[l].type&&(e[l].operators=this.customOperators[e[l].type+"Operator"]),e[l].columns&&(e[l].type="object",this.updateSubFieldsFromColumns(e[l].columns,e[l].field))},d.prototype.updateSubFieldsLarge=function(e,t){var l=this,n=0,r=e.length,i=function(){for(var o=Math.min(n+10,r);n<o;n++)""!==l.separator&&e[n].field.indexOf(l.separator)<0&&(e[n].field=t?t+l.separator+e[n].field:e[n].field),e[n].operators?l.updateCustomOperator(e[n]):e[n].type&&"object"!==e[n].type&&(e[n].operators=l.customOperators[e[n].type+"Operator"]);n<r?requestAnimationFrame(i):setTimeout(function(){for(var t=0;t<r;t++)e[t].columns&&(e[t].type="object",l.updateSubFieldsFromColumns(e[t].columns,e[t].field))},0)};i()},d.prototype.updateSubFields=function(e,t,l){var n;t.columns=[];var r,i,o=Object.keys(e);l=l||this.dataColl[0];for(var s=0,a=o.length;s<a;s++){var u=t.field.split(".");i=l?l[u[u.length-1]][o[s]]:this.dataColl[0][t.field][o[s]];var d=l[t.field.split(this.separator)[t.field.split(this.separator).length-1]];r=typeof i,n={field:t.field+this.separator+o[s],label:o[s],type:r="object"!==r||isNaN(Date.parse(i))?r:"date"},"object"!==r&&(n.operators=this.customOperators[r+"Operator"]),t.columns.push(n),"object"===r&&this.updateSubFields(i,n,d)}},d.prototype.updateCustomOperator=function(e,l){if(e.operators){this.isLocale||"initial"!==l||(0,t.isNullOrUndefined)(this.isCustomOprCols)||this.isCustomOprCols.push(e.field);for(var n=function(t){var l=Object.keys(e.operators[t]).indexOf("sqlOperator");if(l>-1){var n=e.operators[t],i=Object.keys(n),o=i.map(function(e){return n[""+e]}).join(",").split(","),s=i.indexOf("value");r.operators[o[s]]=o[l]}},r=this,i=0;i<e.operators.length;i++)n(i)}},d.prototype.focusEventHandler=function(e){this.target=e.target},d.prototype.clickEventHandler=function(e){var l,n,r=this,i=e.target;if(this.isImportRules=!1,"SPAN"===i.tagName&&(i=i.parentElement),"string"==typeof i.className&&i.className.indexOf("e-collapse-rule")>-1){var o=new t.Animation({duration:1e3,delay:0});this.element.querySelectorAll(".e-summary-content").length<1&&this.renderSummary();var s=document.getElementById(this.element.id+"_summary_content"),a=s.querySelector(".e-summary-text");o.animate(".e-query-builder",{name:"SlideLeftIn"}),(d=this.element.querySelector(".e-group-container")).style.display="none",a.textContent=this.getSqlFromRules(this.rule),s.style.display="block",a.style.height=a.scrollHeight+"px"}if("BUTTON"===i.tagName&&"string"==typeof i.className&&i.className.indexOf("e-qb-toggle")<0){o=new t.Animation({duration:1e3,delay:0});switch(!0){case i.className.indexOf("e-removerule")>-1:this.actionButton=i,this.deleteRule(i);break;case i.className.indexOf("e-clone-rule-btn")>-1:this.actionButton=i,this.cloneRuleBtnClick=!0,this.isRuleClicked=!0,this.ruleClone(i);break;case i.className.indexOf("e-lock-rule-btn")>-1:this.actionButton=i,this.ruleLock(i);break;case i.className.indexOf("e-lock-grp-btn")>-1:this.actionButton=i,this.groupLock(i);break;case i.className.indexOf("e-clone-grp-btn")>-1:this.actionButton=i,this.cloneGrpBtnClick=!0,this.isRuleClicked=!0,this.groupClone((0,t.closest)(i,".e-group-container"));break;case i.className.indexOf("e-deletegroup")>-1:this.actionButton=i,this.deleteGroup((0,t.closest)(i,".e-group-container"));break;case i.className.indexOf("e-edit-rule")>-1:if(o.animate(".e-query-builder",{name:"SlideLeftIn"}),document.getElementById(this.element.id+"_summary_content").style.display="none",this.element.querySelectorAll(".e-group-container").length<1){this.addGroupElement(!1,this.element,this.rule.condition,!1,this.rule.not);var u=(0,t.extend)({},this.rule,{},!0);this.setGroupRules(u),this.renderSummaryCollapse()}else{var d;(d=this.element.querySelector(".e-group-container")).querySelectorAll(".e-collapse-rule").length<1&&this.renderSummaryCollapse(),d.style.display="block"}}}else if("LABEL"===i.tagName&&i.parentElement.className.indexOf("e-btn-group")>-1||"string"==typeof i.className&&i.className.indexOf("e-qb-toggle")>-1){var c=(0,t.closest)(i,".e-group-container");if(!this.headerTemplate){var p=i.getAttribute("for"),h=void 0;p?h=document.getElementById(p).getAttribute("value"):this.enableSeparateConnector&&(h=i.classList.contains("e-btngroup-or-lbl")?"or":i.classList.contains("e-btngroup-and-lbl")?"and":i.textContent),n=c.id.replace(this.element.id+"_","");var m=this.getGroup(n),g=void 0;if(this.enableNotCondition)if(i.className.indexOf("e-qb-toggle")>-1){var f=c.getElementsByClassName("e-qb-toggle")[0];f.className.indexOf("e-active-toggle")>-1?((0,t.removeClass)([f],"e-active-toggle"),g=!1):((0,t.addClass)([f],"e-active-toggle"),g=!0),h=m.condition}else g=m.not;l={groupID:n,cancel:!1,type:"condition",value:h.toLowerCase()},this.enableNotCondition&&(l={groupID:n,cancel:!1,type:"condition",value:h.toLowerCase(),not:g})}this.isImportRules?this.beforeSuccessCallBack(l,i):this.trigger("beforeChange",l,function(e){r.beforeSuccessCallBack(e,i)}),this.target=i}},d.prototype.beforeSuccessCallBack=function(e,l){if(e&&!e.cancel){var n=(0,t.closest)(l,".e-group-container"),r=n.id.replace(this.element.id+"_",""),i=this.getValidRules(this.rule),o=this.getParentGroup(n);if(this.enableSeparateConnector){var s=(n=(0,t.isNullOrUndefined)((0,t.closest)(l,".e-rule-container"))&&n.classList.contains("e-group-container")?null!==l.parentElement.previousElementSibling?l.parentElement.previousElementSibling:n:(0,t.closest)(l,".e-rule-container")).id.replace(this.element.id+"_","");n.classList.contains("e-rule-container")?(o=this.getRule(n)).condition=e.value:n.classList.contains("e-group-container")&&((o=this.getGroup(n)).condition=e.value),this.enableNotCondition&&(o.not=e.not),this.isImportRules||this.trigger("change",{groupID:r,ruleID:s,type:"condition",value:o.condition})}else o.condition=e.value,this.enableNotCondition&&(o.not=e.not),this.isImportRules||this.trigger("change",{groupID:r,type:"condition",value:o.condition});if(this.filterRules(i,this.getValidRules(this.rule),"condition"),this.enableSeparateConnector){var a=l.parentElement.querySelector(".e-btngroup-and"),u=l.parentElement.querySelector(".e-btngroup-or");a&&u&&("and"===e.value?(a.checked=!0,u.checked=!1):"or"===e.value&&(u.checked=!0,a.checked=!1))}}},d.prototype.selectBtn=function(e,l){"beforeOpen"===l.name?this.showButtons.groupInsert||(0,t.isNullOrUndefined)(this.showButtons.groupInsert)?(this.element.querySelectorAll(".e-group-container").length>=this.maxGroupCount+1?(0,t.addClass)([l.element.querySelector("li span.e-addgroup").parentElement],"e-button-hide"):(0,t.removeClass)([l.element.querySelector("li span.e-addgroup").parentElement],"e-button-hide"),this.enableRtl&&(0,t.addClass)([l.element.querySelector("li").parentElement],"e-rtl")):(0,t.addClass)([l.element.querySelector("li span.e-addgroup").parentElement],"e-button-hide"):l.element.children[0].className.indexOf("e-addrule")>-1?(this.isRuleClicked=!0,this.addRuleElement((0,t.closest)(e,".e-group-container"),{})):l.element.children[0].className.indexOf("e-addgroup")>-1&&(this.isRuleClicked=!0,this.addGroupElement(!0,(0,t.closest)(e,".e-group-container"),"",!0))},d.prototype.appendRuleElem=function(e,l,n,r,i,o){var s,a,u,d=e&&e.querySelector(".e-rule-list");if("change"===n)s=(0,t.select)("#"+r,e);else{if((s=this.createElement("div",{attrs:{class:"e-rule-container"}})).setAttribute("id",e.id+"_rule"+this.ruleIdCounter),this.showButtons.cloneRule&&this.cloneRuleBtnClick){if(this.ruleIndex<0)d.appendChild(s);else if(this.enableSeparateConnector){for(var c=-1,p=this.ruleIndex+1,h=0;h<p&&h!==d.children.length;h++)d.children[h].classList.contains("e-rule-container")&&(p++,c++);d.insertBefore(s,d.children[this.ruleIndex+c+1])}else d.insertBefore(s,d.children[this.ruleIndex+1]);this.cloneRuleBtnClick=!1}else d.appendChild(s);this.ruleIdCounter++}if(l&&l.ruleTemplate&&o){u={requestType:"template-initialize",ruleID:s.id,action:i,fields:this.fields,rule:o},this.trigger("actionBegin",u),this.ruleTemplateFn=this.templateParser(l.ruleTemplate);var m=this.element.id+l.field;if(u.fields=this.fields,u.columns=this.columns,""===o.field&&(o.field=l.field),u.operators=this.getOperators(o.field),u.operatorFields={text:"key",value:"value"},this.isReact)(a=this.ruleTemplateFn(u,this,s.id,m)[0]).className+=" e-rule-field",s.appendChild(a);else if(this.isAngular){var g=this.ruleTemplateFn(u,this,s.id,m);(a=3===g[0].nodeType?g[1]:g[0]).className+=" e-rule-field",s.appendChild(a)}else this.isVue3?(a=this.ruleTemplateFn(u,this,"Template",m),(0,t.append)(a,s),s.children.length&&(s.children[s.children.length-1].className+=" e-rule-field")):((a=this.ruleTemplateFn(u,this,"Template",m)[0]).className+=" e-rule-field",s.appendChild(a))}else a=this.ruleElem.querySelector(".e-rule-field").cloneNode(!0),s.appendChild(a);return this.showButtons.lockGroup&&(0,t.removeClass)(s.querySelectorAll(".e-lock-grp-btn"),"e-button-hide"),this.showButtons.lockRule&&(0,t.removeClass)(s.querySelectorAll(".e-lock-rule-btn"),"e-button-hide"),this.showButtons.cloneGroup&&(0,t.removeClass)(s.querySelectorAll(".e-clone-grp-btn"),"e-button-hide"),this.showButtons.cloneRule&&(0,t.removeClass)(s.querySelectorAll(".e-clone-rule-btn"),"e-button-hide"),this.showButtons.ruleDelete&&(0,t.removeClass)(s.querySelectorAll(".e-lock-grp-btn"),"e-button-hide"),this.allowDragAndDrop&&(0,t.removeClass)(s.querySelectorAll(".e-drag-qb-rule"),"e-hidden"),l&&l.ruleTemplate&&o&&this.renderReactTemplates(),s},d.prototype.addRuleElement=function(e,t,l,n,r,i){var o=this;if(e){var s={groupID:e.id.replace(this.element.id+"_",""),cancel:!1,type:"insertRule"};this.isImportRules||this.isInitialLoad||this.prvtEvtTgrDaD?(this.isInitialLoad=!1,this.addRuleSuccessCallBack(s,e,t,l,n,r,i)):this.trigger("beforeChange",s,function(s){o.addRuleSuccessCallBack(s,e,t,l,n,r,i)})}},d.prototype.addRuleSuccessCallBack=function(e,l,n,r,i,o,s){var a,u,d,c=this,p=this.element.className.indexOf("e-device")>-1||"Vertical"===this.displayMode,h=p?"250px":"200px",m=n&&n.field?this.getColumn(n.field):r||this.columns[0],g={label:"",field:"",type:"",operator:""};if(!e.cancel){if(m&&m.ruleTemplate&&n.field){this.selectedColumn=m,u=this.selectedColumn.operators,g={label:m.label,field:m.field,type:m.type,operator:u[0].value};var f=Object.keys(n).length?n:g,v={requestType:"template-initialize",ruleID:(d=this.appendRuleElem(l,m,i,o,"field",f)).id,action:"insert-rule",fields:this.fields,rule:f};this.trigger("actionBegin",v),setTimeout(function(){var e={requestType:"template-create",ruleID:d.id,action:"insert-rule",fields:c.fields,rule:f};c.trigger("actionBegin",e)},0)}else{(d=this.appendRuleElem(l,m,i,o,"field")).querySelector(".e-filter-input").setAttribute("id",d.id+"_filterkey");var y=d.querySelector(".e-rule-delete");if(this.element.className.indexOf("e-device")>-1||"Vertical"===this.displayMode)y.textContent=this.l10n.getConstant("Remove"),(0,t.addClass)([y],"e-flat"),(0,t.addClass)([y],"e-primary");else{(0,t.addClass)([y],"e-round"),(0,t.addClass)([y],"e-icon-btn"),y.setAttribute("title",this.l10n.getConstant("DeleteRule"));var b=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-delete-icon"}});y.appendChild(b)}this.showButtons.ruleDelete||y.classList.add("e-button-hide")}d.className="e-rule-container "+(p?"e-vertical-mode":"e-horizontal-mode");var C=d.previousElementSibling;this.processAdjacentElements(d,C,n),this.isImportRules||this.updateAddedRule(l,n,g,s,o,!!this.enableSeparateConnector||null),""===this.rule.condition&&(this.isRuleClicked||this.rule.rules.length>1)&&(this.rule.condition="and"),this.isRuleClicked=!1;var S=this.rule.rules.length;if(m&&(!m||m.ruleTemplate)&&n.field||(S>20?setTimeout(function(){c.applyFieldComponent(d,n,h)},0):this.applyFieldComponent(d,n,h)),a=d.id.replace(this.element.id+"_",""),n&&n.isLocked){var x=d.querySelector(".e-lock-rule-btn");this.ruleLock(x)}this.isImportRules||this.prvtEvtTgrDaD||this.trigger("change",{groupID:l.id.replace(this.element.id+"_",""),ruleID:a,type:"insertRule"})}this.enableSeparateConnector&&(0,t.isNullOrUndefined)(n.condition)&&a&&(n=this.getRule(a)),this.enableSeparateConnector&&this.processConnectorElements(d)},d.prototype.processAdjacentElements=function(e,l,n){if(this.enableSeparateConnector){if(l&&l.classList.contains("e-group-container")){var r=l.querySelectorAll(".e-rule-container");l=r[r.length-1]}if(l&&l.classList.contains("e-rule-container")){var i=this.getRule(l);this.headerTemplate&&this.headerTemplateFn(l,!1,i.condition,i,l.id)}else(0,t.isNullOrUndefined)(l)&&e.id!==this.element.id+"_group0_rule0"&&this.handleOrphanedRuleElement(e,n)}else l&&l.className.indexOf("e-rule-container")>-1&&(e.classList.add("e-joined-rule"),l.classList.add("e-prev-joined-rule"));l&&l.className.indexOf("e-group-container")>-1&&e.className.indexOf("e-separate-rule")<0&&(e.className+=" e-separate-rule")},d.prototype.handleOrphanedRuleElement=function(e,t){var l=e.closest(".e-group-container");if(l&&l.previousElementSibling){var n=l.previousElementSibling,r=n.querySelectorAll(".e-rule-container");if(n.classList.contains("e-group-container")&&(n=r[r.length-1]),n.classList.contains("e-rule-container")){var i=this.getRule(n);this.headerTemplateFn(n,!1,i.condition,i,n.id,!0)}}else this.headerTemplateFn(e,!1,t.condition,t,e.id,!0)},d.prototype.processConnectorElements=function(e){for(var l,n=e.previousElementSibling;n&&!n.classList.contains("e-rule-container");){if(n.classList.contains("e-group-container")){l=n.querySelectorAll(".e-rule-container"),n=l[l.length-1];break}n=n.previousElementSibling}if(this.headerTemplate&&n){var r=this.getRule(n),i={requestType:"rule-template-create",ruleID:n.id,condition:r.condition,notCondition:!!this.enableNotCondition||void 0};this.trigger("actionBegin",i)}else(0,t.isNullOrUndefined)(n)&&e.id!==this.element.id+"_group0_rule0"&&this.handleOrphanedConnectorElement(e);this.setMultiConnector(e)},d.prototype.handleOrphanedConnectorElement=function(e){var t=e.closest(".e-group-container");if(t&&t.previousElementSibling&&t.previousElementSibling.previousElementSibling){var l=t.previousElementSibling.previousElementSibling;if(l.classList.contains("e-group-container")){var n=l.querySelectorAll(".e-rule-container");l=n[n.length-1]}if(l.classList.contains("e-rule-container")){var r=this.getRule(l),i={requestType:"rule-template-create",ruleID:l.id,condition:r.condition,notCondition:!!this.enableNotCondition||void 0};this.trigger("actionBegin",i)}}},d.prototype.applyFieldComponent=function(e,t,l){"Default"===this.fieldMode?this.applyDropdownListComponent(e,t,l):this.applyDropdownTreeComponent(e,t,l)},d.prototype.applyDropdownListComponent=function(e,t,l){var r,i;i=this.separator&&t.field||this.autoSelectField||this.isImportRules?this.GetRootColumnName(t.field):t.field,r={dataSource:this.columns,fields:this.fields,placeholder:this.l10n.getConstant("SelectField"),popupHeight:this.columns.length>5?l:"auto",close:this.fieldClose.bind(this,e.id+"_filterkey"),change:this.changeField.bind(this),value:t?i:null,open:this.popupOpen.bind(this,!0),cssClass:"qb-dropdownlist"},this.fieldModel&&(r=p({},r,this.fieldModel));var o,s=new n.DropDownList(r);s.appendTo("#"+e.id+"_filterkey"),o=this.separator&&t.field||this.isImportRules?this.GetRootColumnName(t.field):s.value,this.selectedColumn=s.getDataByValue(o),Object.keys(t).length&&this.changeRule(t,{element:s.element,itemData:this.selectedColumn})},d.prototype.applyDropdownTreeComponent=function(e,l,r){var i,o=(this.isImportRules,l.field);this.dummyDropdownTreeDs=(0,t.extend)([],this.columns,[],!0),this.updateDropdowntreeDS(this.dummyDropdownTreeDs),i={fields:{dataSource:this.dummyDropdownTreeDs,value:"field",text:"label",child:"columns",expanded:"expanded",selectable:"selectable"},placeholder:this.l10n.getConstant("SelectField"),showClearButton:!1,popupHeight:this.columns.length>5?r:"auto",changeOnBlur:!1,change:this.changeField.bind(this),value:(0,t.isNullOrUndefined)(o)?null:[o],open:this.popupOpen.bind(this,!1),treeSettings:{expandOn:"Click"},cssClass:"e-qb-ddt",filtering:this.dropdownTreeFiltering.bind(this),close:this.dropdownTreeClose.bind(this)},this.fieldModel&&(i=p({},i,this.fieldModel));var s=new n.DropDownTree(i);if(s.appendTo("#"+e.id+"_filterkey"),!(0,t.isNullOrUndefined)(s.value)){var a=this.getLabelFromColumn(s.value[0]);s.element.value=a}var u=(0,t.isNullOrUndefined)(l.field)?s.value:this.GetRootColumnName(l.field);this.selectedColumn=this.getColumn(u),Object.keys(l).length&&this.changeRule(l,{element:s.element,itemData:this.selectedColumn})},d.prototype.dropdownTreeFiltering=function(e){var l,n=this,r=this,i=e.event.srcElement;l=(i.classList.contains("e-clear-icon")?i.parentElement.querySelector(".e-textbox"):i).id.split("_filterkey")[0];var o=document.getElementById(l);this.ddTree=(0,t.getComponent)(o.querySelector("input.e-dropdowntree"),"dropdowntree");var s=(0,t.extend)([],this.columns,[],!0);if(e.cancel=!0,""===e.text)this.changeDataSource(s);else{var a=s.map(function(t){return n.nestedChildFilter(e.text,t)}).filter(function(e){return null!==e});this.changeDataSource(a),setTimeout(function(){(0,t.isNullOrUndefined)(r.ddTree)||(0,t.isNullOrUndefined)(r.ddTree.treeObj)||r.ddTree.treeObj.expandAll()},100)}},d.prototype.changeDataSource=function(e){this.updateDropdowntreeDS(e),this.ddTree.treeObj.fields={dataSource:e,value:"field",text:"label",child:"columns",expanded:"expanded"},this.ddTree.treeObj.refresh()},d.prototype.nestedChildFilter=function(e,t){var l=this,n=t[this.ddTree.fields.child];if(!n)return this.isMatchedNode(e,t)?t:null;var r=n.map(function(t){return l.nestedChildFilter(e,t)}).filter(function(e){return null!==e});return r.length?(t[this.ddTree.fields.child]=r,t):(t[this.ddTree.fields.child]=n,this.isMatchedNode(e,t)?t:null)},d.prototype.isMatchedNode=function(e,t){var l=t[this.ddTree.fields.text].toLowerCase();return e=e?e.toLowerCase():"",-1!==l.indexOf(e)},d.prototype.dropdownTreeClose=function(){this.ddTree&&this.changeDataSource((0,t.extend)([],this.columns,[],!0)),this.ddTree=null},d.prototype.updateDropdowntreeDS=function(e){for(var t=0;t<e.length;t++)"object"===e[parseInt(t.toString(),10)].type?(this.isAngular&&e[parseInt(t.toString(),10)].template&&delete e[parseInt(t.toString(),10)].template,e[parseInt(t.toString(),10)].selectable=!1,this.updateDropdowntreeDS(e[parseInt(t.toString(),10)].columns)):this.isAngular&&e[parseInt(t.toString(),10)].template&&delete e[parseInt(t.toString(),10)].template},d.prototype.updateAddedRule=function(e,l,n,r,i,o){var s,a,u,d=0;if(r){for(s=(0,t.select)("#"+i,e),a=(0,t.closest)(e,".e-group-container"),u=this.getParentGroup(a);s&&null!==s.previousElementSibling;){s=s.previousElementSibling;var c=this.enableSeparateConnector&&(!this.headerTemplate&&!s.classList.contains("e-btn-group")||this.headerTemplate&&(s.classList.contains("e-rule-container")||s.classList.contains("e-group-container")));this.enableSeparateConnector&&!c||d++}u.rules[d]=l}else{a=(0,t.closest)(e,".e-group-container"),u=this.getParentGroup(a);var p=l.custom;Object.keys(l).length?this.ruleIndex<0?(u.rules.push({field:l.field,type:l.type,label:l.label,operator:l.operator,value:l.value}),p&&(u.rules[u.rules.length-1].custom=p),this.enableSeparateConnector&&(u.rules[u.rules.length-1].condition=l.condition?l.condition:n.condition)):(u.rules.splice(this.ruleIndex+1,0,{field:l.field,type:l.type,label:l.label,operator:l.operator,value:l.value}),p&&(u.rules[this.ruleIndex+1].custom=p),this.enableSeparateConnector&&(u.rules[this.ruleIndex+1].condition=l.condition?l.condition:n.condition)):(p&&(n.custom=p),this.autoSelectField&&(l.field=n.field=this.rule.rules[0].field),u.rules.push(n))}this.disableRuleCondition(e,u,o)},d.prototype.changeRuleTemplate=function(e,l){if(!e||!e.ruleTemplate){var n=(0,t.closest)(l,".e-group-container"),r=(0,t.closest)(l,".e-rule-container").id;if(this.previousColumn&&this.previousColumn.ruleTemplate&&((0,t.detach)(l.closest('[id="'+r+'"]').querySelector(".e-rule-field")),this.clearQBTemplate([r])),e){var i=this.selectedColumn.operators,o={field:e.field,label:e.label,operator:i[0].value,value:""};this.addRuleElement(n,o,e,"change",r,!0)}else{o={field:"",label:"",operator:"",value:""};this.addRuleElement(n,o,e,"change",r,!0)}}},d.prototype.renderToolTip=function(e){var t=new a.Tooltip({content:this.l10n.getConstant("ValidationMessage"),isSticky:!0,position:"BottomCenter",cssClass:"e-querybuilder-error",afterClose:function(){t.destroy()},beforeOpen:function(e){var t=e.element.querySelector(".e-tooltip-close");t&&(t.style.display="none")}});t.appendTo(e),t.open(e)},d.prototype.validateFields=function(){var e,l=!0;if(this.allowValidation){var n,r=["isnull","isnotnull","isempty","isnotempty"],i=void 0,o=void 0,s=void 0,a=[],u=void 0,d=void 0,c=void 0,p=void 0,h=void 0,m=this.element.querySelectorAll(".e-rule-container");for(i=0,n=m.length;i<n;i++){var g=void 0;if(u=(0,t.closest)(m[i],".e-group-container"),h=this.getParentGroup(u),d=0,s=p=m[i],"DropdownTree"===this.fieldMode?(e=(0,t.getComponent)(m[i].querySelector(".e-rule-filter input.e-dropdowntree"),"dropdowntree"))&&e.value&&e.value.length&&(this.selectedColumn=this.getColumn(e.value[0]),g=this.selectedColumn.validation):(c=(0,t.getComponent)(m[i].querySelector(".e-rule-filter input.e-dropdownlist"),"dropdownlist"))&&c.value&&(this.selectedColumn=c.getDataByValue(c.value),g=!(0,t.isNullOrUndefined)(c.value)&&this.selectedColumn.validation),o=p.querySelector(".e-rule-field input.e-control"),g&&g.isRequired){for(;s&&null!==s.previousElementSibling;){s=s.previousElementSibling;var f=this.enableSeparateConnector&&(!this.headerTemplate&&!s.classList.contains("e-btn-group")||this.headerTemplate&&(s.classList.contains("e-rule-container")||s.classList.contains("e-group-container")));this.enableSeparateConnector&&!f||d++}if(o=p.querySelector(".e-rule-operator .e-control"),h.rules[d].operator||(o.parentElement.className.indexOf("e-tooltip")<0&&o.className.indexOf("e-tooltip")<0&&this.renderToolTip(o.parentElement),l=!1),h.rules[d].value instanceof Array&&(a=h.rules[d].value),r.indexOf(h.rules[d].operator)<-1&&(0,t.isNullOrUndefined)(h.rules[d].value)&&"date"!==h.rules[d].type||""===h.rules[d].value||null===h.rules[d].value||h.rules[d].value instanceof Array&&a.length<1){var v=p.querySelectorAll(".e-rule-value .e-control");r.indexOf(h.rules[d].operator)<0&&(l=!1);for(var y=0,b=v.length;y<b;y++){var C=v[y],S=void 0;C.parentElement.className.indexOf("e-searcher")>-1?(S=(0,t.closest)(C,".e-multi-select-wrapper")).className.indexOf("e-tooltip")<0&&this.renderToolTip(S):v[y].parentElement.className.indexOf("e-tooltip")<0&&v[y].className.indexOf("e-tooltip")<0&&this.renderToolTip(v[y].parentElement),y++}}else if("date"===h.rules[d].type&&(null===h.rules[d].value||h.rules[d].value.indexOf(null)>-1)){v=p.querySelectorAll(".e-rule-value .e-control");r.indexOf(h.rules[d].operator)<0&&(l=!1);for(y=0,b=v.length;y<b;y++)v[y].parentElement.className.indexOf("e-tooltip")<0&&v[y].className.indexOf("e-tooltip")<0&&((0,t.isNullOrUndefined)(h.rules[d].value)||null==h.rules[d].value[y])&&this.renderToolTip(v[y].parentElement)}}else(c&&c.element&&(0,t.isNullOrUndefined)(c.value)||e&&e.element&&((0,t.isNullOrUndefined)(e.value)||e.value.length<1))&&(o.parentElement.className.indexOf("e-tooltip")<0&&this.renderToolTip(o.parentElement),l=!1)}}return l},d.prototype.refreshLevelColl=function(){this.levelColl={};var e=this.element.querySelector(".e-group-container");if(e){this.levelColl[e.id]=[0];var t={groupElement:e,level:[0]};this.refreshLevel(t)}},d.prototype.refreshLevel=function(e){var l,n,r=e.groupElement.querySelector(".e-rule-list").children,i=e.groupElement,o=r.length,s=0;for(n=0;n<o;n++)(l=r[n]).className.indexOf("e-group-container")>-1&&(e.level.push(s),this.levelColl[l.id]=e.level.slice(),s++,e.groupElement=l,e=this.refreshLevel(e));var a=(0,t.closest)(i,".e-rule-list");return e.groupElement=a?(0,t.closest)(a,".e-group-container"):i,e.level=this.levelColl[e.groupElement.id].slice(),e},d.prototype.groupTemplate=function(e){var t,l,n,r,i,o,s=this.createElement("div",{attrs:{class:"e-group-container"}}),a=this.createElement("div",{attrs:{class:"e-group-header"}}),u=this.createElement("div",{attrs:{class:"e-group-body"}}),d=this.createElement("div",{attrs:{class:"e-rule-list"}});if(s.appendChild(a),u.appendChild(d),s.appendChild(u),!this.headerTemplate){n=this.allowDragAndDrop?"e-icons e-drag-qb-rule":"e-icons e-drag-qb-rule e-hidden";var c=this.createElement("span",{attrs:{class:n,"aria-label":"drag handle",title:"drag handle"}});a.appendChild(c);var p=this.enableSeparateConnector&&!e?"e-lib e-btn-group e-qb-toggle-btn":"e-lib e-btn-group";t=this.createElement("div",{attrs:{class:p,role:"group"}}),this.enableSeparateConnector&&t.classList.add("e-multi-connector"),this.enableNotCondition&&(l=this.enableSeparateConnector?this.createElement("input",{attrs:{type:"checkbox",class:"e-qb-toggle"}}):this.createElement("button",{attrs:{type:"button",class:"e-qb-toggle"}}),t.appendChild(l)),l=this.createElement("input",{attrs:{type:"radio",class:"e-btngroup-and",value:"AND"}}),t.appendChild(l),r=this.createElement("label",{attrs:{class:"e-lib e-btn e-btngroup-and-lbl e-small"},innerHTML:this.l10n.getConstant("AND")}),t.appendChild(r),l=this.createElement("input",{attrs:{type:"radio",class:"e-btngroup-or",value:"OR"}}),t.appendChild(l),r=this.createElement("label",{attrs:{class:"e-lib e-btn e-btngroup-or-lbl e-small"},innerHTML:this.l10n.getConstant("OR")}),t.appendChild(r),a.appendChild(t),i=this.createElement("div",{attrs:{class:"e-group-action"}}),this.enableSeparateConnector?(o=this.createElement("button",{attrs:{type:"button",class:"e-add-condition-btn"}}),i.appendChild(o),o=this.createElement("button",{attrs:{type:"button",class:"e-add-group-btn"}}),i.appendChild(o)):(o=this.createElement("button",{attrs:{type:"button",class:"e-add-btn"}}),i.appendChild(o)),a.appendChild(i)}return s},d.prototype.ruleTemplate=function(){var e,l,n,r,i,o=this.createElement("div"),s=this.createElement("div",{attrs:{class:"e-rule-field"}});e=this.createElement("div",{attrs:{class:"e-rule-filter"}}),i=this.allowDragAndDrop?"e-icons e-drag-qb-rule":"e-icons e-drag-qb-rule e-hidden";var a=this.createElement("span",{attrs:{class:i,"aria-label":"drag handle",title:"drag handle"}});s.appendChild(a);var u=this.createElement("input",{attrs:{type:"text",class:"e-filter-input"}});e.appendChild(u),s.appendChild(e),e=this.createElement("div",{attrs:{class:"e-rule-operator"}}),s.appendChild(e),e=this.createElement("div",{attrs:{class:"e-rule-value"}}),s.appendChild(e),e=this.createElement("div",{attrs:{class:"e-rule-value-delete"}}),n=this.showButtons.cloneRule?"e-clone-rule-btn e-clone-rule e-css e-btn e-small e-round e-icon-btn":"e-clone-rule-btn e-clone-rule e-css e-btn e-small e-round e-icon-btn e-button-hide",r=this.showButtons.lockRule?"e-lock-rule-btn e-lock-rule e-css e-btn e-small e-round e-icons e-icon-btn":"e-lock-rule-btn e-lock-rule e-css e-btn e-small e-round e-icons e-icon-btn e-button-hide";var d=this.createElement("button",{attrs:{title:this.l10n.getConstant("CloneRule"),type:"button",class:n}}),c=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-copy"}});d.appendChild(c);var p=this.createElement("button",{attrs:{title:this.l10n.getConstant("LockRule"),type:"button",class:r}});c=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-unlock"}}),p.appendChild(c),l=this.showButtons.ruleDelete||(0,t.isNullOrUndefined)(this.showButtons.ruleDelete)?"e-removerule e-rule-delete e-css e-btn e-small":"e-removerule e-rule-delete e-css e-btn e-small e-button-hide";var h=this.createElement("button",{attrs:{type:"button",class:l}});return e.appendChild(d),e.appendChild(p),e.appendChild(h),s.appendChild(e),o.appendChild(s),o},d.prototype.addGroupElement=function(e,t,l,n,r,i,o){var s=this,a={groupID:t.id.replace(this.element.id+"_",""),cancel:!1,type:"insertGroup"};this.isImportRules||this.isInitialLoad||this.prvtEvtTgrDaD?(this.isInitialLoad=!1,this.addGroupSuccess(a,e,t,l,n,r,i,o)):this.trigger("beforeChange",a,function(a){s.addGroupSuccess(a,e,t,l,n,r,i,o)})},d.prototype.addGroupSuccess=function(e,n,r,i,o,a,u,d){var c=this;if(!e.cancel&&this.element.querySelectorAll(".e-group-container").length<=this.maxGroupCount){var p=r,h=void 0,m="";m=p.className.indexOf("e-group-container")<0?p.querySelector(".e-group-container")&&p.querySelector(".e-group-container").id:p.id,this.enableSeparateConnector&&(this.groupElem=this.groupTemplate());var g=this.groupElem.cloneNode(!0);if(g.setAttribute("id",this.element.id+"_group"+this.groupIdCounter),0===this.groupIdCounter&&this.allowDragAndDrop&&g.querySelector(".e-drag-qb-rule")&&(g&&g.children[0]&&g.children[0].classList.add("e-parent-header"),(0,t.addClass)([g.querySelector(".e-drag-qb-rule")],"e-hidden")),this.headerTemplate&&(u?(n=!1,g.setAttribute("id",this.element.id+"_group0"),this.headerTemplateFn(g,a,i,d,m),this.groupIdCounter=0):this.headerTemplateFn(g,a,i,d,m)),this.groupIdCounter++,!this.headerTemplate){var f=g.querySelector(".e-btngroup-and"),v=g.querySelector(".e-btngroup-or"),y=g.querySelector(".e-btngroup-and-lbl"),b=g.querySelector(".e-btngroup-or-lbl");f.setAttribute("id",this.element.id+"_and"+this.btnGroupId),v.setAttribute("id",this.element.id+"_or"+this.btnGroupId),f.setAttribute("name",this.element.id+"_and"+this.btnGroupId),v.setAttribute("name",this.element.id+"_and"+this.btnGroupId),y.setAttribute("for",this.element.id+"_and"+this.btnGroupId),b.setAttribute("for",this.element.id+"_or"+this.btnGroupId),this.btnGroupId++}if(n){var C=void 0;C=this.showButtons.groupDelete||(0,t.isNullOrUndefined)(this.showButtons.groupDelete)?"e-deletegroup":"e-deletegroup e-button-hide",h=this.createElement("button",{attrs:{type:"button",class:C}}),new l.Button({iconCss:"e-icons e-delete-icon",cssClass:"e-small e-round"}).appendTo(h),h.setAttribute("title",this.l10n.getConstant("DeleteGroup")),(0,t.rippleEffect)(h,{selector:".deletegroup"});for(var S=p.querySelector(".e-rule-list"),x=S.children,E=0,q=0,O=x.length;q<O;q++)x[q].className.indexOf("e-group-container")>-1&&(E+=1);if(this.showButtons.cloneGroup&&this.cloneGrpBtnClick)if(this.groupIndex===x.length-1)S.appendChild(g),this.isLastGroup=!0;else{if(this.enableSeparateConnector){for(var k=0,w=this.groupIndex+1,N=0;N<w;N++)x[N].classList.contains("e-rule-container")&&(w++,k++);k>0&&k--,x[L=this.groupIndex+k+1].parentNode.insertBefore(g,x[L])}else{var L;x[L=this.groupIndex+1].parentNode.insertBefore(g,x[L])}this.isMiddleGroup=!0}else S.appendChild(g);var R=this.levelColl[p.id].slice(0);if(R.push(E),this.levelColl[g.id]=R,this.groupIndex>-1&&this.refreshLevelColl(),this.isImportRules||(this.isAddSuccess=!0,this.addGroups([],p.id.replace(this.element.id+"_","")),this.isAddSuccess=!1,o&&this.addRuleToNewGroups&&this.addRuleElement(g,{})),!this.headerTemplate){var D="";D=this.showButtons.cloneGroup?"e-clone-grp-btn e-css e-btn e-small e-round e-icons e-icon-btn":"e-clone-grp-btn e-css e-btn e-small e-round e-icons e-icon-btn e-button-hide";var T=this.createElement("button",{attrs:{title:this.l10n.getConstant("CloneGroup"),type:"button",class:D}}),I=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-copy"}});T.appendChild(I),g.querySelector(".e-group-action").appendChild(T),D=this.showButtons.lockGroup?"e-lock-grp-btn e-css e-btn e-small e-round e-icons e-icon-btn":"e-lock-grp-btn e-css e-btn e-small e-round e-icons e-icon-btn e-button-hide";var B=this.createElement("button",{attrs:{title:this.l10n.getConstant("LockGroup"),type:"button",class:D}}),A=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-unlock"}});B.appendChild(A),g.querySelector(".e-group-action").appendChild(B),g.querySelector(".e-group-action").appendChild(h)}}else{if(!this.headerTemplate){D="";D=this.showButtons.lockGroup?"e-lock-grp-btn e-css e-btn e-small e-round e-icons e-icon-btn":"e-lock-grp-btn e-css e-btn e-small e-round e-icons e-icon-btn e-button-hide";B=this.createElement("button",{attrs:{title:this.l10n.getConstant("LockGroup"),type:"button",class:D}}),I=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-unlock"}});B.appendChild(I),g.querySelector(".e-group-action").appendChild(B)}p.appendChild(g),this.levelColl[g.id]=[0]}if(this.enableNotCondition&&!this.headerTemplate){var P=g.querySelector(".e-qb-toggle");(this.enableSeparateConnector?new l.CheckBox({label:this.l10n.getConstant("NOT"),cssClass:"e-qb-toggle"}):new l.Button({content:this.l10n.getConstant("NOT"),cssClass:"e-btn e-small"})).appendTo(P),g.querySelector(".e-btngroup-and-lbl").classList.add("e-not"),this.updatedRule&&this.updatedRule.not&&(0,t.addClass)([P],"e-active-toggle")}if(this.enableSeparateConnector&&!this.headerTemplate){var M=g.querySelector(".e-btngroup-and"),G=g.querySelector(".e-btngroup-or"),V=g.querySelector(".e-btn-group");for(N=0;N<V.childNodes.length;N++)"not"===g.querySelector(".e-btn-group").childNodes[N].textContent.toLowerCase()&&this.enableNotCondition?V.childNodes[N].classList.add("e-multiconnector"):V.childNodes[N].style.display="none";if(g.previousElementSibling){if((0,t.isNullOrUndefined)(this.headerTemplate))g.parentElement.insertBefore(this.groupTemplate(!0).querySelector(".e-btn-group"),g),(P=g.previousElementSibling.childNodes[0]).classList.contains("e-qb-toggle")&&(P.style.display="none");if(!this.isImportRules){var F=g.previousElementSibling,U=F.querySelector(".e-btngroup-and"),_=F.querySelector(".e-btngroup-or");if(M.checked||G.checked)this.enableSeparateConnector&&(M.checked&&(U.checked=!0),G.checked&&(_.checked=!0));else{var j=g.nextElementSibling;j&&j.classList.contains("e-btn-group")&&(M=j.querySelector(".e-btngroup-and"),G=j.querySelector(".e-btngroup-or"),U.checked=M.checked,_.checked=G.checked)}}}}if(this.updatedRule=null,this.headerTemplate){var $={requestType:"header-template-create",ruleID:g.id,condition:i,notCondition:this.enableNotCondition?a:void 0};this.trigger("actionBegin",$)}else if(this.enableSeparateConnector){var Q=g.querySelector(".e-add-condition-btn");(W=new l.Button({cssClass:this.element.id+"_addConditionbtn",content:this.l10n.getConstant("AddCondition")})).appendTo(Q),W.element.onclick=function(){c.addRuleElement((0,t.closest)(Q,".e-group-container"),{})};var H=g.querySelector(".e-add-group-btn");(W=new l.Button({cssClass:this.element.id+"_addGroupbtn",content:this.l10n.getConstant("AddGroup")})).appendTo(H),W.element.onclick=function(){c.addGroupElement(!0,(0,t.closest)(H,".e-group-container"),"",!0)}}else{var W,z=g.querySelector(".e-add-btn");(W=new s.DropDownButton({items:this.items,cssClass:"e-round e-small e-caret-hide e-addrulegroup",iconCss:"e-icons e-add-icon",beforeOpen:this.selectBtn.bind(this,z),select:this.selectBtn.bind(this,z)})).appendTo(z),z.setAttribute("title",this.l10n.getConstant("AddButton"))}if(!this.isImportRules&&!this.prvtEvtTgrDaD){var Y=p.id.replace(this.element.id+"_",""),K=g.id.replace(this.element.id+"_","");this.trigger("change",{groupID:Y,type:"insertGroup",childGroupID:K})}}},d.prototype.setMultiConnector=function(e){if(this.enableSeparateConnector&&!this.headerTemplate&&e.previousElementSibling){var t=this.groupTemplate(!0).querySelector(".e-btn-group");if(t){e.parentElement.insertBefore(t,e);var l=e.previousElementSibling.childNodes[0];l.classList.contains("e-qb-toggle")&&(l.style.display="none"),this.addHeaderDiv(e)}}},d.prototype.addHeaderDiv=function(e){var l,n=e.previousElementSibling.previousElementSibling;if(n){l=n.id.indexOf("rule")>-1?this.getRule(n):this.getGroup(n),!(0,t.isNullOrUndefined)(l)&&(0,t.isNullOrUndefined)(l.condition)&&(l.condition="and");var r=e.previousElementSibling.querySelector(".e-btngroup-or"),i=e.previousElementSibling.querySelector(".e-btngroup-and");r.disabled=!1,i.disabled=!1,(0,t.isNullOrUndefined)(l)||"or"!==l.condition?i.checked=!0:r.checked=!0}},d.prototype.headerTemplateFn=function(e,l,n,r,i,o){var s,a,u=this.element.id+"_header",d=e.querySelector(".e-group-header");if(this.enableSeparateConnector&&-1!==e.id.indexOf("rule")&&(d=e),this.headerTemplate){if(a={requestType:"header-template-initialize",ruleID:e.id,notCondition:this.enableNotCondition?l:void 0,condition:n,rule:this.getRuleCollection(r,!1),groupID:i},this.trigger("actionBegin",a),this.enableSeparateConnector&&-1!==e.id.indexOf("rule")&&(a.requestType="rule-template-create"),this.headerFn=this.templateParser(this.headerTemplate),this.isReact)s=this.headerFn(a,this,e.id,u)[0],this.enableSeparateConnector&&o?this.enableSeparateConnectorInitialRule(e,s):this.enableSeparateConnector&&-1!==e.id.indexOf("rule")?d.parentElement.insertBefore(s,d.nextElementSibling):d.appendChild(s);else if(this.isAngular){var c=this.headerFn(a,this,e.id,u);s=3===c[0].nodeType?c[1]:c[0],this.enableSeparateConnector&&o?this.enableSeparateConnectorInitialRule(e,s):this.enableSeparateConnector&&-1!==e.id.indexOf("rule")?d.parentElement.insertBefore(s,d.nextElementSibling):d.appendChild(s)}else if(this.isVue3){if(s=this.headerFn(a,this,e.id,u),this.enableSeparateConnector&&(o||-1!==e.id.indexOf("rule")))for(var p=0;p<s.length;p++)if("DIV"===s[p].nodeName){s=s[p];break}this.enableSeparateConnector&&o?this.enableSeparateConnectorInitialRule(e,s):this.enableSeparateConnector&&-1!==e.id.indexOf("rule")?d.parentElement.insertBefore(s,d.nextElementSibling):(0,t.append)(s,d)}else s=this.headerFn(a,this,"Template",u)[0],this.enableSeparateConnector&&o?this.enableSeparateConnectorInitialRule(e,s):this.enableSeparateConnector&&-1!==e.id.indexOf("rule")?d.parentElement.insertBefore(s,d.nextElementSibling):d.appendChild(s);this.renderReactTemplates()}return e},d.prototype.enableSeparateConnectorInitialRule=function(e,t){var l=(e.nextElementSibling?e.nextElementSibling:e).closest(".e-group-container");!e.nextElementSibling&&l&&(l=l.nextElementSibling?l.nextElementSibling:l),l&&l.parentElement.insertBefore(t,l)},d.prototype.notifyChange=function(e,l,n){var r=(0,t.closest)(l,".e-group-container"),i=this.getParentGroup(r),o=(0,t.closest)(l,".e-rule-container"),s=0;if("not"!==n)if("condition"!==n){for(;o&&null!==o.previousElementSibling;)o=o.previousElementSibling,(!this.enableSeparateConnector||this.enableSeparateConnector&&(!this.headerTemplate&&!o.classList.contains("e-btn-group")||this.headerTemplate&&(o.classList.contains("e-rule-container")||o.classList.contains("e-group-container"))))&&s++;var a=i.rules[s],u=this.getColumn(a.field),d=this.getFormat(u.format);if("date"===u.type)if(e instanceof Date)e=this.intl.formatDate(e,d);else if(e instanceof Array)for(var c=0;c<e.length;c++)e[c]&&e[c]instanceof Date&&(e[c]=this.intl.formatDate(e[c],d));u.ruleTemplate?this.templateChange(l,e,n):(this.isNotified=!0,this.updateRules(l,e),this.isNotified=!1)}else this.enableSeparateConnector?((o=l.parentElement.previousElementSibling)&&o.classList.contains("e-group-container")&&(o=o.querySelectorAll(".e-rule-container")[o.querySelectorAll(".e-rule-container").length-1]),o&&o.classList.contains("e-rule-container")&&(i=this.getRule(o)),i.condition=e):i.condition=e;else i.not=e},d.prototype.templateChange=function(e,l,n){var r,i=(0,t.closest)(e,".e-group-container"),o=i&&this.getParentGroup(i),s=(0,t.closest)(e,".e-rule-container"),a=0;for(this.allowValidation&&this.validateValue(o,s);s&&null!==s.previousElementSibling;)s=s.previousElementSibling,(!this.enableSeparateConnector||this.enableSeparateConnector&&(!this.headerTemplate&&!s.classList.contains("e-btn-group")||this.headerTemplate&&(s.classList.contains("e-rule-container")||s.classList.contains("e-group-container"))))&&a++;var u,d=o&&o.rules[a];"field"===n?this.selectedColumn=this.getColumn(l):d&&(this.selectedColumn=this.getColumn(d.field)),this.previousColumn=d&&this.getColumn(d.field);var c=this.getValidRules(this.rule);this.selectedColumn&&(u=this.selectedColumn.operators?this.selectedColumn.operators:this.customOperators[this.selectedColumn.type+"Operator"]);var p,h=["in","notin","between","notbetween"];switch(n){case"field":if((0,t.isNullOrUndefined)(l)){if((0,t.isNullOrUndefined)(d))return;d.field="",d.label="",d.type="",d.value="",d.operator=""}else d.field=l,d.label=this.selectedColumn.label,d.type=this.selectedColumn.type,d.value="",d.operator=u[0].value;break;case"operator":p=d.operator,d.operator=l,h.indexOf(d.operator)>-1?d.value=[]:h.indexOf(p)>-1&&(d.value="");break;case"value":d.value=l}if(this.changeRuleTemplate(this.selectedColumn,e),this.filterRules(c,this.getValidRules(this.rule),n),this.selectedColumn&&this.selectedColumn.ruleTemplate&&("field"===n||"operator"===n)){var m=(0,t.closest)(e,".e-rule-container");this.destroyControls(m,!0),(0,t.detach)(m.querySelector(".e-rule-field"));var g=this.appendRuleElem((0,t.closest)(m,".e-group-container"),this.selectedColumn,"change",m.id,n,d);"Vertical"===this.displayMode||this.element.className.indexOf("e-device")>-1?g.className="e-rule-container e-vertical-mode":g.className="e-rule-container e-horizontal-mode",this.enableSeparateConnector||g.previousElementSibling&&g.previousElementSibling.className.indexOf("e-rule-container")>-1&&(g.className.indexOf("e-joined-rule")<0&&(g.className+=" e-joined-rule"),g.previousElementSibling.className.indexOf("e-prev-joined-rule")<0&&(g.previousElementSibling.className+=" e-prev-joined-rule")),g.previousElementSibling&&g.previousElementSibling.className.indexOf("e-group-container")>-1&&g.className.indexOf("e-separate-rule")<0&&(g.className+=" e-separate-rule");var f={requestType:"template-create",action:n,ruleID:m.id,fields:this.fields,rule:d};r={groupID:i.id.replace(this.element.id+"_",""),ruleID:m.id.replace(this.element.id+"_",""),value:d.field,type:"field"},this.trigger("actionBegin",f),this.trigger("change",r)}},d.prototype.changeValue=function(e,l){var n,r=this;if(this.isNumInput&&"number"==typeof l.value||"input"===l.type&&l.target&&l.target.classList.contains("e-numerictextbox")&&this.selectedColumn.validation&&(this.selectedColumn.validation.max!==Number.MAX_VALUE||this.selectedColumn.validation.min>0))this.isNumInput=!1;else{if(l.element&&l.element.classList.contains("e-multiselect"))n=l.element;else n=l.event?l.event.target:"input"===l.type&&l.target&&l.target.classList.contains("e-numerictextbox")?l.currentTarget:l.element;if(n){if(n.className.indexOf("e-day")>-1||n.className.indexOf("e-today")>-1||n.className.indexOf("e-cell")>-1)n=l.element;var o,s,a,u=(0,t.closest)(n,".e-group-container"),d=(0,t.closest)(n,".e-rule-container"),c=u&&u.id.replace(this.element.id+"_",""),p=d.id.replace(this.element.id+"_",""),h=l;if(h.element&&h.element.className.indexOf("e-datepicker")>-1&&(n=h.element,(o=(0,t.getComponent)((0,t.closest)(n,".e-rule-container").querySelector(".e-filter-input"),"dropdownlist"))&&(this.selectedColumn=o.getDataByValue(o.value)),(o=(0,t.getComponent)((0,t.closest)(n,".e-rule-container").querySelector(".e-filter-input"),"dropdowntree"))&&(this.selectedColumn=this.getColumn(o.value[0]))),n.className.indexOf("e-radio")>-1)if(a=parseInt(n.id.split("valuekey")[1],10),"Default"===this.fieldMode?(o=(0,t.getComponent)((0,t.closest)(n,".e-rule-container").querySelector(".e-filter-input"),"dropdownlist"),this.selectedColumn=o.getDataByValue(o.value),this.selectedColumn.columns&&(o=(0,t.getComponent)((0,t.closest)(n,".e-rule-container").querySelector(".e-rule-sub-filter .e-dropdownlist"),"dropdownlist"),this.selectedColumn=this.getColumn(o.value))):(o=(0,t.getComponent)((0,t.closest)(n,".e-rule-container").querySelector(".e-filter-input"),"dropdowntree"),this.selectedColumn=this.getColumn(o.value[0])),this.selectedColumn.values)s=this.selectedColumn.values[a];else{s=[!0,!1][a]}else if(n.className.indexOf("e-multiselect")>-1)s=(0,t.getComponent)(n,"multiselect").value;else if(s=l.value,"input"===l.type&&l.target&&l.target.classList.contains("e-numerictextbox")){s=Number(l.currentTarget.value);var m=l.currentTarget,g=(0,t.getInstance)(m,i.NumericTextBox),f=(0,t.getValue)("decimal",(0,t.getNumericObject)(this.locale));isNaN(s)&&-1!==m.value.indexOf(f)&&(s=this.intl.getNumberParser({format:"n"})(m.value)),isNaN(s)||(g.value=s),this.isNumInput=!0}"input"===l.name&&this.immediateModeDelay?(window.clearInterval(this.timer),this.timer=window.setInterval(function(){r.filterValue(c,p,s,e,n)},this.immediateModeDelay)):this.filterValue(c,p,s,e,n)}}},d.prototype.filterValue=function(e,t,l,n,r){var i=this,o={groupID:e,ruleID:t,value:l,cancel:!1,type:"value"};window.clearInterval(this.timer),this.isImportRules?this.changeValueSuccessCallBack(o,r,n,e,t):this.trigger("beforeChange",o,function(l){i.changeValueSuccessCallBack(l,r,n,e,t)})},d.prototype.changeValueSuccessCallBack=function(e,t,l,n,r){e.cancel||(this.updateRules(t,e.value,l),this.setSecondDateMinFromFirst(t,l),this.isImportRules||this.trigger("change",{groupID:n,ruleID:r,value:e.value,cancel:!1,type:"value"}))},d.prototype.setSecondDateMinFromFirst=function(e,l){if(0===l){var n=(0,t.closest)(e,".e-rule-container");if(n){var r=n.querySelector(".e-rule-operator .e-dropdownlist");if(r){var i=(0,t.getComponent)(r,"dropdownlist");if(!((i&&i.value?i.value.toString().toLowerCase():"").indexOf("between")<0)){var o=document.getElementById(n.id+"_valuekey0"),s=document.getElementById(n.id+"_valuekey1");if(o&&s){var a=(0,t.getComponent)(o,"datepicker"),u=(0,t.getComponent)(s,"datepicker");if(a&&u&&a.value instanceof Date){var d=new Date(a.value.getTime());d.setDate(d.getDate()+1),u.min=d,u.value instanceof Date&&u.value.getTime()<d.getTime()&&(u.value=d)}}}}}}},d.prototype.fieldClose=function(e){if(!this.isFieldChange&&!this.isDestroy){this.isFieldClose=!0;var l=(0,t.getComponent)(e,"dropdownlist"),n=l.popupObj&&l.popupObj.element.querySelector(".e-active"),r=l.getItemData();l.value=r.value;var i={element:l.element,value:r.value,isInteracted:!0,previousItemData:this.prevItemData,previousItem:null,item:n,itemData:r,event:null,e:null};l.previousValue!==l.value&&this.changeField(i),this.isFieldChange=!1}},d.prototype.changeField=function(e){if(e.isInteracted){if((0,t.isNullOrUndefined)(e.value))return;this.isFieldChange=!0,this.prevItemData=e.itemData;var l=(0,t.closest)(e.element,".e-rule-filter")||(0,t.closest)(e.element,".e-rule-sub-filter"),n="DropdownTree"===this.fieldMode?this.getColumn(e.value[0]):this.getColumn(e.value);if("DropdownTree"===this.fieldMode&&null!==l){var r=l.querySelector(".e-dropdowntree.e-control"),i=(0,t.getComponent)(r,"dropdowntree");if(!n)return;if("object"===n.type){if(i.value=e.oldValue,i.dataBind(),(0,t.isNullOrUndefined)(e.oldValue))r.value="";else{var o=this.getLabelFromColumn(e.oldValue[0]);r.value=o}return}if(!(0,t.isNullOrUndefined)(e.value[0])){i.value=e.value[0],i.dataBind();o=this.getLabelFromColumn(e.value[0]);r.value=o}}if(this.destroySubFields(l),this.subFieldElem=null,this.isNotValueChange=!0,n&&n.ruleTemplate)this.templateChange(e.element,n.field,"field");else if(n&&n.columns&&n.columns[0].ruleTemplate)this.templateChange(e.element,n.columns[0].field,"field");else{for(var s=(0,t.closest)(e.element,".e-group-container"),a=this.getParentGroup(s),u=(0,t.closest)(e.element,".e-rule-container"),d=0;u&&null!==u.previousElementSibling;)u=u.previousElementSibling,(!this.enableSeparateConnector||this.enableSeparateConnector&&(!this.headerTemplate&&!u.classList.contains("e-btn-group")||this.headerTemplate&&(u.classList.contains("e-rule-container")||u.classList.contains("e-group-container"))))&&d++;a.rules[d].value="",this.changeRule(a.rules[d],e)}}},d.prototype.changeRule=function(e,l){if(!l.itemData){if("DropdownTree"!==this.fieldMode)return;if(null==(0,t.getComponent)(l.element,"dropdowntree").value)return}var n=(0,t.closest)(l.element,".e-rule-filter");n=n||(0,t.closest)(l.element,".e-rule-sub-filter");var r=(0,t.getComponent)(l.element,"dropdownlist");"DropdownTree"===this.fieldMode&&null!==n&&(r=(0,t.getComponent)(l.element,"dropdowntree"));var i=(0,t.closest)(l.element,".e-group-container").id.replace(this.element.id+"_","");this.changeFilter(n,r,i,e,{},l)},d.prototype.changeFilter=function(e,l,n,r,i,o){var s=this;if(e){var a=void 0;a="DropdownTree"===this.fieldMode?l.value[0]:this.isImportRules?this.GetRootColumnName(l.value):l.value,this.selectedColumn=this.getColumn(a);var u={groupID:n,ruleID:(0,t.closest)(e,".e-rule-container").id.replace(this.element.id+"_",""),selectedField:"DropdownTree"===this.fieldMode?l.value[0]:l.value,cancel:!1,type:"field"};this.isImportRules||this.prvtEvtTgrDaD?this.fieldChangeSuccess(u,i,e,r,o):this.trigger("beforeChange",u,function(t){s.fieldChangeSuccess(t,i,e,r,o)})}else{var d=(0,t.closest)(o.element,".e-rule-operator");this.changeOperator(e,d,l,n,r,i,o)}},d.prototype.changeOperator=function(e,l,n,r,i,o,s){var a,u=this;l?(a={groupID:r,ruleID:(0,t.closest)(l,".e-rule-container").id.replace(this.element.id+"_",""),selectedIndex:n.index,cancel:!1,type:"operator"},this.isImportRules?this.operatorChangeSuccess(a,e,o,i,s):this.trigger("beforeChange",a,function(t){u.operatorChangeSuccess(t,e,o,i,s)})):this.changeRuleValues(e,i,o,s)},d.prototype.fieldChangeSuccess=function(e,l,n,r,i){for(var o=(0,t.closest)(n,".e-rule-container"),s=(0,t.closest)(i.element,".e-rule-operator"),a=(0,t.closest)(i.element,".e-group-container").id.replace(this.element.id+"_",""),u=(0,t.getComponent)(i.element,"dropdownlist"),d=o.querySelectorAll(".e-tooltip.e-input-group"),c=0;c<d.length;c++)(0,t.getComponent)(d[c],"tooltip").destroy();if(e.cancel)this.changeOperator(n,s,u,a,r,l,i);else{if((0,t.isNullOrUndefined)(this.selectedColumn))return;if(l.type=this.selectedColumn.type,o.querySelector(".e-template")&&(r.value=""),"object"===this.selectedColumn.type&&"Default"===this.fieldMode)for(l.type=this.selectedColumn.columns[0].type;this.selectedColumn.columns;)this.createSubFields(n,r,l,i);else this.destroySubFields(n),this.changeOperator(n,s,u,a,r,l,i)}},d.prototype.destroySubFields=function(e){for(;e&&e.nextElementSibling.classList.contains("e-rule-sub-filter");)this.destroyControls(e),e.nextElementSibling.remove()},d.prototype.createSubFields=function(e,l,r,i){var o=!1,s=(0,t.closest)(e,".e-rule-field"),a=this.createElement("div",{attrs:{class:"e-rule-sub-filter",id:"subfilter"+this.subFilterCounter}});s.insertBefore(a,s.querySelector(".e-rule-operator"));var u=(0,t.closest)(a,".e-rule-container").id,d=this.createElement("input",{attrs:{type:"text",id:u+"_subfilterkey"+this.subFilterCounter}});a.appendChild(d);var c,h=this.element.className.indexOf("e-device")>-1?"250px":"200px";c={dataSource:this.selectedColumn.columns,fields:this.fields,placeholder:this.l10n.getConstant("SelectField"),popupHeight:this.selectedColumn.columns.length>5?h:"auto",change:this.changeField.bind(this),index:0,open:this.popupOpen.bind(this,!1)},this.fieldModel&&(c=p({},c,this.fieldModel));var m=new n.DropDownList(c);if(m.appendTo("#"+u+"_subfilterkey"+this.subFilterCounter),this.isImportRules||this.previousColumn&&this.previousColumn.ruleTemplate&&this.GetRootColumnName(l.field)===this.GetRootColumnName(this.previousColumn.field))for(var g=this.selectedColumn.columns,f=0;f<g.length;f++)if(l.field===g[f].field||l.field.indexOf(g[f].field+this.separator)>-1){m.value=g[f].field,this.selectedColumn=g[f],o=!0;break}this.subFilterCounter++,this.subFieldElem=d,i.itemData=i.itemData,!o&&this.selectedColumn.columns&&(!o&&this.isImportRules&&(m.value=null),this.selectedColumn=this.selectedColumn.columns[0]),this.previousColumn=this.selectedColumn,this.selectedColumn.columns||this.changeRuleValues(a,l,r,i)},d.prototype.operatorChangeSuccess=function(e,l,n,r,i){if(!e.cancel){var o=(0,t.closest)(i.element,".e-rule-operator"),s=o.nextElementSibling,a=(0,t.getComponent)(i.element,"dropdownlist"),u=r.operator?r.operator.toString().toLowerCase():"";n.operator=a.value.toString();var d=n.operator.toLowerCase();if(n.operator.toLowerCase().indexOf("between")>-1||n.operator.toLowerCase().indexOf("in")>-1&&n.operator.toLowerCase().indexOf("contains")<0?(l=o.previousElementSibling,n.type=r.type,(n.operator.toLowerCase().indexOf("in")<0||u.indexOf("in")<0)&&(r.value=[])):"object"==typeof r.value&&null!==r.value&&(r.value=r.value.length>0?r.value[0]:"number"===r.type?0:""),i.previousItemData){var c=i.previousItemData.value.toString().toLowerCase();(c.indexOf("between")>-1||(c.indexOf("in")>-1||c.indexOf("null")>-1||c.indexOf("empty")>-1)&&c.indexOf("contains")<0)&&(l=o.previousElementSibling,n.type=r.type)}if(u.indexOf("in")>-1&&u.indexOf("in")<5&&d.indexOf("in")>-1&&d.indexOf("in")<5&&(l=null),n.operator.indexOf("null")>-1||n.operator.indexOf("empty")>-1){var p=o.parentElement.querySelector(".e-rule-value"),h=p.querySelector(".e-tooltip.e-input-group");(h||u.indexOf("in")>-1&&(h=p.querySelector(".e-tooltip")))&&(0,t.getComponent)(h,"tooltip").destroy(),(0,t.removeClass)([p],"e-show"),(0,t.addClass)([p],"e-hide")}s&&this.getColumn(r.field).template&&(l=o.previousElementSibling),0===s.children.length&&(l=o.previousElementSibling),this.changeRuleValues(l,r,n,i)}},d.prototype.changeRuleValues=function(e,l,r,i){var o,s,a,u,d=(0,t.closest)(i.element,".e-rule-operator");if(e)if(d=e.nextElementSibling,e.classList.contains("e-rule-sub-filter")&&(r.type=this.selectedColumn.type,o=d.classList.contains("e-rule-sub-filter"),d=o?d.nextElementSibling:d),(0,t.addClass)([d],"e-operator"),d.childElementCount){s=(0,t.getComponent)(d.querySelector(".e-dropdownlist"),"dropdownlist"),r.operator=s.value;var c=void 0;c="DropdownTree"===this.fieldMode?(0,t.getComponent)(e.querySelector(".e-dropdowntree"),"dropdowntree"):(0,t.getComponent)(e.querySelector(".e-dropdownlist"),"dropdownlist"),r.type="DropdownTree"===this.fieldMode?this.getColumn(c.value[0]).type:this.getColumn(c.value).type;var h=i.itemData;""!==s.value&&this.renderValues(d,h,i.previousItemData,!0,l,r,i.element)}else{var m=(0,t.closest)(d,".e-rule-container").id;u=this.createElement("input",{attrs:{type:"text",id:m+"_operatorkey"}}),d.appendChild(u),this.selectedColumn.operators?a=this.selectedColumn.operators:i.itemData&&(a=this.customOperators[this.selectedColumn.type+"Operator"]);var g,f=this.element.className.indexOf("e-device")>-1?"250px":"200px";l.operator&&a.forEach(function(e){"value"in e&&"string"==typeof e.value&&e.value.toLowerCase()===l.operator.toLowerCase()&&(g=e.value)});var v=g||a[0].value,y=0;this.autoSelectOperator||(v="",y=-1),(this.isImportRules||this.ruleIndex>-1||this.groupIndex>-1||this.prvtEvtTgrDaD)&&(v=l&&l.operator?l.operator:v);var b=void 0;b={dataSource:a,fields:{text:"key",value:"value"},placeholder:this.l10n.getConstant("SelectOperator"),popupHeight:a.length>5?f:"auto",change:this.changeField.bind(this),index:y,value:v,open:this.popupOpen.bind(this,!1)},this.operatorModel&&(b=p({},b,this.operatorModel)),new n.DropDownList(b).appendTo("#"+m+"_operatorkey"),r.operator=l&&""!==l.operator&&!(0,t.isNullOrUndefined)(l.operator)?l.operator:a[0].value,this.isImportRules&&(r.type=this.selectedColumn.type,r.operator=l.operator),(0,t.isNullOrUndefined)(v)||""===v?this.autoSelectField&&this.autoSelectOperator&&this.renderValues(d,this.selectedColumn,i.previousItemData,!1,l,r,i.element):this.renderValues(d,this.selectedColumn,i.previousItemData,!1,l,r,i.element)}this.isImportRules||this.updateRules(i.element,i.item)},d.prototype.popupOpen=function(e,l){this.enableRtl&&(0,t.addClass)([l.popup.element],"e-rtl"),e&&(this.isFieldClose=!1)},d.prototype.destroyControls=function(e,l){for(var n=l?e:e.nextElementSibling,r=n.querySelectorAll("input.e-control"),i=n.querySelectorAll("div.e-control:not(.e-handle)"),o=this.columns,s=0,a=r.length;s<a;s++){if(r[s].classList.contains("e-textbox"))(0,t.getComponent)(r[s],"textbox").destroy(),(0,t.detach)((0,t.select)("input#"+r[s].id,n));else if(r[s].classList.contains("e-dropdownlist"))this.allowValidation&&r[s].parentElement.className.indexOf("e-tooltip")>-1&&(0,t.getComponent)(r[s].parentElement,"tooltip").destroy(),(0,t.getComponent)(r[s],"dropdownlist").destroy();else if(r[s].classList.contains("e-radio"))(0,t.getComponent)(r[s],"radio").destroy();else if(r[s].classList.contains("e-numerictextbox"))(0,t.getComponent)(r[s],"numerictextbox").destroy(),(0,t.detach)((0,t.select)("input#"+r[s].id,n));else if(r[s].classList.contains("e-datepicker"))(0,t.getComponent)(r[s],"datepicker").destroy();else if(r[s].classList.contains("e-multiselect"))(0,t.getComponent)(r[s],"multiselect").destroy();else if(r[s].className.indexOf("e-template")>-1)for(var u=r[s].className,d=0,c=o.length;d<c;d++)if(o[d].template&&u.indexOf(o[d].field)>-1){this.templateDestroy(o[d],r[s].id);break}document.getElementById(r[s].id)&&(0,t.detach)(r[s])}for(s=0,a=i.length;s<a;s++){if(i[s].className.indexOf("e-template")>-1)for(u=i[s].className,d=0,c=o.length;d<c;d++)if(o[d].template&&u.indexOf(o[d].field)>-1){this.templateDestroy(o[d],i[s].id);break}(0,t.detach)(i[s])}var p=n.querySelectorAll(".e-template:not(.e-control)");for(s=0,a=p.length;s<a;s++)(0,t.detach)(p[s])},d.prototype.templateDestroy=function(e,l){var n;if("string"!=typeof e.template||void 0===e.template.destroy){var r=(n=e.template).destroy;if(n.destroy){var i=void 0;document.getElementById(l)&&(i=(0,t.closest)(document.getElementById(l),".e-rule-field").querySelectorAll(".e-template")),"string"==typeof r?(r=(0,t.getValue)(r,window))({field:e.field,elementId:l,elements:i}):n.destroy({field:e.field,elementId:l,elements:i})}}},d.prototype.getValues=function(e){var t,l={},n=[],r=[];this.separator.length>0&&(r=e.split(this.separator));var i=this.dataColl;if(this.dataColl[1])for(var o=0,s=i.length;o<s;o++){var a={};if(r.length>1)for(var u=i[o],d=void 0,c=0,p=r.length;c<p;c++)d=r[c],r.length===c+1?(t=u[""+d],Number(u[""+d])===u[""+d]&&u[""+d]%1!=0&&(t=u[""+d].toString())):u=u[""+d];else t=i[o][""+e],Number(i[o][""+e])===i[o][""+e]&&i[o][""+e]%1!=0&&(t=i[o][""+e].toString());t in l||(l[""+t]=1,r.length>1?this.createNestedObject(a,r,t):a[""+e]=t,n.push(a))}return n},d.prototype.createNestedObject=function(e,t,l){for(var n,r=t.length-1,i=0;i<r;++i)(n=t[i])in e||(e[""+n]={}),e=e[""+n];e[t[r]]=l},d.prototype.getDistinctValues=function(e,t){for(var l={},n=[],r=[],i="",o=t.indexOf(this.separator),s=function(s,u){i="",0===o?i=e[s][""+t]:(r=t.split(a.separator)).forEach(function(t){i=i?i[""+t]:e[s][""+t]}),Number(e[s][""+t])===e[s][""+t]&&e[s][""+t]%1!=0&&(i=e[s][""+t].toString());var d={};i in l||(l[""+i]=1,0===o?d[""+t]=i:d[r[r.length-1]]=i,n.push(d))},a=this,u=0,d=e.length;u<d;u++)s(u);return n},d.prototype.renderMultiSelect=function(e,t,l,i,o){var s,a,u=!1,d=!1;this.isGetNestedData=!1,this.dataColl[1]&&Object.keys(this.dataColl[1]).indexOf(e.field)>-1&&(u=!0,s=this.getDistinctValues(this.dataColl,e.field)),u=!e.columns&&u,!this.dataColl.length&&o.length&&(d=!0);var c=this.valueModel&&this.valueModel.multiSelectModel&&this.valueModel.multiSelectModel.query?this.valueModel.multiSelectModel.query:null,h=c&&"function"==typeof c.clone?c.clone():new r.Query,m=e.field;m&&h.select([m]);var g=new r.Query([e.field]);d||u||!(this.dataManager instanceof r.DataManager||this.dataSource instanceof r.DataManager)||(g=h),a={dataSource:d?o:u?s:this.dataManager,query:g,fields:{text:this.selectedRule.field,value:this.selectedRule.field},placeholder:this.l10n.getConstant("SelectValue"),value:i,mode:"CheckBox",width:"100%",change:this.changeValue.bind(this,l),close:this.closePopup.bind(this,l),actionBegin:this.multiSelectOpen.bind(this,t+"_valuekey"+l),open:this.popupOpen.bind(this,!1)},this.valueModel&&this.valueModel.multiSelectModel&&(a=p({},a,this.valueModel.multiSelectModel));var f=new n.MultiSelect(a);f.appendTo("#"+t+"_valuekey"+l),this.updateRules(f.element,i,0)},d.prototype.multiSelectOpen=function(e,l){if(this.dataSource instanceof r.DataManager){var n=document.getElementById(e),i=(0,t.getComponent)((0,t.closest)(n,".e-rule-container").querySelector(".e-filter-input"),"DropdownTree"===this.fieldMode?"dropdowntree":"dropdownlist");"DropdownTree"===this.fieldMode?this.selectedColumn=this.getColumn(i.value[0]):this.selectedColumn=i.getDataByValue(i.value);var o=this.selectedColumn.field,s=!1;if(this.dataColl[1])Object.keys(this.dataColl[1]).indexOf(o)>-1&&(s=!0),0!==o.indexOf(this.separator)&&this.isGetNestedData&&(s=!0);s||(l.cancel=!0,this.bindMultiSelectData(n,o))}},d.prototype.bindMultiSelectData=function(e,t){this.getMultiSelectData(e,t)},d.prototype.getMultiSelectData=function(e,l){var n,i=this,o=new r.Deferred,s=this.valueModel&&this.valueModel.multiSelectModel&&this.valueModel.multiSelectModel.query?this.valueModel.multiSelectModel.query:null,u=s&&"function"==typeof s.clone?s.clone():new r.Query;u.select([l]);var d=this.dataManager.executeQuery(u),c=(0,t.getComponent)(e,"multiselect");c.hideSpinner(),this.createSpinner((0,t.closest)(e,".e-multi-select-wrapper").parentElement),(0,a.showSpinner)((0,t.closest)(e,".e-multi-select-wrapper").parentElement),d.then(function(r){n=r.actual&&r.actual.result?r.actual.result:r.result,i.dataColl=(0,t.extend)(i.dataColl,n,[],!0),c.dataSource=i.getDistinctValues(i.dataColl,l),i.isGetNestedData=!0,(0,a.hideSpinner)((0,t.closest)(e,".e-multi-select-wrapper").parentElement)}).catch(function(e){o.reject(e)})},d.prototype.createSpinner=function(e){var l=this.createElement("span",{attrs:{class:"e-qb-spinner"}});e.appendChild(l),(0,a.createSpinner)({target:l,width:t.Browser.isDevice?"16px":"14px"})},d.prototype.closePopup=function(e,l){var n=document.getElementById(l.popup.element.id.replace("_popup",""));if(n){var r=(0,t.getComponent)(n,"multiselect");if(r){var i=r.value;this.updateRules(n,i,e)}}},d.prototype.processTemplate=function(e,l,n,r){var i=(0,t.closest)(e,".e-rule-container"),o=i.querySelectorAll(".e-template"),s=i.querySelector(".e-rule-filter .e-filter-input"),a="DropdownTree"===this.fieldMode?(0,t.getComponent)(s,"dropdowntree"):(0,t.getComponent)(i.querySelector(".e-rule-filter .e-filter-input"),"dropdownlist"),u="DropdownTree"===this.fieldMode?this.getColumn(a.value[0]):this.getColumn(a.value);e&&e.nextElementSibling&&(e.nextElementSibling.style.position="relative",e.nextElementSibling.classList.add("e-querybuilder-spinner"));var d=function(){e&&e.nextElementSibling&&e.nextElementSibling.classList.contains("e-querybuilder-spinner")&&e.nextElementSibling.classList.remove("e-querybuilder-spinner")};if("string"==typeof l.template||void 0===l.template.write){var c={rule:n,ruleID:i.id,operator:r.operator,field:u.field,requestType:"value-template-create"};this.trigger("actionBegin",c),d()}else{var p=l.template,h={elements:o.length>1?o:o[0],values:n.value,operator:r.operator,field:u.field,dataSource:u.values,onComplete:d},m=void 0;"string"==typeof p.write?m=(0,t.getValue)(p.write,window)(h):"function"!=typeof l.template&&(m=l.template.write(h)),m&&"function"==typeof m.then?m.then(function(){return d()}):setTimeout(function(){return d()},100)}},d.prototype.getItemData=function(e){var l=(0,t.getComponent)(document.getElementById(e+"_filterkey"),"dropdownlist"),n=this.element.querySelector("#"+e);if("DropdownTree"===this.fieldMode)l=(0,t.getComponent)(document.getElementById(e+"_filterkey"),"dropdowntree");else if(n){var r=n.querySelectorAll(".e-rule-sub-filter");if(r.length>0){var i=r[r.length-1].querySelector(".e-dropdownlist");l=(0,t.getComponent)(i,"dropdownlist")}}return"DropdownTree"===this.fieldMode?this.getColumn(l.value[0]):this.getColumn(l.value)},d.prototype.setDefaultValue=function(e,l,n){var r=this.getItemData(e);if((0,t.isNullOrUndefined)(r.value))return n?l?[0,0]:0:l?[]:"";if(l){if(!(r.value instanceof Array))return[r.value]}else if(r.value instanceof Array)return r.value[0];return r.value},d.prototype.renderStringValue=function(e,t,l,n,r){var o,s,a=this.getItemData(e),u="string"==typeof a.template;if(s=this.isImportRules||this.ruleIndex>-1||this.groupIndex>-1||this.isPublic||u||""!==t.value?t.value:this.setDefaultValue(e,!1,!1),"in"!==l&&"notin"!==l||!this.dataColl.length&&!a.values){"in"!==l&&"notin"!==l||(s=(o=this.isImportRules||this.ruleIndex>-1||this.groupIndex>-1?t.value:this.setDefaultValue(e,!0,!1)).join(",")),"between"!==l&&"notbetween"!==l||s.length>1&&(s=s[n]);var d=void 0;d={placeholder:this.l10n.getConstant("SelectValue"),input:this.changeValue.bind(this,n)},this.valueModel&&this.valueModel.textBoxModel&&(d=p({},d,this.valueModel.textBoxModel));var c=new i.TextBox(d);c.appendTo("#"+e+"_valuekey"+n),c.value=s,c.dataBind()}else o=this.isImportRules||this.ruleIndex>-1||this.groupIndex>-1||this.isPublic?t.value:this.setDefaultValue(e,!0,!1),this.renderMultiSelect(a,e,n,o,a.values),"Vertical"===this.displayMode||this.element.className.indexOf("e-device")>-1?r.style.width="100%":(r.style.width=null,r.style.minWidth="200px")},d.prototype.renderNumberValue=function(e,t,l,n,r,o,s){var a=this.getItemData(e),u="string"==typeof a.template,d=this.isImportRules||this.ruleIndex>-1||this.groupIndex>-1||this.isPublic||u||"number"==typeof t.value?t.value:this.setDefaultValue(e,!1,!0);if("in"!==l&&"notin"!==l||!this.dataColl.length&&!a.values)if("in"===l||"notin"===l){var c=(d=this.isImportRules||this.ruleIndex>-1||this.groupIndex>-1?t.value:this.setDefaultValue(e,!0,!1)).join(","),h=void 0;h={placeholder:this.l10n.getConstant("SelectValue"),input:this.changeValue.bind(this,n)},this.valueModel&&this.valueModel.textBoxModel&&(h=p({},h,this.valueModel.textBoxModel));var m=new i.TextBox(h);m.appendTo("#"+e+"_valuekey"+n),m.value=c,m.dataBind()}else{var g=(o=a).validation&&o.validation.min?o.validation.min:0,f=o.validation&&o.validation.max?o.validation.max:Number.MAX_VALUE,v=o.format?o.format:"n";s>1&&t&&(d=t.value[n]?t.value[n]:this.setDefaultValue(e,!0,!0));var y=void 0;y={value:d instanceof Array?d[n]:d,format:v,min:g,max:f,width:"100%",step:o.step?o.step:1,change:this.changeValue.bind(this,n)},this.valueModel&&this.valueModel.numericTextBoxModel&&(y=p({},y,this.valueModel.numericTextBoxModel));var b=new i.NumericTextBox(y);b.appendTo("#"+e+"_valuekey"+n),b.element.setAttribute("aria-label",o.label+" Value"),b.element.oninput=this.changeValue.bind(this,n)}else d=this.isImportRules||this.ruleIndex>-1||this.groupIndex>-1||this.isPublic?t.value:this.setDefaultValue(e,!0,!1),this.renderMultiSelect(a,e,n,d,a.values),this.element.className.indexOf("e-device")>-1||"Vertical"===this.displayMode?r.style.width="100%":(r.style.minWidth="200px",r.style.width=null)},d.prototype.processValueString=function(e,t){var l=[],n=e.split(",");if("string"===t)return n;for(var r=0,i=n.length;r<i;r++)l.push(Number(n[r]));return l},d.prototype.parseDate=function(e,l){var n,r;if(l){var i=this.intl.getDateParser({skeleton:"full",type:"dateTime"});n=this.getFormat(l),r=i(e),(0,t.isNullOrUndefined)(r)&&(r=this.intl.parseDate(e,n))}else r=new Date(e);return r},d.prototype.renderControls=function(e,l,n,r,i){if((0,t.addClass)([e.parentElement.querySelector(".e-rule-value")],"e-value"),(0,t.removeClass)([e.parentElement.querySelector(".e-rule-value")],"e-hide"),(0,t.addClass)([e.parentElement.querySelector(".e-rule-value")],"e-show"),l.template&&(l.template.create||i))this.processTemplate(e,l,n,r);else{var s;s="boolean"===r.type?this.selectedColumn.values?this.selectedColumn.values.length:2:r.operator&&r.operator.toString().toLowerCase().indexOf("between")>-1?2:1;var a=(0,t.closest)(e,".e-rule-container").id,u=void 0,d=r.operator.toString();if(e.className.indexOf("e-rule-operator")>-1||e.className.indexOf("e-rule-filter")>-1){u=e.parentElement.querySelector(".e-rule-value"),this.element.className.indexOf("e-device")>-1||"Vertical"===this.displayMode?u.style.width="100%":"in"!==d&&"notin"!==d?(0,t.addClass)([u],"e-custom-value"):(0,t.removeClass)([u],"e-custom-value");for(var c=0;c<s;c++)switch(r.type){case"string":this.renderStringValue(a,n,d,c,u);break;case"number":this.renderNumberValue(a,n,d,c,u,l,s);break;case"boolean":this.processBoolValues(l,n,a,c);break;case"date":var h=new Date,m=void 0,g=void 0,f=l.format,v=void 0,y=void 0,b=this.l10n.getConstant("SelectValue"),C="string"==typeof l.template;if(n.value&&!(0,t.isNullOrUndefined)(f)&&(m=s>1?n.value[c]:n.value,h=this.parseDate(m,f)||new Date),!(0,t.isNullOrUndefined)(l)&&l.value&&!C)(x=this.parseDate(l.value.toString(),l.format))&&!isNaN(x.getTime())&&(h=x);if(l.field||l.key||!l.value||(h=l.value instanceof Date?l.value:this.parseDate(l.value,l.format)),!l.format&&n&&""!==n.field&&(f=(g=this.getColumn(n.field)).format),(this.isImportRules||this.isPublic||C)&&n&&(f=(g=this.getColumn(n.field)).format,n.value?(m=s>1?n.value[c]:n.value,h=this.parseDate(m,g.format)):h=n.value),f){var S=this.getFormat(f);if(S.skeleton)y={locale:this.getLocale(),value:h,placeholder:b,format:S,change:this.changeValue.bind(this,c)},this.valueModel&&this.valueModel.datePickerModel&&(y=p({},y,this.valueModel.datePickerModel)),v=new o.DatePicker(y);else{if(y={value:h,locale:this.getLocale(),placeholder:b,format:S.format,change:this.changeValue.bind(this,c)},!(0,t.isNullOrUndefined)(g)&&!(0,t.isNullOrUndefined)(g.values)&&g.values.length>0){var x=this.parseDate(g.values[c],f);if(!(0,t.isNullOrUndefined)(x)&&x instanceof Date&&(y.value=x,1===c)){var E=this.parseDate(g.values[0],f);E instanceof Date&&!isNaN(E.getTime())&&(E.setDate(E.getDate()+1),y.min=E)}}this.valueModel&&this.valueModel.datePickerModel&&(y=p({},y,this.valueModel.datePickerModel)),v=new o.DatePicker(y)}}else y={locale:this.getLocale(),value:h,placeholder:b,change:this.changeValue.bind(this,c)},this.valueModel&&this.valueModel.datePickerModel&&(y=p({},y,this.valueModel.datePickerModel)),v=new o.DatePicker(y);if(v.appendTo("#"+a+"_valuekey"+c),!n.value){var q=document.getElementById(a+"_valuekey"+c);this.updateRules(q,h,null,this.isNotValueChange),this.isNotValueChange=!1}}}}},d.prototype.processBoolValues=function(e,n,r,i){var o,s,a,u,d=!1;if((0,t.isNullOrUndefined)(n.type)&&e&&(n.type=e.type),e.values){var c=e.values;"boolean"!==n.type||(0,t.isNullOrUndefined)(n.value)?e.value?d=c[i].toLowerCase()===e.value.toString().toLowerCase():0===i&&(d=!0):d=c[i].toLowerCase()===n.value.toString().toLowerCase(),s=o=a=c[i]}else{c=[!0,!1];"boolean"!==n.type||(0,t.isNullOrUndefined)(n.value)?e.value?d=c[i].toString().toLowerCase()===e.value.toString().toLowerCase():0===i&&(d="boolean"!=typeof n.value||!!n.value):d=c[i].toString().toLowerCase()===n.value.toString().toLowerCase(),"boolean"==typeof n.value&&1===i&&(d=!n.value),o=c[i].toString(),s=c[i],a=this.l10n.getConstant(["True","False"][i])}u={label:a,name:r+"default",checked:d,value:o,change:this.changeValue.bind(this,i)},this.valueModel&&this.valueModel.radioButtonModel&&(u=p({},u,this.valueModel.radioButtonModel));var h=new l.RadioButton(u);h.appendTo("#"+r+"_valuekey"+i),d&&this.updateRules(h.element,s,0,!0)},d.prototype.getOperatorIndex=function(e,t){var l,n=e.dataSource.length;for(l=0;l<n;l++)if(t.operator===e.dataSource[l].value)return l;return 0},d.prototype.getPreviousItemData=function(e,t){return this.isFieldClose&&e&&(e=this.getColumn(e.value?e.value:e.field)),t&&t.template&&e&&Object.keys(e).length<4&&(e.template=t.template),e},d.prototype.renderValues=function(e,l,n,r,i,o,s){var a=e.previousElementSibling.getElementsByTagName("input")[0],u="DropdownTree"===this.fieldMode?(0,t.getComponent)(a,"dropdowntree"):(0,t.getComponent)(a,"dropdownlist"),d="DropdownTree"===this.fieldMode?this.getColumn(u.value[0]):this.getColumn(u.value);this.selectedRule=d;var c=(0,t.getComponent)(e.querySelector("input"),"dropdownlist");r&&(l=s.id.indexOf("operator")>-1?l:this.selectedRule).operators&&(c.value=null,c.dataBind(),c.dataSource=l.operators,c.index=this.getOperatorIndex(c,i),c.value=o.operator=c.dataSource[c.index].value,this.autoSelectOperator?c.dataBind():(c.index=-1,o.operator=c.value=""));var p=o.operator.toString(),h=!1;if(p.indexOf("null")>-1||p.indexOf("isempty")>-1||p.indexOf("isnotempty")>-1){(f=e.parentElement.querySelector(".e-rule-value"))&&((0,t.removeClass)([f],"e-show"),(0,t.addClass)([f],"e-hide"))}else{var m=(0,t.closest)(e,".e-rule-container").id;if((n=this.getPreviousItemData(n,d))&&void 0===n.template?n.columns&&(n=this.getColumn(i.field)):"DropdownTree"===this.fieldMode&&void 0===n&&(n=this.getColumn(i.field)),n&&n.template){this.templateDestroy(n,m+"_valuekey0");var g=(0,t.select)("#"+m+"_valuekey0",e.nextElementSibling);g&&!g.classList.contains("e-control")&&(0,t.detach)((0,t.select)("#"+m+"_valuekey0",e.nextElementSibling)),"string"!=typeof n.template&&void 0!==n.template.create||(e.nextElementSibling.classList.contains("e-template-value")&&this.clearQBTemplate([m]),e.nextElementSibling.innerHTML=""),this.isAngular&&!(0,t.isNullOrUndefined)(n.key)&&"DropdownTree"===this.fieldMode&&delete n.template}if(r&&(this.validateValue(i,(0,t.closest)(e,".e-rule-container")),this.destroyControls(e)),this.isImportRules||c&&""!==c.value){if(d&&(l.template=d.template),l.template&&((0,t.addClass)([e.nextElementSibling],"e-template-value"),l.template=d.template,h=this.setColumnTemplate(l,m,d.field,l.value||p,e,i)),h){var f=e.parentElement.querySelector(".e-rule-value");this.element.className.indexOf("e-device")>-1||"Vertical"===this.displayMode?f.style.width="100%":f.style.width="200px"}else{(0,t.removeClass)([e.nextElementSibling],"e-template-value");var v=1;v="boolean"===o.type?this.selectedColumn.values?this.selectedColumn.values.length:2:p&&p.toLowerCase().indexOf("between")>-1?2:1;for(var y=0;y<v;y++){var b=this.createElement("input",{attrs:{type:"text",id:m+"_valuekey"+y}});e.nextElementSibling.appendChild(b)}}this.renderControls(e,l,i,o,h),this.isAngular&&!(0,t.isNullOrUndefined)(l.key)&&l.template&&"DropdownTree"===this.fieldMode&&delete l.template}}},d.prototype.setColumnTemplate=function(e,l,n,r,i,o){var s,a=this,u=!0;if(e.template){if("string"==typeof e.template||void 0===e.template.create)return s={requestType:"value-template-initialize",ruleID:l,field:n,operator:r,rule:o,renderTemplate:!0},this.trigger("actionBegin",s,function(t){u=a.actionBeginSuccessCallBack(t,e,l,n,i)}),u;var d=void 0,c=e.template;if((d="string"==typeof c.create?(0,t.getValue)(c.create,window)({field:n,operator:r}):c.create({field:n,operator:r}))instanceof Element)d.id=l+"_valuekey0",(0,t.addClass)([d],"e-template"),i.nextElementSibling.appendChild(d),n.indexOf(" ")<0&&(0,t.addClass)([d],"e-"+n);else if(d instanceof Array){(0,t.addClass)(d,"e-template");for(var p=0,h=d.length;p<h;p++)d[p].id=l+"_valuekey"+p,i.nextElementSibling.appendChild(d[p])}return(0,t.addClass)([i.nextElementSibling],"e-template-value"),!0}return!0},d.prototype.actionBeginSuccessCallBack=function(e,l,n,r,i){if(e.renderTemplate){var o=void 0;this.columnTemplateFn=this.templateParser((l.template,l.template));var s=this.element.id+r;if(this.isReact)o=this.columnTemplateFn(e,this,n,s)[0],i.nextElementSibling.appendChild(o);else if(this.isAngular){var a=this.columnTemplateFn(e,this,n,s);o=3===a[0].nodeType?a[1]:a[0],i.nextElementSibling.appendChild(o)}else this.isVue3?(o=this.columnTemplateFn(e,this,"Template",s),(0,t.append)(o,i.nextElementSibling)):(o=this.columnTemplateFn(e,this,"Template",s)[0],i.nextElementSibling.appendChild(o));return(0,t.addClass)([i.nextElementSibling],"e-template-value"),this.renderReactTemplates(),!0}return!1},d.prototype.updateValues=function(e,l){var n=1;e.className.indexOf("e-template")>-1&&(n=3);var r,i,o,s,a,u,d=e.className.split(" e-")[n],c=parseInt(e.id.slice(-1),2);switch(d){case"checkbox":s=(0,t.getComponent)(e,d).value,l.value=""!==s?s:void 0;break;case"textbox":u=(0,t.getComponent)(e,d).value,l.operator.indexOf("between")>-1?("string"==typeof l.value&&(l.value=[]),l.value[c]=u):["in","notin"].some(function(e){return-1!==l.operator.indexOf(e)})&&-1===l.operator.indexOf("contains")?l.value=u?"string"===l.type?u.split(",").map(function(e){return e.trim()}):u.split(",").map(Number):[]:l.value=u;break;case"dropdownlist":case"multiselect":l.value=(0,t.getComponent)(e,d).value;break;case"radio":(a=(0,t.getComponent)(e,d)).checked&&("boolean"==typeof l.value?l.value="true"===a.value:this.getColumn(l.field).values?l.value=a.value:l.value="true"===a.value),a.refresh();break;case"numerictextbox":l.operator.indexOf("between")>-1?("string"==typeof l.value&&(l.value=[]),l.value[c]=(0,t.getComponent)(e,d).value):l.value=(0,t.getComponent)(e,d).value;break;case"datepicker":r=this.getColumn(l.field),i=this.getFormat(r.format),o=(0,t.getComponent)(e,d).value,l.operator.indexOf("between")>-1?("string"==typeof l.value&&(l.value=[]),l.value[c]=this.intl.formatDate(o,i)):(0,t.isNullOrUndefined)(i.format)&&o?l.value=this.intl.formatDate(o):l.value=o?this.intl.formatDate(o,i):o}},d.prototype.updateRules=function(e,l,n,r){for(var i,o,s=(0,t.closest)(e,".e-group-container"),a=this.getParentGroup(s),u=(0,t.closest)(e,".e-rule-container"),d=0,c=s.id.replace(this.element.id+"_",""),p=this.getValidRules(this.rule);u&&null!==u.previousElementSibling;)u=u.previousElementSibling,(!this.enableSeparateConnector||this.enableSeparateConnector&&(!this.headerTemplate&&!u.classList.contains("e-btn-group")||this.headerTemplate&&(u.classList.contains("e-rule-container")||u.classList.contains("e-group-container"))))&&d++;var h=a.rules[d].operator?a.rules[d].operator.toString():"",m=(u=(0,t.closest)(e,".e-rule-container")).id.replace(this.element.id+"_","");if((0,t.closest)(e,".e-rule-filter")||(0,t.closest)(e,".e-rule-sub-filter")){this.subFieldElem&&(e=this.subFieldElem),i="DropdownTree"===this.fieldMode?(0,t.getComponent)(e,"dropdowntree"):(0,t.getComponent)(e,"dropdownlist");var g="DropdownTree"===this.fieldMode?this.getColumn(i.value[0]):this.getColumn(i.value);!this.isImportRules&&a.rules[d].field&&a.rules[d].field.toLowerCase()!==g.field.toLowerCase()&&(!u.querySelectorAll(".e-template")&&!(h.indexOf("null")>-1)||h.indexOf("empty")>-1)&&(a.rules[d].value=""),this.selectedColumn=this.getColumn(this.selectedColumn.field),a.rules[d].field=this.selectedColumn.field,a.rules[d].type=this.selectedColumn.type,a.rules[d].label=this.selectedColumn.label;var f=(0,t.closest)(e,".e-rule-filter"),v=(f=f||(0,t.closest)(e,".e-rule-sub-filter")).nextElementSibling.querySelector("input.e-control");v=v||f.nextElementSibling.nextElementSibling.querySelector("input.e-control"),h=(0,t.getComponent)(v,"dropdownlist").value.toString(),a.rules[d].operator=h;var y=f.nextElementSibling.nextElementSibling,b=y.querySelectorAll("input.e-control");b.length<1&&(b=y.querySelectorAll("div.e-control")),b.length<1&&(b=y.querySelectorAll(".e-template")),o={groupID:c,ruleID:m,value:a.rules[d].field,type:"field"};for(var C=0;C<b.length;C++)h.indexOf("null")>-1||h.indexOf("empty")>-1?a.rules[d].value=null:this.updateValues(b[C],a.rules[d]);this.isImportRules||this.prvtEvtTgrDaD||this.trigger("change",o),this.allowValidation&&a.rules[d].field&&e.parentElement.className.indexOf("e-tooltip")>-1&&(0,t.getComponent)(e.parentElement,"tooltip").destroy(),this.filterRules(p,this.getValidRules(this.rule),"field")}else if((0,t.closest)(e,".e-rule-operator")){i=(0,t.getComponent)(e,"dropdownlist"),a.rules[d].operator=i.value.toString();var S=u.querySelectorAll(".e-rule-value input.e-control");o={groupID:c,ruleID:m,value:i.value,type:"operator"},this.allowValidation&&a.rules[d].operator&&e.parentElement.className.indexOf("e-tooltip")>-1&&(0,t.getComponent)(e.parentElement,"tooltip").destroy(),S.length>1&&!(S[0].className.indexOf("e-template")>-1)&&(a.rules[d].value=[]);for(var x=0;x<S.length;x++)a.rules[d].operator.indexOf("null")>-1||a.rules[d].operator.indexOf("empty")>-1?a.rules[d].value=null:S[x].classList.contains("e-template")||this.updateValues(S[x],a.rules[d]);this.isImportRules||this.trigger("change",o),this.filterRules(p,this.getValidRules(this.rule),"operator")}else(0,t.closest)(e,".e-rule-value")&&(this.ruleValueUpdate(e,l,a,d,s,u,n),r||this.filterRules(p,this.getValidRules(this.rule),"value"))},d.prototype.filterRules=function(e,t,l){JSON.stringify({condition:e.condition,not:e.not,rule:e.rules})!==JSON.stringify({condition:t.condition,not:t.not,rule:t.rules})&&(this.isImportRules||this.prvtEvtTgrDaD||this.trigger("ruleChange",{previousRule:e,rule:t,type:l}))},d.prototype.ruleValueUpdate=function(e,t,l,n,r,i,o){var s,a,u=["in","between","notin","notbetween"];if(l.rules[n].operator&&(a=l.rules[n].operator.toString().toLowerCase()),null!==t){if(e.className.indexOf("e-multiselect")>-1&&"number"===l.rules[n].type&&!this.isNotified){for(var d=[],c=t,p=0,h=c.length;p<h;p++)"string"==typeof c[p]&&d.push(parseFloat(c[p]));d.length&&(t=d)}if(this.isNotified)l.rules[n].value=t,s={groupID:r.id,ruleID:i.id,value:l.rules[n].value,type:"value"},this.isImportRules||this.trigger("change",s);else if(e.className.indexOf("e-spin")>-1||e.className.indexOf("e-numeric")>-1)u.indexOf(a)>-1?l.rules[n].value[o]=t:l.rules[n].value=t;else if(e.className.indexOf("e-radio")>-1)l.rules[n].value=t;else if(e.className.indexOf("e-multiselect")>-1)l.rules[n].value=t;else if(e.className.indexOf("e-textbox")>-1)"in"===a||"notin"===a?(l.rules[n].type,l.rules[n].value=this.processValueString(t,l.rules[n].type)):"between"===a||"notbetween"===a?("string"==typeof l.rules[n].value&&(l.rules[n].value=[]),l.rules[n].value[o]=t):l.rules[n].value=t;else if(e.className.indexOf("e-datepicker")>-1){var m=this.getFormat(this.getColumn(this.selectedColumn.field).format);m.type&&(u.indexOf(a)>-1?("string"==typeof l.rules[n].value&&(l.rules[n].value=[]),l.rules[n].value[o]=this.intl.formatDate(t,m)):l.rules[n].value=this.intl.formatDate(t,m))}this.validateValue(l,i,n)}else e.className.indexOf("e-datepicker")>-1&&u.indexOf(a)>-1?("string"==typeof l.rules[n].value&&(l.rules[n].value=[]),l.rules[n].value[o]=t):l.rules[n].value=t},d.prototype.validateValue=function(e,l,n){if(!(0,t.isNullOrUndefined)(e)||!(0,t.isNullOrUndefined)(l)){(0,t.isNullOrUndefined)(n)||(e=e.rules[n]);var r="object"==typeof e.value;if(this.allowValidation&&((0,t.isNullOrUndefined)(n)||(r?e.value.length>0:e.value))){var i=l.querySelectorAll(".e-rule-value .e-control");i.length>0&&(i[0].className.indexOf("e-tooltip")>-1?(0,t.getComponent)(i[0],"tooltip").destroy():i[0].parentElement.className.indexOf("e-tooltip")>-1&&(0,t.getComponent)(i[0].parentElement,"tooltip").destroy(),i[1]&&i[1].parentElement.className.indexOf("e-tooltip")>-1&&(0,t.getComponent)(i[1].parentElement,"tooltip").destroy(),i[2]&&i[2].parentElement.className.indexOf("e-tooltip")>-1&&(0,t.getComponent)(i[2].parentElement,"tooltip").destroy())}}},d.prototype.getFormat=function(e){var t;return e?"string"==typeof e?(t={type:"dateTime"},"short"===e||"yMd"===e?(t.type="date",t.skeleton=e):t.format=e):t={type:"dateTime",skeleton:e.skeleton}:t={type:"date",skeleton:"yMd"},t},d.prototype.findGroupByIdx=function(e,t,l){var n=t.rules,r=[];if(!l){for(var i=0,o=n.length;i<o;i++)(t=n[i]).rules&&r.push(t);return r[e]}return t},d.prototype.destroy=function(){if(this.isDestroy=!0,this.element){var l,n,r,i;for(e.prototype.destroy.call(this),r=(l=this.element.querySelectorAll(".e-addrulegroup")).length,n=0;n<r;n++)(0,t.getComponent)(l[n],"dropdown-btn").destroy(),(0,t.detach)(l[n]);for(i=this.element.querySelectorAll(".e-rule-filter .e-control.e-tooltip"),n=0;n<i.length;n++)(0,t.getComponent)(i[n],"tooltip").destroy();for(r=(l=this.element.querySelectorAll(".e-rule-filter .e-control:not(.e-tooltip)")).length,n=0;n<r;n++)(0,t.getComponent)(l[n],"dropdownlist")?(0,t.getComponent)(l[n],"dropdownlist").destroy():(0,t.getComponent)(l[n],"dropdowntree").destroy(),(0,t.detach)(l[n]);for(i=this.element.querySelectorAll(".e-rule-operator .e-control.e-tooltip"),n=0;n<i.length;n++)(0,t.getComponent)(i[n],"tooltip").destroy();for(r=(l=this.element.querySelectorAll(".e-rule-operator .e-control:not(.e-tooltip)")).length,n=0;n<r;n++)(0,t.getComponent)(l[n],"dropdownlist")&&((0,t.getComponent)(l[n],"dropdownlist").destroy(),(0,t.detach)(l[n]));for(i=this.element.querySelectorAll(".e-rule-value .e-control.e-tooltip"),n=0;n<i.length;n++)(0,t.getComponent)(i[n],"tooltip").destroy();this.isImportRules=!1,this.unWireEvents(),this.levelColl[this.element.id+"_group0"]=[0],this.element.innerHTML="",this.portals&&this.portals.length&&this.clearQBTemplate();var o=document.querySelectorAll(".qb-dropdownlist.e-popup");if(o)for(n=0;n<o.length;n++)o[n].remove();(0,t.classList)(this.element,[],["e-rtl","e-responsive","e-device"]),this.isDestroy=!1,e.prototype.destroy.call(this)}},d.prototype.addRules=function(e,t){t=this.element.id+"_"+t,this.isPublic=!0;for(var l=0,n=e.length;l<n;l++)this.addRuleElement(document.getElementById(t),e[l]);this.isPublic=!1},d.prototype.addGroups=function(e,t){if(this.isAddSuccess||this.element.querySelectorAll(".e-group-container").length<=this.maxGroupCount){t=this.element.id+"_"+t;var l=document.getElementById(t),n=this.getParentGroup(l);if(e.length){this.isPublic=!0;for(var r=0,i=e.length;r<i;r++)this.updatedRule={isLocked:e[r].isLocked,condition:e[r].condition,not:e[r].not},this.importRules(e[r],l,!1,e[r].not);this.isPublic=!1}else{var o="and",s=!1,a=!1;this.updatedRule&&(o=this.updatedRule.condition,s=this.updatedRule.not,a=this.updatedRule.isLocked),this.groupIndex<0?this.enableNotCondition?n.rules.push({condition:o,not:s,rules:[]}):n.rules.push({condition:o,rules:[]}):this.enableNotCondition?n.rules.splice(this.groupIndex+1,0,{condition:o,not:s,rules:[],isLocked:a}):n.rules.splice(this.groupIndex+1,0,{condition:o,rules:[],isLocked:a})}this.headerTemplate||this.disableRuleCondition(l,n,null,!!this.enableSeparateConnector||null)}},d.prototype.initWrapper=function(){if(this.isInitialLoad=!0,this.cssClass&&(0,t.addClass)([this.element],this.cssClass.replace(/\s+/g," ").trim().split(" ")),this.enableSeparateConnector&&(0,t.addClass)([this.element],"e-multi-connector"),this.enableRtl&&(0,t.addClass)([this.element],"e-rtl"),this.width&&(this.element.style.width=this.width),this.height&&(this.element.style.height=this.height),this.rule.rules.length?this.isImportRules=!0:this.addGroupElement(!1,this.element),t.Browser.isDevice||window.innerWidth<768&&!this.isPropChange||"Vertical"===this.displayMode?((t.Browser.isDevice||window.innerWidth<768)&&(this.element.style.width="100%",this.element.classList.add("e-device")),(0,t.removeClass)(this.element.querySelectorAll(".e-rule-container"),"e-horizontal-mode"),(0,t.addClass)(this.element.querySelectorAll(".e-rule-container"),"e-vertical-mode"),this.displayMode="Vertical"):this.displayMode="Horizontal",this.summaryView)this.isImportRules?this.renderSummary():this.renderSummaryCollapse();else{if(this.columns&&this.columns.length&&this.isImportRules){this.addGroupElement(!1,this.element,this.rule.condition,!1,this.rule.not,!1,this.rule);var e=(0,t.extend)({},this.rule,{},!0);this.isRefreshed=!0,this.setGroupRules(e),this.isRefreshed=!1}else this.columns&&this.columns.length&&this.addRuleElement(this.element.querySelector(".e-group-container"),{});this.notGroupRtl(),this.readonly&&this.enableReadonly();for(var l=this.element.querySelectorAll("label.e-btn"),n=void 0,r=0;r<l.length;r++)n=l.item(r),(0,t.rippleEffect)(n,{selector:".e-btn"})}},d.prototype.renderSummary=function(){var e=this.createElement("div",{attrs:{class:"e-summary-content",id:this.element.id+"_summary_content"}}),t=this.createElement("textarea",{attrs:{class:"e-summary-text",readonly:"true"},styles:"max-height:500px"}),l=this.createElement("button",{attrs:{type:"button",class:"e-edit-rule e-css e-btn e-small e-flat e-primary"}}),n=this.createElement("div",{attrs:{class:"e-summary-btndiv"}});e.appendChild(t),t.textContent=this.getSqlFromRules(this.rule),l.textContent=this.l10n.getConstant("Edit"),n.appendChild(l),e.appendChild(n),this.element.appendChild(e)},d.prototype.renderSummaryCollapse=function(){var e=this.createElement("div",{attrs:{class:"e-collapse-rule e-icons",title:this.l10n.getConstant("SummaryViewTitle")}});this.element.querySelector(".e-group-header").appendChild(e)},d.prototype.columnSort=function(){this.sortDirection&&"descending"===this.sortDirection.toLowerCase()?this.columns=new r.DataManager(this.columns).executeLocal((new r.Query).sortByDesc("field")):this.sortDirection&&"ascending"===this.sortDirection.toLowerCase()&&(this.columns=new r.DataManager(this.columns).executeLocal((new r.Query).sortBy("field")))},d.prototype.onChangeNotGroup=function(){if(this.element.innerHTML="",this.groupIdCounter=0,!this.headerTemplate)if(this.enableNotCondition){var e=this.createElement("button",{attrs:{type:"button",class:"e-qb-toggle"}});this.groupElem.querySelector(".e-btn-group")&&this.groupElem.querySelector(".e-btn-group").insertBefore(e,this.groupElem.querySelector(".e-btngroup-and"))}else this.groupElem.querySelector(".e-qb-toggle").remove();this.setProperties({rule:this.checkNotGroup(this.rule)},!0),this.initWrapper()},d.prototype.notGroupRtl=function(){this.enableRtl?(0,t.addClass)(this.element.querySelectorAll(".e-btn-group"),"e-rtl"):(0,t.removeClass)(this.element.querySelectorAll(".e-btn-group"),"e-rtl")},d.prototype.checkNotGroup=function(e){var l;if(e.rules)for(var n=0;n<e.rules.length;n++)l=e.rules[n],l=this.checkNotGroup(l),e.rules[n]=l;return(0,t.isNullOrUndefined)(e.not)?this.enableNotCondition&&!(0,t.isNullOrUndefined)(e.condition)&&(e.not=!1):(this.enableNotCondition&&(e.not=!1),delete e.not),e},d.prototype.onPropertyChanged=function(e,l){var n=Object.keys(e);this.isPropChange=!0;for(var r=this.element.querySelector(".e-group-container"),i=this.element.querySelector(".e-summary-content"),o=0,s=n;o<s.length;o++){switch(s[o]){case"summaryView":e.summaryView?(r.style.display="none",this.element.querySelectorAll(".e-summary-content").length<1?(this.renderSummary(),i=this.element.querySelector(".e-summary-content")):this.element.querySelector(".e-summary-text").textContent=this.getSqlFromRules(this.rule),i.style.display="block"):(r.querySelectorAll(".e-collapse-rule").length>-1&&this.renderSummaryCollapse(),r.style.display="block",i.style.display="none");break;case"displayMode":this.refresh();break;case"showButtons":(0,t.isNullOrUndefined)(e.showButtons.lockGroup)||(e.showButtons.lockGroup?(0,t.removeClass)(this.element.querySelectorAll(".e-lock-grp-btn"),"e-button-hide"):(0,t.addClass)(this.element.querySelectorAll(".e-lock-grp-btn"),"e-button-hide")),(0,t.isNullOrUndefined)(e.showButtons.lockRule)||(e.showButtons.lockRule?(0,t.removeClass)(this.element.querySelectorAll(".e-lock-rule-btn"),"e-button-hide"):(0,t.addClass)(this.element.querySelectorAll(".e-lock-rule-btn"),"e-button-hide")),(0,t.isNullOrUndefined)(e.showButtons.cloneGroup)||(e.showButtons.cloneGroup?(0,t.removeClass)(this.element.querySelectorAll(".e-clone-grp-btn"),"e-button-hide"):(0,t.addClass)(this.element.querySelectorAll(".e-clone-grp-btn"),"e-button-hide")),(0,t.isNullOrUndefined)(e.showButtons.cloneRule)||(e.showButtons.cloneRule?(0,t.removeClass)(this.element.querySelectorAll(".e-clone-rule-btn"),"e-button-hide"):(0,t.addClass)(this.element.querySelectorAll(".e-clone-rule-btn"),"e-button-hide")),(0,t.isNullOrUndefined)(e.showButtons.ruleDelete)||(e.showButtons.ruleDelete?(0,t.removeClass)(this.element.querySelectorAll(".e-rule-delete"),"e-button-hide"):(0,t.addClass)(this.element.querySelectorAll(".e-rule-delete"),"e-button-hide")),(0,t.isNullOrUndefined)(e.showButtons.groupDelete)||(e.showButtons.groupDelete?(0,t.removeClass)(this.element.querySelectorAll(".e-deletegroup"),"e-button-hide"):(0,t.addClass)(this.element.querySelectorAll(".e-deletegroup"),"e-button-hide"));break;case"cssClass":l.cssClass&&(0,t.removeClass)([this.element],l.cssClass.split(" ")),e.cssClass&&(0,t.addClass)([this.element],e.cssClass.replace(/\s+/g," ").trim().split(" "));break;case"enableRtl":e.enableRtl?((0,t.addClass)([this.element],"e-rtl"),this.notGroupRtl()):((0,t.removeClass)([this.element],"e-rtl"),this.notGroupRtl());break;case"enablePersistence":this.enablePersistence=e.enablePersistence;break;case"dataSource":this.dataSource=e.dataSource,this.refresh();break;case"columns":this.columns=e.columns,this.columnSort(),this.updateSubFieldsFromColumns(this.columns);break;case"sortDirection":this.sortDirection=e.sortDirection,this.columnSort();break;case"maxGroupCount":this.maxGroupCount=e.maxGroupCount;break;case"height":this.height=e.height,this.element.style.height=this.height;break;case"rule":0!==this.rule.rules.length||(0,t.isNullOrUndefined)(this.rule)||this.reset(),this.setProperties({rule:e.rule},!0),e.rule=this.getRuleCollection(this.rule,!1),this.setRules(this.rule);break;case"width":this.width=e.width,this.element.style.width=this.width;break;case"locale":this.locale=e.locale,this.intl=new t.Internationalization(this.locale),this.isLocale=!0,this.refresh(),this.isLocale=!1;break;case"enableNotCondition":this.onChangeNotGroup();break;case"readonly":this.isReadonly=e.readonly,this.enableReadonly();break;case"allowDragAndDrop":this.allowDragAndDrop=e.allowDragAndDrop,this.refresh();break;case"enableSeparateConnector":this.enableSeparateConnector=e.enableSeparateConnector,this.refresh()}}this.isPropChange=!1},d.prototype.preRender=function(){this.element.id=this.element.id||(0,t.getUniqueID)("ej2-querybuilder"),this.defaultLocale={StartsWith:"Starts With",DoesNotStartWith:"Does Not Start With",EndsWith:"Ends With",DoesNotEndWith:"Does Not End With",Contains:"Contains",DoesNotContain:"Does Not Contain",NotLike:"Not Like",Like:"Like",Equal:"Equal",NotEqual:"Not Equal",LessThan:"Less Than",LessThanOrEqual:"Less Than Or Equal",GreaterThan:"Greater Than",GreaterThanOrEqual:"Greater Than Or Equal",Between:"Between",NotBetween:"Not Between",In:"In",NotIn:"Not In",Remove:"REMOVE",SelectField:"Select a field",SelectOperator:"Select operator",DeleteRule:"Remove this condition",DeleteGroup:"Delete group",AddGroup:"Add Group",AddCondition:"Add Condition",Edit:"EDIT",ValidationMessage:"This field is required",SummaryViewTitle:"Summary View",OtherFields:"Other Fields",AND:"AND",OR:"OR",NOT:"NOT",SelectValue:"Enter Value",IsEmpty:"Is Empty",IsNotEmpty:"Is Not Empty",IsNull:"Is Null",IsNotNull:"Is Not Null",True:"true",False:"false",AddButton:"Add Group/Condition",CloneGroup:"Clone Group",LockGroup:"Lock Group",CloneRule:"Clone Rule",LockRule:"Lock Rule",UnlockRule:"Unlock Rule",UnlockGroup:"Unlock Group"},this.l10n=new t.L10n("querybuilder",this.defaultLocale,this.locale),this.intl=new t.Internationalization(this.locale),this.groupIdCounter=0,this.subFilterCounter=0,this.ruleIdCounter=0,this.btnGroupId=0,this.isImportRules=!1,this.parser=[],this.customOperators={stringOperator:[{value:"startswith",key:this.l10n.getConstant("StartsWith")},{value:"notstartswith",key:this.l10n.getConstant("DoesNotStartWith")},{value:"endswith",key:this.l10n.getConstant("EndsWith")},{value:"notendswith",key:this.l10n.getConstant("DoesNotEndWith")},{value:"contains",key:this.l10n.getConstant("Contains")},{value:"notcontains",key:this.l10n.getConstant("DoesNotContain")},{value:"equal",key:this.l10n.getConstant("Equal")},{value:"notequal",key:this.l10n.getConstant("NotEqual")},{value:"in",key:this.l10n.getConstant("In")},{value:"notin",key:this.l10n.getConstant("NotIn")},{value:"isempty",key:this.l10n.getConstant("IsEmpty")},{value:"isnotempty",key:this.l10n.getConstant("IsNotEmpty")}],dateOperator:[{value:"equal",key:this.l10n.getConstant("Equal")},{value:"greaterthan",key:this.l10n.getConstant("GreaterThan")},{value:"greaterthanorequal",key:this.l10n.getConstant("GreaterThanOrEqual")},{value:"lessthan",key:this.l10n.getConstant("LessThan")},{value:"lessthanorequal",key:this.l10n.getConstant("LessThanOrEqual")},{value:"notequal",key:this.l10n.getConstant("NotEqual")},{value:"between",key:this.l10n.getConstant("Between")},{value:"notbetween",key:this.l10n.getConstant("NotBetween")}],booleanOperator:[{value:"equal",key:this.l10n.getConstant("Equal")},{value:"notequal",key:this.l10n.getConstant("NotEqual")}],numberOperator:[{value:"equal",key:this.l10n.getConstant("Equal")},{value:"greaterthanorequal",key:this.l10n.getConstant("GreaterThanOrEqual")},{value:"greaterthan",key:this.l10n.getConstant("GreaterThan")},{value:"between",key:this.l10n.getConstant("Between")},{value:"lessthan",key:this.l10n.getConstant("LessThan")},{value:"notbetween",key:this.l10n.getConstant("NotBetween")},{value:"lessthanorequal",key:this.l10n.getConstant("LessThanOrEqual")},{value:"notequal",key:this.l10n.getConstant("NotEqual")},{value:"in",key:this.l10n.getConstant("In")},{value:"notin",key:this.l10n.getConstant("NotIn")}]},this.operators={equal:"=",notequal:"!=",greaterthan:">",greaterthanorequal:">=",lessthan:"<",in:"IN",notin:"NOT IN",lessthanorequal:"<=",startswith:"LIKE",endswith:"LIKE",between:"BETWEEN",notbetween:"NOT BETWEEN",contains:"LIKE",isnull:"IS NULL",isnotnull:"IS NOT NULL",isempty:"IS EMPTY",isnotempty:"IS NOT EMPTY",notstartswith:"NOT LIKE",notendswith:"NOT LIKE",notcontains:"NOT LIKE"},this.sqlOperators={equal:"=",notequal:"!=",greaterthan:">",greaterthanorequal:">=",lessthan:"<",in:this.l10n.getConstant("In").toUpperCase(),notin:this.l10n.getConstant("NotIn").toUpperCase(),lessthanorequal:"<=",startswith:this.l10n.getConstant("Like").toUpperCase(),endswith:this.l10n.getConstant("Like").toUpperCase(),between:this.l10n.getConstant("Between").toUpperCase(),notbetween:this.l10n.getConstant("NotBetween").toUpperCase(),contains:this.l10n.getConstant("Like").toUpperCase(),isnull:this.l10n.getConstant("IsNull").toUpperCase(),isnotnull:this.l10n.getConstant("IsNotNull").toUpperCase(),isempty:this.l10n.getConstant("IsEmpty").toUpperCase(),isnotempty:this.l10n.getConstant("IsNotEmpty").toUpperCase(),notstartswith:this.l10n.getConstant("NotLike").toUpperCase(),notendswith:this.l10n.getConstant("NotLike").toUpperCase(),notcontains:this.l10n.getConstant("NotLike").toUpperCase()},this.fields||(this.fields={text:"label",value:"field"})},d.prototype.render=function(){this.levelColl={},this.items=[{text:this.l10n.getConstant("AddGroup"),iconCss:"e-icons e-add-icon e-addgroup"},{text:this.l10n.getConstant("AddCondition"),iconCss:"e-icons e-add-icon e-addrule"}],this.ruleElem=this.ruleTemplate(),this.groupElem=this.groupTemplate();var e=[{value:"isnull",key:this.l10n.getConstant("IsNull")},{value:"isnotnull",key:this.l10n.getConstant("IsNotNull")}],t=[{value:"isnull",key:this.l10n.getConstant("IsNull")},{value:"isnotnull",key:this.l10n.getConstant("IsNotNull")}];this.customOperators.stringOperator=this.customOperators.stringOperator.concat(e),this.customOperators.numberOperator=this.customOperators.numberOperator.concat(t),this.dataSource instanceof r.DataManager?(this.dataManager=this.dataSource,this.columns&&this.columns.length?(this.dataColl=this.columns,this.initControl()):this.executeDataManager((new r.Query).take(1))):(this.dataManager=new r.DataManager(this.dataSource),this.dataColl=this.dataManager.executeLocal(new r.Query),this.initControl()),this.renderComplete(),this.allowDragAndDrop&&this.initializeDrag()},d.prototype.initializeDrag=function(){this.draggable=new t.Draggable(this.element,{dragTarget:".e-drag-qb-rule",distance:5,helper:this.helper.bind(this),dragStart:this.dragStartHandler.bind(this),drag:this.dragHandler.bind(this),dragStop:this.dragStopHandler.bind(this),isReplaceDragEle:!0,isPreventSelect:!1,abort:".e-parent-header",isDragScroll:!0,enableAutoScroll:!0})},d.prototype.helper=function(e){var l=this.draggable.currentStateTarget;if(!l.classList.contains("e-drag-qb-rule")||l.classList.contains("e-drag-qb-rule")&&(0,t.closest)(l,".e-disable"))return!1;var n,r=this.createElement("div",{className:"e-cloneproperties e-draganddrop e-dragclone",styles:'height:"auto", z-index:2, width:'+this.element.offsetWidth});if(this.draggable.currentStateTarget.parentElement.classList.contains("e-group-header"))n=(0,t.closest)(l,".e-group-container").cloneNode(!0),(0,t.closest)(l,".e-group-container").classList.add("e-qb-dragging-rule");else{r.classList.add("e-group-body"),n=this.createElement("div",{className:"e-rule-container"});var i=(0,t.closest)(l,".e-rule-field").cloneNode(!0);n.appendChild(i),(0,t.closest)(l,".e-rule-field").classList.add("e-qb-dragging-rule")}return r.appendChild(n),r.querySelectorAll("*").forEach(function(e){e.removeAttribute("id")}),this.element.appendChild(r),r},d.prototype.dragStartHandler=function(e){this.draggedRule=e.target,this.isDragEventPrevent=!1,document.body.classList.add("e-prevent-select"),this.dragElement=e.dragElement;var l=(0,t.closest)(e.target,".e-rule-container"),n=(0,t.closest)(e.target,".e-group-container"),r={dragRuleID:null!==l?l.id:n.id,dragGroupID:n.id,cancel:!1};this.trigger("dragStart",r),this.isDragEventPrevent=r.cancel},d.prototype.dragHandler=function(e){if(!this.isDragEventPrevent){var l=this.element.querySelectorAll(".e-drag-rule-bottom-line");if(l.forEach(function(e){e.classList.remove("e-drag-rule-bottom-line")}),(l=this.element.querySelectorAll(".e-drag-rule-top-line")).forEach(function(e){e.classList.remove("e-drag-rule-top-line")}),!(0,t.isNullOrUndefined)(e.target))if("HTML"===e.target.nodeName||(0,t.closest)(e.target,".e-qb-dragging-rule")||(0,t.closest)(e.target,".e-group-header")||!(0,t.closest)(e.target,"#"+this.element.id)||(0,t.closest)(e.target,".e-disable")||e.target.parentElement&&e.target.parentElement.classList.contains("e-btn-group")&&this.enableSeparateConnector)this.dragElement.classList.add("e-notallowedcur");else{this.dragElement.classList.remove("e-notallowedcur");var n=(0,t.closest)(e.target,".e-rule-container"),r=(0,t.closest)(e.target,".e-group-container");if(n){var i=n.getBoundingClientRect(),o=(u=e.event.clientY||e.event.changedTouches[0].clientY)-i.top,s=i.bottom-u;o<(a=20)?n.classList.add("e-drag-rule-top-line"):s<a&&n.classList.add("e-drag-rule-bottom-line")}else if(e.target.classList.contains("e-rule-list")&&0===e.target.children.length)e.target.classList.add("e-drag-rule-bottom-line");else if(e.target.classList.contains("e-rule-list")&&e.target.children[0].classList.contains("e-group-container")){i=e.target.children[0].getBoundingClientRect();(o=(u=e.event.clientY||e.event.changedTouches[0].clientY)-i.top)<(a=20)&&e.target.classList.add("e-drag-rule-top-line")}else if(((0,t.closest)(e.target,".e-group-container")||e.target.classList.contains("e-group-container"))&&(r||(r=e.target),r.id.indexOf("group0")>-1)){i=e.target.getBoundingClientRect();var a,u=e.event.clientY||e.event.changedTouches[0].clientY;(s=i.bottom-u)<(a=20)&&e.target.classList.add("e-drag-rule-bottom-line")}var d={dragRuleID:null!==n?n.id:null!==r?r.id:null,dragGroupID:null!==r?r.id:null,cancel:!1};this.trigger("drag",d),this.isDragEventPrevent=d.cancel}}},d.prototype.dragStopHandler=function(e){var l=this;if(!this.isDragEventPrevent){var n,r,i=(0,t.closest)(e.target,".e-rule-container");if((0,t.isNullOrUndefined)(i)&&e.target.parentElement&&e.target.parentElement.classList.contains("e-btn-group")&&this.enableSeparateConnector&&(i=(0,t.closest)(e.target.parentElement.previousElementSibling,".e-rule-container")),(0,t.isNullOrUndefined)(e.helper)||(n=(0,t.closest)(e.helper,".e-notallowedcur")),!n){var o=(0,t.closest)(e.target,".e-group-container"),s={cancel:!1,dropRuleID:null!==i?i.id:null!==o?o.id:null,dropGroupID:null!==o?o.id:null};this.trigger("drop",s),s.cancel&&(n=!0),r=this.getValidRules()}this.prvtEvtTgrDaD=!0;var a=this.enableSeparateConnector&&e.target.parentElement&&e.target.parentElement.classList.contains("e-btn-group")?e.target.parentElement.previousElementSibling:e.target;if(i&&!n){var u=i.id.split(this.element.id+"_")[1].split("_")[0];if(this.draggable.currentStateTarget.parentElement.classList.contains("e-rule-field")||this.draggable.currentStateTarget.parentElement.classList.contains("e-group-header")){var d=void 0;this.draggable.currentStateTarget.parentElement.classList.contains("e-group-header")?(d=this.getGroup(this.draggedRule),this.deleteGroup((0,t.closest)(this.draggedRule,".e-group-container"))):(d=this.getRule(this.draggedRule),this.deleteRule(this.draggedRule)),(v=(0,t.extend)([],this.getGroup(i),[],!0)).properties&&(v=v.properties),(f=(0,t.closest)(i,".e-group-container")).querySelectorAll(".e-group-container").forEach(function(e){l.element.querySelector("#"+e.id)&&l.deleteGroup(e)});for(var c=f.querySelectorAll(".e-rule-container"),p=[],h=void 0,m=0;m<c.length;m++)(c[m].classList.contains("e-drag-rule-top-line")||c[m].classList.contains("e-drag-rule-bottom-line"))&&(h=m),p.push(c[m].id.split(this.element.id+"_")[1]);this.deleteRules(p),i.classList.contains("e-drag-rule-top-line")?v.rules.splice(h,0,d):v.rules.splice(h+1,0,d),v.rules.forEach(function(e){l.enableSeparateConnector?e.rules?l.addGroups([e],u):l.addRules([e],u):e.condition?l.addGroups([e],u):l.addRules([e],u)})}}else if(a.classList.contains("e-rule-list")&&0===a.children.length&&!n){var g=(f=(0,t.closest)(a,".e-group-container")).id.split(this.element.id+"_")[1].split("_")[0];d=void 0;this.draggable.currentStateTarget.parentElement.classList.contains("e-group-header")?(d=this.getGroup(this.draggedRule),this.deleteGroup((0,t.closest)(this.draggedRule,".e-group-container"))):(d=this.getRule(this.draggedRule),this.deleteRule(this.draggedRule)),this.enableSeparateConnector?d.rules?this.addGroups([d],g):this.addRules([d],g):d.condition?this.addGroups([d],g):this.addRules([d],g)}else if(a.classList.contains("e-rule-list")&&a.children[0].classList.contains("e-group-container")&&!n){var f,v,y=(f=(0,t.closest)(a,".e-group-container")).id.split(this.element.id+"_")[1].split("_")[0];d=void 0;this.draggable.currentStateTarget.parentElement.classList.contains("e-group-header")?(d=this.getGroup(this.draggedRule),this.deleteGroup((0,t.closest)(this.draggedRule,".e-group-container"))):(d=this.getRule(this.draggedRule),this.deleteRule(this.draggedRule)),(v=(0,t.extend)([],this.getGroup(a),[],!0)).properties&&(v=v.properties),a.querySelectorAll(".e-group-container").forEach(function(e){l.element.querySelector("#"+e.id)&&l.deleteGroup(e)}),(c=f.querySelectorAll(".e-rule-container")).forEach(function(e){l.element.querySelector("#"+e.id)&&l.deleteRule(e)}),this.draggable.currentStateTarget.parentElement.classList.contains("e-group-header")?this.addGroups([d],y):this.addRules([d],y),v.rules.forEach(function(e){l.enableSeparateConnector?e.rules?l.addGroups([e],y):l.addRules([e],y):e.condition?l.addGroups([e],y):l.addRules([e],y)})}else if(((0,t.closest)(e.target,".e-group-container")||e.target.classList.contains("e-group-container"))&&!n){d=void 0;!(i=(0,t.closest)(e.target,".e-group-container"))&&e.target.classList.contains("e-group-container")&&(i=e.target),"group0"===(g=i.id.split(this.element.id+"_")[1].split("_")[0])&&(this.draggable.currentStateTarget.parentElement.classList.contains("e-group-header")?(d=this.getGroup(this.draggedRule),this.deleteGroup((0,t.closest)(this.draggedRule,".e-group-container"))):(d=this.getRule(this.draggedRule),this.deleteRule(this.draggedRule)),this.enableSeparateConnector?d.rules?this.addGroups([d],g):this.addRules([d],g):d.condition?this.addGroups([d],g):this.addRules([d],g))}n||this.trigger("ruleChange",{previousRule:r,rule:this.getValidRules(),type:"drag-and-drop"}),this.prvtEvtTgrDaD=!1,document.body.classList.remove("e-prevent-select");var b=this.element.querySelectorAll(".e-drag-rule-bottom-line");b.forEach(function(e){e.classList.remove("e-drag-rule-bottom-line")}),(b=this.element.querySelectorAll(".e-drag-rule-top-line")).forEach(function(e){e.classList.remove("e-drag-rule-top-line")}),(b=this.element.querySelectorAll(".e-qb-dragging-rule")).forEach(function(e){e.classList.remove("e-qb-dragging-rule")}),e.helper&&e.helper.classList.contains("e-cloneproperties")&&document.querySelector("."+e.helper.classList[0])&&(0,t.remove)(e.helper),this.enableSeparateConnector&&this.refresh()}},d.prototype.templateParser=function(e){if(e)try{return"function"!=typeof e&&document.querySelectorAll(e).length?(0,t.compile)(document.querySelector(e).innerHTML.trim()):(0,t.compile)(e)}catch(l){return(0,t.compile)(e)}},d.prototype.executeDataManager=function(e){var t=this,l=this.dataManager.executeQuery(e),n=new r.Deferred;l.then(function(e){e.actual&&e.actual.result?t.dataColl=e.actual.result:t.dataColl=e.result,t.initControl()}).catch(function(e){n.reject(e)})},d.prototype.initControl=function(){this.initialize(),this.initWrapper(),this.wireEvents()},d.prototype.wireEvents=function(){var e=this.getWrapper();t.EventHandler.add(e,"click",this.clickEventHandler,this),t.EventHandler.add(e,"focusout",this.focusEventHandler,this),t.EventHandler.add(e,"focusin",this.focusEventHandler,this),t.EventHandler.add(this.element,"keydown",this.keyBoardHandler,this),this.allowDragAndDrop&&t.EventHandler.add(document,"keydown",this.keyBoardHandler,this),window.addEventListener("resize",this.windowResizeHandler.bind(this))},d.prototype.unWireEvents=function(){var e=this.getWrapper();t.EventHandler.remove(e,"click",this.clickEventHandler),t.EventHandler.remove(e,"focusout",this.focusEventHandler),t.EventHandler.remove(e,"focusin",this.focusEventHandler),t.EventHandler.remove(this.element,"keydown",this.keyBoardHandler),t.EventHandler.remove(document,"keydown",this.keyBoardHandler),window.removeEventListener("resize",this.windowResizeHandler)},d.prototype.getParentGroup=function(e,t){for(var l=e instanceof Element?this.levelColl[e.id]:this.levelColl[""+e],n=t?l.length-1:l.length,r=this.rule,i=0;i<n;i++)r=this.findGroupByIdx(l[i],r,0===i);return r},d.prototype.deleteGroup=function(e){var t,l=this,n=e;if("string"==typeof e?(t=this.element.id+"_"+e,e=document.getElementById(t),t=t.replace(this.element.id+"_","")):t=n.id.replace(this.element.id+"_",""),"group0"!==t&&e){var r={groupID:t,cancel:!1,type:"deleteGroup"};this.isImportRules||this.prvtEvtTgrDaD?this.deleteGroupSuccessCallBack(r,e):this.trigger("beforeChange",r,function(t){l.deleteGroupSuccessCallBack(t,e)})}},d.prototype.deleteGroupSuccessCallBack=function(e,l){if(!e.cancel){var n=l,r=this.getParentGroup(n,!0),i=0,o=void 0,s=void 0,a=this.getValidRules(this.rule),u=n.nextElementSibling,d=n.previousElementSibling,c=n.querySelectorAll(".e-group-container"),p=n.querySelectorAll(".e-tooltip");for(s=p.length,o=0;o<s;o++)(0,t.getComponent)(p[o],"tooltip").destroy();for(o=0,s=c.length;o<s;o++)delete this.levelColl[c[o].id];for(;null!==n.previousElementSibling;)n=n.previousElementSibling,(!this.enableSeparateConnector||this.enableSeparateConnector&&(!this.headerTemplate&&!n.classList.contains("e-btn-group")||this.headerTemplate&&(n.classList.contains("e-rule-container")||n.classList.contains("e-group-container"))))&&i++;this.enableSeparateConnector||u&&u.className.indexOf("e-separate-rule")>-1&&((0,t.removeClass)([u],"e-separate-rule"),(0,t.addClass)([u],"e-joined-rule"),d&&d.className.indexOf("e-rule-container")>-1&&(0,t.addClass)([d],"e-prev-joined-rule"));var h=n.parentElement.parentElement.parentElement,m=[];if(this.isReact||this.isAngular){var g=r.rules[i],f=l.querySelectorAll(".e-rule-container");if(g&&g.rules)for(var v=0;v<g.rules.length;v++){var y=this.getColumn(g.rules[v].field);if(f[v]){var b=f[v].querySelector(".e-template-value");y&&(y.ruleTemplate||this.isPlatformTemplate(y)&&b)&&m.push(f[v].id)}}}(0,t.detach)(l),this.headerTemplate&&this.clearQBTemplate([l.id]),m.length&&this.clearQBTemplate(m),r.rules.splice(i,1),delete this.levelColl[e.groupID],this.refreshLevelColl(),this.disableRuleCondition(h,r),this.enableSeparateConnector&&d&&(!this.headerTemplate&&d.classList.contains("e-btn-group")||this.headerTemplate&&d.classList.contains("e-custom-group-btn"))&&(0,t.detach)(d),this.isImportRules||this.prvtEvtTgrDaD||this.trigger("change",e),this.filterRules(a,this.getValidRules(this.rule),"deleteGroup")}},d.prototype.isPlatformTemplate=function(e){return e.template&&("string"==typeof e.template||void 0===e.template.create)},d.prototype.deleteRule=function(e){var l=this,n={groupID:(0,t.closest)(e,".e-group-container").id.replace(this.element.id+"_",""),ruleID:(0,t.closest)(e,".e-rule-container").id.replace(this.element.id+"_",""),cancel:!1,type:"deleteRule"};this.isImportRules||this.prvtEvtTgrDaD?this.deleteRuleSuccessCallBack(n,e):this.trigger("beforeChange",n,function(t){l.deleteRuleSuccessCallBack(t,e)})},d.prototype.deleteRuleSuccessCallBack=function(e,l){if(!e.cancel){var n=(0,t.closest)(l,".e-group-container"),r=this.getParentGroup(n),i=(0,t.closest)(l,".e-rule-container"),o=this.getValidRules(this.rule),s=i.previousElementSibling,a=0,u=i,d=i.nextElementSibling,c=i.querySelectorAll(".e-tooltip"),p=void 0,h=c.length;for(p=0;p<h;p++)(0,t.getComponent)(c[p],"tooltip").destroy();for(;null!==i.previousElementSibling;)i=i.previousElementSibling,(!this.enableSeparateConnector||this.enableSeparateConnector&&(!this.headerTemplate&&!i.classList.contains("e-btn-group")||this.headerTemplate&&(i.classList.contains("e-rule-container")||i.classList.contains("e-group-container"))))&&a++;var m=this.getColumn(r.rules[a].field);m&&m.template&&u.querySelector(".e-template")&&this.templateDestroy(m,u.querySelector(".e-template").id),(!s||s.className.indexOf("e-rule-container")<0)&&d&&(0,t.removeClass)([d],"e-joined-rule"),(!d||d.className.indexOf("e-rule-container")<0)&&s&&(0,t.removeClass)([s],"e-prev-joined-rule");var g=u.querySelector(".e-template-value");try{if(this.enableSeparateConnector&&(u.previousElementSibling||u.nextElementSibling)){var f=u.previousElementSibling,v=u.nextElementSibling;if((0,t.isNullOrUndefined)(v)&&(!this.headerTemplate&&f.classList.contains("e-btn-group")||this.headerTemplate&&f.classList.contains("e-custom-group-btn"))){if(f&&f.previousElementSibling&&f.previousElementSibling.classList.contains("e-rule-container"))this.getRule(f.previousElementSibling).condition=null;(0,t.detach)(f)}else(!this.headerTemplate&&v.classList.contains("e-btn-group")||this.headerTemplate&&v.classList.contains("e-custom-group-btn"))&&(0,t.detach)(v)}(0,t.detach)(u)}catch(e){return}m&&m.ruleTemplate&&this.clearQBTemplate([u.id]),m&&this.isPlatformTemplate(m)&&g&&this.clearQBTemplate([u.id]),r.rules.splice(a,1),r.rules[0]&&r.rules[0].rules||this.disableRuleCondition(n,r,!!this.enableSeparateConnector);for(var y=this.element.querySelectorAll(".e-tooltip"),b=0;b<y.length;b++)(0,t.getComponent)(y[b],"tooltip").refresh(y[b]);this.isImportRules||this.prvtEvtTgrDaD||this.trigger("change",e),this.filterRules(o,this.getValidRules(this.rule),"deleteRule")}},d.prototype.setGroupRules=function(e,t){if(this.headerTemplate&&t&&(this.isRoot=!0),this.reset(),this.groupIdCounter=1,this.ruleIdCounter=0,this.isImportRules=!0,this.setProperties({rule:e},!0),e=this.getRuleCollection(this.rule,!1),this.importRules(this.rule,this.element.querySelector(".e-group-container"),!0,this.rule.not,t),e.isLocked){var l=this.element.querySelector(".e-group-container").querySelector(".e-lock-grp-btn");this.groupLock(l)}this.isImportRules=!1},d.prototype.keyBoardHandler=function(e){if(e.currentTarget!==this.element||!this.readonly||38!==e.keyCode&&40!==e.keyCode&&13!==e.keyCode){if("Escape"===e.code&&this.allowDragAndDrop){this.isDragEventPrevent=!0,document.body.classList.remove("e-prevent-select");var l=this.element.querySelectorAll(".e-drag-rule-bottom-line");l.forEach(function(e){e.classList.remove("e-drag-rule-bottom-line")}),(l=this.element.querySelectorAll(".e-drag-rule-top-line")).forEach(function(e){e.classList.remove("e-drag-rule-top-line")}),(l=this.element.querySelectorAll(".e-qb-dragging-rule")).forEach(function(e){e.classList.remove("e-qb-dragging-rule")});var n=this.element.querySelector(".e-cloneproperties");n&&(0,t.remove)(n),this.enableSeparateConnector&&this.refresh()}}else e.preventDefault()},d.prototype.windowResizeHandler=function(){t.Browser.isDevice||window.innerWidth<768?this.displayMode="Vertical":this.displayMode="Horizontal"},d.prototype.clearQBTemplate=function(e){(this.isReact||this.isAngular)&&this.clearTemplate(e)},d.prototype.disableRuleCondition=function(e,l,n,r){if(!this.headerTemplate){if(this.readonly)return;var i=e.querySelector(".e-rule-list").childElementCount,o=e.querySelector(".e-btngroup-and"),s=e.querySelector(".e-btngroup-or");if(i>1)if(o.disabled=!1,s.disabled=!1,(s.nextElementSibling.classList.contains("e-btn-disable")||o.nextElementSibling.classList.contains("e-btn-disable"))&&(s.nextElementSibling.classList.remove("e-btn-disable"),o.nextElementSibling.classList.remove("e-btn-disable")),this.enableSeparateConnector&&!n){for(var a=0,u=void 0;;){var d=e.parentElement.querySelectorAll(".e-btngroup-and"),c=e.parentElement.querySelectorAll(".e-btngroup-or");if(o=d[d.length-(1+a)],s=c[c.length-(1+a)],!(u=d[d.length-(1+a)])||!u.parentElement||"none"!==u.parentElement.style.display)break;a++}for(var p=e.previousElementSibling;p&&!p.classList.contains("e-rule-container");){if(p.classList.contains("e-group-container")){p=p.querySelectorAll(".e-rule-container")[p.querySelectorAll(".e-rule-container").length-1];break}p=p.previousElementSibling}if(r&&e.classList.contains("e-group-container"))p=e,"or"===this.getGroup(p).condition?s.checked=!0:o.checked=!0;else if(p&&p.classList.contains("e-rule-container")){var h=p.id.replace(this.element.id+"_","");"or"===this.getRule(h).condition?s.checked=!0:o.checked=!0}}else n||(l&&"or"===l.condition?s.checked=!0:o.checked=!0);else if(this.enableSeparateConnector&&!n){for(a=0,u=void 0;;){d=e.parentElement.querySelectorAll(".e-btngroup-and"),c=e.parentElement.querySelectorAll(".e-btngroup-or");if(o=d[d.length-(1+a)],s=c[c.length-(1+a)],this.isImportRules&&(o=e.parentElement.querySelector(".e-btn-group.e-multi-connector .e-btngroup-and"),s=e.parentElement.querySelector(".e-btn-group.e-multi-connector .e-btngroup-or")),!(u=d[d.length-(1+a)])||!u.parentElement||"none"!==u.parentElement.style.display)break;a++}p=void 0;for(var m=e.previousElementSibling;m;){if(m.classList.contains("e-group-container")&&(m=m.querySelectorAll(".e-rule-container")[m.querySelectorAll(".e-rule-container").length-1]),m.classList.contains("e-rule-container")){p=m;break}m=m.previousElementSibling}if((0,t.isNullOrUndefined)(p)&&e.querySelectorAll(".e-rule-container")[e.querySelectorAll(".e-rule-container").length-1]&&(p=e.querySelectorAll(".e-rule-container")[e.querySelectorAll(".e-rule-container").length-1]),r&&e.classList.contains("e-group-container"))p=e,"or"===this.getGroup(p).condition?s.checked=!0:o.checked=!0;else if(p){h=p.id.replace(this.element.id+"_","");"or"===this.getRule(h).condition&&s?s.checked=!0:o&&(o.checked=!0)}}else n||(0,t.isNullOrUndefined)(o)||(o.checked=!1,o.disabled=!0,s.checked=!1,s.disabled=!0,l&&(s.nextElementSibling.classList.add("e-btn-disable"),o.nextElementSibling.classList.add("e-btn-disable")))}},d.prototype.getValidRules=function(e){this.isValueEmpty=!0,e||(e=this.getRules());var l=e.condition,n=e.not,r=(0,t.extend)([],e.rules,[],!0),i=(0,t.isNullOrUndefined)(e.isLocked)?this.getRuleCollection({condition:l,rules:r,not:n},!0):this.getRuleCollection({condition:l,rules:r,not:n,isLocked:e.isLocked},!0);return this.isValueEmpty=!1,i},d.prototype.getRuleCollection=function(e,l){if((0,t.isNullOrUndefined)(e))return null;var n;if(e.rules&&e.rules.length&&(Object.keys(e.rules[0]).length>6||l))for(var r=e.rules.length,i=0;i<r;i++)n=e.rules[i],n=this.getRuleCollection(n,l),e.rules[i]=n,Object.keys(n).length<1&&l&&(e.rules.splice(i,1),i--,r--);var o=e.custom;if(e.field&&""!==e.field&&((0,t.isNullOrUndefined)(o)||o&&"question"!==o.type&&"answer"!==o.type))if(e.operator&&(e.operator.toString().indexOf("null")>-1||e.operator.toString().indexOf("empty")>-1)&&(e.value=null),this.isRefreshed&&this.enablePersistence||""!==e.field&&""!==e.operator&&(this.isValueEmpty?""!==e.value&&void 0!==e.value:void 0!==e.value)||o&&o.isQuestion){var s=e.condition,a=e.isLocked;e={label:e.label,field:e.field,operator:e.operator,type:e.type,value:e.value},(0,t.isNullOrUndefined)(a)||(e.isLocked=a),s&&(e.condition=s),o&&(e.custom=o),"in"!==e.operator&&"notin"!==e.operator||!e.value||0!==e.value.length||(e={}),("between"===e.operator||"notbetween"===e.operator)&&Array.isArray(e.value)&&(e.value.length<2||e.value.some(function(e){return""===e||null===e}))&&(e={})}else e={};else if(!o||"question"!==o.type&&"answer"!==o.type)if((0,t.isNullOrUndefined)(e.condition)&&(0,t.isNullOrUndefined)(e.rules))e={};else{var u=e.isLocked;e=this.enableNotCondition?{condition:e.condition,rules:e.rules,not:e.not}:{condition:e.condition,rules:e.rules},(0,t.isNullOrUndefined)(u)||(e.isLocked=u),o&&(e.custom=o),e.rules&&0===e.rules.length&&(e={})}else{var d=e.not;(e={label:e.label,field:e.field,operator:e.operator,type:e.type,value:e.value,condition:e.condition,rules:e.rules}).custom=o,this.enableNotCondition&&(e.not=d)}return e},d.prototype.setRules=function(e){var l=(0,t.extend)({},e,{},!0);this.headerTemplate?this.setGroupRules(l,!0):this.setGroupRules(l)},d.prototype.getRules=function(){var e;return e=this.enableNotCondition?{condition:this.rule.condition,rules:this.rule.rules,not:this.rule.not}:{condition:this.rule.condition,rules:this.rule.rules},(0,t.isNullOrUndefined)(this.rule.isLocked)||(e.isLocked=this.rule.isLocked),this.rule.custom&&(e.custom=this.rule.custom),e},d.prototype.getRule=function(e){var l,n,r=0;if(e instanceof HTMLElement?l=(0,t.closest)(e,".e-rule-container"):(n=this.element.id+"_"+e,l=document.getElementById(n)),(0,t.isNullOrUndefined)(l))return null;for(var i=(0,t.closest)(l,".e-group-container"),o=this.getParentGroup(i);null!==l.previousElementSibling;)l=l.previousElementSibling,(!this.enableSeparateConnector||this.enableSeparateConnector&&(!this.headerTemplate&&!l.classList.contains("e-btn-group")||this.headerTemplate&&(l.classList.contains("e-rule-container")||l.classList.contains("e-group-container"))))&&r++;return o.rules[r]},d.prototype.getGroup=function(e){e instanceof Element&&e.className.indexOf("e-group-container")<1&&(e=(0,t.closest)(e,".e-group-container"));var l=e instanceof Element?e.id:this.element.id+"_"+e;return this.getParentGroup(l)},d.prototype.deleteGroups=function(e){var t,l,n=e.length;for(t=0;t<n;t++)"group0"!==e[t]&&(l=this.element.id+"_"+e[t],this.deleteGroup(document.getElementById(l)))},d.prototype.getFilteredRecords=function(){var e=this.getPredicate(this.getValidRules(this.rule)),l=(0,t.isNullOrUndefined)(e)?new r.Query:(new r.Query).where(e);return this.dataManager.executeQuery(l)},d.prototype.deleteRules=function(e){var t,l,n=e.length;for(t=0;t<n;t++)l=this.element.id+"_"+e[t],this.deleteRule(document.getElementById(l))},d.prototype.getDataManagerQuery=function(e){for(var t=this.getPredicate(e),l=[],n=0,i=Object.keys(this.columns);n<i.length;n++)l.push(this.columns[n].field);return e.rules.length?(new r.Query).select(l).where(t):(new r.Query).select(l)},d.prototype.getPredicate=function(e){var l,n,i,o,s=e.rules,a=!1;if(!s)return l;for(var u=0,d=s.length;u<d;u++){var c=s[u].operator;if("notstartswith"===c?c="doesnotstartwith":"notendswith"===c?c="doesnotendwith":"notcontains"===c&&(c="doesnotcontain"),a=!1,Object.keys(s[u]).indexOf("rules")>-1&&s[u].rules)(n=this.getPredicate(s[u]))&&(l=l?"and"===e.condition?l.and(n):l.or(n):n);else if(!(0,t.isNullOrUndefined)(c)&&!(0,t.isNullOrUndefined)(c.length)){var p=s[u].operator.toLowerCase(),h=!1,m=["equal","notequal","greaterthan","greaterthanorequal","lessthan","lessthanorequal"];if("string"===s[u].type&&(a=!this.matchCase),"date"===s[u].type&&m.indexOf(p)>-1&&(a=!0),o=this.getColumn(s[u].field),p.indexOf("null")>-1||p.indexOf("empty")>-1)s[u].value=null;else if("date"!==s[u].type||s[u].value instanceof Array)i=s[u].value;else{var g=this.getFormat(o.format);(0,t.isNullOrUndefined)(s[u].value)?i=null:(i=this.getDate(s[u].value,g),m.indexOf(p)>-1&&!this.isTime(s[u].value)&&(h=!0))}if(0===u)if(h||(p.indexOf("in")>-1||p.indexOf("between")>-1||p.indexOf("null")>-1||p.indexOf("empty")>-1)&&p.indexOf("contain")<0)l=h?this.datePredicate(s[u],i):this.arrayPredicate(s[u]);else""!==(f=i)&&(l=new r.Predicate(s[u].field,c,i,a));else if(h||(p.indexOf("in")>-1||p.indexOf("between")>-1||p.indexOf("null")>-1||p.indexOf("empty")>-1)&&p.indexOf("contain")<0)l=h?this.datePredicate(s[u],i,l,e.condition):this.arrayPredicate(s[u],l,e.condition);else if("and"===e.condition){var f=i;l&&""!==f?l=l.and(s[u].field,c,i,a):""!==f&&(l=new r.Predicate(s[u].field,c,i,a))}else{f=i;l&&""!==f?l=l.or(s[u].field,c,i,a):""!==f&&(l=new r.Predicate(s[u].field,c,i,a))}}}return this.dataSource instanceof r.DataManager&&((0,t.isNullOrUndefined)(l)||"isnull"!==l.operator&&"isnotnull"!==l.operator||(l.operator="isnull"===l.operator?"equal":"notequal")),l},d.prototype.getLocale=function(){var e=this.locale;return(0,t.getValue)("main."+this.locale+".dates.calendars.gregorian.days.format.short",t.cldrData)||(e="en"),e},d.prototype.getColumn=function(e,t){var l,n=this.columns;n=t||n;for(var r=""!==this.separator?e?e.split(this.separator):[]:[e],i=r&&r.length>0?r[0]:null,o=0;o<n.length;o++)if(n[o].field===e){l=n[o];break}if(!l&&""!==this.separator)for(o=0;o<n.length;o++)if(n[o].field===i){if(n[o].columns){var s=e.substring(i.length+this.separator.length);l=s?this.getColumn(s,n[o].columns):n[o]}else l=n[o];break}if(!l)for(o=0;o<n.length&&(!n[o].columns||!(l=this.getColumn(e,n[o].columns)));o++);return l},d.prototype.getOperators=function(e){return this.getColumn(e).operators},d.prototype.setTime=function(e,t){return t?e.setHours(0,0,0):e.setHours(23,59,59),e},d.prototype.datePredicate=function(e,t,l,n){var i,o=this.setTime(new Date(t.getTime()),!0),s=this.setTime(t);switch(e.operator){case"equal":i=(i=new r.Predicate(e.field,"greaterthanorequal",o)).and(e.field,"lessthanorequal",s);break;case"notequal":i=(i=new r.Predicate(e.field,"lessthan",o)).or(e.field,"greaterthan",s);break;case"greaterthan":i=new r.Predicate(e.field,"greaterthan",s);break;case"greaterthanorequal":i=new r.Predicate(e.field,"greaterthanorequal",o);break;case"lessthan":i=new r.Predicate(e.field,"lessthan",o);break;case"lessthanorequal":i=new r.Predicate(e.field,"lessthanorequal",s)}return i&&(l?"and"===n?l=l.and(i):"or"===n&&(l=l.or(i)):l=i),l},d.prototype.arrayPredicate=function(e,t,l){var n,i=e.value,o=e.operator.toString(),s=e.value,a=this.getColumn(e.field),u=this.getFormat(a.format);if(o.indexOf("null")>-1||o.indexOf("empty")>-1)switch(o){case"isnull":n=new r.Predicate(e.field,"isnull",s);break;case"isnotnull":n=new r.Predicate(e.field,"isnotnull",s);break;case"isempty":n=new r.Predicate(e.field,"equal","");break;case"isnotempty":n=new r.Predicate(e.field,"notequal","")}if(!(o.indexOf("null")>-1||o.indexOf("empty")>-1))for(var d=0,c=i.length;d<c;d++)if(""!==i[d]||("in"===o||"notin"===o)&&"string"===a.type)if(0===d){var p="greaterthanorequal";switch(o){case"between":n="date"!==a.type?new r.Predicate(e.field,p,i[d]):new r.Predicate(e.field,p,i[d]?this.isTime(i[d])?this.getDate(i[d],u):this.setTime(this.getDate(i[d],u),!0):null);break;case"notbetween":n="date"===a.type?new r.Predicate(e.field,"lessthan",i[d]?this.isTime(i[d])?this.getDate(i[d],u):this.setTime(this.getDate(i[d],u),!0):null):new r.Predicate(e.field,"lessthan",i[d]);break;case"in":n=new r.Predicate(e.field,"equal",i[d]);break;case"notin":n=new r.Predicate(e.field,"notequal",i[d])}}else{switch(e.operator){case"between":n="date"===a.type?n.and(e.field,"lessthanorequal",i[d]?this.isTime(i[d])?this.getDate(i[d],u):this.setTime(this.getDate(i[d],u)):i[d]):n.and(e.field,"lessthanorequal",i[d]);break;case"notbetween":n="date"===a.type?n.or(e.field,"greaterthan",i[d]?this.isTime(i[d])?this.getDate(i[d],u):this.setTime(this.getDate(i[d],u)):i[d]):n.or(e.field,"greaterthan",i[d]);break;case"in":n=n.or(e.field,"equal",i[d]);break;case"notin":n=n.and(e.field,"notequal",i[d])}}return n&&(t?"and"===l?t=t.and(n):"or"===l&&(t=t.or(n)):t=n),t},d.prototype.getDate=function(e,t){var l=this.intl.parseDate(e,t);return e.indexOf(":")>-1&&e.indexOf("/")<0&&e.indexOf(",")<0&&e.indexOf("-")<0&&((l=new Date).setHours(parseInt(e.split(":")[0],10)),l.setMinutes(parseInt(e.split(":")[1],10)),e.split(":")[2]&&l.setSeconds(parseInt(e.split(":")[2],10))),l},d.prototype.isTime=function(e){return!!(e&&e.indexOf(":")>-1)},d.prototype.importRules=function(e,l,n,r,i){if(n){if(e.rules&&e.rules.length>1&&!this.headerTemplate){var o=l.querySelector(".e-btngroup-or"),s=l.querySelector(".e-btngroup-and");if(this.enableSeparateConnector&&l.previousElementSibling&&(o=l.previousElementSibling.querySelector(".e-btngroup-or"),s=l.previousElementSibling.querySelector(".e-btngroup-and")),o.disabled=!1,s.disabled=!1,this.enableSeparateConnector){for(var a=l.previousElementSibling;a&&!a.classList.contains("e-rule-container");){if(a.classList.contains("e-group-container")){a=a.querySelectorAll(".e-rule-container")[a.querySelectorAll(".e-rule-container").length-1];break}a=a.previousElementSibling}if(a&&a.classList.contains("e-rule-container")){var u=a.id.replace(this.element.id+"_","");"or"===this.getRule(u).condition?o.checked=!0:s.checked=!0}}else"or"===e.condition?o.checked=!0:s.checked=!0}else this.disableRuleCondition(l);if(this.headerTemplate&&i&&(l=this.renderGroup(e,e.condition,this.element,e.not,i)),this.enableNotCondition&&!this.headerTemplate){var d=l.querySelector(".e-qb-toggle");e.not?((0,t.addClass)([d],"e-active-toggle"),this.enableSeparateConnector&&((0,t.getComponent)(d.querySelector(".e-checkbox"),"checkbox").checked=e.not)):(0,t.removeClass)([d],"e-active-toggle")}}else l=this.renderGroup(e,e.condition,l,r);e.rules&&0===e.rules.length&&this.headerTemplate&&(e.rules[0]={label:"",field:"",operator:"",type:"",value:""});var c=e.rules;if(!(0,t.isNullOrUndefined)(c))for(var p=0,h=c.length;p<h;p++){var m=Object.keys(c[p]);if(!(0,t.isNullOrUndefined)(c[p].rules)&&m.indexOf("rules")>-1&&0!==c[p].rules.length){if(this.element.querySelectorAll(".e-group-container").length>this.maxGroupCount)return null;l=this.renderGroup(c[p],c[p].condition,l,c[p].not),l=this.importRules(c[p],l,!0)}else if((0,t.isNullOrUndefined)(c[p].rules))this.renderRule(c[p],l);else{s=(l=this.renderGroup(c[p],c[p].condition,l,c[p].not)).querySelector(".e-btngroup-and"),o=l.querySelector(".e-btngroup-or");s.disabled=!0,o.disabled=!0}if(!(0,t.isNullOrUndefined)(c[p].rules)&&c[p].isLocked){var g=l.querySelector(".e-rule-list").children[p].querySelector(".e-lock-grp-btn");this.groupLock(g)}}return l&&(l=(0,t.closest)(l,".e-rule-list")),l&&(l=(0,t.closest)(l,".e-group-container")),l},d.prototype.renderGroup=function(e,t,l,n,r){this.addGroupElement(!0,l,t,!1,n,r,e);var i=l.querySelectorAll(".e-group-container"),o=l.querySelector(".e-rule-list").children;if(this.showButtons.cloneGroup&&this.cloneGrpBtnClick&&this.isMiddleGroup){this.isMiddleGroup=!1,this.cloneGrpBtnClick=!1;var s=0,a=this.groupIndex+1;if(this.enableSeparateConnector)for(var u=0;u<a;u++)o[u].classList.contains("e-rule-container")&&(a++,s++);return o[this.groupIndex+s+1]}return this.showButtons.cloneGroup&&this.cloneGrpBtnClick&&this.isLastGroup?(this.isLastGroup=!1,this.cloneGrpBtnClick=!1,o[o.length-1]):i[i.length-1]},d.prototype.renderRule=function(e,t){t.className.indexOf("e-group-container")>-1?this.addRuleElement(t,e):this.addRuleElement(t.querySelector(".e-group-container"),e)},d.prototype.enableReadonly=function(){for(var e=this.element.querySelectorAll(".e-dropdownlist, .e-dropdowntree, .e-numerictextbox, .e-textbox, .e-datepicker, .e-multiselect .e-lib, .e-radio"),r=0;r<e.length;r++){if(e[r].classList.contains("e-dropdownlist"))(0,t.getInstance)(e[r],n.DropDownList).readonly=this.isReadonly;else if(e[r].classList.contains("e-dropdowntree")){(0,t.getComponent)(e[r],"dropdowntree").readonly=this.isReadonly}else if(e[r].classList.contains("e-numerictextbox")){(0,t.getInstance)(e[r],i.NumericTextBox).readonly=this.isReadonly}else if(e[r].classList.contains("e-textbox")){(0,t.getInstance)(e[r],i.TextBox).readonly=this.isReadonly}else if(e[r].classList.contains("e-datepicker")){(0,t.getInstance)(e[r],o.DatePicker).readonly=this.isReadonly}else if(e[r].classList.contains("e-multiselect")){(0,t.getInstance)(e[r],n.MultiSelect).readonly=this.isReadonly}else if(e[r].classList.contains("e-radio")){(0,t.getInstance)(e[r],l.RadioButton).checked||(this.isReadonly?e[r].parentElement.style.display="none":e[r].parentElement.style.display="inherit")}}var s=this.element.querySelectorAll(".e-deletegroup"),a=this.element.querySelectorAll(".e-addrulegroup"),u=this.element.querySelectorAll(".e-removerule");!this.isReadonly&&this.ruleElem.classList.contains("e-readonly")&&this.ruleElem.classList.remove("e-readonly");var d=[s,a,u];for(r=0;r<d.length;r++)d[r].forEach(function(e){e.classList.contains("e-readonly")?e.classList.remove("e-readonly"):e.classList.add("e-readonly")});this.enableBtnGroup()},d.prototype.enableBtnGroup=function(){var e=this,t=this.element.querySelectorAll(".e-btngroup-and-lbl, .e-btngroup-or-lbl, .e-qb-toggle"),l=!1;t.forEach(function(t){!t.classList.contains("e-qb-toggle")||t.classList.contains("e-active-toggle")||t.classList.contains("e-readonly")?t.classList.contains("e-qb-toggle")&&t.classList.contains("e-not-readonly")?t.classList.remove("e-not-readonly"):t.classList.contains("e-qb-toggle")&&t.classList.contains("e-readonly")?t.classList.remove("e-readonly"):t.classList.contains("e-active-toggle")?(t.classList.add("e-not-readonly"),l=!0):t.previousElementSibling.checked||t.classList.contains("e-readonly")?(t.classList.remove("e-readonly"),l?"AND"===t.textContent?t.classList.add("e-readonly-and"):t.classList.add("e-readonly-or"):("AND"===t.textContent&&e.isReadonly?(t.classList.remove("e-not"),t.classList.add("e-readonly-and")):(e.enableNotCondition&&t.classList.add("e-not"),t.classList.remove("e-readonly-and")),"OR"===t.textContent&&e.isReadonly?t.classList.add("e-readonly-or-not"):t.classList.remove("e-readonly-or-not"))):t.classList.contains("e-btn-disable")||t.classList.add("e-readonly"):(t.classList.add("e-readonly"),l=!1)})},d.prototype.isDateFunction=function(e){for(var t=["date","time","day","week","month","year","hour","minute","second","now","quarter","period","extract"],l=0,n=t.length;l<n;l++)if(e.toLowerCase().indexOf(t[l])>-1)return!0;return!1},d.prototype.getSqlString=function(e,t,l,n){var r=this,i=!1;if(l||""===l?l+="(":(l="",i=!0),e.not){var o=n?this.l10n.getConstant("NOT").toUpperCase()+" ":"NOT ";l+=i?o+"(":" "+o+"("}return e.rules&&e.rules.length&&(l+=e.rules.reduce(function(l,i,o){var s="";if(i.rules)s=r.getSqlString(i,t,"",n),r.enableSeparateConnector&&(e.condition=i.condition);else{var a=n?r.sqlOperators[i.operator]:r.operators[i.operator],u="";if(i.value instanceof Array)if(i.operator.toString().indexOf("between")>-1){var d=n?" "+r.l10n.getConstant("AND").toUpperCase()+" ":" AND ";u="date"!==i.type||r.isDateFunction(i.value[0])?""+i.value[0]+d+i.value[1]:'"'+i.value[0]+'"'+d+'"'+i.value[1]+'"'}else{if("string"==typeof i.value[0]&&null!==i.value)u='("'+i.value.join('","')+'")';else u="("+i.value+")"}else u=i.operator.toString().indexOf("startswith")>-1?i.value?'("'+i.value+'%")':"("+i.value+")":i.operator.toString().indexOf("endswith")>-1?i.value?'("%'+i.value+'")':"("+i.value+")":i.operator.toString().indexOf("contains")>-1?i.value?'("%'+i.value+'%")':"("+i.value+")":"number"===i.type||"boolean"==typeof i.value||null===i.value&&i.operator.toString().indexOf("empty")<-1?""+i.value:i.operator.toString().indexOf("empty")>-1?'""':'"'+i.value+'"';var c=i.field;if(t?c="`"+c+"`":c.indexOf(" ")>-1&&(c='"'+c+'"'),i.operator.toString().indexOf("null")>-1)s=c+" "+a;else{var p=a;"isempty"===i.operator?p="=":"isnotempty"===i.operator&&(p="!="),s=c+" "+p+" "+u}}if(o!==e.rules.length-1){var h=e.condition;(""===h||i&&""!==i.condition&&i.custom&&i.custom.isCustom)&&(h=i.condition),h&&(s+=" "+(h=n?r.l10n.getConstant(h.toUpperCase()).toUpperCase():h.toUpperCase())+" ")}return l+s},"")),i||(l+=")"),e.not&&(l+=")"),l},d.prototype.setRulesFromSql=function(e,t){e=e.replace(/`/g,"");var l=this.getRulesFromSql(e,t);this.setRules({condition:l.condition,not:l.not,rules:l.rules})},d.prototype.getRulesFromSql=function(e,t){this.parser=[],this.sqlParser(e,t),this.setProperties({rule:{condition:"and",not:!1,rules:[]}},!0);var l=this.processParser(this.parser,this.rule,[0],t);return this.enableNotCondition?{condition:l.condition,not:l.not,rules:l.rules}:{condition:l.condition,rules:l.rules}},d.prototype.getSqlFromRules=function(e,t,l){return e||(e=this.getValidRules()),e=this.getRuleCollection(e,!1),this.getSqlString(this.getValidRules(e),t,null,l).replace(/"/g,"'")},d.prototype.getParameterizedSql=function(e){if(this.moduleLoader.loadedModules.length){e||(e=this.getValidRules());var t={sql:null};return this.notify("query-library",{prop:"getParameterSql",onPropertyChange:!1,value:{rule:e,obj:t}}),t.sql}return console.warn('[WARNING] :: Module "query-library" is not available in QueryBuilder component! You either misspelled the module name or forgot to load it.'),null},d.prototype.setParameterizedSql=function(e){if(this.moduleLoader.loadedModules.length){var t={sql:null};this.notify("query-library",{prop:"convertParamSqlToSql",onPropertyChange:!1,value:{sql:e,obj:t}});var l=t.sql;if(l){l=l.replace(/`/g,"");var n=this.getRulesFromSql(l);this.setRules({condition:n.condition,not:n.not,rules:n.rules})}}else console.warn('[WARNING] :: Module "query-library" is not available in QueryBuilder component! You either misspelled the module name or forgot to load it.')},d.prototype.getParameterizedNamedSql=function(e){if(this.moduleLoader.loadedModules.length){e||(e=this.getValidRules());var t={sql:null};return this.notify("query-library",{prop:"getNamedParameterSql",onPropertyChange:!1,value:{rule:e,obj:t}}),t.sql}return console.warn('[WARNING] :: Module "query-library" is not available in QueryBuilder component! You either misspelled the module name or forgot to load it.'),null},d.prototype.setParameterizedNamedSql=function(e){if(this.moduleLoader.loadedModules.length){var t={sql:null};this.notify("query-library",{prop:"convertNamedParamSqlToSql",onPropertyChange:!1,value:{sql:e,obj:t}});var l=t.sql;if(l){l=l.replace(/`/g,"");var n=this.getRulesFromSql(l);this.setRules({condition:n.condition,not:n.not,rules:n.rules})}}else console.warn('[WARNING] :: Module "query-library" is not available in QueryBuilder component! You either misspelled the module name or forgot to load it.')},d.prototype.setMongoQuery=function(e,t){this.moduleLoader.loadedModules.length?(this.rule={condition:"and",not:!1,rules:[]},this.notify("query-library",{prop:"mongoParser",onPropertyChange:!1,value:{mongoQuery:JSON.parse(e),rule:this.rule,mongoLocale:t}})):console.warn('[WARNING] :: Module "query-library" is not available in QueryBuilder component! You either misspelled the module name or forgot to load it.')},d.prototype.getMongoQuery=function(e){if(this.moduleLoader.loadedModules.length){e||(e=this.getValidRules());var t={mongoQuery:null};return this.notify("query-library",{prop:"getMongoFromRules",onPropertyChange:!1,value:{rule:e,mongoQuery:"",obj:t}}),t.mongoQuery}return console.warn('[WARNING] :: Module "query-library" is not available in QueryBuilder component! You either misspelled the module name or forgot to load it.'),""},d.prototype.cloneRule=function(e,t,l){var n=this.getRule(e.replace(this.element.id+"_","")),r=this.showButtons.cloneRule;t=t.replace(this.element.id+"_",""),this.ruleIndex=l,this.cloneRuleBtnClick=!0,this.showButtons.cloneRule=!0,this.addRules([{label:n.label,field:n.field,type:n.type,operator:n.operator,value:n.value,condition:n.condition}],t),this.ruleIndex=-1,this.cloneRuleBtnClick=!1,this.showButtons.cloneRule=r,r=!1},d.prototype.cloneGroup=function(e,t,l){t=t.replace(this.element.id+"_","");var n=this.getGroup(t),r=this.showButtons.cloneGroup;e=e.replace(this.element.id+"_",""),this.groupIndex=l,this.cloneGrpBtnClick=!0,this.showButtons.cloneGroup=!0,this.addGroups([{condition:n.condition,not:n.not,rules:n.rules}],e),this.groupIndex=-1,this.cloneGrpBtnClick=!1,this.showButtons.cloneGroup=r,r=!1},d.prototype.lockRule=function(e){e.indexOf(this.element.id)<0&&(e=this.element.id+"_"+e);var t=document.getElementById(e).querySelectorAll(".e-lock-rule-btn")[0];this.ruleLock(t)},d.prototype.lockGroup=function(e){e.indexOf(this.element.id)<0&&(e=this.element.id+"_"+e);var t=document.getElementById(e).querySelectorAll(".e-lock-grp-btn")[0];this.groupLock(t)},d.prototype.sqlParser=function(e,t){var l,n=0;do{l=e.slice(n),n+=this.parseSqlStrings(l,t)}while(""!==l);return this.parser},d.prototype.parseSqlStrings=function(e,t){var l,n,r,i,o=["=","!=","<=",">=","<",">"];l=t?[this.l10n.getConstant("AND").toUpperCase(),this.l10n.getConstant("OR").toUpperCase(),this.l10n.getConstant("NOT").toUpperCase()]:["AND","OR","NOT"],n=t?[this.l10n.getConstant("In").toUpperCase(),this.l10n.getConstant("NotIn").toUpperCase(),this.l10n.getConstant("Like").toUpperCase(),this.l10n.getConstant("NotLike").toUpperCase(),this.l10n.getConstant("Between").toUpperCase(),this.l10n.getConstant("NotBetween").toUpperCase(),this.l10n.getConstant("IsNull").toUpperCase(),this.l10n.getConstant("IsNotNull").toUpperCase(),this.l10n.getConstant("IsEmpty").toUpperCase(),this.l10n.getConstant("IsNotEmpty").toUpperCase()]:["IN","NOT IN","LIKE","NOT LIKE","BETWEEN","NOT BETWEEN","IS NULL","IS NOT NULL","IS EMPTY","IS NOT EMPTY"];for(var s=0,a=o.length;s<a;s++){if(r=/^\w+$/.test(o[s])?"\\b":"",new RegExp("^("+o[s]+")"+r,"ig").exec(e))return this.parser.push(["Operators",o[s].toLowerCase()]),o[s].length}var u=this.parser[this.parser.length-1];if(!u||u&&"Literal"!==u[0])for(s=0,a=l.length;s<a;s++){if(r=/^\w+$/.test(l[s])?"\\b":"",new RegExp("^("+l[s]+")"+r,"ig").exec(e))return this.parser.push(["Conditions",l[s].toLowerCase()]),l[s].length}for(s=0,a=n.length;s<a;s++){if(r=/^\w+$/.test(n[s])?"\\b":"",new RegExp("^("+n[s]+")"+r,"ig").exec(e))return this.parser.push(["SubOperators",n[s].toLowerCase()]),n[s].length}if(/^\(/.exec(e))return this.parser.push(["Left","("]),1;if(/^\)/.exec(e))return this.parser.push(["Right",")"]),1;if(/^(true|false)/.exec(e))return i=/^(true|false)/.exec(e)[0],this.parser.push(["String",i]),i.length;if(/^null/.exec(e))return i=/^null/.exec(e)[0],this.parser.push(["String",null]),i.length;if(/^`?([a-z_][a-z0-9_.\\[\]\\(\\)]{0,}(\\:(number|float|string|date|boolean))?)`?/i.exec(e))return i=/^`?([a-z_][a-z0-9_.\\[\]\\(\\)]{0,}(\\:(number|float|string|date|boolean))?)`?/i.exec(e)[1],this.parser.push(["Literal",i]),i.length;if(this.checkLiteral()&&/^'?([a-z_][a-z0-9 _.\\[\]\\(\\)-]{0,}(\\:(number|float|string|date|boolean))?)'?/i.exec(e))return i=/^'?([a-z_][a-z0-9 _.\\[\]\\(\\)-]{0,}(\\:(number|float|string|date|boolean))?)'?/i.exec(e)[1],this.parser.push(["Literal",i]),i.length+2;if(this.checkNumberLiteral(e,t)){var d=/^[0-9]+(\.[0-9]+)$/.exec(e);if(d)return i=d[0],this.parser.push(["Literal",i]),i.length}var c=this.getSingleQuoteString(e);if(""!==c){if("("===(i=c)[i.length-2])for(var p=!1,h=i.length;h<e.length&&(i+=e[h],")"===e[h]&&(p=!0),!p||"'"!==e[h]);h++);else e[i.length]&&")"!==e[i.length]&&!this.checkCondition(e,i)&&(i=this.combineSingleQuoteString(e,i));return this.parser.push(["String",i]),i.length}var m=this.getDoubleQuoteString(e);return""!==m?(i=m,this.parser.push(["DoubleString",i]),i.length):/^\d*\.?\d+/.exec(e)?(i=/^\d*\.?\d+/.exec(e)[0],this.parser.push(["Number",i]),i.length):/^-?\d*\.?\d+/.exec(e)?(i=/^-?\d*\.?\d+/.exec(e)[0],this.parser.push(["Number",i]),i.length):1},d.prototype.getDoubleQuoteString=function(e){var t=e.indexOf('"');if(0===t){var l=e.indexOf('"',t+1);if(-1!==l)return e.substring(t,l+1)}return""},d.prototype.checkCondition=function(e,t){return"AND"===e.slice(t.length+1,t.length+4)||"OR"===e.slice(t.length+1,t.length+3)},d.prototype.getSingleQuoteString=function(e,t){var l=e.indexOf("'");if(-1!==l&&t||0===l&&!t){var n=e.indexOf("'",l+1);if(-1!==n)return e.substring(l,n+1)}return""},d.prototype.combineSingleQuoteString=function(e,t){if(e[t.length]&&")"!==e[t.length]&&!this.checkCondition(e,t)&&","!==e[t.length]){var l=t.substring(0,t.length-1),n=e.replace(l,""),r=this.getSingleQuoteString(n,!0);if(""!==r)t+=r.substring(1,r.length),t=this.combineSingleQuoteString(e,t)}return t},d.prototype.checkLiteral=function(){var e=this.parser[this.parser.length-1];if(!e)return!0;var t=this.parser[this.parser.length-2],l=this.parser[this.parser.length-3];if("Left"===e[0]&&t&&"Conditions"===t[0])return!0;return!!("Conditions"===e[0]&&l&&l[1].indexOf("between")<0)},d.prototype.checkNumberLiteral=function(e,t){var l=this.parser[this.parser.length-1];if(!l)return!0;if(/^[0-9]+(?:\.[0-9]+)$/.exec(e)){var n=this.parser[this.parser.length-2],r=this.parser[this.parser.length-3];if("Left"===l[0]&&n&&"Conditions"===n[0])return!0;var i=t?this.l10n.getConstant("Between").toLowerCase():"between";if("Conditions"===l[0]&&r&&r[1].indexOf(i)<0)return!0}return!1},d.prototype.getOperator=function(e,t,l){if(l){for(var n=Object.keys(this.sqlOperators),r=0;r<n.length;r++)if(this.sqlOperators[n[r]]===t.toUpperCase())return e&&0===e.indexOf("%")&&"%"===e[e.length-1]?"NOT LIKE"===t.toUpperCase()?"notcontains":"contains":e&&0!==e.indexOf("%")&&e.indexOf("%")===e.length-1?"NOT LIKE"===t.toUpperCase()?"notstartswith":"startswith":e&&0===e.indexOf("%")&&e.indexOf("%")!==e.length-1?"NOT LIKE"===t.toUpperCase()?"notendswith":"endswith":n[r];return null}if(e){if(0===e.indexOf("%")&&"%"===e[e.length-1])return"not like"===t?"notcontains":"contains";if(0!==e.indexOf("%")&&e.indexOf("%")===e.length-1)return"not like"===t?"notstartswith":"startswith";if(0===e.indexOf("%")&&e.indexOf("%")!==e.length-1)return"not like"===t?"notendswith":"endswith"}else{if("not like"===t)return"notequal";if("like"===t)return"equal"}return{"=":"equal","!=":"notequal","<":"lessthan",">":"greaterthan","<=":"lessthanorequal",">=":"greaterthanorequal",in:"in","not in":"notin",between:"between","not between":"notbetween","is empty":"isempty","is null":"isnull","is not null":"isnotnull","is not empty":"isnotempty"}[""+t]},d.prototype.getTypeFromColumn=function(e){var l=this.getColumn(e.field);return(0,t.isNullOrUndefined)(l)?null:l.type},d.prototype.getLabelFromColumn=function(e){var t="",l=0;if(""!==this.separator){for(var n=e.split(this.separator),r=0;r<n.length;r++)t+=this.getLabelFromField(n,r+1),++l<n.length&&(t+=this.separator);return t}return this.getColumn(e).label},d.prototype.getLabelFromField=function(e,t){for(var l="",n=0,r=0;r<t;r++)l+=e[r],++n<t&&(l+=this.separator);return this.getColumn(l)?this.getColumn(l).label:""},d.prototype.processParser=function(e,t,l,n){for(var r,i,o,s,a,u,d,c,p,h,m=[],g=[],f=!1,v=!1,y=0,b=e.length;y<b;y++)if("Literal"===e[y][0]){var C=this.getColumn(e[y][1]);if(o={label:C&&C.label?C.label:e[y][1],field:e[y][1]},"SubOperators"===e[y+1][0]){if(e[y+1][1].indexOf("null")>-1||e[y+1][1].indexOf("empty")>-1)o.operator=this.getOperator(" ",e[y+1][1],n),o.value=null,o.type=this.getTypeFromColumn(o);else if(3===e.length&&"String"===e[2][0]&&-1!==e[2][1].indexOf("%")){var S=e[y+2][1]?e[y+2][1].replace(/'/g,""):e[y+2][1];o.operator=this.getOperator(S,e[y+1][1],n)}else{S=e[y+3][1]?e[y+3][1].replace(/'/g,""):e[y+3][1];o.operator=this.getOperator(S,e[y+1][1],n)}for(h=e[y+1][1],r=++y+1,i=b,n&&"contains"===o.operator||"startswith"===o.operator||"endswith"===o.operator?h="like":n&&"notcontains"===o.operator||"notstartswith"===o.operator||"notendswith"===o.operator?h="not like":n&&(h=o.operator),r=y+1;r<i;r++)if(h.indexOf("between")<0&&"Left"===e[r][0])f=!0;else{if("Right"===e[r][0]&&f){y=r,f=!1;break}if(h.indexOf("null")>-1||h.indexOf("empty")>-1)break;if(h.indexOf("like")>-1&&"String"===e[r][0]){var x=e[r][1];e[r][1]&&"'"===e[r][1][0]&&(x=e[r][1].substring(1,e[r][1].length-1)),x=x?x.replace(/%/g,""):e[r][1],o.value=x,o.type="string"}else if(h.indexOf("between")>-1){if("Literal"===e[r][0]||"Left"===e[r][0])break;if("Number"===e[r][0])m.push(Number(e[r][1]));else if("String"===e[r][0]){x=e[r][1];e[r][1]&&"'"===e[r][1][0]&&(x=e[r][1].substring(1,e[r][1].length-1)),g.push(x)}}else if("Number"===e[r][0])m.push(Number(e[r][1]));else if("String"===e[r][0]){x=e[r][1];e[r][1]&&"'"===e[r][1][0]&&(x=e[r][1].substring(1,e[r][1].length-1)),g.push(x)}o.type=this.getTypeFromColumn(o)}h.indexOf("like")<0&&("Number"===e[r-1][0]?(o.value=m,o.type="number"):"String"===e[r-1][0]?(o.value=g,o.type="string"):h.indexOf("between")>-1&&"Conditions"===e[r-1][0]&&(0!==g.length?(o.value=g,o.type="string"):(o.value=m,o.type="number")),m=[],g=[],o.type=this.getTypeFromColumn(o)),this.enableSeparateConnector&&"Conditions"===e[y+1][0]&&(o.condition=e[y+1][1])}else if("Operators"===e[y+1][0]){if(o.operator=this.getOperator(e[y+2][1],e[y+1][1],n),"equal"===o.operator&&"String"===e[y+2][0]&&"''"===e[y+2][1]?o.operator="isempty":"notequal"===o.operator&&"String"===e[y+2][0]&&"''"===e[y+2][1]&&(o.operator="isnotempty"),"Number"===e[y+2][0])o.type="number",o.value=Number(e[y+2][1]);else o.type="string",(x=e[y+2][1])&&"'"===x[0]&&(x=x.substring(1,x.length-1)),o.value=x;this.enableSeparateConnector&&"Conditions"===e[y+3][0]&&(o.condition=e[y+3][1]),o.type=this.getTypeFromColumn(o)}t.rules.push(o)}else{if("Left"===e[y][0]){if("Left"!==e[0][0]&&("not"===e[y-1][1]||n&&this.l10n.getConstant("NOT").toLowerCase()===e[y-1][1])){v=!0;continue}for(this.parser=e.splice(y+1,b-(y+1)),s=this.enableNotCondition?{condition:"and",rules:[],not:!1}:{condition:"and",rules:[]},p=0,u=t.rules.length,a=0;a<u;a++)t.rules[a].rules&&p++;return l.push(p),t.rules.push(s),s=this.processParser(this.parser,s,l,n),t}if("Conditions"!==e[y][0]||this.enableSeparateConnector){if("Right"===e[y][0]){if(v&&"Right"===e[y+1][0]){v=!1;continue}for(this.parser=e.splice(y+1,b-(y+1)),l.pop(),t=this.rule,c=l.length,d=0;d<c;d++)t=this.findGroupByIdx(l[d],t,0===d);return this.processParser(this.parser,t,l,n)}}else"not"===e[y][1]||n&&this.l10n.getConstant("NOT").toLowerCase()===e[y][1]?t.not=!0:t.condition=e[y][1]}return t},d.prototype.groupClone=function(e){var t=e.closest(".e-rule-list").closest(".e-group-container"),l=e.id.replace(this.element.id+"_",""),n=t.id.replace(this.element.id+"_",""),r=this.getGroup(l);this.groupIndex=Array.prototype.indexOf.call(e.closest(".e-rule-list").children,e.closest(".e-group-container")),this.addGroups([{condition:r.condition,not:r.not,rules:r.rules}],n),this.groupIndex=-1},d.prototype.ruleClone=function(e){for(var l=(0,t.closest)(e,".e-rule-container"),n=e.closest(".e-rule-list").closest(".e-group-container"),r=this.getRule(e),i=n.id.replace(this.element.id+"_",""),o=n.querySelectorAll(".e-rule-container"),s=0,a=o.length;s<a;s++)l.id===o[s].id&&(this.ruleIndex=s);this.enableSeparateConnector?this.addRules([{label:r.label,field:r.field,type:r.type,operator:r.operator,value:r.value,condition:r.condition}],i):this.addRules([{label:r.label,field:r.field,type:r.type,operator:r.operator,value:r.value}],i),this.ruleIndex=-1},d.prototype.ruleLock=function(e){var l=(0,t.closest)(e,".e-rule-container"),n=this.getRule(l.id.replace(this.element.id+"_",""));l.classList.contains("e-disable")?(n.isLocked=!1,this.lockItems=this.lockItems.filter(function(e){return e!==l.id}),l.classList.remove("e-disable"),this.disableRuleControls(e,l,!1),e.children[0].classList.add("e-unlock"),e.children[0].classList.remove("e-lock"),e.setAttribute("title",this.l10n.getConstant("LockRule"))):(n.isLocked=!0,this.lockItems.indexOf(l.id)<0&&this.lockItems.splice(this.lockItems.length-1,0,l.id),l.classList.add("e-disable"),this.disableRuleControls(e,l,!0),e.children[0].classList.add("e-lock"),e.children[0].classList.remove("e-unlock"),e.setAttribute("title",this.l10n.getConstant("UnlockRule")))},d.prototype.groupLock=function(e){var l=(0,t.closest)(e,".e-group-container"),n=this.getGroup(l.id.replace(this.element.id+"_","")),r=l.id.indexOf("group0")>-1;if(l.classList.contains("e-disable")){if(r)(i={}).condition=n.condition,i.not=n.not,i.isLocked=!1,this.setProperties({rule:i},!0);else n.isLocked=!1;this.lockItems=this.lockItems.filter(function(e){return e!==l.id}),l.classList.remove("e-disable"),this.disableHeaderControls(e,l,!1),e.children[0].classList.add("e-unlock"),e.children[0].classList.remove("e-lock"),e.setAttribute("title",this.l10n.getConstant("LockGroup")),this.updateLockItems()}else{var i;if(r)(i={}).condition=n.condition,i.not=n.not,i.isLocked=!0,this.setProperties({rule:i},!0);else n.isLocked=!0;this.lockItems.indexOf(l.id)<0&&this.lockItems.splice(this.lockItems.length-1,0,l.id),l.classList.add("e-disable"),this.disableHeaderControls(e,l,!0),e.children[0].classList.add("e-lock"),e.children[0].classList.remove("e-unlock"),e.setAttribute("title",this.l10n.getConstant("UnlockGroup"))}},d.prototype.updateLockItems=function(){for(var e=0;e<this.lockItems.length;e++){if(this.lockItems[e].split("_").length>2){var l=this.element.querySelector("#"+this.lockItems[e]),n=l.querySelector(".e-lock-rule-btn");(l=(0,t.closest)(n,".e-rule-container")).classList.contains("e-disable")||this.ruleLock(n)}else{var r=this.element.querySelector("#"+this.lockItems[e]);n=r.querySelector(".e-lock-grp-btn");(r=(0,t.closest)(n,".e-group-container")).classList.contains("e-disable")||this.groupLock(n)}}},d.prototype.disableHeaderControls=function(e,t,l){for(var n=t.querySelectorAll(".e-btngroup-and"),r=t.querySelectorAll(".e-btngroup-or"),i=t.querySelectorAll(".e-qb-toggle"),o=t.querySelectorAll(".e-add-btn"),s=t.querySelectorAll(".e-deletegroup"),a=t.querySelectorAll(".e-lock-grp-btn"),u=t.querySelectorAll(".e-clone-grp-btn"),d=t.querySelectorAll(".e-group-container"),c=t.querySelectorAll(".e-add-condition-btn"),p=t.querySelectorAll(".e-add-group-btn"),h=0;h<n.length;h++)l?(d[h]&&d[h].classList.contains("e-disable")&&d[h].classList.add("e-disable"),n[h].disabled=!0,r[h].disabled=!0,o[h]&&(o[h].disabled=!0),c[h]&&(c[h].disabled=!0),p[h]&&(p[h].disabled=!0),i[h]&&(i[h].disabled=!0),s[h]&&(s[h].disabled=!0),u[h]&&(u[h].disabled=!0),n[h].parentElement.classList.add("e-disabled"),a[h]&&a[h]!==e&&(a[h].disabled=!0,a[h].children[0].classList.remove("e-unlock"),a[h].children[0].classList.add("e-lock"))):(d[h]&&d[h].classList.remove("e-disable"),n[h].disabled=!1,r[h].disabled=!1,o[h]&&(o[h].disabled=!1),c[h]&&(c[h].disabled=!1),p[h]&&(p[h].disabled=!1),a[h]&&(a[h].disabled=!1),i[h]&&(i[h].disabled=!1),s[h]&&(s[h].disabled=!1),u[h]&&(u[h].disabled=!1),n[h].parentElement.classList.remove("e-disabled"),a[h]&&a[h].children[0].classList.remove("e-lock"),a[h]&&a[h].children[0].classList.add("e-unlock"));this.disableRuleControls(e,t,l)},d.prototype.disableRuleControls=function(e,l,n){var r=function(e,t,l){e.forEach(function(e){var n=t(e);"enabled"in n?n.enabled=!l:"disabled"in n&&(n.disabled=l)})},i={ddl:l.querySelectorAll(".e-control.e-dropdownlist"),numeric:l.querySelectorAll(".e-control.e-numerictextbox"),text:l.querySelectorAll(".e-control.e-textbox"),date:l.querySelectorAll(".e-control.e-datepicker"),checkbox:l.querySelectorAll(".e-control.e-checkbox"),radio:l.querySelectorAll(".e-control.e-radio"),multiSelect:l.querySelectorAll(".e-control.e-multiselect"),deleteElem:l.querySelectorAll(".e-rule-delete"),lockElem:l.querySelectorAll(".e-lock-rule"),cloneElem:l.querySelectorAll(".e-clone-rule"),ruleElem:l.querySelectorAll(".e-rule-container"),ddTree:l.querySelectorAll(".e-control.e-dropdowntree")};i.deleteElem.forEach(function(t,l){n?(i.ruleElem[l]&&i.ruleElem[l].classList.contains("e-disable")&&i.ruleElem[l].classList.add("e-disable"),i.deleteElem[l].disabled=!0,i.cloneElem[l]&&(i.cloneElem[l].disabled=!0),i.lockElem[l]!==e&&(i.lockElem[l].disabled=!0,i.lockElem[l].children[0].classList.remove("e-unlock"),i.lockElem[l].children[0].classList.add("e-lock"))):(i.ruleElem[l]&&i.ruleElem[l].classList.remove("e-disable"),i.cloneElem[l]&&(i.cloneElem[l].disabled=!1),i.deleteElem[l].disabled=!1,i.lockElem[l].disabled=!1,i.lockElem[l].children[0].classList.remove("e-lock"),i.lockElem[l].children[0].classList.add("e-unlock"))}),r(i.ddl,function(e){return(0,t.getComponent)(e,"dropdownlist")},n),r(i.numeric,function(e){return(0,t.getComponent)(e,"numerictextbox")},n),r(i.text,function(e){return(0,t.getComponent)(e,"textbox")},n),r(i.date,function(e){return(0,t.getComponent)(e,"datepicker")},n),r(i.checkbox,function(e){return(0,t.getComponent)(e,"checkbox")},n),r(i.radio,function(e){return(0,t.getComponent)(e,"radio")},n),r(i.multiSelect,function(e){return(0,t.getComponent)(e,"multiselect")},n),r(i.ddTree,function(e){return(0,t.getComponent)(e,"dropdowntree")},n)},h([(0,t.Event)()],d.prototype,"created",void 0),h([(0,t.Event)()],d.prototype,"destroyed",void 0),h([(0,t.Event)()],d.prototype,"actionBegin",void 0),h([(0,t.Event)()],d.prototype,"beforeChange",void 0),h([(0,t.Event)()],d.prototype,"change",void 0),h([(0,t.Event)()],d.prototype,"dataBound",void 0),h([(0,t.Event)()],d.prototype,"ruleChange",void 0),h([(0,t.Event)()],d.prototype,"dragStart",void 0),h([(0,t.Event)()],d.prototype,"drag",void 0),h([(0,t.Event)()],d.prototype,"drop",void 0),h([(0,t.Complex)({},v)],d.prototype,"showButtons",void 0),h([(0,t.Property)(!1)],d.prototype,"summaryView",void 0),h([(0,t.Property)(!1)],d.prototype,"allowValidation",void 0),h([(0,t.Property)("Default")],d.prototype,"fieldMode",void 0),h([(0,t.Property)([])],d.prototype,"columns",void 0),h([(0,t.Property)(null)],d.prototype,"fieldModel",void 0),h([(0,t.Property)(null)],d.prototype,"operatorModel",void 0),h([(0,t.Property)(null)],d.prototype,"valueModel",void 0),h([(0,t.Property)()],d.prototype,"headerTemplate",void 0),h([(0,t.Property)("")],d.prototype,"cssClass",void 0),h([(0,t.Property)([])],d.prototype,"dataSource",void 0),h([(0,t.Property)("Horizontal")],d.prototype,"displayMode",void 0),h([(0,t.Property)(!1)],d.prototype,"enablePersistence",void 0),h([(0,t.Property)("Default")],d.prototype,"sortDirection",void 0),h([(0,t.Property)(5)],d.prototype,"maxGroupCount",void 0),h([(0,t.Property)("auto")],d.prototype,"height",void 0),h([(0,t.Property)("auto")],d.prototype,"width",void 0),h([(0,t.Property)(!1)],d.prototype,"matchCase",void 0),h([(0,t.Property)(0)],d.prototype,"immediateModeDelay",void 0),h([(0,t.Property)(!1)],d.prototype,"enableNotCondition",void 0),h([(0,t.Property)(!1)],d.prototype,"readonly",void 0),h([(0,t.Property)(!0)],d.prototype,"addRuleToNewGroups",void 0),h([(0,t.Property)(!1)],d.prototype,"autoSelectField",void 0),h([(0,t.Property)(!0)],d.prototype,"autoSelectOperator",void 0),h([(0,t.Property)("")],d.prototype,"separator",void 0),h([(0,t.Property)(!1)],d.prototype,"enableSeparateConnector",void 0),h([(0,t.Complex)({condition:"and",rules:[]},g)],d.prototype,"rule",void 0),h([(0,t.Property)(!1)],d.prototype,"allowDragAndDrop",void 0),d=h([t.NotifyPropertyChanges],d)}(t.Component),b=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.destroy=function(){this.parent.isDestroyed||this.removeEventListener()},e.prototype.addEventListener=function(){this.parent.isDestroyed||(this.parent.on("query-library",this.queryLibrary,this),this.parent.on("destroyed",this.destroy,this))},e.prototype.removeEventListener=function(){this.parent.off("query-library",this.queryLibrary),this.parent.off("destroyed",this.destroy)},e.prototype.queryLibrary=function(e){switch(e.prop){case"getMongoFromRules":e.value.obj.mongoQuery=this.getMongoFromRules(e.value.rule,e.value.mongoQuery);break;case"mongoParser":this.mongoParser(e.value.mongoQuery,e.value.rule,e.value.mongoLocale);break;case"getParameterSql":e.value.obj.sql=this.getParameterSql(e.value.rule);break;case"getNamedParameterSql":e.value.obj.sql=this.getNamedParameterSql(e.value.rule);break;case"convertParamSqlToSql":e.value.obj.sql=this.convertParamSqlToSql(e.value.sql);break;case"convertNamedParamSqlToSql":e.value.obj.sql=this.convertNamedParamSqlToSql(e.value.sql)}},e.prototype.getMongoFromRules=function(e,t){return t="{","or"===e.condition?(t+='"$or":[',t=this.convertMongoQuery(e.rules,t)+"]"):(t+='"$and":[',t=this.convertMongoQuery(e.rules,t)+"]"),t+="}"},e.prototype.getOperatorFromMongoOperator=function(e){var t;switch(e){case"$ne":t="notequal";break;case"$gt":t="greaterthan";break;case"$gte":t="greaterthanorequal";break;case"$lt":t="lessthan";break;case"$lte":t="lessthanorequal";break;case"$nin":t="notin"}return t},e.prototype.convertMongoQuery=function(e,t){var l=this,n=0;return e.forEach(function(r){n++,t+="{",void 0!==r.rules&&("or"===r.condition?(t+=' "$or":[',t=l.convertMongoQuery(r.rules,t)+"]"):(t+=' "$and":[',t=l.convertMongoQuery(r.rules,t)+"]"));var i="string"===r.type&&"in"!==r.operator&&"notin"!==r.operator&&r.value&&""!==r.value.trim()?r.value.replace(/'/g,"\\"):"";"string"!==r.type||"in"!==r.operator&&"notin"!==r.operator||!r.value||1!==r.value.length||(i=r.value[0].replace(/'/g,"\\"));var o=r.field?r.field.substring(0):"";switch(r.operator){case"contains":t+='"'+o+'":{"$regex":"'+i+'"}';break;case"notcontains":t+='"'+o+'":{"$not":{"$regex":"'+r.value+'"}}';break;case"startswith":t+='"'+o+'":{"$regex":"^'+i+'"}';break;case"notstartswith":t+='"'+o+'":{"$not":{"$regex":"^'+r.value+'"}}';break;case"endswith":t+='"'+o+'":{"$regex":"'+i+'$"}';break;case"notendswith":t+='"'+o+'":{"$not":{"$regex":"'+r.value+'$"}}';break;case"isnull":t+='"'+o+'": null';break;case"isnotnull":t+='"'+o+'":{"$ne": null}';break;case"isempty":t+='"'+o+'": ""';break;case"isnotempty":t+='"'+o+'":{"$ne": ""}';break;case"equal":"string"===r.type?t+='"'+o+'":"'+i+'"':"date"===r.type?t+='"'+o+'":"'+r.value+'"':(r.type,t+='"'+o+'":'+r.value);break;case"notequal":"string"===r.type?t+='"'+o+'":{"$ne":"'+i+'"}':"date"===r.type?t+='"'+o+'":{"$ne":"'+r.value+'"}':t+='"'+o+'":{"$ne":'+r.value+"}";break;case"in":if("string"===r.type)if(r.value.length>1)s=(s=r.value.map(function(e,t){return t<r.value.length?'"'+e+'"':""}).toString()).endsWith(",")?s.substring(0,s.length-1):s,t+='"'+o+'": { "$in": ['+s+"]}";else t+='"'+o+'": { "$in": ["'+i+'"]}';else"number"===r.type&&(r.value.length>1?t+='"'+o+'": { "$in": ['+r.value.toString()+"]}":t+='"'+o+'": { "$in": ['+r.value+"]}");break;case"notin":var s;if("string"===r.type)if(r.value.length>1)s=(s=r.value.map(function(e,t){return t<r.value.length?'"'+e+'"':""}).toString()).endsWith(",")?s.substring(0,s.length-1):s,t+='"'+o+'": { "$nin": ['+s+"]}";else t+='"'+o+'": { "$nin": ["'+i+'"]}';else"number"===r.type&&(r.value.length>1?t+='"'+o+'": { "$nin": ['+r.value.toString()+"]}":t+='"'+o+'": { "$nin": ['+r.value+"]}");break;case"greaterthan":"number"===r.type?t+='"'+o+'": { "$gt": '+r.value+"}":t+='"'+o+'": { "$gt": "'+r.value+'"}';break;case"greaterthanorequal":"number"===r.type?t+='"'+o+'": { "$gte": '+r.value+"}":t+='"'+o+'": { "$gte": "'+r.value+'"}';break;case"between":"number"===r.type?t+='"'+o+'": {"$gte":'+r.value[0]+', "$lte":'+r.value[1]+"}":t+='"'+o+'": {"$gte": "'+r.value[0]+'", "$lte": "'+r.value[1]+'"}';break;case"notbetween":"number"===r.type?t+='"$or":[{"'+o+'": {"$lt":'+r.value[0]+'}}, {"'+o+'": {"$gt":'+r.value[1]+"}}]":t+='"$or":[{"'+o+'": {"$lt": "'+r.value[0]+'"}}, {"'+o+'": {"$gt": "'+r.value[1]+'"}}]';break;case"lessthan":"number"===r.type?t+='"'+o+'": { "$lt": '+r.value+"}":t+='"'+o+'": { "$lt": "'+r.value+'"}';break;case"lessthanorequal":"number"===r.type?t+='"'+o+'": { "$lte": '+r.value+"}":t+='"'+o+'": { "$lte": "'+r.value+'"}'}t+="}",e.length!==n&&(t+=",")}),t},e.prototype.mongoParser=function(e,t,l){var n;Object.keys(e).indexOf("$and")>-1?(n=e.$and,t.condition="and"):Object.keys(e).indexOf("$or")>-1&&(n=e.$or,t.condition="or"),t.rules=[],this.mongoRecursion(n,t.rules,l)},e.prototype.mongoRecursion=function(e,l,n){for(var r,i,o,s,a,u,d,c,p,h,m,g,f=0,v=e.length;f<v;f++){var y=[],b=[];if(d=Object.keys(e[f])[0],c=e[f][d],"$and"===d)p=this.parent.enableNotCondition?{condition:d.replace("$",""),rules:[],not:!1}:{condition:d.replace("$",""),rules:[]},l.push(p),this.mongoRecursion(e[f][d],l[l.length-1].rules,n);else if("$or"===d){var C=void 0,S=[],x=[],E=[],q=[],O=[],k=[],w=[];Array.isArray(c)&&2===c.length&&(k=c[(x=Object.keys(c))[0]],w=c[x[1]],"object"==typeof k&&(S=Object.keys(k)[0],E=Object.keys(k[Object.keys(k)[0]])[0],q=Object.keys(w[Object.keys(w)[0]])[0],"$lt"===E&&"$gt"===q&&(r="notbetween",h={field:S,label:S,value:g=[O=k[S][E],w[S][q]],operator:r,type:i="number"==typeof O?"number":"date"},l.push(h),C=!0))),C||(p=this.parent.enableNotCondition?{condition:d.replace("$",""),rules:[],not:!1}:{condition:d.replace("$",""),rules:[]},l.push(p),this.mongoRecursion(e[f][d],l[l.length-1].rules,n))}else{if(null===(c=e[f][d])&&(r="isnull"),"boolean"==typeof c&&(r="equal",i="boolean",g=c),"number"==typeof c)g=c,i="number",r="equal";else if("object"==typeof c&&null!==c){m=Object.keys(c);for(var N=0;N<m.length;N++)if(s=m[N],o=c[m[N]],"$ne"===s&&(0,t.isNullOrUndefined)(o)&&(r="isnotnull",g=null),"$ne"===s&&"boolean"==typeof o&&(r="notequal",g=o,i="boolean"),m.length>=2&&m[N]?("object"==typeof o?(r="notbetween",d=Object.keys(o)[0],a=[Object.keys(o[d])[0]],y.push(o[d][a]),i="number"):(r="between",y.push(o)),"number"==typeof o&&(i="number")):"object"==typeof o&&null!==o?"$not"===s&&"$regex"===Object.keys(o)[0]?o.$regex.indexOf("^")>-1?(r="notstartswith",g=o.$regex.replace("^","")):o.$regex.indexOf("$")>-1?(r="notendswith",g=o.$regex.replace("$","")):(r="notcontains",g=o.$regex):(r="$in"===s?"in":"notin",b=o,i="number"==typeof o[0]?"number":"string"):"number"==typeof o&&(r=this.getOperatorFromMongoOperator(s),i="number",g=o),"string"==typeof o){"$regex"===s&&(r="contains",g=o,i="string"),"$ne"===s&&(null!==o&&o.length>0&&isNaN(Date.parse(o))?(r="notequal",g=o):(0,t.isNullOrUndefined)(o)?(r="isnotnull",g=o):""===o&&(r="isnotempty",g=o),i="string"),o.indexOf("^")>-1&&(r="startswith",g=o.replace("^",""),i="string"),o.indexOf("$")>-1&&"$not"!==s&&(r="endswith",g=o.replace("$",""),i="string");for(var L=0,R=this.parent.columns;L<R.length;L++){var D=R[L];if(D.field===d){u=D.type;break}}isNaN(Date.parse(o))&&"date"!==u||(r=r||this.getOperatorFromMongoOperator(s),i="date",g=o)}}else c&&"string"==typeof c&&!isNaN(Date.parse(c))?(r="equal",g=c,i="date"):"string"==typeof c&&""!==c&&"true"!==c&&"false"!==c?(r="equal",g=c,i="string"):"string"==typeof c&&""===c&&(r="isempty",g=c,i="string");h=y&&y.length>1?{field:d,label:d,value:y,operator:r,type:i}:b&&b.length>1?{field:d,label:d,value:b,operator:r,type:i}:{field:d,label:d,value:g,operator:r,type:i},l.push(h),r=""}}},e.prototype.convertParamSqlToSql=function(e){for(var t=e.sql,l=e.params,n=t.split("?"),r=n[0],i=0;i<l.length;i++)r+="string"==typeof l[i]?"'"+l[i]+"'"+n[i+1]:l[i]+n[i+1];return r.length>=2&&"("===r[0]&&")"===r[r.length-1]&&(r=r.slice(1,-1)),r=r.replace(/!= ''(?! =)/g,"IS NOT EMPTY").replace(/= ''/g,"IS EMPTY")},e.prototype.convertNamedParamSqlToSql=function(e){var t=e.sql,l=e.params,n=t;return Object.keys(l).forEach(function(e){var t=l[e];e=":"+e,n=n.replace(e,"string"==typeof t?"'"+t+"'":String(t))}),n.length>=2&&"("===n[0]&&")"===n[n.length-1]&&(n=n.slice(1,-1)),n=n.replace(/!= ''(?! =)/g,"IS NOT EMPTY").replace(/= ''/g,"IS EMPTY")},e.prototype.getParameterSql=function(e){var l=(0,t.extend)({},e,null,!0),n=this.updateRuleValue(l,!1);return this.getParameterSQLVal(this.parent.getSqlFromRules(l),n.ruleVal)},e.prototype.getNamedParameterSql=function(e){var l=(0,t.extend)({},e,null,!0),n=this.updateRuleValue(l,!0);return this.getNamedParameterSQLVal(this.parent.getSqlFromRules(l),n.namedRuleVal)},e.prototype.getParameterSQLVal=function(e,t){return{sql:"("+e.replace(/[%']/g,"")+")",params:t}},e.prototype.getNamedParameterSQLVal=function(e,t){return{sql:"("+e.replace(/[%']/g,"")+")",params:t}},e.prototype.updateRuleValue=function(e,t){return this.updateValue(e.rules,t,[],{},[])},e.prototype.updateValue=function(e,l,n,r,i){if((0,t.isNullOrUndefined)(e))return{ruleVal:n,namedRuleVal:r};for(var o=0;o<e.length;o++)if(e[o].rules){n=(u=this.updateValue(e[o].rules,l,n,r,i)).ruleVal,r=u.namedRuleVal}else{var s=void 0;if(e[o].value instanceof Array)for(var a=0;a<e[o].value.length;a++)l&&(s=this.getNamedParameter(e[o].field,i)),(0,t.isNullOrUndefined)(e[o].value[a])||("string"===e[o].type||e[o].type,l?r[s]=e[o].value[a]:n.push(e[o].value[a])),e[o].value[a]=l?":"+s:"?";else if(l&&(s=this.getNamedParameter(e[o].field,i)),e[o].operator.indexOf("null")<1&&("string"!==e[o].type||"string"===e[o].type&&(""!==e[o].value||0===e[o].value))){if("string"===e[o].type||"date"===e[o].type)if(e[o].operator.indexOf("empty")<1){var u=e[o].value.toString();switch(e[o].operator){case"startswith":case"notstartswith":u+="%";break;case"endswith":case"notendswith":u="%"+u;break;case"contains":case"notcontains":u="%"+u+"%"}l?r[s]=u:n.push(u)}else l?r[s]="":n.push(""),"isempty"===e[o].operator?e[o].operator="equal":e[o].operator="notequal";else(0,t.isNullOrUndefined)(e[o].value)||(l?r[s]=e[o].value:n.push(e[o].value));e[o].value=l?":"+s:"?"}}return{ruleVal:n,namedRuleVal:r}},e.prototype.getNamedParameter=function(e,t){var l=null;if(t.length>0)for(var n=t.length-1;n>=0;n--){var r=t[n];if(r.indexOf(e)>-1){l=e+"_"+(parseInt(r.split("_")[1],10)+1),t.push(l);break}}return l||(l=e+"_1",t.push(l)),l},e.prototype.getModuleName=function(){return"query-library"},e}()})(),c})());
|