@easyquery/ui 7.2.4-rc02 → 7.2.4-rc04

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.
@@ -1,2 +1,2 @@
1
- (function(){var __webpack_modules__={305:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.d(__webpack_exports__,{z:function(){return browserUtils}});var _utils__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(464),browserUtils;(function(browserUtils){var _isFirefox=null,_isIE=null;function isIE(){return eval("/*@cc_on!@*/false || !!document.documentMode")}function isFirefox(){if(null===_isFirefox){var t=navigator.userAgent;_isFirefox=t.toLowerCase().indexOf("firefox")>-1}return _isFirefox}browserUtils.isIE=isIE,browserUtils.isFirefox=isFirefox;var _detectedIsMobileMode=!1,_isMobileMode=void 0,detectIsMobileMode=function(){var t=isMobileMode();_detectedIsMobileMode=window.matchMedia("only screen and (max-width: 840px)").matches||window.matchMedia("only screen and (max-height: 420px)").matches;var e=isMobileMode();e!==t&&mobileModeChangeHandler&&mobileModeChangeHandler(e)},mobileModeChangeHandler;function isMobileMode(){return void 0!==_isMobileMode?_isMobileMode:_detectedIsMobileMode}function setIsMobileMode(t){var e=isMobileMode();_isMobileMode=t;var n=isMobileMode();n!==e&&mobileModeChangeHandler&&mobileModeChangeHandler(n)}function onMobileModeChanged(t){mobileModeChangeHandler=t}function getMobileCssClass(){return isMobileMode()?_utils__WEBPACK_IMPORTED_MODULE_0__.XD:null}detectIsMobileMode(),window.addEventListener("resize",(function(){return detectIsMobileMode()})),browserUtils.isMobileMode=isMobileMode,browserUtils.setIsMobileMode=setIsMobileMode,browserUtils.onMobileModeChanged=onMobileModeChanged,browserUtils.getMobileCssClass=getMobileCssClass})(browserUtils||(browserUtils={}))},464:function(t,e,n){"use strict";n.d(e,{X1:function(){return o},XD:function(){return s},YR:function(){return r},n6:function(){return i}});n(514);function o(t){for(var e=0;null!==t;){var n=document.defaultView.getComputedStyle(t,null).getPropertyValue("z-index");if("auto"!=n){var o=parseInt(n);o>e&&(e=o)}t=t.parentElement}return e}function i(t){setTimeout((function(e){t&&t.focus()}),100)}var r="eqjs",s="eqjs-mobile"},702:function(t,e,n){t.exports=function(){"use strict";function t(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}function e(t){return"function"==typeof t}var o=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},i=0,r=void 0,s=void 0,a=function(t,e){b[i]=t,b[i+1]=e,2===(i+=2)&&(s?s(x):E())};function l(t){s=t}function u(t){a=t}var c="undefined"!=typeof window?window:void 0,d=c||{},h=d.MutationObserver||d.WebKitMutationObserver,p="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),f="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function g(){return function(){return process.nextTick(x)}}function y(){return void 0!==r?function(){r(x)}:C()}function m(){var t=0,e=new h(x),n=document.createTextNode("");return e.observe(n,{characterData:!0}),function(){n.data=t=++t%2}}function v(){var t=new MessageChannel;return t.port1.onmessage=x,function(){return t.port2.postMessage(0)}}function C(){var t=setTimeout;return function(){return t(x,1)}}var b=new Array(1e3);function x(){for(var t=0;t<i;t+=2)(0,b[t])(b[t+1]),b[t]=void 0,b[t+1]=void 0;i=0}function w(){try{var t=Function("return this")().require("vertx");return r=t.runOnLoop||t.runOnContext,y()}catch(t){return C()}}var E=void 0;function T(t,e){var n=this,o=new this.constructor(k);void 0===o[S]&&U(o);var i=n._state;if(i){var r=arguments[i-1];a((function(){return W(i,o,r,n._result)}))}else j(n,o,t,e);return o}function D(t){var e=this;if(t&&"object"==typeof t&&t.constructor===e)return t;var n=new e(k);return F(n,t),n}E=p?g():h?m():f?v():void 0===c?w():C();var S=Math.random().toString(36).substring(2);function k(){}var M=void 0,I=1,B=2;function A(){return new TypeError("You cannot resolve a promise with itself")}function _(){return new TypeError("A promises callback cannot return that same promise.")}function P(t,e,n,o){try{t.call(e,n,o)}catch(t){return t}}function O(t,e,n){a((function(t){var o=!1,i=P(n,e,(function(n){o||(o=!0,e!==n?F(t,n):Q(t,n))}),(function(e){o||(o=!0,N(t,e))}),"Settle: "+(t._label||" unknown promise"));!o&&i&&(o=!0,N(t,i))}),t)}function L(t,e){e._state===I?Q(t,e._result):e._state===B?N(t,e._result):j(e,void 0,(function(e){return F(t,e)}),(function(e){return N(t,e)}))}function R(t,n,o){n.constructor===t.constructor&&o===T&&n.constructor.resolve===D?L(t,n):void 0===o?Q(t,n):e(o)?O(t,n,o):Q(t,n)}function F(e,n){if(e===n)N(e,A());else if(t(n)){var o=void 0;try{o=n.then}catch(t){return void N(e,t)}R(e,n,o)}else Q(e,n)}function q(t){t._onerror&&t._onerror(t._result),H(t)}function Q(t,e){t._state===M&&(t._result=e,t._state=I,0!==t._subscribers.length&&a(H,t))}function N(t,e){t._state===M&&(t._state=B,t._result=e,a(q,t))}function j(t,e,n,o){var i=t._subscribers,r=i.length;t._onerror=null,i[r]=e,i[r+I]=n,i[r+B]=o,0===r&&t._state&&a(H,t)}function H(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var o=void 0,i=void 0,r=t._result,s=0;s<e.length;s+=3)o=e[s],i=e[s+n],o?W(n,o,i,r):i(r);t._subscribers.length=0}}function W(t,n,o,i){var r=e(o),s=void 0,a=void 0,l=!0;if(r){try{s=o(i)}catch(t){l=!1,a=t}if(n===s)return void N(n,_())}else s=i;n._state!==M||(r&&l?F(n,s):!1===l?N(n,a):t===I?Q(n,s):t===B&&N(n,s))}function G(t,e){try{e((function(e){F(t,e)}),(function(e){N(t,e)}))}catch(e){N(t,e)}}var z=0;function V(){return z++}function U(t){t[S]=z++,t._state=void 0,t._result=void 0,t._subscribers=[]}function Y(){return new Error("Array Methods must be provided an Array")}var J=function(){function t(t,e){this._instanceConstructor=t,this.promise=new t(k),this.promise[S]||U(this.promise),o(e)?(this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?Q(this.promise,this._result):(this.length=this.length||0,this._enumerate(e),0===this._remaining&&Q(this.promise,this._result))):N(this.promise,Y())}return t.prototype._enumerate=function(t){for(var e=0;this._state===M&&e<t.length;e++)this._eachEntry(t[e],e)},t.prototype._eachEntry=function(t,e){var n=this._instanceConstructor,o=n.resolve;if(o===D){var i=void 0,r=void 0,s=!1;try{i=t.then}catch(t){s=!0,r=t}if(i===T&&t._state!==M)this._settledAt(t._state,e,t._result);else if("function"!=typeof i)this._remaining--,this._result[e]=t;else if(n===et){var a=new n(k);s?N(a,r):R(a,t,i),this._willSettleAt(a,e)}else this._willSettleAt(new n((function(e){return e(t)})),e)}else this._willSettleAt(o(t),e)},t.prototype._settledAt=function(t,e,n){var o=this.promise;o._state===M&&(this._remaining--,t===B?N(o,n):this._result[e]=n),0===this._remaining&&Q(o,this._result)},t.prototype._willSettleAt=function(t,e){var n=this;j(t,void 0,(function(t){return n._settledAt(I,e,t)}),(function(t){return n._settledAt(B,e,t)}))},t}();function K(t){return new J(this,t).promise}function X(t){var e=this;return o(t)?new e((function(n,o){for(var i=t.length,r=0;r<i;r++)e.resolve(t[r]).then(n,o)})):new e((function(t,e){return e(new TypeError("You must pass an array to race."))}))}function $(t){var e=new this(k);return N(e,t),e}function Z(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function tt(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}var et=function(){function t(e){this[S]=V(),this._result=this._state=void 0,this._subscribers=[],k!==e&&("function"!=typeof e&&Z(),this instanceof t?G(this,e):tt())}return t.prototype.catch=function(t){return this.then(null,t)},t.prototype.finally=function(t){var n=this,o=n.constructor;return e(t)?n.then((function(e){return o.resolve(t()).then((function(){return e}))}),(function(e){return o.resolve(t()).then((function(){throw e}))})):n.then(t,t)},t}();function nt(){var t=void 0;if(void 0!==n.g)t=n.g;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var e=t.Promise;if(e){var o=null;try{o=Object.prototype.toString.call(e.resolve())}catch(t){}if("[object Promise]"===o&&!e.cast)return}t.Promise=et}return et.prototype.then=T,et.all=K,et.race=X,et.resolve=D,et.reject=$,et._setScheduler=l,et._setAsap=u,et._asap=a,et.polyfill=nt,et.Promise=et,et}()},235:function(t,e,n){"use strict";n.r(e)},85:function(t,e,n){"use strict";n.r(e)},817:function(t,e,n){"use strict";n.r(e)},57:function(t,e,n){"use strict";n.r(e)},527:function(t,e,n){"use strict";n.r(e)},311:function(t,e,n){"use strict";n.r(e)},610:function(t,e,n){"use strict";n.r(e)},546:function(t,e,n){"use strict";n.r(e)},292:function(t,e,n){"use strict";n.r(e)},907:function(t,e,n){"use strict";var o,i;n.r(e),n.d(e,{AggregationSettings:function(){return k},ColumnAlignment:function(){return g},DataColumn:function(){return I},DataColumnList:function(){return B},DataRow:function(){return A},DataType:function(){return o},EasyDataTable:function(){return P},EasyGuid:function(){return O},EditorTag:function(){return s},EntityAttrKind:function(){return i},EventEmitter:function(){return L},HttpClient:function(){return x},HttpMethod:function(){return r},HttpRequest:function(){return u},HttpResponseError:function(){return b},MetaData:function(){return D},MetaEntity:function(){return w},MetaEntityAttr:function(){return E},ValueEditor:function(){return T},combinePath:function(){return p},i18n:function(){return a},liquid:function(){return M},repeatString:function(){return c},reverseString:function(){return d},strEndsWith:function(){return h},utils:function(){return l}}),function(t){t[t.Unknown=0]="Unknown",t[t.String=1]="String",t[t.Byte=2]="Byte",t[t.Word=3]="Word",t[t.Int32=4]="Int32",t[t.Int64=5]="Int64",t[t.Bool=6]="Bool",t[t.Float=7]="Float",t[t.Currency=8]="Currency",t[t.BCD=9]="BCD",t[t.Date=10]="Date",t[t.Time=11]="Time",t[t.DateTime=12]="DateTime",t[t.Autoinc=13]="Autoinc",t[t.Memo=14]="Memo",t[t.Blob=15]="Blob",t[t.FixedChar=16]="FixedChar",t[t.Guid=17]="Guid",t[t.Geometry=18]="Geometry",t[t.Geography=19]="Geography"}(o||(o={})),function(t){t[t.Data=0]="Data",t[t.Virtual=1]="Virtual",t[t.Lookup=2]="Lookup"}(i||(i={}));var r,s={Unknown:"Unknown",Edit:"EDIT",DateTime:"DATETIME",List:"LIST",CustomList:"CUSTOMLIST",File:"FILE"};!function(t){t.Trace="TRACE",t.Options="OPTIONS",t.Get="GET",t.Put="PUT",t.Post="POST",t.Delete="DELETE"}(r||(r={}));var a,l,u=function(){function t(t,e){this.xhr=t,this.method=e.method,this.url=e.url,this.headers=e.headers,this.queryParams=e.queryParams,this.data=e.data}return t.prototype.setHeader=function(t,e){this.headers[t]=e},t.prototype.setQueryParam=function(t,e){this.queryParams[t]=e},t.prototype.getXMLHttpRequest=function(){return this.xhr},t.prototype.getResponseHeaders=function(){if(this.xhr.readyState==this.xhr.HEADERS_RECEIVED){for(var t={},e=0,n=this.xhr.getAllResponseHeaders().trim().split(/[\r\n]+/);e<n.length;e++){var o=n[e].split(": "),i=o.shift(),r=o.join(": ");t[i]=r}return t}return{}},t.prototype.open=function(){var t=this;if(this.xhr.readyState===this.xhr.UNSENT){var e=this.url;for(var n in this.queryParams&&Object.keys(this.queryParams).length>0&&(e+=encodeURI("?"+Object.keys(this.queryParams).map((function(e){return e+"="+t.queryParams[e]})).join("&"))),this.xhr.open(this.method,e,!0),this.xhr.setRequestHeader("X-Requested-With","XMLHttpRequest"),this.headers)this.xhr.setRequestHeader(n,this.headers[n])}},t.prototype.abort=function(){this.xhr.abort()},t}();function c(t,e){for(var n="",o=0;o<e;o++)n+=t;return n}function d(t){return t.split("").reverse().join("")}function h(t,e){return t&&t.lastIndexOf(e)==t.length-e.length}function p(t,e){var n=t;return null!=n&&n.length>0?("/"!=n.charAt(n.length-1)&&(n+="/"),n+=e):n=e,n}!function(t){var e,n={shortDateFormat:"MM/dd/yyyy",longDateFormat:"dd MMM, yyyy",editDateFormat:"MM/dd/yyyy",shortTimeFormat:"HH:mm",editTimeFormat:"HH:mm",longTimeFormat:"HH:mm:ss",shortMonthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],longMonthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],shortWeekDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],longWeekDayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],decimalSeparator:".",currency:"USD"},i={localeId:"en-US",englishName:"English",displayName:"English",texts:{ButtonOK:"OK",ButtonCancel:"Cancel",Yes:"Yes",No:"No",True:"True",False:"False"},settings:n},r={"en-US":i},s=[];function a(t){for(var e=0,n=s;e<n.length;e++){(0,n[e])(t)}}function u(){return e.localeId}function c(t){var n=r[t];n?l.assignDeep(e,n):(e.englishName=t,e.displayName=t,e.texts=l.assignDeep({},i.texts)),e.localeId=t}function d(){return e.settings}function h(t){e.settings||(e.settings=l.assignDeep({},n)),e.settings=l.assignDeep(e.settings,t)}function p(t,n){a(n);var o=e;t&&(n.localeId||(n.localeId=t),(o=r[t])||(o=l.assignDeep({},i),r[t]=o)),l.assignDeep(o,n)}function f(){var t,n,o,i,r,s,a="object"==typeof navigator?navigator.language:void 0;t=a,n=new Date(2020,5,7,19,34,56,88),o=n.toLocaleDateString(t,{year:"numeric",month:"numeric",day:"numeric"}),i=n.toLocaleTimeString(t,{hour:"numeric",minute:"numeric",second:"numeric"}),r=o.replace("07","dd").replace("7","d").replace("06","MM").replace("6","M").replace("2020","yyyy").replace("20","yy"),s=i.replace("19","HH").replace("07","hh").replace("7","h").replace("34","mm").replace("56","ss").replace("PM","tt"),e.settings||(e.settings={}),h({shortDateFormat:r,shortTimeFormat:s})}function g(t){var e,n=d();switch(t){case o.Date:e=n.shortDateFormat;break;case o.Time:e=n.shortTimeFormat;break;default:e=n.shortDateFormat+" "+n.shortTimeFormat}return e}function y(t){var e,n=d();switch(t){case o.Date:e=n.longDateFormat;break;case o.Time:e=n.longTimeFormat;break;default:e=n.longDateFormat+" "+n.longTimeFormat}return e}t.addMapper=function(t){s.push(t)},t.getLocales=function(){var t=[];for(var e in r)t.push({locale:e,englishName:r[e].englishName,displayName:r[e].displayName});return t.sort((function(t,e){return t.englishName>e.englishName?1:t.englishName===e.englishName?0:-1}))},t.getCurrentLocale=u,t.setLocale=function(t){console.warn("This method is deprecated. Use setCurrentLocale instead"),c(t)},t.setCurrentLocale=c,t.getText=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var o=e.texts,i="";if(t&&t.length)for(var r=t.length,s=0;s<r&&"object"==typeof(i=o[t[s]]);s++)o=i;return i},t.getLocaleSettings=d,t.getOneLocaleSetting=function(t){return e.settings[t]},t.getShortMonthName=function(t){var e=d();if(t>0&&t<13)return e.shortMonthNames[t-1];throw"Wrong month number: "+t},t.getLongMonthName=function(t){var e=d();if(t>0&&t<13)return e.longMonthNames[t-1];throw"Wrong month number: "+t},t.getShortWeekDayName=function(t){var e=d();if(t>0&&t<8)return e.shortWeekDayNames.length>=t?e.shortWeekDayNames[t-1]:t.toString();throw"Wrong month number: "+t},t.getLongWeekDayName=function(t){var e=d();if(t>0&&t<8)return e.longWeekDayNames.length>=t?e.longWeekDayNames[t-1]:t.toString();throw"Wrong month number: "+t},t.updateLocaleSettings=h,t.updateLocaleTexts=function(t){"object"==typeof t?(a({localeId:e.localeId,texts:t}),l.assignDeep(e.texts,t)):console.error("Wrong parameter type in updateLocaleTexts function call.The first parameter (localeId) is not necessary. Use updateLocaleTexts(texts) instead")},t.updateDefaultTexts=function(t){for(var n in r){var o=r[n];o.texts=l.assignDeep({},t,o.texts)}e.texts=l.assignDeep({},t,e.texts)},t.updateLocaleInfo=p,t.addLocale=function(t,e){p(t,e)},t.resetLocales=function(){e||(e=l.assignDeep({},i),f())},t.dateTimeToStr=function(t,e,n){return n?"d"==n?n=g(o.Date):"D"==n?n=y(o.Date):"f"==n?n=g(o.DateTime):"F"==n&&(n=y(o.DateTime)):n=g(e),l.dateTimeToStr(t,n)},t.numberToStr=function(e,n){if(n&&n.length>0){var o=n.charAt(0).toUpperCase();if("S"===o)return function(e,n){if(!m[n]){var o=n.split("|").filter((function(t){return t.length>0})).map((function(t){return t.split("=")}));if(m[n]={},o.length>0)if(o[0].length>1)for(var i=0,r=o;i<r.length;i++){var s=r[i];m[n][Number.parseInt(s[1])]=s[0]}else o.forEach((function(t,e){m[n][e]=t[0]}))}var a=m[n];if(void 0!==a[e]){s=a[e];return t.getText(s)||s}return e.toString()}(e,n.slice(1));if(["D","F","C"].indexOf(o)>=0){var i=u();return e.toLocaleString(i,function(t){var e=d(),n=t[0].toUpperCase(),o=t.length>1?Number.parseInt(t.slice(1)):"D"==n?1:2;switch(n){case"D":return{style:"decimal",useGrouping:!1,minimumIntegerDigits:o};case"C":return{style:"currency",currency:e.currency,minimumFractionDigits:o};default:return{style:"decimal",minimumFractionDigits:o,maximumFractionDigits:o}}}(n))}return function(t,e){for(var n=t.toString(),o="",i=n.length-1,r=e.length-1;r>=0;r--){var s=e.charAt(r);"#"===s||"0"===s?i>=0?(o+=n.charAt(i),i--):"0"===s&&(o+=0):o+=s}return o.split("").reverse().join("")}(Math.trunc(e),n)}var r=d();return l.numberToStr(e,r.decimalSeparator)},t.booleanToStr=function(e,n){if(n&&n.length>0&&"S"===n.charAt(0).toUpperCase()){var o=n.slice(1).split("|");if(o.length>1){var i=o[e?1:0];return t.getText(i)||i}}return"".concat(e)};var m={}}(a||(a={})),function(t){t.getAllDataTypes=function(){return Object.values(o).filter((function(t){return"number"==typeof t}))},t.getDateDataTypes=function(){return[o.Time,o.Date,o.DateTime]},t.getStringDataTypes=function(){return[o.String,o.Memo,o.FixedChar]};var e=[o.Byte,o.Word,o.Int32,o.Int64,o.Float,o.Currency,o.Autoinc];t.getNumericDataTypes=function(){return e};var n=[o.Byte,o.Word,o.Int32,o.Int64,o.Autoinc];function i(t,e,n){e||(e={});for(var o=0,s=n;o<s.length;o++){var a=s[o];if(a)for(var l in a)if(a.hasOwnProperty(l)){var u=a[l];null!==u&&"object"==typeof u?t.has(u)?e[l]=t.get(u):Array.isArray(u)?(e[l]=r(u),t.set(u,e[l])):(void 0!==e[l]&&null!=e[l]||(e[l]=Object.create(Object.getPrototypeOf(u))),t.set(u,e[l]),i(t,e[l],[u])):e[l]=u}}return e}function r(t){for(var e=[],n=0,o=t;n<o.length;n++){var i=o[n];e.push(i)}return e}t.assign=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var o=0;o<e.length;o++){var i=e[o];if(i)for(var r in i)i.hasOwnProperty(r)&&(t[r]=i[r])}return t},t.assignDeep=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return i(new WeakMap,t,e)},t.getIfDefined=function(t,e){return void 0!==t?t:e},t.IsDefinedAndNotNull=function(t){return null!=t},t.copyArrayTo=function(t,e){for(var n=t.length,o=e.length,i=0;i<n&&i<o;i++)e[i]=t[i]},t.createArrayFrom=r,t.findItemById=function(t,e){for(var n=t.length,o=0;o<n;o++)if(t[o].id===e)return t[o];return null},t.findItemIndexById=function(t,e){for(var n=t.length,o=0;o<n;o++)if(t[o].id===e)return o;return-1},t.indexOfArrayItem=function(t,e){if(t.indexOf)return t.indexOf(e);for(var n=t.length,o=0;o<n;o++)if(e==t[o])return o;return-1},t.moveArrayItem=function(t,e,n){if(e>=t.length)throw"Index out of bounds: "+e;n>=t.length&&(n=t.length-1);var o=t.splice(e,1)[0];t.splice(n,0,o)},t.removeArrayItem=function(t,e){var n=t.indexOf(e);if(-1!=n)return t.splice(n,1)[0]},t.insertArrayItem=function(t,e,n){t.splice(e,0,n)},t.fillArray=function(t,e,n,o){void 0===n&&(n=0);for(var i=t.length>>>0,r=n>>0,s=r<0?Math.max(i+r,0):Math.min(r,i),a=void 0===o?i:o>>0,l=a<0?Math.max(i+a,0):Math.min(a,i);s<l;)t[s]=e,s++;return t},t.shiftToFitWindow=function(t,e){var n=document.getElementsByTagName("body")[0],o=window.innerWidth||document.documentElement.clientWidth||n.clientWidth,i=t+e,r=0;return i>o&&t+(r=o-i-10)<0&&(r=10-t),r},t.isObject=function(t){return null!==t&&("function"==typeof t||"object"==typeof t)},t.isNumericType=function(t){return e.indexOf(t)>=0},t.isIntType=function(t){return n.indexOf(t)>=0},t.isNumeric=function(t){return!isNaN(parseFloat(t))&&isFinite(t)},t.areCompatibleDataTypes=function(t,e){return void 0===t||void 0===e||t==o.Unknown||e==o.Unknown||t==e||t==o.Date&&e==o.DateTime||t==o.DateTime&&e==o.Date},t.isPropSet=function(t,e){return t[e]||t[e.toLowerCase()]||t[e.toUpperCase()]};var s="0123456789abcdefghijklmnopqrstuvwxyz";function l(t,e){var n=t.length;if(n>e){var o=n/e,i="";i+=t[0];for(var r=o,s=void 0,a=1;a<n;a++)s=t[a],a+1>r&&(i+=s,r+=o);return i}return t}function u(t,e,n){return t.substr(0,e)+n+t.substr(e+n.length)}function h(t,e){return Math.floor(Math.random()*(e-t))+t}function p(t){var e=parseInt(t);if(isNaN(e))throw'"'.concat(t,'" is not a valid number');return e}t.generateId=function(t){t||(t="easy");var e=t.length>4?function(t,e){var n=t.split("-"),o=1,i=e;n.length<e&&(o=e/n.length,i=n.length);for(var r="",s=0;s<i;s++)r+=l(n[s],o);return r}(t,4):t;e&&e.length>0&&(e+="-");var n=c("",2),o=s.length-1;return n=u(n,0,s[h(0,o)]),e+(n=u(n,1,s[h(0,o)]))+function(t){var e=36,n=14,o=c("",n),i=t;do{o=u(o,n--,s[i%e]),i=Math.floor(i/=e)}while(i>0);return d(o.trim())}(621355968e9+1e4*(new Date).getTime()-0x8d60e562e627800)},t.strToDateTime=function(t,e){if(!t||0==t.length)return new Date;var n=t.replace(/[^a-zA-Z0-9_]/g,"-"),o=e.replace(/[^a-zA-Z0-9_]/g,"-").split("-"),i=n.split("-"),r=o.indexOf("MM"),s=o.indexOf("dd"),a=o.indexOf("yyyy"),l=o.indexOf("HH"),u=o.indexOf("mm"),c=o.indexOf("ss"),d=new Date;try{var h=a>-1&&a<i.length?p(i[a]):d.getFullYear(),f=r>-1&&r<i.length?p(i[r])-1:d.getMonth()-1;if(f>11)throw"";var g=s>-1&&s<i.length?p(i[s]):d.getDate();if(g>function(t,e){return new Date(e,t+1,0).getDate()}(f,h))throw"";var y=l>-1&&l<i.length?p(i[l]):0;if(y>23)throw"";var m=u>-1&&u<i.length?p(i[u]):0;if(m>59)throw"";var v=c>-1&&c<i.length?p(i[c]):0;if(v>59)throw"";return new Date(h,f,g,y,m,v)}catch(e){throw"".concat(t," is not a valid date.")}},t.strToTime=function(t){var e=t.split(":");try{var n=e.length>0?p(e[0]):0;if(n>23)throw"";var o=e.length>1?p(e[1]):0;if(o>59)throw"";var i=e.length>1?p(e[1]):0;if(i>59)throw"";return new Date(0,0,0,n,o,i)}catch(e){throw"".concat(t," is not a valid time.")}};var f=/\[([^\]]+)]|y{2,4}|M{1,4}|d{1,2}|H{1,2}|h{1,2}|m{2}|s{2}|t{2}/g;t.dateTimeToStr=function(t,e){var n=t.getFullYear().toString(),o=t.getMonth()+1,i=t.getDate(),r=t.getHours(),s=t.getMinutes(),l=t.getSeconds(),u=r%12||12,c=r>11,d={yyyy:n,yy:n.substring(n.length-2),MMMM:a.getLongMonthName(o),MMM:a.getShortMonthName(o),MM:o<10?"0"+o:o.toString(),M:o.toString(),dd:i<10?"0"+i:i.toString(),d:i.toString(),HH:r<10?"0"+r:r.toString(),H:r.toString(),hh:u<10?"0"+u:u.toString(),h:u.toString(),tt:c?"PM":"AM",mm:s<10?"0"+s:s.toString(),ss:l<10?"0"+l:l.toString()};return e.replace(f,(function(t,e){return e||d[t]}))},t.numberToStr=function(t,e){return e=e||a.getLocaleSettings().decimalSeparator,t.toString().replace(".",e)}}(l||(l={}));var f,g,y=function(){function t(t,e){this.request=t,this.promise=e}return t.prototype.getPromise=function(){return this.promise},t.prototype.getRequest=function(){return this.request},t.prototype.then=function(t,e){return this.promise.then(t,e)},t.prototype.catch=function(t){return this.promise.catch(t)},t.prototype.finally=function(t){return this.promise.finally(t)},t}(),m=n(895),v=(f=function(t,e){return f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},f(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}f(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),C=function(){return C=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},C.apply(this,arguments)},b=function(t){function e(e,n){var o=t.call(this,n)||this;return o.status=e,o}return v(e,t),e}(Error),x=function(){function t(){this.defaultHeaders={},this.customPayload=void 0}return Object.defineProperty(t.prototype,"responseBody",{get:function(){return this._responseBody},enumerable:!1,configurable:!0}),t.prototype.get=function(t,e){return this.send(r.Get,t,null,e)},t.prototype.post=function(t,e,n){return this.send(r.Post,t,e,n)},t.prototype.put=function(t,e,n){return this.send(r.Put,t,e,n)},t.prototype.delete=function(t,e,n){return this.send(r.Delete,t,e,n)},t.prototype.send=function(e,n,o,i){var r=this,s=(i=i||{}).dataType||"json",a=i.contentType||"form-data"!==s?"application/json":null;o&&"form-data"!=s&&this.customPayload&&(o.data=l.assignDeep(o.data||{},this.customPayload));var c=new("onload"in new XMLHttpRequest?XMLHttpRequest:window.XDomainRequest),d={method:e,url:n,headers:C(C({},this.defaultHeaders),i.headers||{}),queryParams:i.queryParams||{},data:o};a&&(d.headers["Content-Type"]=a);var h=new u(c,d);this.beforeEachRequest&&(console.warn("HttpClient: 'beforeEachRequest' is deprecated and will be removed in future updates.\n Use 'onRequest' instead"),this.beforeEachRequest(h)),this.onRequest&&this.onRequest(h);var p=h.data&&"string"!=typeof h.data&&"json"==s?JSON.stringify(h.data):h.data;return h.open(),new y(h,new m((function(e,o){i.responseType&&(c.responseType=i.responseType),c.onerror=function(t){o(new b(c.status,c.responseText))},c.onreadystatechange=function(){if(4==c.readyState){var i=c.getResponseHeader("Content-Type")||"",s=c.status;if(0===s)o(new b(s,"Network error or the request was aborted"));else if(s>=200&&s<400){var a="arraybuffer"===c.responseType||"blob"===c.responseType?c.response:0==i.indexOf("application/json")?JSON.parse(c.responseText):c.responseText;r._responseBody=a,r.onResponse&&r.onResponse(c),e(a)}else{("arraybuffer"===c.responseType||"blob"===c.responseType?t.decodeArrayBuffer(c.response):m.resolve(c.responseText)).then((function(t){var e=0==i.indexOf("application/json")?JSON.parse(t):t;r._responseBody=e;var a=e.message||(404==s?"No such endpoint: ".concat(n):e);o(new b(s,a))}))}}},c.send(p)})))},t.decodeArrayBuffer=function(t){var e=new FileReader;return new m((function(n){e.onloadend=function(){e.readyState==FileReader.DONE&&n(e.result)},e.readAsText(new Blob([t]))}))},t}(),w=function(){function t(t){this.isEditable=!0,this.name="",this.caption="",this.description="",this.parent=t,this.attributes=new Array,this.subEntities=new Array}return t.prototype.loadFromData=function(t,e){if(e){if(this.id=e.id,this.name=e.name,this.captionPlural=e.namePlur,this.caption=e.name,this.description=e.desc,void 0!==e.ied&&(this.isEditable=e.ied),this.subEntities=new Array,e.ents)for(var n=0;n<e.ents.length;n++){var o=t.createEntity(this);o.loadFromData(t,e.ents[n]),this.subEntities.push(o)}if(this.attributes=new Array,e.attrs)for(n=0;n<e.attrs.length;n++){var i=t.createEntityAttr(this);i.loadFromData(t,e.attrs[n]),this.attributes.push(i)}}},t.prototype.scan=function(t,e){var n={stop:!1},o=function(i){if(e&&e(i,n),i.attributes)for(var r=i.attributes.length,s=0;s<r&&!n.stop;s++){var a=i.attributes[s];if(t&&t(a,n),n.stop)return}if(i.subEntities){var l=i.subEntities.length;for(s=0;s<l&&!n.stop;s++)o(i.subEntities[s])}};o(this)},t.prototype.getFirstPrimaryAttr=function(){return this.getPrimaryAttrs()[0]},t.prototype.getPrimaryAttrs=function(){return this.attributes.filter((function(t){return t.isPrimaryKey}))},t}(),E=function(){function t(t){this.id="",this.caption="{Unrecognized attribute}",this.dataType=o.String,this.size=0,this.isPrimaryKey=!1,this.isForeignKey=!1,this.isNullable=!0,this.showOnView=!0,this.isEditable=!0,this.showOnCreate=!0,this.showOnEdit=!0,this.showInLookup=!1,this.lookupAttr="",this.expr="",this.entity=t,this.kind=i.Data}return t.prototype.loadFromData=function(t,e){if(e){this.id=e.id,this.description=e.desc,this.caption=e.cptn,this.dataType=e.dtype,this.isPrimaryKey=e.ipk,this.isForeignKey=e.ifk,this.size=e.size,this.lookupAttr=e.lattr,this.lookupEntity=e.lent,this.dataAttr=e.dattr,this.lookupDataAttr=e.ldattr;var n=l.getDateDataTypes().indexOf(this.dataType);this.defaultValue=e.defVal&&n?new Date(e.defVal):e.defVal,this.isNullable=l.getIfDefined(e.nul,this.isNullable),this.isEditable=l.getIfDefined(e.ied,this.isEditable),this.showOnView=l.getIfDefined(e.ivis||e.sov,this.showOnView),this.showOnCreate=l.getIfDefined(e.soc,this.showOnCreate),this.showOnEdit=l.getIfDefined(e.soe,this.showOnEdit),this.showInLookup=l.getIfDefined(e.sil,this.showInLookup),this.kind=e.kind,this.displayFormat=e.dfmt,e.udata&&(this.userData=e.udata),e.edtr&&(this.defaultEditor=t.getEditorById(e.edtr)||t.createValueEditor())}},t}(),T=function(){function t(){this.id="",this.tag=s.Unknown,this.resType=o.Unknown,this.defValue=""}return t.prototype.loadFromData=function(t){t&&(this.id=t.id,this.tag=t.tag,this.defValue=t.defval,this.resType=t.rtype,this.accept=t.accept,this.multiline=t.multiline,t.subType&&(this.resType=t.subType),t.name&&(this.name=t.name),t.values&&(this.values=t.values))},t.prototype.getValueText=function(t){var e="";if(!this.values)return e;if(Array.isArray(t))for(var n=0,o=this.values;n<o.length;n++){var i=o[n];t.indexOf(i.id)>=0&&(e+=i.text+",")}else for(var r=0,s=this.values;r<s.length;r++){(i=s[r]).id===t&&(e+=i.text+",")}return e&&(e=e.substring(0,e.length-1)),e},t}(),D=function(){function t(){this.mainEntity=null,this.id="__none",this.name="Empty model",this.rootEntity=this.createEntity(),this.displayFormats=new Map}return t.prototype.getMainEntity=function(){return this.mainEntity},t.prototype.createEntity=function(t){return new w(t)},t.prototype.createEntityAttr=function(t){return new E(t)},t.prototype.createValueEditor=function(){return new T},t.prototype.loadFromJSON=function(t){var e=JSON.parse(t);this.loadFromData(e)},t.prototype.loadFromData=function(t){if(this.id=t.id,this.name=t.name,this.version=t.vers,this.editors=new Array,t.editors)for(var e=0;e<t.editors.length;e++){var n=this.createValueEditor();n.loadFromData(t.editors[e]),this.editors.push(n)}if(this.rootEntity.loadFromData(this,t.entroot),this.displayFormats=new Map,t.displayFormats)for(var i in t.displayFormats){var r=o[i],s=t.displayFormats[i]||new Array;this.displayFormats.set(r,s)}},t.prototype.getDisplayFormats=function(){return this.displayFormats},t.prototype.getDisplayFormatsForType=function(t){return this.displayFormats.has(t)?this.displayFormats.get(t):[]},t.prototype.getDefaultFormat=function(t){return this.displayFormats.has(t)?this.displayFormats.get(t).filter((function(t){return t.isdef}))[0]:null},t.prototype.setData=function(t){"string"==typeof t?this.loadFromJSON(t):this.loadFromData(t)},t.prototype.isEmpty=function(){return 0===this.rootEntity.subEntities.length&&0===this.rootEntity.attributes.length},t.prototype.getId=function(){return this.id},t.prototype.getName=function(){return this.name},t.prototype.getRootEntity=function(){return this.rootEntity},t.prototype.getEditorById=function(t){for(var e=0,n=this.editors;e<n.length;e++){var o=n[e];if(o.id===t)return o}return null},t.prototype.getAttributeById=function(t){var e=this.getEntityAttrById(this.getRootEntity(),t);return e||null},t.prototype.checkAttrProperty=function(t,e){var n=this.getAttributeById(t);if(n){if(void 0===n[e])throw"No such property: "+e;return!!n[e]||!!n.lookupAttr&&(t=n.lookupAttr,(n=this.getAttributeById(t))&&n[e])}return!1},t.prototype.getEntityAttrById=function(t,e){var n,o;if(t.attributes){var i=t.attributes.length;for(n=0;n<i;n++)if(t.attributes[n].id==e)return t.attributes[n]}if(t.subEntities){var r=t.subEntities.length;for(n=0;n<r;n++)if(o=this.getEntityAttrById(t.subEntities[n],e))return o}return null},t.prototype.listByEntityWithFilter=function(t,e){var n,o=new Array,i=null;if(t.subEntities)for(var r=t.subEntities.length,s=0;s<r;s++){if(i=t.subEntities[s],!e||e(i,null))(n=a.getText("Entities",i.name))||(n=i.caption),(h=l.assign(this.createEntity(),{id:i.name,text:n,items:[],isEntity:!0})).items=this.listByEntityWithFilter(i,e),h.items.length>0&&o.push(h)}var u=null;if(t.attributes)for(var c=t.attributes.length,d=0;d<c;d++)if(u=t.attributes[d],!e||e(t,u)){(n=a.getText("Attributes",u.id))||(n=u.caption);var h=l.assign(this.createEntity(),{id:u.id,text:n,dataType:u.dataType});o.push(h)}return o},t.prototype.listByEntity=function(t,e,n){e=e||{};var o,i=[],r=[],s=null;if(t.subEntities)for(var u=t.subEntities.length,c=0;c<u;c++)if(s=t.subEntities[c],!n||n(s,null)){o=a.getText("Entities",s.name)||s.caption;var d=l.assign(this.createEntity(),{id:s.name,text:o,items:[],isEntity:!0,description:s.description}),h=l.assign({},e);h.includeRootData=!1,d.items=this.listByEntity(s,h,n),d.items.length>0&&i.push(d)}var p=null;if(t.attributes)for(var f=t.attributes.length,g=0;g<f;g++)p=t.attributes[g],n&&!n(t,p)||(o=a.getText("Attributes",p.id)||p.caption,r.push(l.assign(this.createEntityAttr(t),{id:p.id,text:o,dataType:p.dataType,lookupAttr:p.lookupAttr,description:p.description})));var y,m=function(t,e){return t.text.toLowerCase()==e.text.toLowerCase()?0:t.text.toLowerCase()>e.text.toLowerCase()?1:-1};return e.sortEntities&&(i.sort(m),r.sort(m)),y=e.attrPlacement&&0!=e.attrPlacement?r.concat(i):i.concat(r),2==e.attrPlacement&&y.sort(m),e.includeRootData?((o=a.getText("Entities",t.name))||(o=t.caption),{id:t.name,text:o,items:y}):y},t.prototype.clear=function(){this.rootEntity=this.createEntity(),this.editors=[],this.version=""},t.prototype.addDefaultValueEditors=function(){this.addOrUpdateValueEditor("_DTE",s.Edit,o.String).defValue="",this.addOrUpdateValueEditor("_DPDE",s.DateTime,o.DateTime),this.addOrUpdateValueEditor("_DPTE",s.DateTime,o.DateTime)},t.prototype.addOrUpdateValueEditor=function(t,e,n){var o=l.findItemById(this.editors,t);return o||((o=this.createValueEditor()).id=t,this.editors.push(o)),o.tag=e,o.resType=n,o},t.prototype.getEntitiesTree=function(t,e){return this.listByEntity(this.getRootEntity(),t,e)},t.prototype.getEntitiesTreeWithFilter=function(t){return this.listByEntityWithFilter(this.getRootEntity(),t)},t.prototype.getFullEntityPathByAttr=function(t,e){return e=e||" ",this.getEntityPathByAttr(this.getRootEntity(),t,e,!0)},t.prototype.getEntityPathByAttr=function(t,e,n,o){if(!t)return"";n=n||" ";var i="";if(t.caption&&!o){var r=a.getText("Entities",t.caption);i=r||t.caption}if(t.attributes)for(var s=t.attributes.length,l=0;l<s;l++)if(t.attributes[l].id==e)return i;if(t.subEntities){var u=t.subEntities.length;for(l=0;l<u;l++){var c=t.subEntities[l],d=this.getEntityPathByAttr(c,e,n,!1);if(""!==d)return""!==i&&(d=i+n+d),d}}return""},t.prototype.getAttributeText=function(t,e){var n=a.getText("Attributes",t.id);if(n||(n=t.caption),!e)return n;var o=this.getFullEntityPathByAttr(t.id," ");return(o?e.replace(new RegExp("{attr}","g"),n).replace(new RegExp("{entity}","g"),o):n).trim()},t.prototype.runThroughEntities=function(t,e){this.getRootEntity().scan(t,e)},t.prototype.getFirstAttributeByFilter=function(t){var e=null;return this.runThroughEntities((function(n,o){t(n)&&(o.stop=!0,e=n)}),null),e},t}(),S=function(){return S=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},S.apply(this,arguments)},k=function(){function t(t){this.colStore=t,this.aggregates=[],this.groups=[],this.useGrandTotals=!1,this.useRecordCount=!1,this._caseSensitiveGroups=!1,this.COUNT_FIELD_NAME="GRPRECCNT"}return Object.defineProperty(t.prototype,"caseSensitiveGroups",{get:function(){return this._caseSensitiveGroups},set:function(t){this._caseSensitiveGroups=t,this.updateCompareProc()},enumerable:!1,configurable:!0}),t.prototype.updateCompareProc=function(){this.compareValues=this._caseSensitiveGroups?this.strictCompare:this.caseInsensitiveCompare},t.prototype.addGroup=function(t){var e=t.columns||this.colStore.getColumnIds(t.from,t.to);if(!this.colStore.validateColumns(e))throw"Invalid columns: "+e;if(this.hasColumnsInUse(e))throw"Can't add same columns to different groups/aggregates";return this.groups.push(S({columns:e},t)),this},t.prototype.addAggregateColumn=function(t,e){var n="string"==typeof t?t:this.colStore.getColumnIds(t,t)[0];if(this.hasColumnsInUse([n])||!this.colStore.validateAggregate(n,e))throw"Invalid aggregation function for the column: "+n;return this.aggregates.push({colId:n,funcId:e}),this},t.prototype.addGrandTotals=function(){return this.useGrandTotals=!0,this},t.prototype.addCounts=function(){return this.useRecordCount=!0,this},t.prototype.getGroups=function(){var t=this,e=[];return this.groups.map((function(n){return e=e.concat(n.columns),S(S({},n),{columns:Array.from(e),aggregates:Array.from(t.aggregates)})}))},t.prototype.getInternalGroups=function(){return this.groups},t.prototype.lastGroup=function(){var t=this.getGroups();return t[t.length-1]},t.prototype.getAggregates=function(){return this.aggregates},t.prototype.hasAggregates=function(){return this.aggregates.length>0},t.prototype.hasGroups=function(){return this.groups.length>0},t.prototype.hasGrandTotals=function(){return this.useGrandTotals},t.prototype.hasRecordCount=function(){return this.useRecordCount},t.prototype.isEmpty=function(){return!(this.hasAggregates()||this.hasGroups()||this.hasAggregates()||this.hasRecordCount())},t.prototype.drop=function(){console.warn('"drop()" method is obsolete. Use "clear()" instead'),this.clear()},t.prototype.clear=function(){return this.groups=[],this.aggregates=[],this.useGrandTotals=!1,this.useRecordCount=!1,this.caseSensitiveGroups=!1,this},t.prototype.hasColumnsInUse=function(t){for(var e=0,n=this.groups;e<n.length;e++){if(n[e].columns.filter((function(e){return t.indexOf(e)>=0})).length>0)return!0}for(var o=0,i=this.aggregates;o<i.length;o++){var r=i[o];if(t.indexOf(r.colId)>=0)return!0}return!1},t.prototype.needAggrCalculation=function(){return(this.hasAggregates()||this.hasRecordCount())&&(this.hasGrandTotals()||this.hasGroups())},t.prototype.saveToData=function(){return{groups:Array.from(this.groups),ugt:this.useGrandTotals,urc:this.useRecordCount,csg:this.caseSensitiveGroups,aggregates:Array.from(this.aggregates)}},t.prototype.loadFromData=function(t){t&&(void 0!==t.ugt&&(this.useGrandTotals=t.ugt),void 0!==t.urc&&(this.useRecordCount=t.urc),void 0!==t.csg&&(this.caseSensitiveGroups=t.csg),t.groups&&(this.groups=Array.from(t.groups)),t.aggregates&&(this.aggregates=Array.from(t.aggregates)))},t.prototype.buildGroupKey=function(t,e){var n=!this.caseSensitiveGroups,o={};if(t)for(var i=0,r=t.columns;i<r.length;i++){var s=r[i],a=e.getValue(s);n&&"string"==typeof a&&(a=a.toLowerCase()),o[s]=a}return o},t.prototype.strictCompare=function(t,e){return t instanceof Date?t.getTime()===e.getTime():t===e},t.prototype.caseInsensitiveCompare=function(t,e){return t instanceof Date?t.getTime()===e.getTime():("string"==typeof t?t.toLowerCase():t)===("string"==typeof e?e.toLowerCase():e)},t}();!function(t){t[t.None=0]="None",t[t.Left=1]="Left",t[t.Center=2]="Center",t[t.Right=3]="Right"}(g||(g={}));var M,I=function(t){if(!t)throw Error("Options are required");if(!t.id)throw Error("Field Id is required");if(!t.label)throw Error("Label is required");this.id=t.id,this.type=l.getIfDefined(t.type,o.String),this.label=t.label,this.originAttrId=t.originAttrId,this.isAggr=t.isAggr||!1,this.displayFormat=t.dfmt,this.groupFooterColumnTemplate=t.gfct,this.style=t.style||{},this.description=t.description,this.calculatedWidth=0},B=function(){function t(){this.items=[],this.mapper={},this._dateColumnIdx=[]}return Object.defineProperty(t.prototype,"count",{get:function(){return this.items.length},enumerable:!1,configurable:!0}),t.prototype.add=function(t){var e;e=t instanceof I?t:new I(t);var n=this.items.length;return this.items.push(e),this.mapper[e.id]=n,[o.Date,o.DateTime,o.Time].indexOf(e.type)>=0&&this._dateColumnIdx.push(n),n},t.prototype.updateDateColumnIdx=function(){this._dateColumnIdx=this.getItems().filter((function(t){return[o.Date,o.DateTime,o.Time].indexOf(t.type)>=0})).map((function(t,e){return e}))},t.prototype.put=function(t,e){t>=0&&t<this.count&&(this.items[t]=e,this.updateDateColumnIdx())},t.prototype.move=function(t,e){var n=this.items.indexOf(t);n>=0&&n!=e&&(l.moveArrayItem(this.items,n,e),this.updateDateColumnIdx())},t.prototype.get=function(t){return t>=0&&t<this.count?this.items[t]:null},t.prototype.getIndex=function(t){return this.mapper[t]},t.prototype.getItems=function(){return this.items},t.prototype.getDateColumnIndexes=function(){return this._dateColumnIdx},t.prototype.removeAt=function(t){var e=this.get(t);this.items.splice(t,1);var n=this._dateColumnIdx.indexOf(t);n>=0&&this._dateColumnIdx.splice(n,1),delete this.mapper[e.id]},t.prototype.clear=function(){this.items=[],this._dateColumnIdx=[],this.mapper={}},t}(),A=function(){function t(t,e){this.columns=t,this.values=e}return t.prototype.toArray=function(){return Array.from(this.values)},t.prototype.size=function(){return this.values.length},t.prototype.getValue=function(t){var e;if("string"==typeof t){if(void 0===(e=this.columns.getIndex(t)))throw new RangeError("No column with id '".concat(t,"'"))}else e=t;if(e>=this.values.length)throw new RangeError("Out of range: "+e);return this.values[e]},t.prototype.setValue=function(t,e){var n;if("string"==typeof t){if(void 0===(n=this.columns.getIndex(t)))throw new RangeError("No column with id '".concat(t,"'"))}else n=t;if(n>=this.values.length)throw new RangeError("Out of range: "+n);this.values[n]=e},t}(),_=n(895),P=function(){function t(t){if(this._chunkSize=1e3,this._elasticChunks=!1,this.cachedRows=[],this.total=0,this.loader=null,this.needTotal=!0,this.isInMemory=!1,t=t||{},this._chunkSize=t.chunkSize||this._chunkSize,this._elasticChunks=t.elasticChunks||this._elasticChunks,this.loader=t.loader,void 0!==t.inMemory&&(this.isInMemory=t.inMemory),this.isInMemory&&(this.needTotal=!1),this._columns=new B,this.onUpdate=t.onUpdate,t.columns)for(var e=0,n=t.columns;e<n.length;e++){var o=n[e];this._columns.add(o)}if(t.rows)for(var i=0,r=t.rows;i<r.length;i++){var s=r[i],a=this.createRow(s);this.addRow(a)}this.needTotal=!this._elasticChunks}return Object.defineProperty(t.prototype,"columns",{get:function(){return this._columns},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"chunkSize",{get:function(){return this._chunkSize},set:function(t){this._chunkSize=t,this.total=0,this.needTotal=!this.elasticChunks,this.cachedRows=[]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"elasticChunks",{get:function(){return this._elasticChunks},set:function(t){this._elasticChunks=t,this.total=0,this.needTotal=!this.elasticChunks,this.cachedRows=[]},enumerable:!1,configurable:!0}),t.prototype.getRows=function(t){var e=this,n=0,o=this._chunkSize;t&&("page"in t?(n=t.pageSize*(t.page-1),o=t.pageSize):(n=t.offset,o=t.limit));var i=n+o;if(!this.needTotal&&!this.elasticChunks){if(n>=this.total)return _.resolve([]);i>this.total&&(i=this.total)}if(this.isInMemory&&i>this.cachedRows.length&&(i=this.cachedRows.length),i<=this.cachedRows.length)return _.resolve(this.cachedRows.slice(n,i));if(!this.loader)throw"Loader is not defined. Can't get the rows from ".concat(n," to ").concat(i);var r=this.needTotal;this.needTotal&&(this.needTotal=!1);var s=this.cachedRows.length,a=i-s;return a<this._chunkSize&&(a=this._chunkSize),this.loader.loadChunk({offset:s,limit:a,needTotal:r}).then((function(t){(r&&(e.total=t.total),Array.prototype.push.apply(e.cachedRows,t.table.getCachedRows()),i>e.cachedRows.length&&(i=e.cachedRows.length),e.elasticChunks)&&(t.table.getCachedCount()<a&&(e.total=e.cachedRows.length));return e.fireUpdated(),e.cachedRows.slice(n,i)}))},t.prototype.getRow=function(t){return this.getRows({offset:t,limit:1}).then((function(t){return t.length>0?t[0]:null}))},t.prototype.getTotal=function(){return this.total},t.prototype.setTotal=function(t){this.total=t,this.needTotal=!1},t.prototype.getCachedCount=function(){return this.cachedRows.length},t.prototype.clear=function(){this.columns.clear(),this.cachedRows=[],this.total=0,this.needTotal=!this._elasticChunks,this.fireUpdated()},t.prototype.createRow=function(t){var e=this,n=this._columns.getDateColumnIndexes(),o=new Array(this._columns.count),i=t instanceof A?function(e){return t.getValue(e)}:function(e){return t[e]};return t&&this.columns.getItems().forEach((function(t){var r=i(t.id),s=e.columns.getIndex(t.id);o[s]=n.indexOf(s)>=0?e.mapDate(r,t.type):r})),new A(this._columns,o)},t.prototype.mapDate=function(t,e){if(t){var n=new Date(t);return isNaN(n.getTime())&&e==o.Time&&(n=l.strToTime(t)),n}return null},t.prototype.addRow=function(t){var e;if(Array.isArray(t)){var n=t,o=this._columns.getDateColumnIndexes();if(o.length>0)for(var i=0,r=o;i<r.length;i++){var s=r[i];n[s]&&(n[s]=this.mapDate(n[s],this._columns.get(s).type))}e=new A(this._columns,n)}else e=this.createRow(t);this.cachedRows.push(e);var a=this.getCachedCount();return a>this.total&&(this.total=a),e},t.prototype.getCachedRows=function(){return this.cachedRows},t.prototype.totalIsKnown=function(){return this.elasticChunks?this.getCachedCount()===this.total:!this.needTotal},t.prototype.fireUpdated=function(){this.onUpdate&&this.onUpdate(this)},t}(),O=function(){function t(){}return t.newGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)}))},t}(),L=function(){function t(t){this.silentMode=0,this.events=new Array,this.source=t}return t.prototype.subscribe=function(t,e){var n=this.getEventRecByType(t),o={id:O.newGuid(),callback:e};return n?n.eventCallbacks.push(o):(n={type:t,eventCallbacks:new Array(o)},this.events.push(n)),o.id},t.prototype.unsubscribe=function(t,e){var n=this.getEventRecByType(t);if(n){var o=-1;for(o=0;o<n.eventCallbacks.length&&n.eventCallbacks[o].id!==e;o++);o>=0&&n.eventCallbacks.splice(o,1)}},t.prototype.fire=function(t,e,n,o){if(void 0===n&&(n=0),void 0===o&&(o=!1),!this.silentMode||o){var i=this.getEventRecByType(t);if(i){var r={type:t,source:this.source,data:e},s=function(){for(var t=0,e=i.eventCallbacks;t<e.length;t++){e[t].callback(r)}};n>0?setTimeout(s,n):s()}}},t.prototype.enterSilentMode=function(){this.silentMode++},t.prototype.exitSilentMode=function(){this.silentMode&&this.silentMode--},t.prototype.isSilent=function(){return this.silentMode>0},t.prototype.getEventRecByType=function(t){for(var e=0,n=this.events;e<n.length;e++){var o=n[e];if(o.type==t)return o}return null},t}();!function(t){t.renderLiquidTemplate=function(t,e){var n=t;if(e)for(var o in e){var i=new RegExp("{{"+o+"}}","g");n=n.replace(i,e[o])}return n}}(M||(M={})),a.resetLocales(),"function"!=typeof Object.values&&(Object.values=function(t){return Object.keys(t).map((function(e){return t[e]}))}),"function"!=typeof Math.trunc&&(Math.trunc=function(t){return isNaN(t)?NaN:t>0?Math.floor(t):Math.ceil(t)})},895:function(t,e,n){t.exports=function(){"use strict";function t(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}function e(t){return"function"==typeof t}var o=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},i=0,r=void 0,s=void 0,a=function(t,e){b[i]=t,b[i+1]=e,2===(i+=2)&&(s?s(x):E())};function l(t){s=t}function u(t){a=t}var c="undefined"!=typeof window?window:void 0,d=c||{},h=d.MutationObserver||d.WebKitMutationObserver,p="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),f="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function g(){return function(){return process.nextTick(x)}}function y(){return void 0!==r?function(){r(x)}:C()}function m(){var t=0,e=new h(x),n=document.createTextNode("");return e.observe(n,{characterData:!0}),function(){n.data=t=++t%2}}function v(){var t=new MessageChannel;return t.port1.onmessage=x,function(){return t.port2.postMessage(0)}}function C(){var t=setTimeout;return function(){return t(x,1)}}var b=new Array(1e3);function x(){for(var t=0;t<i;t+=2)(0,b[t])(b[t+1]),b[t]=void 0,b[t+1]=void 0;i=0}function w(){try{var t=Function("return this")().require("vertx");return r=t.runOnLoop||t.runOnContext,y()}catch(t){return C()}}var E=void 0;function T(t,e){var n=this,o=new this.constructor(k);void 0===o[S]&&U(o);var i=n._state;if(i){var r=arguments[i-1];a((function(){return W(i,o,r,n._result)}))}else j(n,o,t,e);return o}function D(t){var e=this;if(t&&"object"==typeof t&&t.constructor===e)return t;var n=new e(k);return F(n,t),n}E=p?g():h?m():f?v():void 0===c?w():C();var S=Math.random().toString(36).substring(2);function k(){}var M=void 0,I=1,B=2;function A(){return new TypeError("You cannot resolve a promise with itself")}function _(){return new TypeError("A promises callback cannot return that same promise.")}function P(t,e,n,o){try{t.call(e,n,o)}catch(t){return t}}function O(t,e,n){a((function(t){var o=!1,i=P(n,e,(function(n){o||(o=!0,e!==n?F(t,n):Q(t,n))}),(function(e){o||(o=!0,N(t,e))}),"Settle: "+(t._label||" unknown promise"));!o&&i&&(o=!0,N(t,i))}),t)}function L(t,e){e._state===I?Q(t,e._result):e._state===B?N(t,e._result):j(e,void 0,(function(e){return F(t,e)}),(function(e){return N(t,e)}))}function R(t,n,o){n.constructor===t.constructor&&o===T&&n.constructor.resolve===D?L(t,n):void 0===o?Q(t,n):e(o)?O(t,n,o):Q(t,n)}function F(e,n){if(e===n)N(e,A());else if(t(n)){var o=void 0;try{o=n.then}catch(t){return void N(e,t)}R(e,n,o)}else Q(e,n)}function q(t){t._onerror&&t._onerror(t._result),H(t)}function Q(t,e){t._state===M&&(t._result=e,t._state=I,0!==t._subscribers.length&&a(H,t))}function N(t,e){t._state===M&&(t._state=B,t._result=e,a(q,t))}function j(t,e,n,o){var i=t._subscribers,r=i.length;t._onerror=null,i[r]=e,i[r+I]=n,i[r+B]=o,0===r&&t._state&&a(H,t)}function H(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var o=void 0,i=void 0,r=t._result,s=0;s<e.length;s+=3)o=e[s],i=e[s+n],o?W(n,o,i,r):i(r);t._subscribers.length=0}}function W(t,n,o,i){var r=e(o),s=void 0,a=void 0,l=!0;if(r){try{s=o(i)}catch(t){l=!1,a=t}if(n===s)return void N(n,_())}else s=i;n._state!==M||(r&&l?F(n,s):!1===l?N(n,a):t===I?Q(n,s):t===B&&N(n,s))}function G(t,e){try{e((function(e){F(t,e)}),(function(e){N(t,e)}))}catch(e){N(t,e)}}var z=0;function V(){return z++}function U(t){t[S]=z++,t._state=void 0,t._result=void 0,t._subscribers=[]}function Y(){return new Error("Array Methods must be provided an Array")}var J=function(){function t(t,e){this._instanceConstructor=t,this.promise=new t(k),this.promise[S]||U(this.promise),o(e)?(this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?Q(this.promise,this._result):(this.length=this.length||0,this._enumerate(e),0===this._remaining&&Q(this.promise,this._result))):N(this.promise,Y())}return t.prototype._enumerate=function(t){for(var e=0;this._state===M&&e<t.length;e++)this._eachEntry(t[e],e)},t.prototype._eachEntry=function(t,e){var n=this._instanceConstructor,o=n.resolve;if(o===D){var i=void 0,r=void 0,s=!1;try{i=t.then}catch(t){s=!0,r=t}if(i===T&&t._state!==M)this._settledAt(t._state,e,t._result);else if("function"!=typeof i)this._remaining--,this._result[e]=t;else if(n===et){var a=new n(k);s?N(a,r):R(a,t,i),this._willSettleAt(a,e)}else this._willSettleAt(new n((function(e){return e(t)})),e)}else this._willSettleAt(o(t),e)},t.prototype._settledAt=function(t,e,n){var o=this.promise;o._state===M&&(this._remaining--,t===B?N(o,n):this._result[e]=n),0===this._remaining&&Q(o,this._result)},t.prototype._willSettleAt=function(t,e){var n=this;j(t,void 0,(function(t){return n._settledAt(I,e,t)}),(function(t){return n._settledAt(B,e,t)}))},t}();function K(t){return new J(this,t).promise}function X(t){var e=this;return o(t)?new e((function(n,o){for(var i=t.length,r=0;r<i;r++)e.resolve(t[r]).then(n,o)})):new e((function(t,e){return e(new TypeError("You must pass an array to race."))}))}function $(t){var e=new this(k);return N(e,t),e}function Z(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function tt(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}var et=function(){function t(e){this[S]=V(),this._result=this._state=void 0,this._subscribers=[],k!==e&&("function"!=typeof e&&Z(),this instanceof t?G(this,e):tt())}return t.prototype.catch=function(t){return this.then(null,t)},t.prototype.finally=function(t){var n=this,o=n.constructor;return e(t)?n.then((function(e){return o.resolve(t()).then((function(){return e}))}),(function(e){return o.resolve(t()).then((function(){throw e}))})):n.then(t,t)},t}();function nt(){var t=void 0;if(void 0!==n.g)t=n.g;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var e=t.Promise;if(e){var o=null;try{o=Object.prototype.toString.call(e.resolve())}catch(t){}if("[object Promise]"===o&&!e.cast)return}t.Promise=et}return et.prototype.then=T,et.all=K,et.race=X,et.resolve=D,et.reject=$,et._setScheduler=l,et._setAsap=u,et._asap=a,et.polyfill=nt,et.Promise=et,et}()},514:function(t,e,n){"use strict";n.r(e),n.d(e,{AutoResizeColumns:function(){return P},Calendar:function(){return tt},CellRendererType:function(){return q},DFMT_REGEX:function(){return N},DateTimePicker:function(){return et},DefaultCalendar:function(){return ot},DefaultDateTimePicker:function(){return lt},DefaultDialog:function(){return pt},DefaultDialogService:function(){return ht},DefaultDialogSet:function(){return gt},DefaultProgressDialog:function(){return ft},DefaultTimePicker:function(){return st},DialogFooterAlignment:function(){return U},DomElementBuilder:function(){return S},DomInputElementBuilder:function(){return M},DomSelectElementBuilder:function(){return I},DomTextAreaElementBuilder:function(){return k},DragManager:function(){return R},DropEffect:function(){return A},EasyGrid:function(){return Z},EqDragEvent:function(){return O},GridCellRendererStore:function(){return V},GridColumn:function(){return Y},GridColumnAlign:function(){return j},GridColumnList:function(){return J},TimePicker:function(){return it},addCssClass:function(){return a},addElement:function(){return s},browserUtils:function(){return i.z},createBrowserEvent:function(){return h},dialogs:function(){return yt},domel:function(){return B},eqCssMobile:function(){return x},eqCssPrefix:function(){return b},eqDragManager:function(){return F},getDocSize:function(){return f},getElementAbsolutePos:function(){return y},getScrollPos:function(){return g},getViewportSize:function(){return p},getWinSize:function(){return m},hideElement:function(){return l},isVisible:function(){return d},mask:function(){return w},showElement:function(){return u},slideDown:function(){return v},slideUp:function(){return C},toggleVisibility:function(){return c},wrapInner:function(){return r}});var o=n(907),i=n(789);function r(t,e){for(t.appendChild(e);t.firstChild!==e;)e.appendChild(t.firstChild)}function s(t,e,n){var o=document.createElement(e),i=n||{};return i.cssClass&&(o.className=i.cssClass),t.appendChild(o),o}function a(t,e){t.className=t.className?t.className+" "+e:e}function l(t){t.style.display="none"}function u(t,e){e||(e=""),t.style.display=e}function c(t,e,n){n||(n={}),n.display||(n.display=""),n.duration||(n.duration=200),l(t),u(e,n.display),n.complete&&n.complete()}function d(t){return"none"!=t.style.display&&0!=t.offsetWidth&&0!=t.offsetHeight}function h(t){var e;return"function"==typeof Event?e=new Event(t):(e=document.createEvent("Event")).initEvent(t,!0,!0),e}function p(){return{width:Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),height:Math.max(document.documentElement.clientHeight||0,window.innerHeight||0)}}function f(){return i.z.IsIE()?m():{width:Math.max(document.documentElement.clientWidth,document.body.clientWidth||0),height:Math.max(document.documentElement.clientHeight,document.body.clientHeight||0)}}function g(){var t=document.body,e=document.documentElement;return{top:window.pageYOffset||e.scrollTop||t.scrollTop,left:window.pageXOffset||e.scrollLeft||t.scrollLeft}}function y(t){var e={x:0,y:0};if(null!==t){var n=function(t){var e,n={top:0,right:0,bottom:0,left:0,width:0,height:0};try{e=t.getBoundingClientRect()}catch(t){e=n}var o=document.body,i=document.documentElement,r=g(),s=r.top,a=r.left,l=i.clientTop||o.clientTop||0,u=i.clientLeft||o.clientLeft||0,c=e.top+s-l,d=e.left+a-u;return{top:Math.round(c),left:Math.round(d)}}(t);e={x:n.left,y:n.top}}return e}function m(){return{width:window.innerWidth,height:window.innerHeight}}function v(t,e,n){t.style.removeProperty("display");var o=window.getComputedStyle(t).display;"none"===o&&(o="block"),t.style.display=o;var i=t.offsetHeight;t.style.overflow="hidden",t.style.height="0px",t.style.paddingTop="0px",t.style.paddingBottom="0px",t.style.marginTop="0px",t.style.marginBottom="0px",t.offsetHeight,t.style.boxSizing="border-box",t.style.transitionProperty="height, margin, padding",t.style.transitionDuration=e+"ms",t.style.height=i+"px",t.style.removeProperty("padding-top"),t.style.removeProperty("padding-bottom"),t.style.removeProperty("margin-top"),t.style.removeProperty("margin-bottom"),window.setTimeout((function(){t.style.removeProperty("height"),t.style.removeProperty("overflow"),t.style.removeProperty("transition-duration"),t.style.removeProperty("transition-property"),t.style.removeProperty("box-sizing"),n&&n()}),e)}function C(t,e,n){t.style.transitionProperty="height, margin, padding",t.style.transitionDuration=e+"ms",t.style.boxSizing="border-box",t.style.height=t.offsetHeight+"px",t.offsetHeight,t.style.overflow="hidden",t.style.height="0px",t.style.paddingTop="0px",t.style.paddingBottom="0px",t.style.marginTop="0px",t.style.marginBottom="0px",window.setTimeout((function(){t.style.display="none",t.style.removeProperty("height"),t.style.removeProperty("padding-top"),t.style.removeProperty("padding-bottom"),t.style.removeProperty("margin-top"),t.style.removeProperty("margin-bottom"),t.style.removeProperty("overflow"),t.style.removeProperty("transition-duration"),t.style.removeProperty("transition-property"),t.style.removeProperty("box-sizing"),n&&n()}),e)}var b="eqjs",x="eqjs-mobile";function w(t,e){var n={9:"[0-9]",a:"[a-z]"},o=e.split(""),i=function(e){if("focus"!==e.type||""===t.value){var i=[],r=t.selectionStart;o.forEach((function(e,o){if(n[e]){var r=new RegExp(n[e],"i").test(t.value.charAt(o));i.push(r?t.value.charAt(o):"_")}else i.push(e)})),t.value=i.join(""),t.selectionStart=t.selectionEnd=r}};t.addEventListener("keydown",(function(e){if(8===e.keyCode||46===e.keyCode){e.preventDefault();var i=[],r=t.selectionStart;if(0==r)return;for(var s=r,a=!0,l=o.length-1;l>=0;l--){var u=o[l];if(n[u]){var c=new RegExp(n[u],"i").test(t.value.charAt(l));c&&l!=r-1&&(a=!1),l===r-1&&s--,i.push(c&&l!=r-1?t.value.charAt(l):"_")}else l===s-1&&s--,r-1===l&&r--,i.push(u)}t.value=a?"":i.reverse().join(""),t.selectionStart=t.selectionEnd=s<0?0:s;var d=document.createEvent("Event");d.initEvent("input",!0,!0),t.dispatchEvent(d)}})),t.addEventListener("keypress",(function(e){var i=String.fromCharCode(e.charCode);if(i){e.preventDefault();var r=[],s=t.selectionStart,a=s;o.forEach((function(e,o){if(n[e]){var l=o!=s?t.value.charAt(o):i,u=new RegExp(n[e],"i").test(l);r.push(u?l:"_"),u&&s===o&&a++}else r.push(e),a===o&&a++,s===o&&s++})),t.value=r.join(""),t.selectionStart=t.selectionEnd=a;var l=document.createEvent("Event");l.initEvent("input",!0,!0),t.dispatchEvent(l)}})),t.addEventListener("input",i),t.addEventListener("focus",i)}var E,T=(E=function(t,e){return E=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},E(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}E(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),D=function(t,e,n){if(n||2===arguments.length)for(var o,i=0,r=e.length;i<r;i++)!o&&i in e||(o||(o=Array.prototype.slice.call(e,0,i)),o[i]=e[i]);return t.concat(o||Array.prototype.slice.call(e))},S=function(){function t(t,e){this.element="string"==typeof t?document.createElement(t):t,e&&this.element.parentElement!==e&&e.appendChild(this.element)}return t.prototype.addChild=function(t,e){var n=B(t,this.element);return e&&e(n),this},t.prototype.addChildElement=function(t){return t&&this.element.appendChild(t),this},t.prototype.attr=function(t,e){return this.element.setAttribute(t,e),this},t.prototype.id=function(t){return this.attr("id",t)},t.prototype.focus=function(){return this.element.focus(),this},t.prototype.title=function(t){return this.attr("title",t)},t.prototype.data=function(t,e){return void 0===e&&(e=null),null===e?(this.element.removeAttribute("data-"+t),this):this.attr("data-"+t,e)},t.prototype.show=function(){return this.removeStyle("display")},t.prototype.hide=function(t){return void 0===t&&(t=!0),t?this.setStyle("display","none"):this},t.prototype.visible=function(t){return void 0===t&&(t=!0),t?this.setStyle("visibility","visible"):this.setStyle("visibility","hidden")},t.prototype.isVisible=function(){return!!(this.element.offsetWidth||this.element.offsetHeight||this.element.getClientRects().length)},t.prototype.addClass=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(t)for(var o=D(D([],t.trim().split(" "),!0),e,!0),i=0;i<o.length;i++)this.element.classList.add(o[i]);return this},t.prototype.removeClass=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(t)for(var o=D(D([],t.trim().split(" "),!0),e,!0),i=0;i<o.length;i++)this.element.classList.remove(o[i]);return this},t.prototype.toggleClass=function(t,e){return void 0===e&&(e=void 0),t&&this.element.classList.toggle(t,e),this},t.prototype.on=function(t,e){for(var n=t.split(" "),o=0;o<n.length;o++)this.element.addEventListener(n[o],e);return this},t.prototype.off=function(t,e){for(var n=t.split(" "),o=0;o<n.length;o++)this.element.removeEventListener(n[o],e);return this},t.prototype.setStyle=function(t,e){return this.element.style.setProperty(t,e),this},t.prototype.removeStyle=function(t){return this.element.style.removeProperty(t),this},t.prototype.text=function(t){return this.element.innerText=t,this},t.prototype.html=function(t){return this.element.innerHTML=t,this},t.prototype.clear=function(){var t=this.element;this.element=document.createElement(this.element.tagName),t.replaceWith(this.element)},t.prototype.addText=function(t){var e=document.createTextNode(t);return this.element.appendChild(e),this},t.prototype.addHtml=function(t){return this.element.innerHTML+=t,this},t.prototype.toDOM=function(){return this.element},t.prototype.appendTo=function(t){return t&&t.appendChild(this.element),this},t}(),k=function(t){function e(e,n){return e?t.call(this,e,n)||this:t.call(this,"textarea",n)||this}return T(e,t),e.prototype.name=function(t){return this.element.name=t,this},e.prototype.rows=function(t){return this.element.rows=t,this},e.prototype.cols=function(t){return this.element.cols=t,this},e.prototype.value=function(t){return this.element.value=t,this},e}(S),M=function(t){function e(e,n){return e?t.call(this,e,n)||this:t.call(this,"input",n)||this}return T(e,t),e.prototype.name=function(t){return this.element.name=t,this},e.prototype.type=function(t){return this.element.type=t,this},e.prototype.size=function(t){return this.element.size=t,this},e.prototype.value=function(t){return t instanceof Date?this.element.valueAsDate=t:"number"==typeof t?this.element.valueAsNumber=t:this.element.value=t,this},e.prototype.mask=function(t){return w(this.element,t),this},e}(S),I=function(t){function e(e,n){return e?t.call(this,e,n)||this:t.call(this,"select",n)||this}return T(e,t),e.prototype.addOption=function(t){var e=document.createElement("option");return"string"==typeof t?(e.value=t,e.innerHTML=t):(e.value=t.value,e.innerHTML=t.title||t.value,e.selected=t.selected||!1),this.element.appendChild(e),this},e.prototype.value=function(t){return this.element.value=t,this},e}(S);function B(t,e){return"div"===t||t instanceof HTMLDivElement||"span"===t||t instanceof HTMLSpanElement||"a"===t||t instanceof HTMLAnchorElement||"button"===t||t instanceof HTMLButtonElement||"img"===t||t instanceof HTMLImageElement?new S(t,e):"input"===t||t instanceof HTMLInputElement?new M(t instanceof HTMLInputElement?t:null,e):"textarea"===t||t instanceof HTMLTextAreaElement?new k(t instanceof HTMLTextAreaElement?t:null,e):"select"===t||t instanceof HTMLSelectElement?new I(t instanceof HTMLSelectElement?t:null,e):new S(t,e)}var A,_="undefined"!=typeof TouchEvent;!function(t){t.None="none",t.Allow="allow",t.Forbid="forbid"}(A||(A={}));var P,O=function(t,e,n){this.dropEffect=A.Allow,this.pageX=0,this.pageY=0,this.item=t,this.dragImage=e,this.data=t.data,this.sourceEvent=n,n&&n instanceof MouseEvent&&(this.pageX=n.pageX,this.pageY=n.pageY),n&&_&&n instanceof TouchEvent&&n.touches[0]&&(this.pageX=n.touches[0].pageX,this.pageY=n.touches[0].pageY)},L=function(t){t&&t instanceof MouseEvent&&(this.x=t.pageX,this.y=t.pageY),t&&_&&t instanceof TouchEvent&&t.touches[0]&&(this.x=t.touches[0].pageX,this.y=t.touches[0].pageY)},R=function(){function t(){this.delta=5,this.draggableItem=null,this.dragImage=null,this.finishedSuccessfully=!1,this.mouseDownPosition=null,this.containerDescriptors=[],this.containerDescriptorIndex=-1,this.dropEffect=A.None,this.classPrefix="eqjs-drop",this.DRAG_DISABLED_ATTR="drag-disabled"}return t.prototype.registerDraggableItem=function(t){var e=this,n=t.element;if(!n)throw Error("Element in draggle item is null or undefined");n.ondragstart=function(){return!1};var o=function(t){if(!n.hasAttribute(e.DRAG_DISABLED_ATTR)){t.preventDefault(),t instanceof MouseEvent&&t.stopPropagation();var o=new L(t);(Math.abs(o.x-e.mouseDownPosition.x)>e.delta||Math.abs(o.y-e.mouseDownPosition.y)>e.delta)&&r(t)}},i=function(t){e.mouseMoveDragListener(t)},r=function(r){r.preventDefault(),r.stopPropagation(),n.removeEventListener("mousemove",o),n.removeEventListener("touchmove",o),e.finishedSuccessfully=!1,t.beforeDragStart&&t.beforeDragStart(),e.dragImage=B("div").setStyle("position","absolute").setStyle("z-index","65530").toDOM(),document.body.appendChild(e.dragImage),e.dragImage.appendChild(n.cloneNode(!0)),t.renderer&&t.renderer(e.dragImage),e.dropEffect=A.None,e.updateCusror(e.dropEffect),e.updateImageClass(e.dropEffect),e.draggableItem={element:n,scope:t.scope,data:t.data},e.updateDragItemPosition(r);var s=new O(e.draggableItem,e.dragImage,r);s.dropEffect=e.dropEffect,t.onDragStart&&t.onDragStart(s),e.dropEffect!==s.dropEffect&&(e.dropEffect=s.dropEffect,e.updateImageClass(e.dropEffect)),document.addEventListener("mousemove",i,!0),document.addEventListener("touchmove",i,!0)},s=function(t){_&&t instanceof TouchEvent&&t.preventDefault(),e.mouseDownPosition=new L(t),n.addEventListener("mousemove",o),n.addEventListener("touchmove",o),document.addEventListener("mouseup",a),document.addEventListener("touchend",a)};n.addEventListener("mousedown",s),n.addEventListener("touchstart",s);var a=function(t){e.mouseDownPosition=null,n.removeEventListener("mousemove",o),n.removeEventListener("touchmove",o),document.removeEventListener("mousemove",i,!0),document.removeEventListener("touchmove",i,!0),e.draggableItem&&l(t)},l=function(n){try{if(e.containerDescriptorIndex>=0){var o=e.containerDescriptors[e.containerDescriptorIndex],i={element:o.element,scopes:o.scopes,data:o.data},r=new O(e.draggableItem,e.dragImage,n);try{i.scopes.indexOf(e.draggableItem.scope)>=0&&e.dropEffect===A.Allow&&(e.finishedSuccessfully=!0,o.onDrop&&o.onDrop(i,r))}finally{o.onDragLeave&&o.onDragLeave(i,r)}}}finally{try{var s=new O(e.draggableItem,e.dragImage,n);s.data.finishedSuccessfully=e.finishedSuccessfully,t.onDragEnd&&t.onDragEnd(s)}finally{e.draggableItem=null,e.dragImage&&e.dragImage.parentElement&&e.dragImage.parentElement.removeChild(e.dragImage),e.dragImage=null,e.finishedSuccessfully=!1,document.removeEventListener("mouseup",a),document.removeEventListener("touchend",a)}}}},t.prototype.registerDropContainer=function(t){if(!t.element)throw Error("Element in drop container is null or undefined");this.containerDescriptors.push(t)},t.prototype.removeDropContainer=function(t){var e=this.containerDescriptors.filter((function(e){return e===t||e.element==t}));if(e)for(var n=0,i=e;n<i.length;n++){var r=i[n];o.utils.removeArrayItem(this.containerDescriptors,r)}},t.prototype.mouseMoveDragListener=function(t){if(t instanceof MouseEvent&&t.preventDefault(),t.stopPropagation(),this.updateDragItemPosition(t),-1==this.containerDescriptorIndex){for(var e=0;e<this.containerDescriptors.length;e++){var n=this.containerDescriptors[e];if(this.detectDragEnterEvent(n.element,t)){this.containerDescriptorIndex=e;break}}this.containerDescriptorIndex>=0&&this.dragEnterEvent(t)}else{n=this.containerDescriptors[this.containerDescriptorIndex];this.detectDragLeaveEvent(n.element,t)&&(this.dragLeaveEvent(t),this.containerDescriptorIndex=-1)}if(this.containerDescriptorIndex>=0){var o={element:(n=this.containerDescriptors[this.containerDescriptorIndex]).element,scopes:n.scopes,data:n.data};if(o.scopes.indexOf(this.draggableItem.scope)>=0){var i=new O(this.draggableItem,this.dragImage,t);i.dropEffect=this.dropEffect,n.onDragOver&&n.onDragOver(o,i)}}},t.prototype.updateCusror=function(t){switch(t){case A.Allow:this.setCursorStyle(this.dragImage,"grabbing");break;case A.Forbid:this.setCursorStyle(this.dragImage,"no-drop");break;default:this.setCursorStyle(this.dragImage,"grabbing")}},t.prototype.updateImageClass=function(t){switch(this.dragImage.classList.remove("".concat(this.classPrefix,"-allow")),this.dragImage.classList.remove("".concat(this.classPrefix,"-forbid")),this.dragImage.classList.remove("".concat(this.classPrefix,"-none")),t){case A.Allow:this.dragImage.classList.add("".concat(this.classPrefix,"-allow"));break;case A.None:this.dragImage.classList.add("".concat(this.classPrefix,"-none"));break;case A.Forbid:this.dragImage.classList.add("".concat(this.classPrefix,"-forbid"));break;default:this.dragImage.classList.add("".concat(this.classPrefix,"-none"))}},t.prototype.setCursorStyle=function(t,e){if(t){t.style.cursor=e;for(var n=0;n<t.children.length;n++)this.setCursorStyle(t.children[n],e)}},t.prototype.updateDragItemPosition=function(t){if(this.dragImage){var e=new L(t);this.dragImage.style.top=e.y-this.dragImage.offsetHeight/2+"px",this.dragImage.style.left=e.x-this.dragImage.offsetWidth/2+"px"}},t.prototype.dragEnterEvent=function(t){var e=this.containerDescriptors[this.containerDescriptorIndex],n={element:e.element,scopes:e.scopes,data:e.data};if(n.scopes.indexOf(this.draggableItem.scope)>=0){var o=new O(this.draggableItem,this.dragImage,t);o.dropEffect=A.Allow,e.onDragEnter&&e.onDragEnter(n,o),this.dropEffect=o.dropEffect,this.updateCusror(this.dropEffect),this.updateImageClass(this.dropEffect)}else this.dropEffect!==A.Forbid&&(this.dropEffect=A.None,this.updateCusror(this.dropEffect),this.updateImageClass(this.dropEffect))},t.prototype.dragLeaveEvent=function(t){var e=this.containerDescriptors[this.containerDescriptorIndex],n={element:e.element,scopes:e.scopes,data:e.data};if(n.scopes.indexOf(this.draggableItem.scope)>=0){var o=new O(this.draggableItem,this.dragImage,t);o.dropEffect=A.None,e.onDragLeave&&e.onDragLeave(n,o),this.dropEffect=o.dropEffect,this.updateCusror(this.dropEffect),this.updateImageClass(this.dropEffect)}},t.prototype.detectDragEnterEvent=function(t,e){var n=y(t),o=new L(e);return!(o.y<n.y||o.y>n.y+t.offsetHeight)&&!(o.x<n.x||o.x>n.x+t.offsetWidth)},t.prototype.detectDragLeaveEvent=function(t,e){var n=y(t),o=new L(e);return!(o.y>n.y&&o.y<n.y+t.offsetHeight&&o.x>n.x&&o.x<n.x+t.offsetWidth)},t}(),F=new R;!function(t){t[t.Always=0]="Always",t[t.Once=1]="Once",t[t.Never=2]="Never"}(P||(P={}));var q,Q="keg",N=/{0:(.*?)}/g;!function(t){t[t.STRING=1]="STRING",t[t.NUMBER=2]="NUMBER",t[t.DATETIME=3]="DATETIME",t[t.BOOL=4]="BOOL"}(q||(q={}));var j,H=function(t,e,n,o){var i=t?t.toString().replace(/\n/g,"↵ "):"";n.innerText=i,n.title=i,e.align==j.NONE&&n.classList.add("".concat(Q,"-cell-value-align-left"))},W=function(t,e,n,i){var r=(t||"").toString();"number"==typeof t&&(r=e.dataColumn&&e.dataColumn.displayFormat&&N.test(e.dataColumn.displayFormat)?e.dataColumn.displayFormat.replace(N,(function(e,n){return o.i18n.numberToStr(t,n)})):t.toLocaleString()),n.innerText=r,n.title=r,e.align==j.NONE&&n.classList.add("".concat(Q,"-cell-value-align-right"))},G=function(t,e,n,i){var r="[object Date]"===Object.prototype.toString.call(t),s=(t||"").toString();if(r)if(e.dataColumn&&e.dataColumn.displayFormat&&N.test(e.dataColumn.displayFormat))s=e.dataColumn.displayFormat.replace(N,(function(n,i){return o.i18n.dateTimeToStr(t,e.type,i)}));else{var a=o.i18n.getCurrentLocale(),l={hour:"numeric",minute:"numeric",second:"numeric"};switch(e.type){case o.DataType.Date:s=t.toLocaleDateString(a);break;case o.DataType.Time:s=t.toLocaleTimeString(a,l);break;case o.DataType.DateTime:s="".concat(t.toLocaleDateString(a)," ").concat(t.toLocaleTimeString(a,l))}}n.innerText=s,n.title=s,e.align==j.NONE&&n.classList.add("".concat(Q,"-cell-value-align-right"))},z=function(t,e,n,i){if(e.dataColumn&&e.dataColumn.displayFormat&&N.test(e.dataColumn.displayFormat)){var r=e.dataColumn.displayFormat.replace(N,(function(e,n){return o.i18n.booleanToStr(t,n)}));return H(r,e,n)}n.classList.add("".concat(Q,"-cell-value-bool")),n.classList.add("".concat(Q,"-").concat(t?"cell-value-true":"cell-value-false"))},V=function(){function t(t){this.renderers={},this.defaultRenderers={},this.registerRenderer("StringDefault",H),this.setDefaultRenderer(q.STRING,H),this.registerRenderer("NumberDefault",W),this.setDefaultRenderer(q.NUMBER,W),this.registerRenderer("DateTimeDefault",G),this.setDefaultRenderer(q.DATETIME,G),this.registerRenderer("BoolDefault",z),this.setDefaultRenderer(q.BOOL,z)}return t.prototype.getDefaultRenderer=function(t){var e=this.getCellType(t);return this.defaultRenderers[q[e]]},t.prototype.getDefaultRendererByType=function(t){return this.defaultRenderers[q[t]]},t.prototype.setDefaultRenderer=function(t,e){e&&(this.defaultRenderers[q[t]]=e)},t.prototype.getRenderer=function(t){return this.renderers[t]},t.prototype.registerRenderer=function(t,e){this.renderers[t]=e},t.prototype.getCellType=function(t){switch(t){case o.DataType.Autoinc:case o.DataType.Byte:case o.DataType.Word:case o.DataType.Currency:case o.DataType.Float:case o.DataType.Int32:case o.DataType.Int64:return q.NUMBER;case o.DataType.Date:case o.DataType.DateTime:case o.DataType.Time:return q.DATETIME;case o.DataType.Bool:return q.BOOL;default:return q.STRING}},t}();!function(t){t[t.NONE=1]="NONE",t[t.LEFT=2]="LEFT",t[t.CENTER=3]="CENTER",t[t.RIGHT=4]="RIGHT"}(j||(j={}));var U,Y=function(){function t(t,e,n){void 0===n&&(n=!1),this._label=null,this._description=null,this.align=j.NONE,this.isVisible=!0,this.isRowNum=!1,this.dataColumn=t,this.grid=e;var i=e.options.columnWidths||{};t?(t.style.alignment&&(this.align=function(t){switch(t){case o.ColumnAlignment.Left:return j.LEFT;case o.ColumnAlignment.Center:return j.CENTER;case o.ColumnAlignment.Right:return j.RIGHT;default:return j.NONE}}(t.style.alignment)),this.width=i&&i[this.type]?i[this.type].default:250,this.cellRenderer=this.grid.cellRendererStore.getDefaultRenderer(t.type),this._description=t.description):n&&(this.isRowNum=!0,this.width=i&&i.rowNumColumn?i.rowNumColumn.default:60,this._label="",this.cellRenderer=this.grid.cellRendererStore.getDefaultRendererByType(q.NUMBER)),e&&e.options&&e.options.onGetCellRenderer&&(this.cellRenderer=e.options.onGetCellRenderer(this,this.cellRenderer)||this.cellRenderer)}return Object.defineProperty(t.prototype,"label",{get:function(){return this._label?this._label:this.isRowNum?"":this.dataColumn.label},set:function(t){this._label=this.label},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"description",{get:function(){return this._description},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"type",{get:function(){return this.dataColumn?this.dataColumn.type:null},enumerable:!1,configurable:!0}),t}(),J=function(){function t(t,e){this.items=[],this.grid=e,this.sync(t)}return t.prototype.sync=function(t,e){void 0===e&&(e=!0),this.clear();var n=new Y(null,this.grid,!0);if(this.add(n),e||(n.isVisible=!1),t)for(var o=0,i=t.getItems();o<i.length;o++){var r=i[o],s=new Y(r,this.grid);this.grid.options.onSyncGridColumn&&this.grid.options.onSyncGridColumn(s),this.add(s)}},Object.defineProperty(t.prototype,"count",{get:function(){return this.items.length},enumerable:!1,configurable:!0}),t.prototype.add=function(t){var e=this.items.length;return this.items.push(t),e},t.prototype.put=function(t,e){t>=0&&t<this.items.length&&(this.items[t]=e)},t.prototype.move=function(t,e){var n=this.items.indexOf(t);n>=0&&n!=e&&o.utils.moveArrayItem(this.items,n,e)},t.prototype.get=function(t){return t>=0&&t<this.items.length?this.items[t]:null},t.prototype.getItems=function(){return this.items},t.prototype.removeAt=function(t){this.get(t);this.items.splice(t,1)},t.prototype.clear=function(){this.items=[]},t}(),K=n(946),X=function(){return X=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},X.apply(this,arguments)},$=function(t,e,n){if(n||2===arguments.length)for(var o,i=0,r=e.length;i<r;i++)!o&&i in e||(o||(o=Array.prototype.slice.call(e,0,i)),o[i]=e[i]);return t.concat(o||Array.prototype.slice.call(e))},Z=function(){function t(t){if(this.cssPrefix="keg",this.pagination={page:1,pageSize:30,total:0},this.paginationOptions={maxButtonCount:10,useBootstrap:!1},this.defaultDataGridOptions={slot:null,dataTable:null,fixHeightOnFirstRender:!1,syncGridColumns:!0,useRowNumeration:!0,allowDragDrop:!1,aggregates:{settings:null,calculator:null},paging:{enabled:!0,pageSize:30,pageSizeItems:[20,30,50,100,200]},columnWidths:{autoResize:P.Always,stringColumns:{min:100,max:500,default:250},numberColumns:{min:60,default:120},boolColumns:{min:50,default:80},dateColumns:{min:80,default:200},otherColumns:{min:100,max:500,default:250},rowNumColumn:{min:40,default:60}},showPlusButton:!1,viewportRowsCount:null,showActiveRow:!0},this.rowsOnPagePromise=null,this.containerInitialHeight=0,this.firstRender=!0,this.prevRowTotals=null,this.landingIndex=-1,this.landingSlot=B("div").addClass("".concat(this.cssPrefix,"-col-landing-slot")).addChildElement(B("div").toDOM()).toDOM(),this._activeRowIndex=-1,t&&t.paging&&(t.paging=o.utils.assign(this.defaultDataGridOptions.paging,t.paging)),this.options=this.mergeOptions(t),this.processColumnWidthsOptions(),!this.options.slot)throw Error('"slot" parameter is required to initialize EasyDataGrid');if(!this.options.dataTable)throw Error('"dataTable" parameter is required to initialize EasyDataGrid');this.dataTable=t.dataTable,this.eventEmitter=new o.EventEmitter(this),this.cellRendererStore=new V(t),this.columns=new J(this.dataTable.columns,this),this.setSlot(this.options.slot),this.init(this.options)}return t.prototype.mergeOptions=function(t){var e=o.utils.assignDeep({},this.defaultDataGridOptions.columnWidths,t.columnWidths),n=o.utils.assignDeep({},this.defaultDataGridOptions.paging,t.paging),i=o.utils.assign({},this.defaultDataGridOptions,t);return i.columnWidths=e,i.paging=n,i},t.prototype.processColumnWidthsOptions=function(){var t=this.options.columnWidths;if(t){o.utils.getStringDataTypes().forEach((function(e){t[e]=X(X({},t.stringColumns),t[e])})),o.utils.getNumericDataTypes().forEach((function(e){t[e]=X(X({},t.numberColumns),t[e])})),t[o.DataType.Bool]=X(X({},t.boolColumns),t[o.DataType.Bool]),o.utils.getDateDataTypes().forEach((function(e){t[e]=X(X({},t.dateColumns),t[e])}));var e=$($($($([],o.utils.getStringDataTypes(),!0),o.utils.getNumericDataTypes(),!0),o.utils.getDateDataTypes(),!0),[o.DataType.Bool],!1);o.utils.getAllDataTypes().forEach((function(n){n in e||(t[n]=X(X({},t.otherColumns),t[n]))})),t[o.DataType.Unknown]=t.otherColumns}},t.prototype.setSlot=function(t){if("string"==typeof t){if(t.length)if("#"===t[0])this.slot=document.getElementById(t.substring(1));else{if("."!==t[0])throw Error("Unrecognized slot parameter (Must be id, class or HTMLElement): "+t);var e=document.getElementsByClassName(t.substring(1));e.length&&(this.slot=e[0])}}else this.slot=t},t.prototype.init=function(t){var e=this;t.onInit&&this.addEventListener("init",t.onInit),t.onRowClick&&this.addEventListener("rowClick",t.onRowClick),t.onRowDbClick&&this.addEventListener("rowDbClick",t.onRowDbClick),t.onPlusButtonClick&&this.addEventListener("plusButtonClick",t.onPlusButtonClick),t.onColumnChanged&&this.addEventListener("columnChanged",t.onColumnChanged),t.onColumnDeleted&&this.addEventListener("columnDeleted",t.onColumnDeleted),t.onColumnMoved&&this.addEventListener("columnMoved",t.onColumnMoved),t.onPageChanged&&this.addEventListener("pageChanged",t.onPageChanged),t.onActiveRowChanged&&this.addEventListener("activeRowChanged",t.onActiveRowChanged),this.addEventListener("pageChanged",(function(t){return e.activeRowIndex=-1})),o.utils.assignDeep(this.paginationOptions,t.pagination),this.pagination.pageSize=this.options.paging.pageSize||this.pagination.pageSize,this.options.allowDragDrop&&F.registerDropContainer({element:this.slot,scopes:["gridColumnMove"],onDragEnter:function(t,n){e.slot.classList.add("".concat(b,"-drophover")),e.showLandingSlot(n.pageX,n.pageY)},onDragOver:function(t,n){e.showLandingSlot(n.pageX,n.pageY)},onDragLeave:function(t,n){n.dropEffect=A.Forbid,e.slot.classList.remove("".concat(b,"-drophover")),e.hideLandingSlot()},onDrop:function(t,n){e.dataTable.columns.move(n.data.column,e.landingIndex),e.refresh(),e.fireEvent({type:"columnMoved",columnId:n.data.column.id,newIndex:e.landingIndex})}}),this.refresh(),this.fireEvent("init")},t.prototype.fireEvent=function(t){"string"==typeof t?this.eventEmitter.fire(t):this.eventEmitter.fire(t.type,t)},t.prototype.setData=function(t){this.dataTable=t,this.clear(),this.refresh()},t.prototype.getData=function(){return this.dataTable},t.prototype.getColumns=function(){return this.columns},t.prototype.destroy=function(){this.slot.innerHTML=""},t.prototype.refresh=function(){this.clearDOM(),this.render()},t.prototype.clearDOM=function(){this.slot.innerHTML=""},t.prototype.clear=function(){this.pagination.page=1,this.clearDOM()},t.prototype.render=function(){var t=this;if(this.hasData()||this.options.showPlusButton){this.containerInitialHeight=this.slot.clientHeight,this.rootDiv=document.createElement("div"),this.rootDiv.style.width="100%",this.rootDiv.classList.add("".concat(this.cssPrefix,"-root")),this.columns.sync(this.dataTable.columns,this.options.useRowNumeration),this.renderHeader(),this.rootDiv.appendChild(this.headerDiv),this.renderBody(),this.rootDiv.appendChild(this.bodyDiv),this.renderFooter(),this.rootDiv.appendChild(this.footerDiv);var e=document.createElement("div");e.classList.add("".concat(this.cssPrefix,"-container")),e.appendChild(this.rootDiv),this.slot.appendChild(e);var n=this.options.columnWidths.autoResize!==P.Never;this.rowsOnPagePromise?this.rowsOnPagePromise.then((function(){return t.updateHeight()})).then((function(){t.firstRender=!1,t.rowsOnPagePromise=null})):setTimeout((function(){t.updateHeight().then((function(){t.firstRender=!1,n&&t.resizeColumns()}))}),100)}},t.prototype.updateHeight=function(){var t=this;return new K((function(e){if(t.options.viewportRowsCount){var n=t.bodyCellContainerDiv.firstElementChild,o=(n?n.offsetHeight:36)*t.options.viewportRowsCount;return B(t.bodyViewportDiv).setStyle("height","".concat(o,"px")),void setTimeout((function(){var n=t.bodyViewportDiv.offsetHeight-t.bodyViewportDiv.clientHeight;o+=n,B(t.bodyViewportDiv).setStyle("height","".concat(o,"px")),e()}),100)}t.containerInitialHeight,e()})).then((function(){t.options.fixHeightOnFirstRender&&t.firstRender&&(t.slot.style.height="".concat(t.slot.offsetHeight,"px"))}))},t.prototype.getContainerWidth=function(){return this.columns.getItems().filter((function(t){return t.isVisible})).map((function(t){return t.width})).reduce((function(t,e){return t+e}))},t.prototype.renderHeader=function(){var t=this;this.headerDiv=B("div").addClass("".concat(this.cssPrefix,"-header")).toDOM(),this.headerViewportDiv=B("div",this.headerDiv).addClass("".concat(this.cssPrefix,"-header-viewport")).toDOM(),this.headerCellContainerDiv=B("div",this.headerViewportDiv).addClass("".concat(this.cssPrefix,"-header-cell-container")).toDOM(),this.headerRowDiv=B("div",this.headerCellContainerDiv).addClass("".concat(this.cssPrefix,"-header-row")).toDOM(),this.columns.getItems().forEach((function(e,n){if(e.isVisible){var o=t.renderColumnHeader(e,n);t.headerRowDiv.appendChild(o),e.isRowNum&&B(o).addChildElement(t.renderHeaderButtons())}}));var e=this.getContainerWidth();B(this.headerCellContainerDiv).setStyle("width","".concat(e,"px"))},t.prototype.hasData=function(){return this.dataTable.columns.count>0},t.prototype.renderColumnHeader=function(t,e){var n=this,o=B("div").addClass("".concat(this.cssPrefix,"-header-cell")).data("col-idx","".concat(e)).setStyle("width","".concat(t.width,"px"));t.dataColumn&&o.data("col-id","".concat(t.dataColumn.id));var i=o.toDOM();return B("div",i).addClass("".concat(this.cssPrefix,"-header-cell-resize")),t.isRowNum||B("div",i).addClass("".concat(this.cssPrefix,"-header-cell-label")).text(t.label),t.description&&B("div",i).addClass("question-mark").title(t.description),this.options.allowDragDrop&&F.registerDraggableItem({element:i,scope:"gridColumnMove",data:{column:t},renderer:function(e){e.innerHTML="";var o=document.createElement("div");o.innerText=t.label,e.classList.add("".concat(n.cssPrefix,"-sortable-helper")),e.appendChild(o)},onDragStart:function(t){t.dropEffect=A.Allow}}),i},t.prototype.renderBody=function(){var t=this;this.bodyDiv=B("div").addClass("".concat(this.cssPrefix,"-body")).toDOM(),this.bodyViewportDiv=B("div",this.bodyDiv).addClass("".concat(this.cssPrefix,"-body-viewport")).attr("tabIndex","0").toDOM(),this.bodyCellContainerDiv=B("div",this.bodyViewportDiv).addClass("".concat(this.cssPrefix,"-cell-container")).toDOM();var e=this.canShowAggregates();this.dataTable&&(this.showProgress(),this.rowsOnPagePromise=this.getRowsToRender().then((function(n){t.pagination.total=t.dataTable.getTotal(),t.hideProgress(),t.bodyCellContainerDiv.innerHTML="",t.prevRowTotals=null;var i=0;if(n.length){var r=e?t.options.aggregates.settings.getGroups():[];i=n.length<t.pagination.pageSize?n.length:t.pagination.pageSize,n.forEach((function(n,o){if(e&&t.updateTotalsState(r,n),o<i){var s=t.renderRow(n,o);t.bodyCellContainerDiv.appendChild(s)}}));var s=t.options.aggregates&&t.options.aggregates.showGrandTotalsOnEachPage;if(e&&(t.isLastPage()||s)){var a=new o.DataRow(t.dataTable.columns,new Array(t.dataTable.columns.count));t.updateTotalsState(r,a,!0)}}if(t.options.columnWidths.autoResize!==P.Never)t.resizeColumns();else{var l=t.getContainerWidth();B(t.bodyCellContainerDiv).setStyle("width","".concat(l,"px"))}return i})).catch((function(t){return console.error(t),0}))),this.bodyViewportDiv.addEventListener("scroll",(function(e){B(t.headerViewportDiv).setStyle("margin-left","-".concat(t.bodyViewportDiv.scrollLeft,"px"))})),this.bodyViewportDiv.addEventListener("keydown",this.onViewportKeydown.bind(this))},t.prototype.isLastPage=function(){return this.dataTable.elasticChunks?this.dataTable.totalIsKnown()&&this.pagination.page*this.pagination.pageSize>=this.pagination.total:this.pagination.page*this.pagination.pageSize>=this.pagination.total},t.prototype.canShowAggregates=function(){if(!this.options||!this.options.aggregates||!this.options.aggregates.settings)return!1;var t=this.options.aggregates.settings;return(t.hasAggregates()||t.hasRecordCount())&&(t.hasGroups()||t.hasGrandTotals())},t.prototype.updateTotalsState=function(t,e,n){void 0===n&&(n=!1);var i=this.options.aggregates.settings;if(this.prevRowTotals&&i.hasGroups()){for(var r=-1,s=1;s<=t.length;s++){for(var a=0,l=t[s-1].columns;a<l.length;a++){var u=l[a];if(!i.compareValues(this.prevRowTotals.getValue(u),e.getValue(u))){r=s;break}}if(-1!==r)break}if(-1!==r)for(s=t.length;s>=r;s--){var c=new o.DataRow(this.dataTable.columns,this.prevRowTotals.toArray()),d=this.renderTotalsRow(s,c);this.bodyCellContainerDiv.appendChild(d)}}if(n&&i.hasGrandTotals()&&i.hasAggregates()){d=this.renderTotalsRow(0,e);this.bodyCellContainerDiv.appendChild(d)}this.prevRowTotals=e},t.prototype.applyGroupColumnTemplate=function(t,e,n){var o=t.replace(/{{\s*GroupValue\s*}}/g,e?"".concat(e):"-");return o=o.replace(/{{\s*GroupCount\s*}}/g,n?"".concat(n):"-")},t.prototype.renderTotalsRow=function(t,e){var n=this,o=this.options.aggregates.settings,i=t>0?o.getGroups()[t-1]:{columns:[],aggregates:o.getAggregates()},r=B("div").addClass("".concat(this.cssPrefix,"-row")).addClass("".concat(this.cssPrefix,"-row-totals")).addClass("".concat(this.cssPrefix,"-totals-lv").concat(t)).data("totals-level","".concat(t)).attr("tabindex","-1").toDOM();this.columns.getItems().forEach((function(t,o){if(t.isVisible){var s="",a=t.isRowNum?-1:n.dataTable.columns.getIndex(t.dataColumn.id);!t.isRowNum&&t.dataColumn&&i.columns.indexOf(t.dataColumn.id)>=0&&(s=e.getValue(a)),a==n.dataTable.columns.count-1&&(s=". . . . . ."),r.appendChild(n.renderCell(t,o,s,r))}}));var s=this.options.aggregates.calculator.getAggrContainer(),a=o.getAggregates().map((function(t){return t.colId})),l=o.buildGroupKey(i,e);return s.getAggregateData(t,l).then((function(s){for(var l=0,u=a;l<u.length;l++){var c=u[l];e.setValue(c,s[c])}r.innerHTML="",n.columns.getItems().forEach((function(l,u){if(l.isVisible){var c="",d=l.isRowNum?-1:n.dataTable.columns.getIndex(l.dataColumn.id);if(!l.isRowNum){var h=!1;if(l.dataColumn){var p=i.columns.indexOf(l.dataColumn.id),f=a.indexOf(l.dataColumn.id);h=t>0?p==i.columns.length-1:0==d,(p>=0||f>=0)&&(c=e.getValue(d))}var g="";if(t>0&&!(g=l.dataColumn.groupFooterColumnTemplate)&&o.hasRecordCount()&&h&&(g="{{GroupValue}} ({{GroupCount}})"),g)c=n.renderCell(l,u,c,r).firstChild.innerHTML,c=n.applyGroupColumnTemplate(g,c,s[o.COUNT_FIELD_NAME])}var y=n.renderCell(l,u,c,r);r.appendChild(y)}}))})).catch((function(t){return console.error(t)})),r},t.prototype.onViewportKeydown=function(t){if(this.options.showActiveRow){var e=this.bodyCellContainerDiv.querySelectorAll(".".concat(this.cssPrefix,"-row")).length,n=void 0;switch(t.key){case"ArrowLeft":case"ArrowRight":break;case"ArrowUp":t.preventDefault(),n=this.activeRowIndex<0||this.activeRowIndex>=e?e-1:this.activeRowIndex-1,this.activeRowIndex=n>=0?n:0;break;case"ArrowDown":t.preventDefault(),n=this.activeRowIndex<0||this.activeRowIndex>=e?0:this.activeRowIndex+1,this.activeRowIndex=n<e?n:e-1}}},t.prototype.ensureRowVisibility=function(t){var e="number"==typeof t?this.getDataRow(t):t;if(e){var n=e.getBoundingClientRect(),o=this.bodyViewportDiv.getBoundingClientRect(),i=n.top-o.top,r=n.bottom-o.top,s=this.bodyViewportDiv.clientHeight,a=window.innerHeight||document.documentElement.clientHeight;if(i>0&&r<=s&&n.top>0&&n.bottom<a)return;i<0?this.bodyViewportDiv.scrollTop=this.bodyViewportDiv.scrollTop+i:r>s&&(this.bodyViewportDiv.scrollTop=this.bodyViewportDiv.scrollTop+r-s),(n=e.getBoundingClientRect()).top<0?document.documentElement.scrollTop=document.documentElement.scrollTop+n.top:n.bottom>a&&(document.documentElement.scrollTop=document.documentElement.scrollTop+n.bottom-a)}},t.prototype.getRowsToRender=function(){return!1===this.options.paging.enabled?K.resolve(this.dataTable.getCachedRows()):this.dataTable.getRows({offset:(this.pagination.page-1)*this.pagination.pageSize,limit:this.pagination.pageSize+1}).catch((function(t){return console.error(t),[]}))},t.prototype.renderFooter=function(){var t=this;this.footerDiv=B("div").addClass("".concat(this.cssPrefix,"-footer")).toDOM(),this.rowsOnPagePromise&&this.rowsOnPagePromise.then((function(e){t.footerDiv.innerHTML="",t.footerPaginateDiv=t.renderPageNavigator(),t.footerDiv.appendChild(t.footerPaginateDiv);var n=t.renderPageInfoBlock(e);t.footerDiv.appendChild(n)}))},t.prototype.renderPageInfoBlock=function(t){var e=B("div").addClass("".concat(this.cssPrefix,"-page-info")).toDOM();if(this.dataTable.getTotal()>0){var n=t?(this.pagination.page-1)*this.pagination.pageSize+1:0,i=t?n+t-1:0,r=this.dataTable.getTotal().toString();if(this.dataTable.elasticChunks)this.dataTable.getCachedCount()!==this.dataTable.getTotal()&&(r="?");e.innerHTML=o.i18n.getText("GridPageInfo").replace("{FirstPageRecordNum}","<span>".concat(n.toString(),"</span>")).replace("{LastPageRecordNum}","<span>".concat(i.toString(),"</span>")).replace("{Total}","<span>".concat(r,"</span>"))}return e},t.prototype.showProgress=function(){},t.prototype.hideProgress=function(){},t.prototype.getLocalIndexByGlobal=function(t){return this.pagination?t%this.pagination.pageSize:t},t.prototype.getGlobalIndexByLocal=function(t){return this.pagination?(this.pagination.page-1)*this.pagination.pageSize+t:t},t.prototype.renderRow=function(t,e){var n=this,o=this.getGlobalIndexByLocal(e),i=B("div").addClass("".concat(this.cssPrefix,"-row")).addClass("".concat(this.cssPrefix,"-row-").concat(e%2==1?"odd":"even")).data("row-idx","".concat(o)).attr("tabindex","-1").on("click",(function(o){n.activeRowIndex=e,n.fireEvent({type:"rowClick",row:t,rowIndex:e,sourceEvent:o})})).on("dblclick",(function(o){n.fireEvent({type:"rowDbClick",row:t,rowIndex:e,sourceEvent:o})}));0==e&&i.addClass("".concat(this.cssPrefix,"-row-first"));var r=i.toDOM();return this.options.showActiveRow&&e==this.activeRowIndex&&i.addClass("".concat(this.cssPrefix,"-row-active")),this.columns.getItems().forEach((function(e,i){if(e.isVisible){var s=e.isRowNum?-1:n.dataTable.columns.getIndex(e.dataColumn.id),a=e.isRowNum?o+1:t.getValue(s);r.appendChild(n.renderCell(e,i,a,r))}})),r},t.prototype.renderCell=function(t,e,n,o){var i=B("div").addClass("".concat(this.cssPrefix,"-cell")).data("col-idx","".concat(e)).attr("tabindex","-1").setStyle("width","".concat(t.width,"px"));t.align==j.LEFT?i.addClass("".concat(this.cssPrefix,"-cell-align-left")):t.align==j.RIGHT?i.addClass("".concat(this.cssPrefix,"-cell-align-right")):t.align==j.CENTER&&i.addClass("".concat(this.cssPrefix,"-cell-align-center"));var r=i.toDOM(),s=r.appendChild(B("div").addClass("".concat(this.cssPrefix,"-cell-value")).toDOM());return t.cellRenderer&&t.cellRenderer(n,t,s,o),r},t.prototype.setPage=function(t){this.pagination.page=t,this.fireEvent({type:"pageChanged",page:t}),this.refresh(),this.bodyViewportDiv.focus()},t.prototype.renderPageNavigator=function(){var t=this,e=document.createElement("div");e.className="".concat(this.cssPrefix,"-pagination-wrapper");var n=this.dataTable.getTotal();if(this.options.paging&&this.options.paging.enabled&&n>0){var i=this.paginationOptions.useBootstrap?"":"".concat(this.cssPrefix,"-"),r=function(e){var n=e.target;if(n.hasAttribute("data-page")){var o=parseInt(n.getAttribute("data-page"));t.setPage(o)}},s=function(e,n,o,s,a){var l=document.createElement("li");if(l.className="".concat(i,"page-item"),!s){a&&(l.className+=" active");var u=document.createElement("a");return u.setAttribute("href","javascript:void(0)"),u.innerHTML=n||e.toString(),u.setAttribute("data-page","".concat(e)),u.className="".concat(i,"page-link"),u.addEventListener("click",r),l.appendChild(u),l}var c=document.createElement("span");if(c.setAttribute("aria-hidden","true"),c.className="".concat(i,"page-link"),o)l.className+=" disabled";else{if(t.paginationOptions.useBootstrap)(c=document.createElement("a")).setAttribute("href","javascript:void(0)"),c.setAttribute("data-page","".concat(e));else{var d=document.createElement("a");d.setAttribute("href","javascript:void(0)"),d.setAttribute("data-page","".concat(e)),c=d}c.className="".concat(i,"page-link"),c.addEventListener("click",r)}return c.innerHTML=n,l.appendChild(c),l};if(this.dataTable.elasticChunks){var a=this.pagination.page||1;(u=document.createElement("ul")).className="".concat(i,"pagination");var l=s(a-1,"&laquo;",1==a,!0,!1);u.appendChild(l),l=s(a+1,"&raquo;",this.isLastPage(),!0,!1),u.appendChild(l),e.appendChild(u)}else if(this.pagination.total>this.pagination.pageSize){a=this.pagination.page||1;var u,c=Math.ceil(this.pagination.total/this.pagination.pageSize)||1,d=this.paginationOptions.maxButtonCount||10,h=a-1,p=h-h%d+1,f=p+d-1;f>c&&(f=c),(u=document.createElement("ul")).className="".concat(i,"pagination");l=s(p-1,"&laquo;",1==p,!0,!1);u.appendChild(l);for(var g=p;g<=f;g++)l=s(g,g.toString(),!1,!1,g==a),u.appendChild(l);l=s(f+1,"&raquo;",f==c,!0,!1),u.appendChild(l),e.appendChild(u)}if(this.options.paging.allowPageSizeChange){var y=document.createElement("div");y.className="".concat(this.cssPrefix,"-page-sizes");var m=document.createElement("div");m.className="kfrm-select ".concat(this.cssPrefix,"-page-sizes-select"),y.appendChild(m);var v=document.createElement("select"),C=this.options.paging.pageSizeItems||[],b=new Set(C);b.add(this.options.paging.pageSize||20),Array.from(b).forEach((function(t){var e=document.createElement("option");e.value=t.toString(),e.text=t.toString(),v.appendChild(e)})),v.value=(this.pagination.pageSize||20).toString(),m.appendChild(v),v.addEventListener("change",(function(e){var n=parseInt(e.target.value);t.pagination.pageSize=n,t.pagination.page=1,t.refresh()}));var x=document.createElement("div");x.className="".concat(this.cssPrefix,"-page-sizes-label"),y.appendChild(x);var w=document.createElement("span");w.innerText=o.i18n.getText("GridItemsPerPage"),x.appendChild(w),e.appendChild(y)}}return e},t.prototype.addEventListener=function(t,e){return this.eventEmitter.subscribe(t,(function(t){return e(t.data)}))},t.prototype.removeEventListener=function(t,e){this.eventEmitter.unsubscribe(t,e)},t.prototype.renderHeaderButtons=function(){var t=this;return this.options.showPlusButton?B("div").addClass("".concat(this.cssPrefix,"-header-btn-plus")).title(this.options.plusButtonTitle||"Add").addChild("a",(function(e){return e.attr("href","javascript:void(0)").on("click",(function(e){e.preventDefault(),t.fireEvent({type:"plusButtonClick",sourceEvent:e})}))})).toDOM():B("span").addText("#").toDOM()},t.prototype.showLandingSlot=function(t,e){for(var n=this.headerRowDiv.querySelectorAll("[class*=".concat(this.cssPrefix,"-table-col]")),o=[],i=1;i<n.length;i++){var r=n[i];"none"!==r.style.display&&o.push(r)}if(0===o.length)return this.landingIndex=0,void this.headerRowDiv.appendChild(this.landingSlot);var s=y(this.landingSlot);if(!(t>=s.x&&t<=s.x+this.landingSlot.offsetWidth)){for(var a=this.landingIndex,l=0,u=o;l<u.length;l++){var c=u[l],d=y(c),h=c.offsetWidth;t>d.x&&t<d.x+h&&(a=parseInt(c.getAttribute("data-col-idx"))-1)}a!=this.landingIndex&&(this.landingIndex=a,this.landingIndex<o.length?this.headerRowDiv.insertBefore(this.landingSlot,o[this.landingIndex]):this.headerRowDiv.appendChild(this.landingSlot))}},t.prototype.hideLandingSlot=function(){var t=this;this.landingIndex=-1,setTimeout((function(){t.landingSlot.parentElement&&t.landingSlot.parentElement.removeChild(t.landingSlot)}),10)},Object.defineProperty(t.prototype,"activeRowIndex",{get:function(){return this._activeRowIndex},set:function(t){if(t!==this._activeRowIndex){var e=this._activeRowIndex;this._activeRowIndex=t,this.updateActiveRow(),this.fireEvent({type:"activeRowChanged",oldValue:e,newValue:this.activeRowIndex,rowIndex:this.getGlobalIndexByLocal(this.activeRowIndex)})}},enumerable:!1,configurable:!0}),t.prototype.updateActiveRow=function(){var t=this;if(this.options.showActiveRow){this.bodyCellContainerDiv.querySelectorAll("[class*=".concat(this.cssPrefix,"-row-active]")).forEach((function(e){e.classList.remove("".concat(t.cssPrefix,"-row-active"))}));var e=this.getActiveRow();e&&(e.classList.add("".concat(this.cssPrefix,"-row-active")),this.ensureRowVisibility(this.activeRowIndex))}},t.prototype.getActiveRow=function(){return this.getDataRow(this.activeRowIndex)},t.prototype.getDataRow=function(t){var e=Array.from(this.bodyCellContainerDiv.querySelectorAll(".".concat(this.cssPrefix,"-row:not(.").concat(this.cssPrefix,"-row-totals)")));return t>=0&&t<e.length?e[t]:null},t.prototype.focus=function(){this.bodyViewportDiv.focus()},t.prototype.resizeColumns=function(){if(this.options.columnWidths.autoResize!==P.Never){var t=this.bodyCellContainerDiv.style.width;this.bodyCellContainerDiv.style.visibility="hidden",this.bodyCellContainerDiv.style.width="1px",this.headerRowDiv.style.width="1px";for(var e=0,n=this.columns.getItems(),i=this.headerCellContainerDiv.querySelectorAll(".".concat(this.cssPrefix,"-header-cell")),r=0,s=function(t){var s=n[t];if(!s.isVisible)return"continue";var l=a.options.columnWidths.autoResize!==P.Always&&s.dataColumn?s.dataColumn.calculatedWidth:0,u=a.bodyCellContainerDiv.querySelectorAll(".".concat(a.cssPrefix,'-cell[data-col-idx="').concat(t,'"] > .').concat(a.cssPrefix,"-cell-value")),c=0;if(l>0)e+=l,s.width=l,u.forEach((function(t){t.parentElement.style.width="".concat(l,"px")})),i[r].style.width="".concat(l,"px");else if(0==u.length&&(i[r].style.width=null,i[r].style.whiteSpace="nowrap"),c=i[r].offsetWidth,u.length>0){u.forEach((function(t){t.parentElement.style.width=null;var e=t.parentElement.offsetWidth;e>c&&(c=e)})),c+=3;var d=s.isRowNum?a.options.columnWidths.rowNumColumn.max||500:a.options.columnWidths[s.dataColumn.type].max||2e3,h=s.isRowNum?a.options.columnWidths.rowNumColumn.min||0:a.options.columnWidths[s.dataColumn.type].min||20;c>d&&(c=d),c<h&&(c=h),o.utils.isNumericType(s.type)&&(c=Math.round(1.3*c)),e+=c,s.width=c,u.forEach((function(t){t.parentElement.style.width="".concat(c,"px")})),i[r].style.width="".concat(c,"px"),s.dataColumn&&(s.dataColumn.calculatedWidth=c)}else e+=c;r++},a=this,l=0;l<this.columns.count;l++)s(l);e>0?(this.bodyCellContainerDiv.style.width="".concat(e,"px"),this.headerCellContainerDiv.style.width="".concat(e,"px")):(this.bodyCellContainerDiv.style.width=t,this.headerCellContainerDiv.style.width=t),this.bodyCellContainerDiv.style.visibility=null,this.headerRowDiv.removeAttribute("style")}},t}(),tt=function(){function t(t,e){this.slot=t,this.options=e||{},this.options.yearRange||(this.options.yearRange="c-10:c+10")}return Object.defineProperty(t.prototype,"cssPrefix",{get:function(){return"kdtp-cal"},enumerable:!1,configurable:!0}),t.prototype.setDate=function(t){this.currentDate=new Date(t)},t.prototype.getDate=function(){return new Date(this.currentDate)},t.prototype.dateChanged=function(t){this.options.onDateChanged&&this.options.onDateChanged(this.currentDate,t)},t}(),et=function(){function t(t){this.calendar=null,this.timePicker=null,this.options=t,this.render()}return Object.defineProperty(t.prototype,"cssPrefix",{get:function(){return"kdtp"},enumerable:!1,configurable:!0}),t.prototype.setDateTime=function(t){this.currentDateTime=new Date(t),this.calendar&&this.calendar.setDate(this.currentDateTime),this.timePicker&&this.timePicker.setTime(this.currentDateTime)},t.prototype.getDateTime=function(){return new Date(this.currentDateTime)},t.prototype.render=function(){var t=this;this.options.showCalendar&&(this.calendar=this.createCalendar({yearRange:this.options.yearRange,showDateTimeInput:this.options.showDateTimeInput,timePickerIsUsed:this.options.showTimePicker,oneClickDateSelection:this.options.oneClickDateSelection,onDateChanged:function(e,n){t.currentDateTime=e,t.timePicker&&t.timePicker.setTime(t.currentDateTime),t.options.showTimePicker&&t.dateTimeChanged(),n&&t.apply(t.currentDateTime)}}),this.calendar&&this.calendar.render()),this.options.showTimePicker&&(this.timePicker=this.createTimePicker({onTimeChanged:function(e){t.currentDateTime.setHours(e.getHours()),t.currentDateTime.setMinutes(e.getMinutes()),t.calendar&&t.calendar.setDate(t.currentDateTime),t.dateTimeChanged()}}),this.timePicker&&this.timePicker.render()),this.setDateTime(new Date)},t.prototype.createCalendar=function(t){return null},t.prototype.createTimePicker=function(t){return null},t.prototype.show=function(t){this.options.beforeShow&&this.options.beforeShow();var e=y(t||document.body);this.slot.style.top=e.y+t.clientHeight+"px",this.slot.style.left=e.x+"px"},t.prototype.apply=function(t){this.options.onApply&&this.options.onApply(t),this.destroy()},t.prototype.cancel=function(){this.options.onCancel&&this.options.onCancel(),this.destroy()},t.prototype.destroy=function(){this.slot&&this.slot.parentElement&&this.slot.parentElement.removeChild(this.slot)},t.prototype.dateTimeChanged=function(){this.options.onDateTimeChanged&&this.options.onDateTimeChanged(this.currentDateTime)},t}(),nt=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),ot=function(t){function e(e,n){var i=t.call(this,e,n)||this;i.daysOfWeek=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],i.months=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],i.calendarBody=null,i.isManualInputChanging=!1;for(var r=0;r<i.daysOfWeek.length;r++)i.daysOfWeek[r]=o.i18n.getShortWeekDayName(r+1);for(r=0;r<i.months.length;r++)i.months[r]=o.i18n.getLongMonthName(r+1);return i}return nt(e,t),e.prototype.setDate=function(e){t.prototype.setDate.call(this,e),this.selectedMonth=this.currentDate.getMonth(),this.selectedYear=this.currentDate.getFullYear(),this.rerenderMonth()},e.prototype.render=function(){var t=this,e=B("div",this.slot).addClass("".concat(this.cssPrefix,"-header"));this.options.showDateTimeInput?e.addChildElement(this.renderManualDateInput()):e.addChild("span",(function(e){return t.headerTextElem=e.toDOM()})),B(this.slot).addChildElement(this.renderCalendarButtons()),this.calendarBody=B("div",this.slot).addClass("".concat(this.cssPrefix,"-body")).toDOM()},e.prototype.getInputDateFormat=function(){var t=o.i18n.getLocaleSettings();return this.options.timePickerIsUsed?"".concat(t.editDateFormat," ").concat(t.editTimeFormat):t.editDateFormat},e.prototype.renderManualDateInput=function(){var t=this,e=this.getInputDateFormat(),n=B("input").attr("placeholder",e).addClass("".concat(this.cssPrefix,"-header-input"));return n.mask(e.replace("yyyy","9999").replace("MM","99").replace("dd","99").replace("HH","99").replace("mm","99").replace("ss","99")).on("input",(function(i){n.removeClass("error");try{t.isManualInputChanging=!0;var r=o.utils.strToDateTime(t.manualInputElem.value,e);t.currentDate=r,t.jump(t.currentDate.getFullYear(),t.currentDate.getMonth()),t.dateChanged(!1)}catch(t){n.addClass("error")}finally{t.isManualInputChanging=!1}})).on("keydown",(function(e){13===e.keyCode&&(e.preventDefault(),e.stopPropagation(),t.manualInputElem.className.indexOf("error")<0&&!t.isManualInputChanging&&t.dateChanged(!0))})).on("focus",(function(){setTimeout((function(){t.manualInputElem.selectionStart=0,t.manualInputElem.selectionEnd=0}),50)})),this.manualInputElem=n.toDOM(),this.manualInputElem},e.prototype.updateDisplayedDateValue=function(){if(this.manualInputElem){if(!this.isManualInputChanging){var t=this.getInputDateFormat();this.manualInputElem.value=o.utils.dateTimeToStr(this.currentDate,t),this.manualInputElem.focus()}}else if(this.headerTextElem){var e=o.i18n.getCurrentLocale();this.headerTextElem.innerText=this.currentDate.toLocaleString("en"==e?void 0:e,{year:"numeric",month:"long",day:"numeric"})}},e.prototype.renderCalendarButtons=function(){var t=this;return B("nav").addClass("".concat(this.cssPrefix,"-nav")).addChild("div",(function(e){return e.addClass("".concat(t.cssPrefix,"-nav-prev")).on("click",(function(){t.prev()})).addChild("span",(function(t){return t.html("&lsaquo;")}))})).addChild("div",(function(e){return e.addClass("".concat(t.cssPrefix,"-nav-selectors")).addChild("div",(function(e){return e.addClass("".concat(t.cssPrefix,"-nav-month")).addChild("select",(function(e){e.on("change",(function(){t.jump(t.selectedYear,parseInt(t.selectMonthElem.value))}));for(var n=function(n){e.addChild("option",(function(e){return e.attr("value",n.toString()).text(t.months[n])}))},o=0;o<t.months.length;o++)n(o);t.selectMonthElem=e.toDOM()}))})).addChild("div",(function(e){return e.addClass("".concat(t.cssPrefix,"-nav-year")).addChild("select",(function(e){return t.selectYearElem=e.on("change",(function(){t.jump(parseInt(t.selectYearElem.value),t.selectedMonth)})).toDOM()}))}))})).addChild("div",(function(e){return e.addClass("".concat(t.cssPrefix,"-nav-next")).on("click",(function(){t.next()})).addChild("span",(function(t){return t.html("&rsaquo;")}))})).toDOM()},e.prototype.prev=function(){this.selectedYear=0===this.selectedMonth?this.selectedYear-1:this.selectedYear,this.selectedMonth=0===this.selectedMonth?11:this.selectedMonth-1,this.rerenderMonth()},e.prototype.next=function(){this.selectedYear=11===this.selectedMonth?this.selectedYear+1:this.selectedYear,this.selectedMonth=(this.selectedMonth+1)%12,this.rerenderMonth()},e.prototype.rerenderSelectYear=function(){var t=/c-(\d*):c\+(\d*)/g.exec(this.options.yearRange),e=0,n=1;null!==t&&(e=parseInt(t[1]),n=parseInt(t[2])),this.selectYearElem.innerHTML="";for(var o=0;o<=e+n;o++){var i=document.createElement("option"),r=this.selectedYear-e+o;i.value=r.toString(),i.innerText=r.toString(),this.selectYearElem.appendChild(i)}},e.prototype.jump=function(t,e){this.selectedYear=t,this.selectedMonth=e,this.rerenderMonth()},e.prototype.rerenderMonth=function(){var t=this;this.updateDisplayedDateValue(),this.rerenderSelectYear();var e=new Date(this.selectedYear,this.selectedMonth).getDay(),n=new Date(this.selectedYear,this.selectedMonth+1,0).getDate();this.calendarBody.innerHTML="",this.selectYearElem.value=this.selectedYear.toString(),this.selectMonthElem.value=this.selectedMonth.toString(),this.daysOfWeek.forEach((function(e,n){B("div",t.calendarBody).addClass("".concat(t.cssPrefix,"-weekday")).addClass(0==n||6==n?"".concat(t.cssPrefix,"-weekend"):"").text(e)}));for(var o=0;o<e;o++)B("div",this.calendarBody).addClass("".concat(this.cssPrefix,"-day-empty"));for(var i=new Date,r=1;r<=n;r++){var s=B("div",this.calendarBody).addClass("".concat(this.cssPrefix,"-day")).attr("data-date",r.toString()).text(r.toString()).on("click",(function(e){t.currentDate.setFullYear(t.selectedYear),t.currentDate.setMonth(t.selectedMonth),t.currentDate.setDate(parseInt(e.target.getAttribute("data-date"))),t.dateChanged(t.options.oneClickDateSelection)}));r===i.getDate()&&this.selectedYear===i.getFullYear()&&this.selectedMonth===i.getMonth()&&s.addClass("".concat(this.cssPrefix,"-day-current")),r===this.currentDate.getDate()&&this.selectedYear===this.currentDate.getFullYear()&&this.selectedMonth===this.currentDate.getMonth()&&s.addClass("".concat(this.cssPrefix,"-day-selected"));var a=(e+r-1)%7;0!=a&&6!=a||s.addClass("".concat(this.cssPrefix,"-weekend"))}var l=(e+n)%7,u=0==l?0:7-l;for(o=0;o<u;o++)B("div",this.calendarBody).addClass("".concat(this.cssPrefix,"-day-empty"))},e.prototype.dateChanged=function(e){t.prototype.dateChanged.call(this,e),this.rerenderMonth()},e}(tt),it=function(){function t(t,e){this.slot=t,this.options=e||{}}return Object.defineProperty(t.prototype,"cssPrefix",{get:function(){return"kdtp-tp"},enumerable:!1,configurable:!0}),t.prototype.setTime=function(t){this.currentTime=new Date(t)},t.prototype.getTime=function(){return new Date(this.currentTime)},t.prototype.timeChanged=function(){this.options.onTimeChanged&&this.options.onTimeChanged(this.currentTime)},t}(),rt=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),st=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return rt(e,t),e.prototype.setTime=function(e){t.prototype.setTime.call(this,e),this.updateDisplayedTime(),this.hoursInput.valueAsNumber=e.getHours(),this.minutesInput.valueAsNumber=e.getMinutes()},e.prototype.render=function(){var t=this;B("div",this.slot).addClass("".concat(this.cssPrefix,"-time")).addChild("span",(function(e){return t.timeText=e.toDOM()})).toDOM();var e=B("div",this.slot).addClass("".concat(this.cssPrefix,"-sliders"));return e.addChild("div",(function(e){return e.addClass("".concat(t.cssPrefix,"-time-row")).title("Hours").addChild("input",(function(e){return t.hoursInput=e.addClass("".concat(t.cssPrefix,"-input-hours")).type("range").attr("min","0").attr("max","23").attr("step","1").on("input",(function(e){t.currentTime.setHours(t.hoursInput.valueAsNumber),t.updateDisplayedTime(),t.timeChanged()})).toDOM()}))})),e.addChild("div",(function(e){return e.addClass("".concat(t.cssPrefix,"-time-row")).title("Minutes").addChild("input",(function(e){return t.minutesInput=e.addClass("".concat(t.cssPrefix,"-input-minutes")).type("range").attr("min","0").attr("max","59").attr("step","1").on("input",(function(e){t.currentTime.setMinutes(t.minutesInput.valueAsNumber),t.updateDisplayedTime(),t.timeChanged()})).toDOM()}))})),this.slot},e.prototype.updateDisplayedTime=function(){var t=o.i18n.getCurrentLocale(),e=this.currentTime.toLocaleString("en"==t?void 0:t,{hour:"numeric",minute:"numeric"});this.timeText.innerText=e},e}(it),at=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),lt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return at(e,t),e.prototype.render=function(){var e=this,n=B("div",document.body).addClass("".concat(this.cssPrefix)).attr("tabIndex","0").setStyle("position","absolute").setStyle("top","-1000px").setStyle("left","-1000px").on("keydown",(function(t){return 27===t.keyCode?e.cancel():13===t.keyCode&&e.apply(e.getDateTime()),!1}));this.options.zIndex&&n.setStyle("z-index","".concat(this.options.zIndex)),this.slot=n.toDOM(),t.prototype.render.call(this),this.renderButtons(),this.globalMouseDownHandler=function(t){var n=window.event||t;n.srcElement||n.target;return!e.slot.contains(n.target)&&(document.removeEventListener("mousedown",e.globalMouseDownHandler,!0),e.cancel()),!0}},e.prototype.renderButtons=function(){var t=this,e=B("div",this.slot).addClass("".concat(this.cssPrefix,"-buttons")).addChild("button",(function(e){return t.nowButton=e.addClass("".concat(t.cssPrefix,"-button ").concat(t.cssPrefix,"-button-now")).text(o.i18n.getText("ButtonNow")).on("click",(function(){return t.setDateTime(new Date),t.dateTimeChanged(),!1})).toDOM()}));!this.options.showTimePicker&&this.options.oneClickDateSelection||e.addChild("button",(function(e){return t.submitButton=e.addClass("".concat(t.cssPrefix,"-button ").concat(t.cssPrefix,"-button-apply")).text(o.i18n.getText("ButtonApply")).on("click",(function(){return t.apply(t.getDateTime()),!1})).toDOM()})),e.addChild("button",(function(e){return t.submitButton=e.addClass("".concat(t.cssPrefix,"-button ").concat(t.cssPrefix,"-button-cancel")).text(o.i18n.getText("ButtonCancel")).on("click",(function(){return t.cancel(),!1})).toDOM()}))},e.prototype.createCalendar=function(t){return this.calendarSlot=B("div",this.slot).addClass("".concat(this.cssPrefix,"-cal")).toDOM(),new ot(this.calendarSlot,t)},e.prototype.createTimePicker=function(t){return this.timePickerSlot=B("div",this.slot).addClass("".concat(this.cssPrefix,"-tp")).toDOM(),new st(this.timePickerSlot,t)},e.prototype.show=function(e){var n=this;if(this.options.showDateTimeInput){this.options.beforeShow&&this.options.beforeShow();var o=y(e||document.body),i=y(e?e.parentElement||e:document.body);this.slot.style.top=i.y+"px",this.slot.style.left=o.x+"px"}else t.prototype.show.call(this,e),this.slot.focus();setTimeout((function(){document.addEventListener("mousedown",n.globalMouseDownHandler,!0)}),1)},e}(et);!function(t){t[t.Left=1]="Left",t[t.Center=2]="Center",t[t.Right=3]="Right"}(U||(U={}));var ut=n(946),ct=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),dt="kdlg",ht=function(){function t(){}return t.prototype.openConfirm=function(t,e,n){var o=this,i={title:t,closable:!1,submitable:!0,cancelable:!0,body:'<div id="'.concat(dt,'-dialog-confirm">').concat(e,"</div>")};return n?(i.onSubmit=function(){n(!0)},i.onCancel=function(){n(!1)},void this.open(i)):new ut((function(t){i.onSubmit=function(){t(!0)},i.onCancel=function(){t(!1)},o.open(i)}))},t.prototype.openPrompt=function(t,e,n,o){var i=this,r={title:t,submitable:!0,closable:!0,cancelable:!0,submitOnEnter:!0,body:'<div id="'.concat(dt,'-dialog-form" class="kfrm-form">\n <div class="kfrm-fields label-above">\n <label for="').concat(dt,'-dialog-form-input" id="').concat(dt,'-dialog-form-content">').concat(e,'</label>\n <input type="text" name="').concat(dt,'-dialog-form-input" id="').concat(dt,'-dialog-form-input" />\n </div>\n </div>'),arrangeParents:!1,beforeOpen:function(){var t=document.getElementById("".concat(dt,"-dialog-form-input"));n&&(t.value=n),t.focus()}},s=function(t){var e=document.getElementById("".concat(dt,"-dialog-form-input")),n=e.value;return n&&n.replace(/\s/g,"").length>0?(t(n),!0):(e.classList.add("eqjs-invalid"),!1)};return o?(r.onSubmit=function(){return s(o)},r.onCancel=function(){o("")},void this.open(r)):new ut((function(t){r.onSubmit=function(){return s(t)},r.onCancel=function(){t("")},i.open(r)}))},t.prototype.open=function(t,e){var n=this,o=new pt(t,e),i=t.onDestroy;return t.onDestroy=function(t){n.untrack(t),i&&i(t)},o.open(),this.track(o),o},t.prototype.createSet=function(t){return new gt(t,this)},t.prototype.untrack=function(e){var n=t.openDialogs.indexOf(e);n>=0&&t.openDialogs.splice(n,1)},t.prototype.track=function(e){t.openDialogs.push(e)},t.prototype.openProgress=function(t){var e=this,n=new ft(t),o=t.onDestroy;return t.onDestroy=function(t){e.untrack(t),o&&o(t)},n.open(),this.track(n),n},t.prototype.getAllDialogs=function(){return Array.from(t.openDialogs)},t.prototype.closeAllDialogs=function(){for(var e=0,n=Array.from(t.openDialogs);e<n.length;e++){n[e].close()}},t.openDialogs=[],t}(),pt=function(){function t(t,e){var n=this;this.options=t,this.submitHandler=function(t){return(!n.options.onSubmit||!1!==n.options.onSubmit(n,t))&&(n.destroy(),!0)},this.cancelHandler=function(){n.options.onCancel&&n.options.onCancel(n),n.destroy()},this.keydownHandler=function(t){return 13!=t.keyCode||!n.isActiveDialog()||(t.preventDefault(),t.stopPropagation(),!n.submitHandler())||(window.removeEventListener("keydown",n.keydownHandler,!1),!1)},this.dialogId=o.utils.generateId("dlg"),this.data=e,this.slot=B("div",document.body).attr("tab-index","-1").data("dialog-id",this.dialogId).addClass("".concat(dt,"-modal"),"is-active").focus().addChild("div",(function(t){return t.addClass("kdlg-modal-background")})).addChild("div",(function(i){return n.windowElement=i.addClass("".concat(dt,"-modal-window")).addChild("header",(function(e){n.headerElement=e.addClass("".concat(dt,"-header")).addChild("p",(function(e){return e.addClass("".concat(dt,"-header-title")).addText(t.title)})).toDOM(),!1!==t.closable&&e.addChild("button",(function(t){return t.addClass("".concat(dt,"-modal-close")).on("click",(function(){n.cancelHandler()})).focus()}))})).addChild("div",(function(t){t.addClass("".concat(dt,"-alert-container")),n.alertElement=t.toDOM()})).addChild("section",(function(i){if(n.bodyElement=i.addClass("".concat(dt,"-body")).toDOM(),"string"==typeof t.body){var r=o.liquid.renderLiquidTemplate(t.body,e);i.addHtml(r)}else i.addChildElement(t.body)})).addChild("footer",(function(e){var i=null;i=t.footerAlignment&&t.footerAlignment==U.Center?"align-center":"align-right",n.footerElement=e.addClass("".concat(dt,"-footer")).toDOM(),e.addClass(i),!1!==t.submitable&&(e.addChild("button",(function(e){e.id(n.dialogId+"-btn-submit").addClass("kfrm-button","is-info").addText(t.submitButtonText||o.i18n.getText("ButtonOK")),t.recaptchaSiteKey?(e.data("sitekey",t.recaptchaSiteKey),e.addClass("g-recaptcha"),e.on("click",(function(e){grecaptcha?grecaptcha.ready((function(){grecaptcha.execute(t.recaptchaSiteKey,{action:"submit"}).then((function(t){n.submitHandler(t)}))})):n.submitHandler()}))):e.on("click",(function(t){n.submitHandler()})),e.focus()})),!1!==t.cancelable&&e.addChild("button",(function(e){return e.id(n.dialogId+"-btn-cancel").addClass("kfrm-button").addText(t.cancelButtonText||o.i18n.getText("ButtonCancel")).on("click",(function(t){n.cancelHandler()}))})))})).toDOM()})).toDOM()}return t.prototype.getData=function(){return this.data},t.prototype.getRootElement=function(){return this.slot},t.prototype.getSubmitButtonElement=function(){return document.getElementById(this.dialogId+"-btn-submit")},t.prototype.getCancelButtonElement=function(){return document.getElementById(this.dialogId+"-btn-cancel")},t.prototype.open=function(){var t=this;this.options.beforeOpen&&this.options.beforeOpen(this),B(this.slot).show(),this.options.arrangeParents&&this.arrangeParents(!0);var e=this.slot.querySelector(".".concat(dt,"-modal-window"));this.options.height&&(e.style.height="string"==typeof this.options.height?this.options.height:"".concat(this.options.height,"px")),this.options.width&&(e.style.width="string"==typeof this.options.width?this.options.width:"".concat(this.options.width,"px")),this.options.submitOnEnter&&window.addEventListener("keydown",this.keydownHandler,!1),this.slot.querySelectorAll("input").forEach((function(e){return e.addEventListener("input",(function(){t.clearAlert(),t.options.onInput&&t.options.onInput(t)}))})),this.options.onShow&&this.options.onShow(this)},t.prototype.submit=function(){this.submitHandler()},t.prototype.cancel=function(){this.cancelHandler()},t.prototype.close=function(){this.destroy()},t.prototype.disableButtons=function(){this.slot.querySelectorAll("button").forEach((function(t){return t.disabled=!0}))},t.prototype.enableButtons=function(){this.slot.querySelectorAll("button").forEach((function(t){return t.disabled=!1}))},t.prototype.showAlert=function(t,e,n){var o=B("div").addClass("".concat(dt,"-alert ").concat(e||"")).addChild("span",(function(t){return t.addClass("".concat(dt,"-alert-closebtn")).text("×").on("click",(function(t){var e=t.target.parentElement;e.parentElement.removeChild(e)}))})).addText(t).toDOM();!0===n&&this.clearAlert(),this.alertElement.appendChild(o)},t.prototype.clearAlert=function(){this.alertElement.innerHTML=""},t.prototype.destroy=function(){document.querySelectorAll('[data-dialog-id="'.concat(this.dialogId,'"]')).length<=0||(this.options.arrangeParents&&this.arrangeParents(!1),document.body.removeChild(this.slot),this.options.submitOnEnter&&window.removeEventListener("keydown",this.keydownHandler,!1),this.options.onDestroy&&this.options.onDestroy(this))},t.prototype.isActiveDialog=function(){var t=document.documentElement.querySelectorAll(".kdlg-modal");return t[t.length-1]===this.slot},t.prototype.arrangeParents=function(t){for(var e=document.documentElement.querySelectorAll(".kdlg-modal-window"),n=0;n<e.length-1;n++)if(t){var o=0==n?20:40*n+20;B(e[n]).setStyle("margin-top","".concat(o,"px")).setStyle("margin-left","".concat(o,"px"))}else B(e[n]).removeStyle("margin-top").removeStyle("margin-left")},t}(),ft=function(t){function e(e,n){var o,i,r=this,s=B("div").addChild("div",(function(t){return o=t.text(e.content||"").toDOM()})).addChild("div",(function(t){t.addClass("".concat(dt,"-progress-line")).addChild("div",(function(t){i=t.addClass("fill").toDOM(),e.determinated?t.setStyle("width","0%"):t.addClass("indeterminate")}))})).toDOM();return(r=t.call(this,{title:e.title,body:s,beforeOpen:e.beforeOpen,onSubmit:e.onSubmit,width:e.width,height:e.height,submitable:!1,cancelable:!1,closable:!1,onDestroy:e.onDestroy},n)||this).contentElement=o,r.progressElement=i,r}return ct(e,t),e.prototype.updateContent=function(t){this.contentElement.innerText=t},e.prototype.updateProgress=function(t){var e=this;t=this.in01(t),this.progressElement.style.width="".concat(100*t,"%"),1===t&&setTimeout((function(){e.submit()}),500)},e.prototype.in01=function(t){return t>1?1:t<0?0:t},e}(pt),gt=function(){function t(t,e){this.options=t,this.dialogService=e,this.currentDialog=null,this.currentIndex=0,this.options=t,this.dialogService=e}return t.prototype.getCurrent=function(){return this.currentDialog},t.prototype.openNext=function(t){return this.open(this.currentIndex+1,t)},t.prototype.openPrev=function(t){return this.open(this.currentIndex-1,t)},t.prototype.open=function(t,e){if(t<0?this.currentIndex=0:t>=this.options.length?this.currentIndex=this.options.length-1:this.currentIndex=t,this.currentDialog)try{this.currentDialog.close()}catch(t){}var n=this.options[this.currentIndex];return this.currentDialog=this.dialogService.open(n,e),this.currentDialog},t.prototype.close=function(){this.currentDialog&&(this.currentDialog.close(),this.currentDialog=null)},t}();o.i18n.updateDefaultTexts({GridPageInfo:"{FirstPageRecordNum} - {LastPageRecordNum} of {Total} records",GridItemsPerPage:"items per page",ButtonOK:"OK",ButtonCancel:"Cancel",ButtonApply:"Apply",ButtonNow:"Now",LblTotal:"Total"});var yt=new ht},789:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){"use strict";var browserUtils;__webpack_require__.d(__webpack_exports__,{z:function(){return browserUtils}}),function(browserUtils){var _isFirefox=null,_isIE=null;function IsIE(){if(null===_isIE){var t=navigator.userAgent;_isIE=t.indexOf("MSIE ")>-1||t.indexOf("Trident/")>-1}return _isIE}function IsEdge(){return!IsIE()&&eval("!!window.StyleMedia")}function IsFirefox(){if(null===_isFirefox){var t=navigator.userAgent;_isFirefox=t.toLowerCase().indexOf("firefox")>-1}return _isFirefox}browserUtils.IsIE=IsIE,browserUtils.IsEdge=IsEdge,browserUtils.IsFirefox=IsFirefox;var _detectedIsMobileMode=!1,_isMobileMode=void 0,detectIsMobileMode=function(){var t=isMobileMode();_detectedIsMobileMode=window.matchMedia("only screen and (max-width: 840px)").matches||window.matchMedia("only screen and (max-height: 420px)").matches;var e=isMobileMode();e!==t&&mobileModeChangeHandler&&mobileModeChangeHandler(e)},mobileModeChangeHandler;function isMobileMode(){return void 0!==_isMobileMode?_isMobileMode:_detectedIsMobileMode}function setIsMobileMode(t){var e=isMobileMode();_isMobileMode=t;var n=isMobileMode();n!==e&&mobileModeChangeHandler&&mobileModeChangeHandler(n)}function onMobileModeChanged(t){mobileModeChangeHandler=t}function getMobileCssClass(){return isMobileMode()?"k-mobile":null}detectIsMobileMode(),window.addEventListener("resize",(function(){return detectIsMobileMode()})),browserUtils.isMobileMode=isMobileMode,browserUtils.setIsMobileMode=setIsMobileMode,browserUtils.onMobileModeChanged=onMobileModeChanged,browserUtils.getMobileCssClass=getMobileCssClass}(browserUtils||(browserUtils={}))},946:function(t,e,n){t.exports=function(){"use strict";function t(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}function e(t){return"function"==typeof t}var o=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},i=0,r=void 0,s=void 0,a=function(t,e){b[i]=t,b[i+1]=e,2===(i+=2)&&(s?s(x):E())};function l(t){s=t}function u(t){a=t}var c="undefined"!=typeof window?window:void 0,d=c||{},h=d.MutationObserver||d.WebKitMutationObserver,p="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),f="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function g(){return function(){return process.nextTick(x)}}function y(){return void 0!==r?function(){r(x)}:C()}function m(){var t=0,e=new h(x),n=document.createTextNode("");return e.observe(n,{characterData:!0}),function(){n.data=t=++t%2}}function v(){var t=new MessageChannel;return t.port1.onmessage=x,function(){return t.port2.postMessage(0)}}function C(){var t=setTimeout;return function(){return t(x,1)}}var b=new Array(1e3);function x(){for(var t=0;t<i;t+=2)(0,b[t])(b[t+1]),b[t]=void 0,b[t+1]=void 0;i=0}function w(){try{var t=Function("return this")().require("vertx");return r=t.runOnLoop||t.runOnContext,y()}catch(t){return C()}}var E=void 0;function T(t,e){var n=this,o=new this.constructor(k);void 0===o[S]&&U(o);var i=n._state;if(i){var r=arguments[i-1];a((function(){return W(i,o,r,n._result)}))}else j(n,o,t,e);return o}function D(t){var e=this;if(t&&"object"==typeof t&&t.constructor===e)return t;var n=new e(k);return F(n,t),n}E=p?g():h?m():f?v():void 0===c?w():C();var S=Math.random().toString(36).substring(2);function k(){}var M=void 0,I=1,B=2;function A(){return new TypeError("You cannot resolve a promise with itself")}function _(){return new TypeError("A promises callback cannot return that same promise.")}function P(t,e,n,o){try{t.call(e,n,o)}catch(t){return t}}function O(t,e,n){a((function(t){var o=!1,i=P(n,e,(function(n){o||(o=!0,e!==n?F(t,n):Q(t,n))}),(function(e){o||(o=!0,N(t,e))}),"Settle: "+(t._label||" unknown promise"));!o&&i&&(o=!0,N(t,i))}),t)}function L(t,e){e._state===I?Q(t,e._result):e._state===B?N(t,e._result):j(e,void 0,(function(e){return F(t,e)}),(function(e){return N(t,e)}))}function R(t,n,o){n.constructor===t.constructor&&o===T&&n.constructor.resolve===D?L(t,n):void 0===o?Q(t,n):e(o)?O(t,n,o):Q(t,n)}function F(e,n){if(e===n)N(e,A());else if(t(n)){var o=void 0;try{o=n.then}catch(t){return void N(e,t)}R(e,n,o)}else Q(e,n)}function q(t){t._onerror&&t._onerror(t._result),H(t)}function Q(t,e){t._state===M&&(t._result=e,t._state=I,0!==t._subscribers.length&&a(H,t))}function N(t,e){t._state===M&&(t._state=B,t._result=e,a(q,t))}function j(t,e,n,o){var i=t._subscribers,r=i.length;t._onerror=null,i[r]=e,i[r+I]=n,i[r+B]=o,0===r&&t._state&&a(H,t)}function H(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var o=void 0,i=void 0,r=t._result,s=0;s<e.length;s+=3)o=e[s],i=e[s+n],o?W(n,o,i,r):i(r);t._subscribers.length=0}}function W(t,n,o,i){var r=e(o),s=void 0,a=void 0,l=!0;if(r){try{s=o(i)}catch(t){l=!1,a=t}if(n===s)return void N(n,_())}else s=i;n._state!==M||(r&&l?F(n,s):!1===l?N(n,a):t===I?Q(n,s):t===B&&N(n,s))}function G(t,e){try{e((function(e){F(t,e)}),(function(e){N(t,e)}))}catch(e){N(t,e)}}var z=0;function V(){return z++}function U(t){t[S]=z++,t._state=void 0,t._result=void 0,t._subscribers=[]}function Y(){return new Error("Array Methods must be provided an Array")}var J=function(){function t(t,e){this._instanceConstructor=t,this.promise=new t(k),this.promise[S]||U(this.promise),o(e)?(this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?Q(this.promise,this._result):(this.length=this.length||0,this._enumerate(e),0===this._remaining&&Q(this.promise,this._result))):N(this.promise,Y())}return t.prototype._enumerate=function(t){for(var e=0;this._state===M&&e<t.length;e++)this._eachEntry(t[e],e)},t.prototype._eachEntry=function(t,e){var n=this._instanceConstructor,o=n.resolve;if(o===D){var i=void 0,r=void 0,s=!1;try{i=t.then}catch(t){s=!0,r=t}if(i===T&&t._state!==M)this._settledAt(t._state,e,t._result);else if("function"!=typeof i)this._remaining--,this._result[e]=t;else if(n===et){var a=new n(k);s?N(a,r):R(a,t,i),this._willSettleAt(a,e)}else this._willSettleAt(new n((function(e){return e(t)})),e)}else this._willSettleAt(o(t),e)},t.prototype._settledAt=function(t,e,n){var o=this.promise;o._state===M&&(this._remaining--,t===B?N(o,n):this._result[e]=n),0===this._remaining&&Q(o,this._result)},t.prototype._willSettleAt=function(t,e){var n=this;j(t,void 0,(function(t){return n._settledAt(I,e,t)}),(function(t){return n._settledAt(B,e,t)}))},t}();function K(t){return new J(this,t).promise}function X(t){var e=this;return o(t)?new e((function(n,o){for(var i=t.length,r=0;r<i;r++)e.resolve(t[r]).then(n,o)})):new e((function(t,e){return e(new TypeError("You must pass an array to race."))}))}function $(t){var e=new this(k);return N(e,t),e}function Z(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function tt(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}var et=function(){function t(e){this[S]=V(),this._result=this._state=void 0,this._subscribers=[],k!==e&&("function"!=typeof e&&Z(),this instanceof t?G(this,e):tt())}return t.prototype.catch=function(t){return this.then(null,t)},t.prototype.finally=function(t){var n=this,o=n.constructor;return e(t)?n.then((function(e){return o.resolve(t()).then((function(){return e}))}),(function(e){return o.resolve(t()).then((function(){throw e}))})):n.then(t,t)},t}();function nt(){var t=void 0;if(void 0!==n.g)t=n.g;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var e=t.Promise;if(e){var o=null;try{o=Object.prototype.toString.call(e.resolve())}catch(t){}if("[object Promise]"===o&&!e.cast)return}t.Promise=et}return et.prototype.then=T,et.all=K,et.race=X,et.resolve=D,et.reject=$,et._setScheduler=l,et._setAsap=u,et._asap=a,et.polyfill=nt,et.Promise=et,et}()},18:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.d(__webpack_exports__,{e:function(){return GoogleDataConverter}});var _easydata_core__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(907),GoogleDataConverter=function(){function GoogleDataConverter(t){t||(t={cols:[],rows:[]}),"string"==typeof t?this.loadFromJSON(t):this.tableObj=t}return GoogleDataConverter.prototype.loadFromJSON=function(t){this.tableObj=JSON.parse(t)},GoogleDataConverter.prototype.toJSON=function(){return JSON.stringify(this.tableObj)},GoogleDataConverter.prototype.getObject=function(){return this.tableObj},GoogleDataConverter.prototype.isEmpty=function(){return 0==this.getNumberOfColumns()||0==this.getNumberOfRows()},GoogleDataConverter.prototype.getNumberOfColumns=function(){return this.tableObj.cols.length},GoogleDataConverter.prototype.getColumnObject=function(t){return t<this.tableObj.cols.length?this.tableObj.cols[t]:null},GoogleDataConverter.prototype.getColumnId=function(t){var e=this.getColumnObject(t);return e?e.id:null},GoogleDataConverter.prototype.getColumnLabel=function(t){var e=this.getColumnObject(t);return e?e.label:null},GoogleDataConverter.prototype.getColumnType=function(t){var e=this.getColumnObject(t);return e?e.type:null},GoogleDataConverter.prototype.getColumnProperties=function(t){var e=this.getColumnObject(t);return e?e.p:null},GoogleDataConverter.prototype.getNumberOfRows=function(){return this.tableObj.rows.length},GoogleDataConverter.prototype.convertValue=function(value,colIndex){var colType=this.googleDataTypeToDataType(this.getColumnType(colIndex));return[_easydata_core__WEBPACK_IMPORTED_MODULE_0__.DataType.Date,_easydata_core__WEBPACK_IMPORTED_MODULE_0__.DataType.DateTime,_easydata_core__WEBPACK_IMPORTED_MODULE_0__.DataType.Time].includes(colType)?eval("new ".concat(value)):value},GoogleDataConverter.prototype.getValue=function(t,e){var n=t<this.tableObj.rows.length?this.tableObj.rows[t]:null;if(n){var o=e<this.tableObj.cols.length?n.c[e]:null;if(o)return this.convertValue(o.v,e)}return null},GoogleDataConverter.prototype.getRow=function(t){var e=this;return(t<this.tableObj.rows.length?this.tableObj.rows[t]:null).c.map((function(t,n){return e.convertValue(t.v,n)}),this)},GoogleDataConverter.prototype.convertTo=function(t){for(var e=this.getNumberOfColumns(),n=0;n<e;n++)t.columns.add({id:this.getColumnId(n),label:this.getColumnLabel(n),type:this.googleDataTypeToDataType(this.getColumnType(n))});var o=this.getNumberOfRows();for(n=0;n<o;n++)t.addRow(this.getRow(n))},GoogleDataConverter.prototype.googleDataTypeToDataType=function(t){switch(t){case"string":default:return _easydata_core__WEBPACK_IMPORTED_MODULE_0__.DataType.String;case"number":return _easydata_core__WEBPACK_IMPORTED_MODULE_0__.DataType.Float;case"boolean":return _easydata_core__WEBPACK_IMPORTED_MODULE_0__.DataType.Bool;case"date":return _easydata_core__WEBPACK_IMPORTED_MODULE_0__.DataType.Date;case"datetime":return _easydata_core__WEBPACK_IMPORTED_MODULE_0__.DataType.DateTime;case"timeofday":return _easydata_core__WEBPACK_IMPORTED_MODULE_0__.DataType.Time}},GoogleDataConverter}()},567:function(t,e,n){t.exports=function(){"use strict";function t(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}function e(t){return"function"==typeof t}var o=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},i=0,r=void 0,s=void 0,a=function(t,e){b[i]=t,b[i+1]=e,2===(i+=2)&&(s?s(x):E())};function l(t){s=t}function u(t){a=t}var c="undefined"!=typeof window?window:void 0,d=c||{},h=d.MutationObserver||d.WebKitMutationObserver,p="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),f="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function g(){return function(){return process.nextTick(x)}}function y(){return void 0!==r?function(){r(x)}:C()}function m(){var t=0,e=new h(x),n=document.createTextNode("");return e.observe(n,{characterData:!0}),function(){n.data=t=++t%2}}function v(){var t=new MessageChannel;return t.port1.onmessage=x,function(){return t.port2.postMessage(0)}}function C(){var t=setTimeout;return function(){return t(x,1)}}var b=new Array(1e3);function x(){for(var t=0;t<i;t+=2)(0,b[t])(b[t+1]),b[t]=void 0,b[t+1]=void 0;i=0}function w(){try{var t=Function("return this")().require("vertx");return r=t.runOnLoop||t.runOnContext,y()}catch(t){return C()}}var E=void 0;function T(t,e){var n=this,o=new this.constructor(k);void 0===o[S]&&U(o);var i=n._state;if(i){var r=arguments[i-1];a((function(){return W(i,o,r,n._result)}))}else j(n,o,t,e);return o}function D(t){var e=this;if(t&&"object"==typeof t&&t.constructor===e)return t;var n=new e(k);return F(n,t),n}E=p?g():h?m():f?v():void 0===c?w():C();var S=Math.random().toString(36).substring(2);function k(){}var M=void 0,I=1,B=2;function A(){return new TypeError("You cannot resolve a promise with itself")}function _(){return new TypeError("A promises callback cannot return that same promise.")}function P(t,e,n,o){try{t.call(e,n,o)}catch(t){return t}}function O(t,e,n){a((function(t){var o=!1,i=P(n,e,(function(n){o||(o=!0,e!==n?F(t,n):Q(t,n))}),(function(e){o||(o=!0,N(t,e))}),"Settle: "+(t._label||" unknown promise"));!o&&i&&(o=!0,N(t,i))}),t)}function L(t,e){e._state===I?Q(t,e._result):e._state===B?N(t,e._result):j(e,void 0,(function(e){return F(t,e)}),(function(e){return N(t,e)}))}function R(t,n,o){n.constructor===t.constructor&&o===T&&n.constructor.resolve===D?L(t,n):void 0===o?Q(t,n):e(o)?O(t,n,o):Q(t,n)}function F(e,n){if(e===n)N(e,A());else if(t(n)){var o=void 0;try{o=n.then}catch(t){return void N(e,t)}R(e,n,o)}else Q(e,n)}function q(t){t._onerror&&t._onerror(t._result),H(t)}function Q(t,e){t._state===M&&(t._result=e,t._state=I,0!==t._subscribers.length&&a(H,t))}function N(t,e){t._state===M&&(t._state=B,t._result=e,a(q,t))}function j(t,e,n,o){var i=t._subscribers,r=i.length;t._onerror=null,i[r]=e,i[r+I]=n,i[r+B]=o,0===r&&t._state&&a(H,t)}function H(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var o=void 0,i=void 0,r=t._result,s=0;s<e.length;s+=3)o=e[s],i=e[s+n],o?W(n,o,i,r):i(r);t._subscribers.length=0}}function W(t,n,o,i){var r=e(o),s=void 0,a=void 0,l=!0;if(r){try{s=o(i)}catch(t){l=!1,a=t}if(n===s)return void N(n,_())}else s=i;n._state!==M||(r&&l?F(n,s):!1===l?N(n,a):t===I?Q(n,s):t===B&&N(n,s))}function G(t,e){try{e((function(e){F(t,e)}),(function(e){N(t,e)}))}catch(e){N(t,e)}}var z=0;function V(){return z++}function U(t){t[S]=z++,t._state=void 0,t._result=void 0,t._subscribers=[]}function Y(){return new Error("Array Methods must be provided an Array")}var J=function(){function t(t,e){this._instanceConstructor=t,this.promise=new t(k),this.promise[S]||U(this.promise),o(e)?(this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?Q(this.promise,this._result):(this.length=this.length||0,this._enumerate(e),0===this._remaining&&Q(this.promise,this._result))):N(this.promise,Y())}return t.prototype._enumerate=function(t){for(var e=0;this._state===M&&e<t.length;e++)this._eachEntry(t[e],e)},t.prototype._eachEntry=function(t,e){var n=this._instanceConstructor,o=n.resolve;if(o===D){var i=void 0,r=void 0,s=!1;try{i=t.then}catch(t){s=!0,r=t}if(i===T&&t._state!==M)this._settledAt(t._state,e,t._result);else if("function"!=typeof i)this._remaining--,this._result[e]=t;else if(n===et){var a=new n(k);s?N(a,r):R(a,t,i),this._willSettleAt(a,e)}else this._willSettleAt(new n((function(e){return e(t)})),e)}else this._willSettleAt(o(t),e)},t.prototype._settledAt=function(t,e,n){var o=this.promise;o._state===M&&(this._remaining--,t===B?N(o,n):this._result[e]=n),0===this._remaining&&Q(o,this._result)},t.prototype._willSettleAt=function(t,e){var n=this;j(t,void 0,(function(t){return n._settledAt(I,e,t)}),(function(t){return n._settledAt(B,e,t)}))},t}();function K(t){return new J(this,t).promise}function X(t){var e=this;return o(t)?new e((function(n,o){for(var i=t.length,r=0;r<i;r++)e.resolve(t[r]).then(n,o)})):new e((function(t,e){return e(new TypeError("You must pass an array to race."))}))}function $(t){var e=new this(k);return N(e,t),e}function Z(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function tt(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}var et=function(){function t(e){this[S]=V(),this._result=this._state=void 0,this._subscribers=[],k!==e&&("function"!=typeof e&&Z(),this instanceof t?G(this,e):tt())}return t.prototype.catch=function(t){return this.then(null,t)},t.prototype.finally=function(t){var n=this,o=n.constructor;return e(t)?n.then((function(e){return o.resolve(t()).then((function(){return e}))}),(function(e){return o.resolve(t()).then((function(){throw e}))})):n.then(t,t)},t}();function nt(){var t=void 0;if(void 0!==n.g)t=n.g;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var e=t.Promise;if(e){var o=null;try{o=Object.prototype.toString.call(e.resolve())}catch(t){}if("[object Promise]"===o&&!e.cast)return}t.Promise=et}return et.prototype.then=T,et.all=K,et.race=X,et.resolve=D,et.reject=$,et._setScheduler=l,et._setAsap=u,et._asap=a,et.polyfill=nt,et.Promise=et,et}()}},__webpack_module_cache__={};function __webpack_require__(t){var e=__webpack_module_cache__[t];if(void 0!==e)return e.exports;var n=__webpack_module_cache__[t]={exports:{}};return __webpack_modules__[t].call(n.exports,n,n.exports,__webpack_require__),n.exports}__webpack_require__.d=function(t,e){for(var n in e)__webpack_require__.o(e,n)&&!__webpack_require__.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),__webpack_require__.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},__webpack_require__.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var __webpack_exports__={};__webpack_require__(292),__webpack_require__(610),__webpack_require__(546),__webpack_require__(527),__webpack_require__(311),__webpack_require__(57),__webpack_require__(85),__webpack_require__(817),__webpack_require__(235),function(){"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{core:function(){return t},ui:function(){return e}});var t={};__webpack_require__.r(t),__webpack_require__.d(t,{AggrFunction:function(){return c},BrowserQueryStorage:function(){return q},CondTag:function(){return M},Condition:function(){return P},ConditionPart:function(){return I},DataKind:function(){return l},DataModel:function(){return S},DefaultAggregatesCalculator:function(){return J},EasyQueryDataLoader:function(){return $},EmptyChunk:function(){return u},Entity:function(){return m},EntityAttr:function(){return v},EqAction:function(){return _},EqActionResult:function(){return tt},EqAggregatesContainer:function(){return Y},EqContext:function(){return rt},EqEditorTag:function(){return b},EqModelLoader:function(){return N},EqQueryFileLoader:function(){return V},EqServerDataFetcher:function(){return W},EqServerExporter:function(){return ot},EqServerModelLoader:function(){return H},EqServerQuerySynchronizer:function(){return G},EqServerValueListResolver:function(){return z},EqServiceProvider:function(){return K},EqValueEditor:function(){return h},ExprTag:function(){return p},Expression:function(){return k},FormatParser:function(){return s},GoogleDataConverter:function(){return Z.e},InMemoryModelStorage:function(){return nt},InvalidQueryError:function(){return L},LinkType:function(){return n},Operand:function(){return g},Operator:function(){return f},Query:function(){return R},QueryChangeAction:function(){return w},QueryChangePart:function(){return x},QueryColumn:function(){return B},SortDirection:function(){return E},Tree:function(){return T},Widget:function(){return st},WidgetGroup:function(){return A},eqconsts:function(){return i},equtils:function(){return o},i18n:function(){return r.i18n},versionInfo:function(){return at}});var e={};__webpack_require__.r(e),__webpack_require__.d(e,{AddRowRenderer:function(){return ce},AdvancedSearchView:function(){return Dn},AggrFuncColumnRendererCB:function(){return _t},AggrFuncColumnRendererCP:function(){return Et},AggrSettingsDialog:function(){return gn},AggrSettingsRenderer:function(){return pn},AggregationBar:function(){return mn},AttributeExpressionRenderer:function(){return se},BaseElementRenderer:function(){return Kt},ChartFacet:function(){return tn},ChartJsWidget:function(){return Ke},ChartType:function(){return qe},ChartWidget:function(){return Ye},ColumnAction:function(){return lt},ColumnRendererCB:function(){return Mt},ColumnRendererCP:function(){return Ct},ColumnsBar:function(){return Ot},ColumnsPanel:function(){return kt},ConditionAction:function(){return qt},ConditionGroupRenderer:function(){return Yt},ConditionGroupRowRenderer:function(){return Jt},ConditionRenderer:function(){return jt},CustomListExpressionRenderer:function(){return oe},CustomSqlColumnRendererCP:function(){return Dt},DataFilterView:function(){return kn},DataTableFacet:function(){return sn},DateTimeExpressionRenderer:function(){return fe},DomDropDownElementBuilder:function(){return Gt},DropDownRenderer:function(){return le},EasyGridWidget:function(){return Ae},EntitiesPanel:function(){return pt},EqHtmlGrid:function(){return Se},ExportDialog:function(){return Ne},ExportWidget:function(){return hn},ExpressionRenderer:function(){return $t},FacetType:function(){return Vt},FilterBar:function(){return we},GoogleChartWidget:function(){return $e},Grid:function(){return Me},HtmlContentWidget:function(){return Te},HtmlDataFilterView:function(){return In},InputExpressionRenderer:function(){return te},ListExpressionRenderer:function(){return ne},ManageDrillDownWidget:function(){return Fe},OperatorRenderer:function(){return he},PivotTableFacet:function(){return on},PopupMenu:function(){return gt},ProcessWidget:function(){return Le},QPEditablePart:function(){return vt},QueryPanel:function(){return be},ReportView:function(){return An},ResultFacet:function(){return Ge},ResultFacetsPanel:function(){return cn},SimpleColumnRendererCB:function(){return Bt},SimpleColumnRendererCP:function(){return xt},SimpleConditionRenderer:function(){return Ht},SortingBar:function(){return Ft},SqlListExpressionRenderer:function(){return ie},StatementPanel:function(){return Pe},SubQueryExpressionRenderer:function(){return ye},TextRenderer:function(){return Qt},View:function(){return wn},browserUtils:function(){return dt.z},dropdown:function(){return zt}});var n,o,i,r=__webpack_require__(907),s=function(){function t(t){this.start(t)}return t.prototype.start=function(t){this.formatStr=t,this.pos=0,this.exprNum=0,this.tokenText=""},t.prototype.skipSpaces=function(){for(;this.pos<this.formatStr.length&&" "===this.formatStr.charAt(this.pos);)this.pos++},t.prototype.next=function(){if(this.skipSpaces(),this.pos>=this.formatStr.length)return!1;var t=0;if("{"===this.formatStr.charAt(this.pos)){if((t=this.formatStr.indexOf("}",this.pos))<0)return!1;this.tokenText=this.formatStr.substring(this.pos,t+1),0===this.tokenText.indexOf("{expr")&&(this.token="expression",this.exprNum=parseInt(this.tokenText.substring(5,this.tokenText.length))),this.pos=t+1}else if("["===this.formatStr.charAt(this.pos)&&this.pos<this.formatStr.length-1&&"["===this.formatStr.charAt(this.pos+1))this.pos+=2,t=this.formatStr.indexOf("]]",this.pos),this.token="operator",this.tokenText=this.formatStr.substring(this.pos,t),this.pos=t+2;else{this.token="text";var e=this.formatStr.indexOf("{",this.pos);e<0&&(e=this.formatStr.length);var n=this.formatStr.indexOf("[[",this.pos);n<0&&(n=this.formatStr.length),t=Math.min(e,n),this.tokenText=this.formatStr.substring(this.pos,t).trim(),this.pos=t}return!0},t.prototype.getToken=function(){return{type:this.token,text:this.tokenText,index:this.exprNum-1}},t.prototype.parse=function(){for(var t=[];this.next();)t.push(this.getToken());return t},t}();!function(t){t[t.None=0]="None",t[t.Any=1]="Any",t[t.NotAll=2]="NotAll",t[t.All=3]="All"}(n||(n={})),function(t){t.combinePath=function(t,e){var n=t;return null!=n&&n.length>0?("/"!=n.charAt(n.length-1)&&(n+="/"),n+=e):n=e,n},t.strToLinkType=function(t){return"All"==t?n.All:"NotAll"==t?n.NotAll:"Any"==t?n.Any:n.None},t.linkTypeToStr=function(t){return t===n.All?"All":t===n.NotAll?"NotAll":t==n.Any?"Any":"None"},t.parseOperatorFormat=function(t){var e=r.i18n.getText("Operators",t.id,"format");return e||(e=r.i18n.getText("Operators",t.id,"displayFormat")),e||(e=t.displayFormat),new s(e).parse()},t.convertValue=function(t,e,n){switch(n){case r.DataType.String:return t;case r.DataType.Autoinc,r.DataType.Byte,r.DataType.Int32,r.DataType.Int64,r.DataType.Word:var o=parseInt(t);return isNaN(o)?"":o.toString();case r.DataType.Currency,r.DataType.Float:var i=parseFloat(t);return isNaN(i)?"":i.toString();default:return""}}}(o||(o={})),function(t){var e=function(){this.SpecDateValues=[{id:"${Today}",key:"Today",isDefault:!0},{id:"${Yesterday}",key:"Yesterday"},{id:"${Tomorrow}",key:"Tomorrow"},{id:"${FirstDayOfMonth}",key:"FirstDayOfMonth"},{id:"${FirstDayOfYear}",key:"FirstDayOfYear"}],this.SpecTimeValues=[{id:"${Now}",key:"Now",isDefault:!0},{id:"${HourStart}",key:"HourStart"},{id:"${Midnight}",key:"Midnight"},{id:"${Noon}",key:"Noon"}],this.BooleanValues=[{id:"${false}",key:"False"},{id:"${true}",key:"True",isDefault:!0}]};t.constLists=new e,t.predicateLinkTypeList=[{id:"All",key:"LinkTypeAll"},{id:"Any",key:"LinkTypeAny"},{id:"None",key:"LinkTypeNone"},{id:"NotAll",key:"LinkTypeNotAll"}]}(i||(i={}));var a,l,u={offset:0,limit:0,needTotal:!1},c=function(){function t(){this.id="",this.caption="",this.sqlExpr="",this.displayFormat="",this.appliedTypes=[]}return t.prototype.loadFromData=function(t){t&&(this.id=t.id,this.caption=t.cptn,this.displayFormat=t.fmt,this.sqlExpr=t.expr,this.appliedTypes=t.dtypes||this.appliedTypes)},t.prototype.getAppliedTypesOrDefault=function(){return this.appliedTypes.length>0?this.appliedTypes:"SUM"===this.id||"AVG"===this.id?[r.DataType.Autoinc,r.DataType.Byte,r.DataType.Currency,r.DataType.Float,r.DataType.Int32,r.DataType.Int64,r.DataType.Word]:"MIN"===this.id||"MAX"===this.id?[r.DataType.Autoinc,r.DataType.BCD,r.DataType.Byte,r.DataType.Currency,r.DataType.Date,r.DataType.DateTime,r.DataType.Time,r.DataType.Float,r.DataType.Int32,r.DataType.Int64,r.DataType.Word]:r.utils.getAllDataTypes()},t}(),d=(a=function(t,e){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},a(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}a(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),h=function(t){function e(){return t.call(this)||this}return d(e,t),e.prototype.loadFromData=function(e){t.prototype.loadFromData.call(this,e),e&&(e.sql&&(this.statement=e.sql),e.extraParams&&(this.extraParams=e.extraParams))},e}(r.ValueEditor);!function(t){t[t.Scalar=0]="Scalar",t[t.Const=1]="Const",t[t.Attribute=2]="Attribute",t[t.List=4]="List",t[t.Query=5]="Query",t[t.ParentColumn=6]="ParentColumn"}(l||(l={}));var p,f=function(){function t(){this.id="",this.expr="",this.constValueFormat="{const}",this.caption="{Unrecognized operator}",this.displayFormat="{expr1} [[{unrecognized operator}]] {expr2}",this.isRange=!1,this.caseIns=!1,this.paramCount=2,this.defaultOperand=new g,this.appliedTypes=[],this.operands=new Array}return t.prototype.loadFromData=function(t,e){if(e&&(this.id=e.id,this.caption=e.cptn,this.caseIns=e.caseIns,this.isRange=e.isRange,this.displayFormat=e.fmt,this.paramCount=e.pcnt,this.expr=e.expr,this.appliedTypes=e.dtypes||this.appliedTypes,e.defOperand&&this.defaultOperand.loadFromData(t,e.defOperand),e.editor&&(this.defaultOperand.editor=t.getEditorById(e.editor)||new h),e.operands))for(var n=0;n<e.operands.length;n++){var o=new g;o.loadFromData(t,e.operands[n]),e.editor&&(o.editor=t.getEditorById(e.editor)||new h),this.operands.push(o)}},t}(),g=function(){function t(){this.kind=l.Scalar,this.dataType=r.DataType.Unknown,this.editor=new h,this.defValue=""}return t.prototype.loadFromData=function(t,e){this.kind=e.kind,this.dataType=e.dtype,this.defValue=e.val,this.defText=e.txt,e.editor&&(this.editor=t.getEditorById(e.editor)||new h)},t.prototype.copyFrom=function(t){r.utils.assign(this,t)},t}(),y=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),m=function(t){function e(e){var n=t.call(this,e)||this;return n.useInConditions=!1,n.useInResult=!1,n.useInSorting=!1,n}return y(e,t),e.prototype.loadFromData=function(e,n){t.prototype.loadFromData.call(this,e,n),n&&(this.useInConditions=n.uic,this.useInResult=n.uir,this.useInSorting=n.uis)},e.prototype.scan=function(e,n){t.prototype.scan.call(this,(function(t,n){return e&&e(t,n)}),(function(t,e){return n&&n(t,e)}))},e}(r.MetaEntity),v=function(t){function e(e){var n=t.call(this,e)||this;return n.params=[],n.useInConditions=!0,n.useInResult=!0,n.useInSorting=!0,n.defaultOperator="",n.operators=new Array,n.lookupAttr="",n.expr="",n}return y(e,t),e.prototype.loadFromData=function(e,n){t.prototype.loadFromData.call(this,e,n),n&&(this.useInConditions=n.uic,this.useInResult=n.uir,this.useInSorting=n.uis,this.expr=n.sql,this.defaultOperator=n.defOperator,this.operators=n.ops,n.udata&&(this.userData=n.udata))},e}(r.MetaEntityAttr),C=function(){return C=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},C.apply(this,arguments)},b=C(C({},r.EditorTag),{SqlList:"SQLLIST",SubQuery:"SUBQUERY",BindToParentColumn:"BINDTOPARENTCOLUMN"});!function(t){t[t.Unknown=0]="Unknown",t[t.Constant=1]="Constant",t[t.EntityAttribute=2]="EntityAttribute",t[t.ParentEntityAttribute=3]="ParentEntityAttribute",t[t.AggregateFunction=4]="AggregateFunction",t[t.ParentColumn=5]="ParentColumn",t[t.Query=11]="Query",t[t.CustomSql=21]="CustomSql"}(p||(p={}));var x,w,E,T=function(){function t(e){void 0===e&&(e=null),this.childs=[],this.value=null,this.parent=null,e&&(Array.isArray(e)?(this.value=e[0],e.length>1&&this.addChild(new t(e.slice(1)))):e instanceof t?(this.value=e.value,this.childs=e.childs):this.value=e)}return t.prototype.contains=function(t){if(this.value===t)return!0;for(var e=0,n=this.childs;e<n.length;e++){if(n[e].contains(t))return!0}return!1},t.prototype.findNode=function(t){if(this.value===t)return this;for(var e=0,n=this.childs;e<n.length;e++){var o=n[e].findNode(t);if(o)return o}return null},t.prototype.addChild=function(t){t.parent=this,this.childs.push(t)},t.prototype.setParents=function(){for(var t=0,e=this.childs;t<e.length;t++){var n=e[t];n.parent=this,n.setParents()}},t}(),D=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),S=function(t){function e(){var e=t.call(this)||this;return e.mainEntity=null,e.nullAttribute=new v(null),e.nullOperator=new f,e.operators=new Array,e.rootEntity=new m,e.aggrFunctions=new Array,e.dateMacros=["Today","Yesterday","Tomorrow","FirstDayOfMonth","LastDayOfMonth","FirstDayOfWeek","FirstDayOfYear","FirstDayOfNextWeek","FirstDayOfPrevMonth","FirstDayOfNextMonth","FirstDayOfNextYear","FirstDayOfPrevYear","FirstDayOfPrevWeek"],e.timeMacros=["Now","HourStart","Midnight","Noon"],e.links=[],e}return D(e,t),e.prototype.getMainEntity=function(){return this.mainEntity},e.prototype.loadFromJSON=function(t){var e=JSON.parse(t);this.loadFromData(e)},e.prototype.loadFromData=function(e){if(t.prototype.loadFromData.call(this,e),this.operators=new Array,e.operators)for(var n=0;n<e.operators.length;n++){var o=new f;o.loadFromData(this,e.operators[n]),this.operators.push(o)}if(this.rootEntity.loadFromData(this,e.entroot),this.aggrFunctions=new Array,e.aggrfuncs)for(n=0;n<e.aggrfuncs.length;n++){var i=new c;i.loadFromData(e.aggrfuncs[n]),this.aggrFunctions.push(i)}},e.prototype.getObject=function(){return this},e.prototype.setData=function(t){"string"==typeof t?this.loadFromJSON(t):this.loadFromData(t)},e.prototype.createEntity=function(t){return new m(t)},e.prototype.createEntityAttr=function(t){return new v(t)},e.prototype.createValueEditor=function(){return new h},e.prototype.createQuery=function(){return new R(this)},e.prototype.getRootEntity=function(){return this.rootEntity},e.prototype.getEditorById=function(e){return t.prototype.getEditorById.call(this,e)},e.prototype.getAttributeById=function(t){var e=this.getEntityAttrById(this.getRootEntity(),t);return e||null},e.prototype.getAttributeByIdSafe=function(t){var e=this.getAttributeById(t);return e||this.nullAttribute},e.prototype.checkAttrProperty=function(t,e){var n=this.getAttributeById(t);if(n){if(void 0===n[e])throw"No such property: "+e;return!!n[e]||!!n.lookupAttr&&(t=n.lookupAttr,(n=this.getAttributeById(t))&&n[e])}return!1},e.prototype.getEntityAttrById=function(e,n){return t.prototype.getEntityAttrById.call(this,e,n)},e.prototype._listByEntityWithFilter=function(t,e){var n,o=new Array,i=null;if(t.subEntities)for(var s=t.subEntities.length,a=0;a<s;a++){if(i=t.subEntities[a],!e||e(i,null))(n=r.i18n.getText("Entities",i.name))||(n=i.caption),(d=r.utils.assign(new m,{id:i.name,text:n,items:[],isEntity:!0})).items=this._listByEntityWithFilter(i,e),d.items.length>0&&o.push(d)}var l=null;if(t.attributes)for(var u=t.attributes.length,c=0;c<u;c++)if(l=t.attributes[c],!e||e(t,l)){(n=r.i18n.getText("Attributes",l.id))||(n=l.caption);var d=r.utils.assign(new m,{id:l.id,text:n,dataType:l.dataType});o.push(d)}return o},e.prototype._listByEntity=function(t,e,n){e=e||{};var o,i=[],s=[],a=null;if(t.subEntities)for(var l=t.subEntities.length,u=0;u<l;u++)if(a=t.subEntities[u],(!n||n(a,null))&&(!1!==e.addUIC&&!1!==a.useInConditions||!1!==e.addUIR&&!1!==a.useInResult||!1!==e.addUIS&&!1!==a.useInSorting)){o=r.i18n.getText("Entities",a.name)||a.caption;var c=r.utils.assign(new m,{id:a.name,text:o,items:[],isEntity:!0,description:a.description}),d=r.utils.assign({},e);d.includeRootData=!1,c.items=this._listByEntity(a,d,n),c.items.length>0&&i.push(c)}var h=null;if(t.attributes)for(var p=t.attributes.length,f=0;f<p;f++)h=t.attributes[f],n&&!n(t,h)||(!1!==e.addUIC&&!1!==h.useInConditions||!1!==e.addUIR&&!1!==h.useInResult||!1!==e.addUIS&&!1!==h.useInSorting)&&(o=r.i18n.getText("Attributes",h.id)||h.caption,s.push(r.utils.assign(new v(t),{id:h.id,text:o,dataType:h.dataType,lookupAttr:h.lookupAttr,description:h.description})));var g,y=function(t,e){return t.text.toLowerCase()==e.text.toLowerCase()?0:t.text.toLowerCase()>e.text.toLowerCase()?1:-1};return e.sortEntities&&(i.sort(y),s.sort(y)),g=e.attrPlacement&&0!=e.attrPlacement?s.concat(i):i.concat(s),2==e.attrPlacement&&g.sort(y),e.includeRootData?((o=r.i18n.getText("Entities",t.name))||(o=t.caption),{id:t.name,text:o,items:g}):g},e.prototype.clear=function(){t.prototype.clear.call(this),this.operators=[],this.aggrFunctions=[]},e.prototype.addOrUpdateOperator=function(t){var e=r.utils.findItemById(this.operators,t.id);return e||((e=new f).id=t.id,this.operators.push(e)),e.caption=t.caption,e.expr=t.expr||"",e.displayFormat=t.format,e.defaultOperand=new g,e.defaultOperand.kind=t.kind||l.Scalar,t.appliedTypes&&(e.appliedTypes=t.appliedTypes),t.paramCount>0&&(e.paramCount=t.paramCount),this.runThroughEntities((function(t,n){t.operators.indexOf(e.id)<0&&e.appliedTypes.indexOf(t.dataType)>=0&&t.operators.push(e.id)})),e},e.prototype.removeOperator=function(t,e){void 0===e&&(e=!1);var n=r.utils.findItemById(this.operators,t);n&&(e||r.utils.removeArrayItem(this.operators,n),this.runThroughEntities((function(t,e){r.utils.removeArrayItem(t.operators,n.id)})))},e.prototype.getOperatorIdsByDataType=function(t){switch(t){case r.DataType.String:case r.DataType.Memo:return"StartsWith,EndsWith,Contains,Equal,InList,NotStartsWith,NotEndsWith,NotContains,NotEqual,NotInList,IsNull,IsNotNull".split(",");case r.DataType.Guid:return"Equal,NotEqual".split(",");case r.DataType.Date:case r.DataType.DateTime:return"DateWithinToday,DateWithinThisWeek,DateWithinPrevWeek,DateWithinThisMonth,DateWithinPrevMonth,DateWithinThisYear,DateWithinPrevYear,DateBeforePrecise,DateAfterPrecise,DatePeriodPrecise,IsNull,IsNotNull".split(",");case r.DataType.Time:return"TimeBeforePrecise,TimeAfterPrecise,TimePeriodPrecise,IsNull,IsNotNull".split(",");case r.DataType.Byte:case r.DataType.Word:case r.DataType.Int32:case r.DataType.Int64:case r.DataType.Float:case r.DataType.Currency:case r.DataType.BCD:case r.DataType.Autoinc:case r.DataType.Unknown:return"Equal,Between,LessThan,LessOrEqual,GreaterThan,GreaterOrEqual,InList,NotEqual,NotBetween,NotInList,IsNull,IsNotNull".split(",");case r.DataType.Bool:return"IsTrue,NotTrue".split(",");default:for(var e=[],n=0,o=this.operators;n<o.length;n++){var i=o[n];i.appliedTypes.indexOf(t)>=0&&e.push(i.id)}return e}},e.prototype.buildQueryPath=function(t){var e=this.mainEntity||this.rootEntity,n=this.createTreeNodeFromEntity(e);return n.setParents(),n},e.prototype.createTreeNodeFromEntity=function(t){for(var e=new T(t),n=0,o=t.subEntities;n<o.length;n++){var i=o[n];e.addChild(this.createTreeNodeFromEntity(i))}return e},e.prototype.getEntitiesInQuery=function(t){if(t.model.id!==this.id)throw Error("Model mithmatch");for(var e=[],n=0,o=t.getColumns();n<o.length;n++){var i=o[n];i.enabled&&this.addEntityByExpression(e,i.expr)}var r=t.getRootCondition();return this.fillEntitiesByCondtionGroup(e,r),e},e.prototype.findAggrFunctionById=function(t){for(var e=0,n=this.aggrFunctions;e<n.length;e++){var o=n[e];if(o.id===t)return o}return null},e.prototype.fillEntitiesByCondtionGroup=function(t,e){for(var n=0,o=e.getConditions();n<o.length;n++){var i=o[n];if(i.isGroup())this.fillEntitiesByCondtionGroup(t,i);else for(var r=0,s=i.expressions;r<s.length;r++){var a=s[r];if(this.addEntityByExpression(t,a),a.args)for(var l=0,u=a.args;l<u.length;l++){var c=u[l];this.addEntityByExpression(t,c)}}}},e.prototype.addEntityByExpression=function(t,e){if(e.tag===p.EntityAttribute){var n=e.baseAttrId||e.value;if(n){var o=this.getAttributeById(n);o&&o.entity&&r.utils.indexOfArrayItem(t,o.entity)<0&&t.push(o.entity)}}},e.prototype.findLink=function(t,e){for(var n=0,o=this.links;n<o.length;n++){var i=o[n];if(i.entityFrom==t&&i.entityTo==e)return i}return null},e.prototype.getLinksByEntity=function(t){for(var e=[],n=0,o=this.links;n<o.length;n++){var i=o[n];i.entityFrom!=t&&i.entityTo!=t||e.push(i)}return e},e.prototype.getEntitiesTree=function(t,e){return this._listByEntity(this.getRootEntity(),t,e)},e.prototype.getEntitiesTreeWithFilter=function(t){return this._listByEntityWithFilter(this.getRootEntity(),t)},e.prototype.getFullEntityPathByAttr=function(t,e){return e=e||" ",this.getEntityPathByAttr(this.getRootEntity(),t,e,!0)},e.prototype.getEntityPathByAttr=function(e,n,o,i){return t.prototype.getEntityPathByAttr.call(this,e,n,o,i)},e.prototype.getAttributeText=function(e,n){return t.prototype.getAttributeText.call(this,e,n)},e.prototype.getFirstUICAttr=function(){return this.getFirstUICAttrInEntity(this.getRootEntity())},e.prototype.getFirstUICAttrInEntity=function(t){if(!1!==t.useInConditions){if(t.attributes)for(var e=t.attributes.length,n=0;n<e;n++)if(t.attributes[n].useInConditions)return t.attributes[n];if(t.subEntities){var o=t.subEntities.length;for(n=0;n<o;n++){var i=this.getFirstUICAttrInEntity(t.subEntities[n]);if(i)return i}}}return null},e.prototype.runThroughEntities=function(t,e){this.getRootEntity().scan(t,e)},e.prototype.getFirstAttributeByFilter=function(t){var e=null;return this.runThroughEntities((function(n,o){t(n)&&(o.stop=!0,e=n)}),null),e},e.prototype.findOperatorById=function(t){if(this.operators.length>0)for(var e=this.operators.length,n=0;n<e;n++)if(this.operators[n].id==t)return this.operators[n];return null},e.prototype.getOperatorById=function(t){var e=this.findOperatorById(t);return e||this.nullOperator},e.prototype.getDefaultOperatorIdForAttr=function(t){return t.defaultOperator?t.defaultOperator:t.operators.length>0?t.operators[0]:this.nullOperator.id},e.prototype.getAggrFunctionCaption=function(t){var e=r.i18n.getText("AggregateFunctions",t),n=e?e.caption:r.i18n.getText("Aggr"+t.replace(" ","")+"_Caption");if(n)return n;var o=r.utils.findItemById(this.aggrFunctions,t);return o&&o.caption?o.caption:t},e.prototype.getAggrFunctionFormat=function(t){var e=r.i18n.getText("AggregateFunctions",t),n=e?e.displayFormat:r.i18n.getText("Aggr"+t.replace(" ","")+"_Format");if(n)return n;var o=r.utils.findItemById(this.aggrFunctions,t);return o&&o.displayFormat?o.displayFormat:""},e.prototype.getDefaultOperatorForAttr=function(t){var e=this.getDefaultOperatorIdForAttr(t);return this.getOperatorById(e)},e.prototype.getOperand=function(t,e,n){var o=new g;e&&e.defaultOperand?(o.copyFrom(e.defaultOperand),o.defValue||(o.defValue=""),o.defText||(o.defText="")):(o.kind=l.Scalar,o.dataType=t.dataType,o.defValue="",o.defText="",o.editor=null);var i=o;return i.dataType===r.DataType.Unknown&&t&&(i.dataType=t.dataType),e&&n>=0&&e.operands&&e.operands[n-1]&&(i=r.utils.assign(i,e.operands[n-1])),i.editor||(o.editor?i.editor=o.editor:o.kind===l.Query?i.editor.tag=b.SubQuery:t&&t.defaultEditor?i.editor=t.defaultEditor:i.dataType===r.DataType.Date||i.dataType===r.DataType.DateTime||i.dataType===r.DataType.Time?i.editor.tag=b.DateTime:i.editor.tag=b.Edit),i},e.prototype.getAggrFunctions=function(){return this.aggrFunctions},e.prototype.isDateMacro=function(t,e){var n=t.match(/\${{?(.*?)}?}/);if(null!=n){var o=n[1];if(r.utils.indexOfArrayItem(this.dateMacros,o)>=0)return e&&e(o),!0}return!1},e.prototype.isTimeMacro=function(t,e){var n=t.match(/\${{?(.*?)}?}/);if(null!=n){var o=n[1];if(r.utils.indexOfArrayItem(this.timeMacros,o)>=0)return e&&e(o),!0}return!1},e.prototype.getDateMacroValue=function(t){var e=new Date;return this.isDateMacro(t,(function(t){switch(t){case"Today":break;case"Yesterday":e.setDate(e.getDate()-1);break;case"Tomorrow":e.setDate(e.getDate()+1);break;case"FirstDayOfMonth":e.setDate(1);break;case"LastDayOfMonth":e.setMonth(e.getMonth()+1,0);break;case"FirstDayOfPrevWeek":n=0==(n=e.getDay())?1:8-n,e.setDate(e.getDate()-n);break;case"FirstDayOfWeek":n=0==(n=e.getDay())?6:n-1,e.setDate(e.getDate()-n);break;case"FirstDayOfYear":e.setMonth(0,1);break;case"FirstDayOfNextWeek":var n;n=0==(n=e.getDay())?1:8-n,e.setDate(e.getDate()+n);break;case"FirstDayOfNextMonth":e.setMonth(e.getMonth()+1,1);break;case"FirstDayOfPrevMonth":e.setMonth(e.getMonth()-1,1);break;case"FirstDayOfPrevYear":e.setFullYear(e.getFullYear()-1,0,1);break;case"FirstDayOfNextYear":e.setFullYear(e.getFullYear()+1,0,1)}}))?e:null},e.prototype.getDateOrMacroValue=function(t){var e=this.getDateMacroValue(t);return e||t},e.prototype.getTimeMacroValue=function(t){var e=new Date;return this.isDateMacro(t,(function(t){switch(t){case"Now":break;case"HourStart":e.setMinutes(0,0,0);break;case"Midnight":e.setHours(0,0,0,0);break;case"Noon":e.setHours(12,0,0,0)}}))?e:null},e.prototype.getTimeOrMacroValue=function(t){var e=this.getTimeMacroValue(t);return e||t},e.prototype.getAllDateMacros=function(){return this.dateMacros},e.prototype.getAllTimeMacros=function(){return this.timeMacros},e}(r.MetaData),k=function(){function t(t){var e=this;this.parent=t,this.tag=p.Constant,this.kind=l.Scalar,this.dataType=r.DataType.Unknown,this._value="",this.distinct=!1,this._isDefaultValue=!1,this.getText=function(){return e.text||e._value},this.args=new Array}return t.prototype.getParent=function(){return this.parent},t.prototype.getModel=function(){return this.parent.getQuery().getModel()},t.prototype.loadFromData=function(e,n){if(n)if(this.tag=n.tag,n.val?(this._value=n.val,this.text=n.txt):n.id&&(this.kind=l.Attribute,this._value=n.id,this.text=n.txt),void 0!==n.dtype&&(this.dataType=n.dtype),this.tag==p.EntityAttribute||this.tag==p.ParentEntityAttribute)this.kind=l.Attribute;else{if(void 0!==n.kind&&(this.kind=n.kind),n.query&&(this.subQuery=this.parent.getQuery().createSubQuery(),this.subQuery.loadFromDataOrJson(n.query)),void 0!==n.distinct&&(this.distinct=n.distinct),n.func&&(this.func=n.func,n.args))for(var o=0;o<n.args.length;o++){var i=new t(this.parent);i.loadFromData(e,n.args[o]),this.args.push(i)}n.sql&&(this.sql=n.sql,this.baseAttrId=n.baseAttrId)}},t.prototype.saveToData=function(){var t={tag:this.tag};if(t.dtype=this.dataType,this.tag==p.EntityAttribute||this.tag==p.ParentEntityAttribute)this._value&&(t.id=this._value,t.val=this._value),this.text&&(t.txt=this.text);else{if(this.subQuery&&(t.query=this.subQuery.toJSONData()),void 0!==this.kind&&(t.kind=this.kind),this._value&&(t.val=this._value),this.text&&(t.txt=this.text),this.distinct&&(t.distinct=this.distinct),this.func){t.func=this.func,t.args=[];for(var e=0;e<this.args.length;e++)t.args.push(this.args[e].saveToData())}this.sql&&(t.sql=this.sql,t.baseAttrId=this.baseAttrId)}return t},t.prototype.getIndex=function(){return this.parent.getExpressionIndex(this)},Object.defineProperty(t.prototype,"value",{get:function(){return this._value},enumerable:!1,configurable:!0}),t.prototype.setValue=function(t,e){void 0===e&&(e=!1),this.setContent(t,void 0,e)},t.prototype.setContent=function(t,e,n){void 0===n&&(n=!1);var o=this.value;if(this.kind==l.Attribute&&t){var i=this.getModel().getAttributeById(t);if(!i)throw"No such entity attribute:"+t;this.dataType=i.dataType}this._value=t,void 0!==e?this.text=e:void 0!==this.text&&(this.text=t),this._isDefaultValue=!1,n||this.parent.expressionChanged(this,o)},t.prototype.isEmpty=function(){return!(this.text||this._value)},t.prototype.hasText=function(){return this.text&&this.text.length>0},t.prototype.tryCopyValueFrom=function(t){if(this.kind==t.kind){if(this.dataType==t.dataType)this.setContent(t.value.length?t.value:this._value,t.text&&t.text.length?t.text:this.text,!0);else{var e=o.convertValue(t.value,t.dataType,this.dataType);this.setContent(e.length?e:this._value,t.text&&t.text.length?t.text:this.text,!0)}this.subQuery=t.subQuery,this.sql=t.sql,this.baseAttrId=t.baseAttrId}else this._isDefaultValue||(this.setContent("","",!0),this.subQuery=null,this.sql=null,this.baseAttrId=null)},t}();!function(t){t[t.Conditions=1]="Conditions",t[t.Columns=2]="Columns",t[t.SortingColumns=4]="SortingColumns",t[t.Properties=32]="Properties",t[t.ExtraData=64]="ExtraData",t[t.Facets=128]="Facets",t[t.Aggregation=256]="Aggregation",t[t.All=511]="All"}(x||(x={})),function(t){t[t.Add=1]="Add",t[t.Modify=2]="Modify",t[t.Delete=4]="Delete",t[t.Activate=8]="Activate",t[t.All=127]="All"}(w||(w={})),function(t){t[t.None=0]="None",t[t.Ascending=1]="Ascending",t[t.Descending=2]="Descending"}(E||(E={}));var M,I,B=function(){function t(t,e){void 0===e&&(e=!1),this.query=t,this.justsorted=e,this.enabled=!0,this.params=[],this._isHidden=!1,this.query=t,this._id=r.utils.generateId("col"),this.caption="",this._sorting=E.None,this._sortIndex=-1,this.expr=new k(this),this.blockId="",this.justsorted=e}return Object.defineProperty(t.prototype,"id",{get:function(){return this._id},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sorting",{get:function(){return this.query?this.query.getColumnSorting(this):this._sorting},set:function(t){this.query?this.query.setColumnSorting(this,t):this._sorting=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sortIndex",{get:function(){return this.query?this.query.getColumnSortIndex(this):this._sortIndex},set:function(t){this.query?this.query.setColumnSortIndex(this,t):this._sortIndex=t},enumerable:!1,configurable:!0}),t.prototype.getModel=function(){return this.query.getModel()},t.prototype.getQuery=function(){return this.query},t.prototype.isReadOnly=function(){return!1},t.prototype.isJustSorted=function(){return this.justsorted},t.prototype.setReadOnly=function(t){},t.prototype.isHidden=function(){return this._isHidden},t.prototype.setHidden=function(t){this._isHidden=t},t.prototype.getDataType=function(){if(this.expr.dataType===r.DataType.Unknown){var t=null;if(this.expr.func){if("COUNT"==this.expr.func||"CNTDST"==this.expr.func)return r.DataType.Int64;t=this.expr.args[0].value}else t=this.expr.value;var e=this.query.getModel().getAttributeById(t);if(e)return e.dataType}return this.expr.dataType},t.prototype.loadFromData=function(t,e){e&&(e.id&&(this._id=e.id),this.caption=e.cptn,void 0!==e.srt&&(this._sorting=e.srt,this._sortIndex=void 0!==e.srtidx?e.srtidx:-1),!1===e.enabled&&(this.enabled=e.enabled),this.expr.loadFromData(t,e.expr),this.blockId=e.blockId,this.displayFormat=e.dfmt,this.groupFooterColumnTemlate=e.gfct,e.hidden&&this.setHidden(!0))},t.prototype.saveToData=function(){var t={};return t.id=this._id,void 0!==this.caption&&(t.cptn=this.caption),this.sorting!=E.None&&(t.srt=this.sorting,t.srtidx=this.sortIndex),t.expr=this.expr.saveToData(),this.blockId&&(t.blockId=this.blockId),!1===this.enabled&&(t.enabled=this.enabled),t.dfmt=this.displayFormat,t.gfct=this.groupFooterColumnTemlate,this.isHidden()&&(t.hidden=!0),t},t.prototype.fireChangedEvent=function(){this.query.fireChangedEvent({part:this.justsorted?x.SortingColumns:x.Columns,action:w.Modify,changee:this})},t.prototype.getExpressionIndex=function(t){return 0},t.prototype.expressionChanged=function(t,e){},t}();!function(t){t[t.Unknown=0]="Unknown",t[t.Simple=1]="Simple",t[t.Group=51]="Group"}(M||(M={})),function(t){t[t.EntityAttr=2]="EntityAttr",t[t.Operator=4]="Operator",t[t.Value=8]="Value",t[t.All=14]="All"}(I||(I={}));var A,_,P=function(){function t(t,e){this.query=t,this.linkType=n.All,this.parent=null,this._id=r.utils.generateId("cond"),this.justAdded=!1,this.tag=e||M.Unknown,this.enabled=!0,this.operatorId="",this.blockId="",this.expressions=new Array,this.conditions=new Array}return Object.defineProperty(t.prototype,"id",{get:function(){return this._id},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enabled",{get:function(){return this._enabled&&(!this.getParent()||this.getParent().enabled)},set:function(t){this._enabled=t&&(!this.getParent()||this.getParent().enabled),this.conditions&&this.conditions.forEach((function(e){e.enabled=t}))},enumerable:!1,configurable:!0}),t.prototype.getQuery=function(){return this.query},t.prototype.getModel=function(){return this.query.getModel()},t.prototype.getParent=function(){return this.parent},t.prototype.setParent=function(t){this.parent=t},t.prototype.getConditions=function(){return this.conditions},t.prototype.isEmpty=function(){return 0===this.conditions.length},t.prototype.isGroup=function(){return this.tag==M.Group||null==this.parent},t.prototype.getLevel=function(){var t=this.getParent();return t?t.getLevel()+1:0},t.prototype.isReadOnly=function(){return!1},t.prototype.setReadOnly=function(t){},t.prototype.isParameterized=function(){return!1},t.prototype.setParameterized=function(t){},t.prototype.isInJoin=function(){return!1},t.prototype.setInJoin=function(t){},t.prototype.clearConditions=function(){this.conditions=[]},t.prototype.addCondition=function(t){return t.setParent(this),this.conditions.push(t)},t.prototype.removeConditionAt=function(t){this.conditions.splice(t,1)},t.prototype.loadFromData=function(t,e){if(e){if(this.tag=e.tag,this.tag||(this.tag=!this.parent||this.conditions.length>0?M.Group:M.Simple),void 0!==e.enabled&&(this.enabled=e.enabled),void 0!==e.disabled&&(this.enabled=!e.disabled),this.tag==M.Simple&&(this.operatorId=e.op,e.exprs))for(var n=0;n<e.exprs.length;n++){var o=new k(this);o.loadFromData(t,e.exprs[n]),this.expressions.push(o)}this.linkType=e.linking}},t.prototype.saveToData=function(){var t={};if(t.tag=this.tag,this.enabled||(t.enabled=this.enabled),this.tag==M.Simple){t.op=this.operatorId,t.exprs=[];for(var e=0;e<this.expressions.length;e++)t.exprs.push(this.expressions[e].saveToData())}return this.tag==M.Group&&(t.linking=this.linkType),t},t.prototype.fireChangedEvent=function(t){void 0===t&&(t=I.All),this.query.fireChangedEvent({part:x.Conditions,action:w.Modify,changee:this,condPart:t})},t.prototype.getExpressionIndex=function(t){return this.expressions.indexOf(t,0)},t.prototype.expressionChanged=function(t,e){0==t.getIndex()&&t.tag==p.EntityAttribute&&this.tuneOperatorForAttr(t.value)},t.prototype.getOperatorId=function(){return this.operatorId},t.prototype.setOperatorId=function(t,e){void 0===e&&(e=!1);var n=this.operatorId;if(this.operatorId=t,!e){var o=this.getModel(),i=o.getOperatorById(t),r=this.expressions[0].value,s=o.getAttributeById(r);this.tuneValueExpressions(s,i,s.id,n)}},t.prototype.tuneOperatorForAttr=function(t){var e=this.getModel(),n=this.expressions[0].value,o=e.getAttributeById(n);if(null!=o){var i=this.getModel().getDefaultOperatorForAttr(o),r=this.operatorId;this.operatorId=i.id,this.tuneValueExpressions(o,i,t,r)}},t.prototype.tuneValueExpressions=function(t,e,n,o){var i=this.getModel();if(e){var s=this.expressions.length,a=(n&&i.getAttributeById(n),null);if(o&&(a=i.getOperatorById(o)),a&&a.paramCount==e.paramCount){for(var l=1;l<e.paramCount;){var u=i.getOperand(t,a,l);(g=i.getOperand(t,e,l)).dataType==r.DataType.Unknown&&(g.dataType=t.dataType);var c=g.editor&&g.editor.tag!==r.EditorTag.Unknown?g.editor:t.defaultEditor&&t.defaultEditor.tag!==r.EditorTag.Unknown?t.defaultEditor:new h;if(l>=s){var d=this.createValueExpr(g);this.expressions.push(d)}else{var p=this.expressions[l],f=this.createValueExpr(g);this.areCompitableEditors(u.editor,c)&&f.tryCopyValueFrom(p),this.expressions[l]=f}l++}s>l&&this.expressions.splice(l,s-l)}else{this.expressions.splice(1,this.expressions.length-1);for(l=1;l<e.paramCount;l++){var g;(g=i.getOperand(t,e,l)).dataType==r.DataType.Unknown&&(g.dataType=t.dataType);d=this.createValueExpr(g);this.expressions.push(d)}}}},t.prototype.areCompitableEditors=function(t,e){return e.tag!=b.CustomList&&e.tag!=b.List&&e.tag!=b.SqlList&&e.tag!=r.EditorTag.Unknown},t.prototype.addExpressionByOperand=function(t,e){void 0===e&&(e=null);var n=this.createValueExpr(t,e);return this.expressions.push(n),n},t.prototype.createValueExpr=function(t,e){void 0===e&&(e=null);var n=null==e,o=e||t.defValue,i=e||t.defText,r=new k(this);if(t.kind===l.Query)r.tag=p.Query,r.dataType=t.dataType,r.kind=t.kind,r.setContent(o,i,!0);else if(t.kind===l.Attribute){if(!n){var s=this.getModel().getFirstAttributeByFilter((function(e){return 1==e.useInConditions&&(!t.dataType||e.dataType==t.dataType)}));o=s?s.id:null}r.tag=p.EntityAttribute,r.kind=t.kind,r.dataType=t.dataType,r.setContent(o,i,!0)}else n&&(o=t.defValue&&""!=t.defValue?t.defValue:t.editor&&t.editor.defValue?t.editor.defValue:"",t.editor&&(i=t.editor.getValueText(o))),r.tag=p.Constant,r.dataType=t.dataType,r.kind=t.kind,r.setContent(o,i,!0),r._isDefaultValue=n;return r},t}(),O=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),L=function(t){function e(n){var o=t.call(this,n)||this;return Error.captureStackTrace&&Error.captureStackTrace(o,e),o.name="InvalidQueryError",o}return O(e,t),e}(Error),R=function(){function t(t,e,n){var o=this;this.extraData={},this.innerData={},this.isNewbie=!0,this._isModified=!1,this._enableAggregation=!1,this.parentQuery=null,this.drillDowns=[],this.syncSortOrderWithColumnsOrder=!0,n&&(this.context=n.context,this.context&&(this.syncSortOrderWithColumnsOrder=this.context.options.syncSortOrderWithColumnsOrder)),this.eventEmitter=new r.EventEmitter(this),this.root=new P(this,M.Group),this.extraConditions=new P(this,M.Group),this.columns=new Array,this.sortedColumns=new Array,this.id||this.regenerateId(),this.setDefaultName(),this.description="",this.model=t||new S,e&&this.loadFromData(e),this.attributeExprTag=n&&n.attrTag||p.EntityAttribute,this.clientListRequestHandler=n?n.clientListRequestHandler:new Array,this.serverListRequestHandler=n?n.serverListRequestHandler:new Array,this.timezoneOffset=(new Date).getTimezoneOffset(),this.aggrSettings=new r.AggregationSettings(this),n&&(this.parentQuery=n.parent),this.addChangedCallback((function(t){t.data&&(t.data.part&x.Columns)>0&&!t.data.aggregation&&o._enableAggregation&&o.updateAggregationSettings()&&o.fireChangedEvent({part:x.Aggregation})}))}return t.prototype.isModified=function(){return this._isModified},t.prototype.resetModified=function(){this._isModified=!1},Object.defineProperty(t.prototype,"enableAggregation",{get:function(){return this._enableAggregation},set:function(t){var e=this._enableAggregation;if(this._enableAggregation=t,!e&&t){this.processQueryForAggregation();this.columns.filter((function(t){return t.enabled&&t.expr.tag==p.AggregateFunction}))}this._enableAggregation||this.aggrSettings.clear()},enumerable:!1,configurable:!0}),t.prototype.updateAggregationSettings=function(){for(var t=!1,e=this.getAggregationSettings(),n=e.groups.length-1;n>=0;n--){for(var o=e.groups[n],i=function(e){var n=o.columns[e];r.columns.find((function(t){return t.id===n}))||(o.columns.splice(e,1),t=!0)},r=this,s=o.columns.length-1;s>=0;s--)i(s);0==o.columns.length&&e.groups.slice(n,1)}var a=e.getAggregates(),l=function(e){var n=a[e];u.columns.find((function(t){return t.id===n.colId}))||(a.splice(e,1),t=!0)},u=this;for(n=a.length-1;n>=0;n--)l(n);return t},t.prototype.createSubQuery=function(){return new t(this.model,null,{context:this.context})},t.prototype.useAggregation=function(t,e){if(void 0===e&&(e=!1),this.aggrSettings.clear(),t(this.aggrSettings),this.enableAggregation)this.processQueryForAggregation(e);else if(!e)return void console.warn("Aggregation is turned off. Turn it on with query.enableAggregation = true")},t.prototype.useDefaultAggregation=function(){var t=this;this._enableAggregation=!0,this.useAggregation((function(e){var n=t.columns.filter((function(t){return t.enabled&&t.expr.tag==p.AggregateFunction}));if(n.length){for(var o=t.columns.filter((function(t){return t.enabled&&t.expr.tag==p.EntityAttribute})),i=[],s=0,a=n;s<a.length;s++){var l=a[s];i.push({id:l.id,func:l.expr.func}),t.changeColumnType(l,p.EntityAttribute)}for(var u=0,c=i;u<c.length;u++){var d=c[u];e.addAggregateColumn(d.id,d.func)}for(var h=0,f=o;h<f.length;h++){l=f[h];e.addGroup({columns:[l.id],name:l.caption})}e.addGrandTotals(),t.fireChangedEvent({part:x.Columns,wasModified:!1})}else{var g=t.getColumns().filter((function(e){return e.enabled&&e.expr.tag==p.EntityAttribute&&t.model.getAttributeById(e.expr.value).dataType===r.DataType.Currency}))[0],y=t.getColumns().filter((function(e){return e.enabled&&e.expr.tag==p.EntityAttribute&&t.model.getAttributeById(e.expr.value).dataType===r.DataType.String}))[0];if(!g&&!e.hasAggregates()||!y)return;e.addGrandTotals().addAggregateColumn(g.id,"SUM").addGroup({columns:[y.id],name:"Default"})}}))},t.prototype.processQueryForAggregation=function(t){var e=this;void 0===t&&(t=!1);var n=this.getAggregationSettings().getGroups();if(n.length>0){for(var o=n[n.length-1].columns,i=[],r=[],s=0,a=this.getColumns();s<a.length;s++){var l=a[s];o.indexOf(l.id)>=0?i.push(l):this.getColumnSorting(l)!=E.None&&r.push(l)}var u=0;i.forEach((function(t){e.getColumnSorting(t)==E.None&&e.setColumnSorting(t,E.Ascending),e.setColumnSortIndex(t,u++)})),r.forEach((function(t){e.setColumnSortIndex(t,u++)})),t||this.fireChangedEvent({part:x.Columns,aggregation:!0,wasModified:!1})}},t.prototype.getAggregationSettings=function(){return this.aggrSettings},t.prototype.getColumnIds=function(t,e){return e=e||t,this.columns.slice(t,e-t+1).map((function(t){return t.id}))},t.prototype.validateColumns=function(t){for(var e=this.columns.filter((function(t){return t.enabled})).map((function(t){return t.id})),n=-1,o=0,i=t;o<i.length;o++){var r=i[o],s=e.indexOf(r);if(s<0)return!1;if(n>s)return!1;n=s}return!0},t.prototype.validateAggregate=function(t,e){var n=this.columns.filter((function(e){return e.enabled&&e.id===t}))[0],o=this.model.findAggrFunctionById(e);return!(!o||!n||o.appliedTypes.indexOf(n.expr.dataType)<0)},t.prototype.isEx=function(){return!1},t.prototype.reset=function(t){void 0===t&&(t=!0),t&&this.clear(),this.regenerateId(),this.setDefaultName(),this._isModified=!1,this.isNewbie=!0},t.prototype.hasEnabledAggrColumns=function(){return this.columns.filter((function(t){return t.enabled&&t.expr.tag===p.AggregateFunction})).length>0},t.prototype.setDefaultName=function(){return this.setName(r.i18n.getText("NewQueryName")),this.getName()},t.prototype.validate=function(t){t=t||{};var e="EntityAttribute isn't declared in the model: ";if(!this.model)throw new L("Model is not declared");if(this.columns)for(var n=0,o=this.columns;n<o.length;n++){var i=o[n];if(i.expr.tag==p.EntityAttribute||i.expr.tag===p.ParentEntityAttribute){if(!this.model.getAttributeById(i.expr.value))throw new L(e+i.expr.value)}else if(i.expr.tag===p.AggregateFunction){if(!this.model.getAttributeById(i.expr.args[0].value))throw new L(e+i.expr.args[0].value)}else if(i.expr.tag!==p.CustomSql)throw new L("The expression has wrond tag: "+i.expr.tag)}this.root&&this.root.getConditions()&&this.validateConditionGroup(this.root,t)},t.prototype.getAggregatedColumns=function(){return this.getColumns().filter((function(t){return t.enabled&&t.expr.tag===p.AggregateFunction}))},t.prototype.tryValidate=function(t){try{return this.validate(t),!0}catch(t){if(t instanceof L)return!1;throw t}},t.prototype.validateConditionGroup=function(t,e){if(t.isGroup())for(var n=0,o=t.getConditions();n<o.length;n++){var i=o[n];i.enabled&&this.validateConditionGroup(i,e)}else if(t.expressions[0].tag===p.EntityAttribute){var s=t.expressions[0].value;if(!this.model.getAttributeById(s))throw new L("EntityAttribute isn't declared in the model: "+s);if(!e.checkExpressions)return;for(var a=1;a<t.expressions.length;a++){var u=t.expressions[a];if(u.tag===p.Constant&&r.utils.isNumericType(u.dataType)){if(!u.value)continue;for(var c=0,d=u.kind===l.List?u.value.split(/\s*,\s*/):[u.value];c<d.length;c++){var h=d[c],f=+h;if(isNaN(f))throw new L("Expression constant is NaN in condition:"+t.id);if(r.utils.isIntType(u.dataType)&&f!=parseInt(h,10))throw new L("Expression constant is wrong interger in condition: "+t.id)}}}}},t.prototype.loadFromDataOrJson=function(t,e){t&&("string"==typeof t?this.loadFromJson(t,e):this.loadFromData(t,e))},t.prototype.loadFromJson=function(t,e){var n=JSON.parse(t);this.loadFromData(n,e)},t.prototype.loadFromData=function(t,e){var n=this;e=r.utils.assign({changeStatus:!0,validate:!0},e||{});if(this.clear(),this.clearDrillDowns(),t){if(this.id=t.id,this.root.loadFromData(this.model,t.root),t.root&&t.root.conds)for(var o=0;o<t.root.conds.length;o++){var i=t.root.conds[o];if(!i.conds||this.isEx()){var s=this.createCondition();s.loadFromData(this.model,i),this.root.addCondition(s)}else console.error("Community version doesn't support working with groups.")}if(this.name=t.name,this.description=t.desc,this.sortedColumns=[],t.justsortcols)for(o=0;o<t.justsortcols.length;o++){(a=this.createColumn(!0)).loadFromData(this.model,t.justsortcols[o]),this.addColumnToSorted(a)}if(t.cols)for(o=0;o<t.cols.length;o++){var a;(a=this.createColumn()).loadFromData(this.model,t.cols[o]),this.columns.push(a),a._sorting!=E.None&&this.addColumnToSorted(a)}if(this.sortedColumns.sort((function(t,e){return t._sortIndex-e._sortIndex})),this.fixupSortingIndices(),t.extraData&&(this.extraData=t.extraData),this.innerData=t.innerData||this.innerData,this.innerData&&this.innerData.aggr&&(this._enableAggregation=this.innerData.aggr.enabled||!1,this.useAggregation((function(t){t.loadFromData(n.innerData.aggr)}),!0)),t.dds&&t.dds.length)for(var l=0,u=t.dds;l<u.length;l++){var c=u[l];this.addDrillDown().loadFromData(c)}}e.changeStatus&&(this.isNewbie=!1,this._isModified=!1),e.validate&&this.validate()},t.prototype.addDrillDown=function(){var t=this.model.createQuery();return t.parentQuery=this,this.drillDowns.push(t),t},t.prototype.getDrillDowns=function(){return this.drillDowns},t.prototype.getParentQuery=function(){return this.parentQuery},t.prototype.findColumnById=function(t){for(var e=0,n=this.columns;e<n.length;e++){var o=n[e];if(o.id===t)return o}return null},t.prototype.getModel=function(){return this.model},t.prototype.setModel=function(t){this.model=t},t.prototype.loadModelData=function(t){this.model.setData(t)},t.prototype.toJSON=function(){return JSON.stringify(this.toJSONData())},t.prototype.toJSONData=function(){var t=this;this.fixupSortingIndices();var e={modelId:this.model?this.model.getId():null,modelName:this.model?this.model.getName():null};e.id=this.id,e.name=this.name,this.description&&(e.desc=this.description),e.cols=[];for(var n=0;n<this.columns.length;n++)e.cols.push(this.columns[n].saveToData());e.justsortcols=[],this.sortedColumns.forEach((function(t){t.isJustSorted()&&e.justsortcols.push(t.saveToData())})),this.extraData&&(e.extraData=this.extraData),this.innerData&&(e.innerData=this.innerData,e.innerData.aggr=this.aggrSettings.saveToData(),e.innerData.aggr.enabled=this._enableAggregation);var o=function(e){var n=e.saveToData();n.conds=[];for(var o=e.getConditions(),i=0;i<o.length;i++)!o[i].isGroup()||t.isEx()?n.conds.push(o[i].saveToData()):console.error("Community version doesn't support working with groups.");return n};if(e.root=o(this.root),e.extraConds=o(this.extraConditions),this.drillDowns.length>0){e.dds=[];for(var i=0,s=this.drillDowns;i<s.length;i++){var a=s[i];e.dds.push(a.toJSONData())}}return e.timezoneOffset=this.timezoneOffset,e.locale=r.i18n.getCurrentLocale(),e},t.prototype.isEmptyConditions=function(){return this.root.isEmpty()},t.prototype.isEmptyColumns=function(){return!this.columns||0===this.columns.length},t.prototype.isEmpty=function(){return this.isEmptyColumns()&&this.isEmptyConditions()},t.prototype.clear=function(){this._enableAggregation=!1,this.aggrSettings.clear(),this.clearColumns(),this.clearConditions(),this.clearExtraConditions(),this.innerData={},this.extraData={}},t.prototype.clearColumns=function(){this.columns=[],this.sortedColumns=[]},t.prototype.clearConditions=function(){this.root.clearConditions(),this.root.linkType=n.All,this.root.enabled=!0},t.prototype.clearExtraConditions=function(){this.extraConditions.clearConditions()},t.prototype.clearDrillDowns=function(){this.drillDowns=[]},t.prototype.getId=function(){return this.id},t.prototype.setId=function(t){this.id=t},t.prototype.regenerateId=function(){this.id=r.utils.generateId("quer")},t.prototype.getName=function(){return this.name},t.prototype.setName=function(t){this.name=t},t.prototype.getDescription=function(){return this.description},t.prototype.setDescription=function(t){this.description=t},t.prototype.getColumns=function(){return this.columns},t.prototype.getUsedInTotalsColumns=function(){if(0===this.getAggregatedColumns().length)return[];var t=this.getColumns().filter((function(t){return t.enabled&&t.expr.tag===p.EntityAttribute}));return t.length&&t.pop(),t},t.prototype.addColumnToSorted=function(t){var e=JSON.stringify(t.expr.saveToData()),n=!0;this.sortedColumns.forEach((function(t){JSON.stringify(t.expr.saveToData())===e&&(n=!1)})),n&&this.sortedColumns.push(t)},t.prototype.getJustSortedColumns=function(){return this.sortedColumns.filter((function(t){return t.isJustSorted()}))},t.prototype.getSortedColumns=function(){return this.sortedColumns},t.prototype.getColumnSortIndex=function(t){return this.sortedColumns.indexOf(t)},t.prototype.setColumnSortIndex=function(t,e){if(!(e<0)){var n=this.getColumnSortIndex(t);n<0&&(this.addColumnToSorted(t),n=this.sortedColumns.length-1),r.utils.moveArrayItem(this.sortedColumns,n,e),this.fixupSortingIndices(),this.fireColumnsChangedEvent(w.All)}},t.prototype.getColumnSorting=function(t){return this.getColumnSortIndex(t)>=0?t._sorting!=E.None?t._sorting:E.Ascending:E.None},t.prototype.setColumnSorting=function(t,e){var n=this.getColumnSortIndex(t);t._sorting=e,n>=0?e==E.None&&(r.utils.removeArrayItem(this.sortedColumns,t),this.fixupSortingIndices()):e!=E.None&&(this.addColumnToSorted(t),this.fixupSortingIndices()),this.adjustColumnsSorting(),this.fireColumnsChangedEvent(w.Modify,t,t.isJustSorted())},t.prototype.fixupSortingIndices=function(){this.sortedColumns.forEach((function(t,e){t._sortIndex=e}))},t.prototype.adjustColumnsSorting=function(){var t=this;if(this.syncSortOrderWithColumnsOrder&&!(this.getJustSortedColumns().length>0)){var e=0;this.columns.forEach((function(n){if(n.sorting!=E.None){var o=t.getColumnSortIndex(n);o>=0&&(r.utils.moveArrayItem(t.sortedColumns,o,e),e++)}})),this.fixupSortingIndices()}},t.prototype.createColumn=function(t){return void 0===t&&(t=!1),new B(this,t)},t.prototype.getColumnById=function(t){return r.utils.findItemById(this.columns,t)},t.prototype.addColumn=function(t,e){var n;if(t.column)n=t.column;else{n=this.createColumn(t.justsorted);var o=void 0;if(t.attribute)o=t.attribute;else{if(!t.attributeId)throw new Error("Not enought data for addColumn operation. Need attribute or attributeId");if(!(o=this.model.getAttributeById(t.attributeId)))throw new Error("Incorrect attribute id (".concat(t.attributeId,"): addColumn"))}if(!o.useInResult&&(o.lookupAttr&&(o=this.model.getAttributeById(o.lookupAttr)),!o||!o.useInResult))throw new Error("Can't use this attribute for a column");if(t.aggrFuncId&&t.cusomtSql&&console.warn("Column cannot be created using aggrFuncId and customSql at the same time. cusomSql will be used."),t.cusomtSql)n.caption="Custom SQL Column",n.expr.tag=p.CustomSql,n.expr.baseAttrId=o.id,n.expr.sql=t.cusomtSql,n.expr.kind=l.Query,n.expr.dataType=r.DataType.Unknown;else if(t.aggrFuncId){var i=t.aggrFuncId;n.caption=o.caption+" "+this.model.getAggrFunctionCaption(t.aggrFuncId),n.expr.tag=p.AggregateFunction,n.expr.func=t.aggrFuncId,n.expr.kind=l.Scalar,n.expr.dataType="COUNT"==i||"CNTDST"==i?4:o.dataType,n.expr.distinct=!1;var s=new k(n);s.setValue(o.id,!0),s.tag=p.EntityAttribute,s.dataType=o.dataType,n.expr.args.push(s)}else n.caption=o.caption,n.expr.setValue(o.id,!0),n.expr.tag=p.EntityAttribute,n.expr.dataType=o.dataType;n.caption=t.caption||n.caption,n._sorting=t.sorting||E.None,n._sortIndex=t.sortIndex||-1,n.enabled=r.utils.getIfDefined(t.enabled,!0),n.setReadOnly(r.utils.getIfDefined(t.readonly,!1))}var a=t.justsorted||t.column&&t.column.isJustSorted();return a||(t.index&&t.index>=0&&t.index<this.columns.length?this.columns.splice(t.index,0,n):this.columns.push(n)),this.setColumnSorting(n,n._sorting),this.fireColumnsChangedEvent(w.Add,n,a),n},t.prototype.addColumnObj=function(t,e,n){var o=this,i=this.columns;void 0===t.length?("number"==typeof e?i.splice(e,0,t):i.push(t),t.sorting!=E.None&&this.addColumnToSorted(t),this.fixupSortingIndices()):("number"==typeof e?i.push.apply(i,[e,0].concat(t)):i.push.apply(i,[].concat(t)),t.forEach((function(t){t.sorting!=E.None&&o.addColumnToSorted(t)})),this.fixupSortingIndices())},t.prototype.changeColumnType=function(t,e,n){if(!t.isJustSorted())if(n=n||{},t.caption=void 0!==n.caption?n.caption:"",e===p.AggregateFunction){if(!n.funcId)throw Error('"funcId" argument is not defined');if(t.expr.tag==p.AggregateFunction)return void(t.expr.func=n.funcId);(l=new k(t)).tag=p.AggregateFunction,l.func=n.funcId,l.distinct=!1,l.dataType="COUNT"==n.funcId||"CNTDST"==n.funcId?4:t.expr.dataType;var o=new k(t);o.loadFromData(this.model,t.expr.saveToData()),l.args.push(o),t.expr=l}else if(e===p.CustomSql){var i=t.expr.tag==p.AggregateFunction?t.expr.args[0].value:t.expr.value,s="";this.model&&(s=this.model.getAttributeById(i).expr);var a=new k(t);a.tag=p.CustomSql,a.dataType=r.DataType.String,a.sql=s,a.baseAttrId=i,t.expr=a}else if(e===p.EntityAttribute){if(t.expr.tag===p.EntityAttribute||t.expr.tag===p.ParentEntityAttribute)return;var l,u=t.expr.tag===p.CustomSql?t.expr.baseAttrId:t.expr.args[0].value,c=this.model.getAttributeById(u);(l=new k(t)).tag=p.EntityAttribute,l.dataType=null!=c?c.dataType:r.DataType.Unknown,l.setValue(u,!0),t.expr=l}},t.prototype.moveColumn=function(t,e){var n=this.getColumns();r.utils.moveArrayItem(n,t,e),this.adjustColumnsSorting()},t.prototype.removeColumn=function(t,e){r.utils.removeArrayItem(this.columns,t),r.utils.removeArrayItem(this.sortedColumns,t)},t.prototype.addConditionGroup=function(t,e){return void 0===e&&(e=!0),console.error("Community version doesn't support working with groups."),null},t.prototype.addExtraConditionGroup=function(t,e){return void 0===e&&(e=!0),console.error("Community version doesn't support working with groups."),null},t.prototype.createCondition=function(t){return void 0===t&&(t=M.Simple),new P(this,t)},t.prototype.addSimpleCondition=function(t){var e=t.parent||this.getRootCondition(),n=this.getModel();if(!n)return null;if(!t.attribute&&!t.attributeId)throw new Error("Either `attribute` or `attributeId` parameter must have a value");if(!t.attribute&&(t.attribute=n.getAttributeById(t.attributeId),!t.attribute))throw new Error("Could not find this attribute: "+t.attributeId);!t.operator&&t.operatorId&&(t.operator=n.getOperatorById(t.operatorId)),t.operator||(t.operator=n.getDefaultOperatorForAttr(t.attribute));var o=this.createSimpleConditionObject(t.attribute,t.operator,t.value);return e.addCondition(o),o.enabled=r.utils.getIfDefined(t.enabled,!0),o.setReadOnly(r.utils.getIfDefined(t.readonly,!1)),o},t.prototype.addSimpleExtraCondition=function(t){return t.parent=t.parent||this.extraConditions,this.addSimpleCondition(t)},t.prototype.createSimpleConditionObject=function(t,e,n){if(!t||!t.useInConditions)throw"Can't add a condition with such attribute: "+(t?t.caption:"NULL");var o=this.createCondition(M.Simple);o.setOperatorId(e.id,!0);var i=new k(o);i.setValue(t.id,!0),i.tag=this.attributeExprTag,i.kind=l.Attribute,i.dataType=t.dataType,o.expressions.push(i);var s=this.getModel(),a=e.paramCount,u=r.utils.fillArray(new Array(a-1),null);null!=n&&(Array.isArray(n)?r.utils.copyArrayTo(n,u):a>0&&(u[0]=n));for(var c=u.length,d=0;d<c;d++){var h=s.getOperand(t,e,d+1);o.addExpressionByOperand(h,u[d])}return o},t.prototype.removeColumns=function(t,e){var n=t.filter((function(t){return t.isJustSorted()})),o=t.filter((function(t){return!t.isJustSorted()}));function i(t,e){for(var n=e.length,o=0;o<n;o++){var i=t.indexOf(e[o]);i>=0&&t.splice(i,1)}}o.length>0&&(i(this.getColumns(),o),i(this.sortedColumns,o)),n.length>0&&i(this.sortedColumns,n),this.fixupSortingIndices()},t.prototype.fireProcessEvent=function(t){this.eventEmitter.fire("query.process",t)},t.prototype.fireChangedEvent=function(t,e,n){t=t||{part:x.All},void 0===e&&void 0===n||(t.postpone=e||0,t.wasModified=n,console.warn("Method with 'postpone' and 'wasModified' args is deprecated. Pass params in data object")),this._isModified=void 0===t.wasModified||t.wasModified;var o=t||{part:x.All};this.eventEmitter.fire("query.change",o,t.postpone||0)},t.prototype.fireColumnsChangedEvent=function(t,e,n){void 0===n&&(n=!1),this.fireChangedEvent({part:n?x.SortingColumns:x.Columns,action:t,changee:e})},t.prototype.fireConditionsChangedEvent=function(t,e){this.fireChangedEvent({part:x.Conditions,action:t,changee:e})},t.prototype.runThroughConditions=function(t){var e=function(n){for(var o=0;o<n.getConditions().length;o++){var i=n.getConditions()[o];i.isGroup()?e(i):t&&t(i)}};e(this.getRootCondition())},t.prototype.getOneValueForAttr=function(t){var e=null;return this.runThroughConditions((function(n){if(n.enabled){var o=n.expressions[0],i=n.getOperatorId();o.value!=t||!n.expressions[1]||"Equal"!=i&&"InList"!=i&&"StartsWith"!=i||(e=n.expressions[1].value)}})),e},t.prototype.getRootCondition=function(){return this.root},t.prototype.addProcessCallback=function(t){return this.eventEmitter.subscribe("query.process",t)},t.prototype.removeProcessCallback=function(t){this.eventEmitter.unsubscribe("query.process",t)},t.prototype.addChangedCallback=function(t){return this.eventEmitter.subscribe("query.change",t)},t.prototype.removeChangedCallback=function(t){this.eventEmitter.unsubscribe("query.change",t)},t.prototype.getConditionsText=function(){var t=this,e=this.getModel();if(!e)return"";var i=function(s){var a,u,c="",d="Conj"+o.linkTypeToStr(s.linkType),h=r.i18n.getText(d);for(u=0;u<s.getConditions().length;u++){a="";var f=s.getConditions()[u];if(f.enabled||void 0===f.enabled)if(f.isGroup())(a=i(f))&&(a="("+a+")");else for(var g=f.getOperatorId(),y=e.getOperatorById(g),m=o.parseOperatorFormat(y),v=m.length,C=0;C<v;C++){var b=m[C],x=b.text;if("expression"==b.type){var w=f.expressions[b.index];if(w.kind==l.Attribute||w.tag==p.EntityAttribute){var E=e.getAttributeById(w.value);x=e.getAttributeText(E,"{entity} {attr}")}else if(x=w.getText(),t.model.isDateMacro(x)||t.model.isTimeMacro(x)){var T=x.substring(3,x.length-2);x=r.i18n.getText(T)||x}}C>0&&(a+=" "),a+=x}a&&(u>0&&c&&(c+=" "+h+" "),c+=a)}return s.linkType!=n.None&&s.linkType!=n.NotAll||(c="not ( "+c+" )"),c};return i(this.getRootCondition())},t.prototype.getConditionsTextAsHtml=function(){var t=this,e=this.getModel();if(!e)return'<div class="eqjs-query-text"></div>';var i=function(e){if(e.kind==l.Query)return"&lt;".concat(e.getText(),"&gt;");if(e.kind==l.List)return"[".concat(e.getText(),"]");if(e.dataType==r.DataType.String||e.dataType==r.DataType.Memo||e.dataType==r.DataType.FixedChar)return"&quot;".concat(e.getText(),"&quot;");var n=e.getText();if(t.model.isDateMacro(n)||t.model.isTimeMacro(n)){var o=n.substring(3,n.length-2);n=r.i18n.getText(o)||n}return n},s=function(t){var a,u,c="",d="Conj"+o.linkTypeToStr(t.linkType),h='<span class="eqjs-query-text-conj">'.concat(r.i18n.getText(d),"</span>");for(u=0;u<t.getConditions().length;u++){a="";var f=t.getConditions()[u];if(f.enabled||void 0===f.enabled)if(f.isGroup())(a=s(f))&&(a="("+a+")");else for(var g=f.getOperatorId(),y=e.getOperatorById(g),m=o.parseOperatorFormat(y),v=m.length,C=0;C<v;C++){var b=m[C],x=b.text;if("expression"==b.type){var w=f.expressions[b.index];if(w.kind==l.Attribute||w.tag==p.EntityAttribute){var E=e.getAttributeById(w.value);x='<span class="eqjs-query-text-attr">'.concat(e.getAttributeText(E,"{entity} {attr}"),"</span>")}else x='<span class="eqjs-query-text-expr">'.concat(i(w),"</span>")}else"operator"==b.type&&(x='<span class="eqjs-query-text-op">'.concat(x,"</span>"));C>0&&(a+=" "),a+=x}a&&(u>0&&c&&(c+=" "+h+" "),c+=a)}return t.linkType!=n.None&&t.linkType!=n.NotAll||(c='<span class="eqjs-query-text-conj">not</span> ( '+c+" )"),c};return'<div class="eqjs-query-text">'.concat(s(this.getRootCondition()),"</div>")},t}(),F=__webpack_require__(567),q=function(){function t(t){this.context=t,console.warn("BrowserQueryStorage is used for managing queries")}return t.prototype.init=function(t){var e="eq";t&&t.keyPrefix&&(e=t.keyPrefix),this.queryListKey=e+"-querylist",this.queryKeyPrefix=e},t.prototype.getQueryList=function(t){var e=this;return new F((function(t,n){try{var o=localStorage.getItem(e.queryListKey);o&&t(JSON.parse(o)),t([])}catch(t){n(t)}}))},t.prototype.newQuery=function(t){var e=this;return new F((function(n,o){var i=new R(e.context.getModel(),null,{context:e.context});i.reset(),i.setDefaultName(),t&&(t.query&&i.loadFromData(t.query.toJSONData()),t.queryId&&i.setId(t.queryId),t.name&&i.setName(t.name),t.description&&i.setDescription(t.description)),e._saveQuery(i),n(i.toJSONData())}))},t.prototype.loadQuery=function(t){var e=this;return new F((function(n,o){try{var i=localStorage.getItem(e.queryKeyPrefix+"-"+t.queryId);throw i&&n(JSON.parse(i)),new Error("Query is not found: "+t.queryId)}catch(t){o(t)}}))},t.prototype.saveQuery=function(t){var e=this;return new F((function(n,o){try{t.modelId||e.context.getModel().getId();var i=t.query||e.context.getQuery();e._saveQuery(i),n(null)}catch(t){o(t)}}))},t.prototype._saveQuery=function(t){var e=[],n=localStorage.getItem(this.queryListKey);n&&(e=JSON.parse(n));var o=r.utils.findItemById(e,t.getId());o||(o={id:t.getId(),name:t.getName(),text:t.getDescription()},e.push(o)),o.name=t.getName(),o.text=t.getDescription(),localStorage.setItem(this.queryListKey,JSON.stringify(e)),localStorage.setItem(this.queryKeyPrefix+"-"+t.getId(),t.toJSON())},t.prototype.removeQuery=function(t){var e=this;return new F((function(n,o){try{t.modelId||e.context.getModel().getId();var i=t.queryId||e.context.getQuery().getId(),r=[],s=localStorage.getItem(e.queryListKey);s&&(r=JSON.parse(s)),r=r.filter((function(t){return t.id!=i})),localStorage.setItem(e.queryListKey,JSON.stringify(r)),localStorage.removeItem(e.queryKeyPrefix+"-"+i),n()}catch(t){o(t)}}))},t}(),Q=__webpack_require__(567),N=function(){function t(t){this.context=t,this.modelPromise=null}return t.prototype.init=function(t){},t.prototype.getContext=function(){return this.context},t.prototype.createModelLoadingPromise=function(){var t=this;this.modelPromise=new Q((function(e,n){t.modelLoadingResolveFunc=e,t.modelLoadingRejectFunc=n}))},t.prototype.getModelPromise=function(){return this.modelPromise||Q.reject(new Error("Model has been never loaded."))},t.prototype.startModelLoading=function(t){return this.createModelLoadingPromise(),this.sendLoadModelRequest(t),this.modelPromise},t}(),j=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),H=function(t){function e(e){return t.call(this,e)||this}return j(e,t),e.prototype.init=function(){},e.prototype.sendLoadModelRequest=function(t){var e=this,n=this.getContext(),o=n.getServices().getHttpClient(),i=n.resolveEndpoint("GetModel",{modelId:t.modelId});o.get(i).then((function(t){t.model||e.modelLoadingRejectFunc(new Error('Wrong response format for "GetModel" request')),e.modelLoadingResolveFunc(t.model)})).catch((function(t){e.modelLoadingRejectFunc(t)}))},e}(N),W=function(){function t(t){this.context=t}return t.prototype.fetchData=function(t){var e=t.query||this.context.getQuery(),n=e.getId(),o={options:t.options};void 0!==t.queryId?o.queryId=t.queryId:o.query=e.toJSONData(),t.debug&&(o.debug=t.debug),t.chunk&&(o.chunk=t.chunk),t.data&&(o.data=t.data),void 0!==t.aux&&(o.aux=t.aux);var i=this.context.resolveEndpoint("FetchData",{modelId:e.getModel().getId(),queryId:n});return this.context.getServices().getHttpClient().post(i,o).then((function(t){return t}))},t}(),G=function(){function t(t){this.context=t}return t.prototype.syncQuery=function(t){var e=(t=t||{}).query||this.context.getQuery(),n=t.options||{},o={query:e.toJSONData(),options:n};t.data&&(o.data=t.data);var i=this.context.resolveEndpoint("SyncQuery",{modelId:e.getModel().getId(),queryId:e.getId()});return this.context.getServices().getHttpClient().post(i,o).then((function(t){return t}))},t}(),z=function(){function t(t){this.context=t}return t.prototype.loadValueList=function(t){var e=t.modelId||this.context.getModel().getId(),n=r.utils.assign({modelId:e},t.params).editorId,o=this.context.getServices().getHttpClient(),i=this.context.resolveEndpoint("GetValueList",{modelId:e,listId:n}),s={};return t&&t.params&&t.params.queryParams&&(s=t.params.queryParams),o.get(i,{queryParams:s}).then((function(t){if(t&&t.values)return t.values;throw new Error('Wrong response format. No "values" property')}))},t}(),V=function(){function t(t){this.context=t}return t.prototype.getQueryFile=function(t){var e=t.query||this.context.getQuery(),n=this.context.resolveEndpoint("GetQueryFile",{modelId:e.getModel().getId(),format:t.format||"xml"}),o=this.context.getServices().getHttpClient().post(n,{query:e.toJSONData()}),i=o.getRequest();return o.then((function(e){var n=new Blob([e]),o=i.getXMLHttpRequest().getResponseHeader("Content-Disposition"),r=o?o.match(/filename="(.*)"/)[1]:"query.json";if(t.fileName&&(r=t.fileName+r.substring(r.lastIndexOf("."))),window.navigator.msSaveOrOpenBlob)window.navigator.msSaveOrOpenBlob(n,r);else{var s=document.createElement("a");document.body.appendChild(s),s.style.display="none",s.href=window.URL.createObjectURL(n),s.download=r,s.click(),window.URL.revokeObjectURL(s.href),document.body.removeChild(s)}}))},t.prototype.uploadQueryFile=function(t){var e=(t=t||{}).query||this.context.getQuery(),n=this.context.resolveEndpoint("UploadQueryFile",{modelId:e.getModel().getId()});return this.context.getServices().getHttpClient().post(n,t.data,{dataType:"form-data"}).then((function(t){return t.query}))},t}(),U=__webpack_require__(567),Y=function(){function t(t){this.context=t,this.levels={}}return t.prototype.getAggregateData=function(t,e){var n=this;return new U((function(o,i){var r=function(t){var r=n.groupKeyToStr(e),s=t.get(r);s?o(s):i("Can't find data for ".concat(r))},s=n.getLevelDesc(t,!1);s&&s.data?r(s.data):s.receivedCallbacks.push(r)}))},t.prototype.setAggregateData=function(t,e){var n=this.getLevelDesc(t,!0);if(n.data=e,n.receivedCallbacks)for(var o=0,i=n.receivedCallbacks;o<i.length;o++){(0,i[o])(n.data)}n.receivedCallbacks=[]},t.prototype.updateAggregateData=function(t,e,n){var o=this.getLevelDesc(t,!0),i=this.groupKeyToStr(e);o.data.set(i,n)},t.prototype.groupKeyToStr=function(t){return JSON.stringify(t)},t.prototype.getLevelDesc=function(t,e){var n=this.levels[t];return!n&&e&&(n={receivedCallbacks:[],data:new Map},this.levels[t]=n),n},t.prototype.clear=function(){this.levels=[]},t}(),J=function(){function t(t){this.context=t,this.aggrs=null}return t.prototype.getAggrContainer=function(){return this.aggrs},t.prototype.calculate=function(t){console.warn("Grand totals and sub totals aggregation calculation can be used in Enterprise version only"),(t=t||{}).maxLevel=t.maxLevel>=0?t.maxLevel:0,this.aggrs=new Y(this.context);var e=this.context.createQuery();e.loadFromData(this.context.getQuery().toJSONData());for(var n=this.context.getQuery().getAggregationSettings(),o=n.getAggregates().map((function(t){return t.colId})),i=e.getColumns().filter((function(t){return o.indexOf(t.id)<0})),r=0;r<i.length;r++)i[r].enabled=!1;n.hasGrandTotals()&&(this.aggrs.setAggregateData(0,new Map),t.resultObtained&&t.resultObtained({},0));for(var s=n.getGroups(),a=1;a<=s.length&&a<=t.maxLevel;a++)this.aggrs.setAggregateData(a,new Map),t.resultObtained&&t.resultObtained({},a);return U.resolve()},t.prototype.needRecalculation=function(){return!0},t.prototype.reset=function(){},t}(),K=function(){function t(t){this.context=t,this.modelLoader=null,this.queryStorage=null,this.querySynchronizer=null,this.dataFetcher=null,this.valueListResolver=null,this.queryFileLoader=null,this.aggrCalculator=null,this.httpClient=new r.HttpClient,this.httpClient.defaultHeaders["x-eqjs-version"]="7.2.0",this.modelResolver=function(t){return new S},this.modelStorageResolver=null,this.queryResolver=function(t){return new R(t.getModel(),null,{context:t})},this.modelLoaderResolver=function(t){return new H(t)},this.queryStorageResolver=function(t){return new q(t)},this.querySynchronizerResolver=function(t){return new G(t)},this.vlrResolver=function(t){return new z(t)},this.dataFetcherResolver=function(t){return new W(t)},this.queryFileLoaderResolver=function(t){return new V(t)},this.aggrCalculatoResolver=function(t){return new J(t)}}return t.prototype.reset=function(){this.modelStorage=null,this.modelLoader=null,this.queryStorage=null,this.querySynchronizer=null},t.prototype.getHttpClient=function(){return this.httpClient},t.prototype.createDataModel=function(){if(!this.modelResolver)throw"Model resolver is not defined";return this.modelResolver(this.context)},t.prototype.createQuery=function(){if(!this.queryResolver)throw"Query resolver is not defined";return this.queryResolver(this.context)},t.prototype.getModelLoader=function(){if(!this.modelLoader){if(!this.modelLoaderResolver)throw"ModelLoaderResolver is not defined";this.modelLoader=this.modelLoaderResolver(this.context)}return this.modelLoader},t.prototype.getModelStorage=function(){if(!this.modelStorage){if(!this.modelStorageResolver)throw"ModelStorageResolver is not defined";this.modelStorage=this.modelStorageResolver(this.context)}return this.modelStorage},t.prototype.getQueryStorage=function(){if(!this.queryStorage){if(!this.queryStorageResolver)throw"QueryStorageResolver is not defined";this.queryStorage=this.queryStorageResolver(this.context)}return this.queryStorage},t.prototype.getQuerySynchronizer=function(){if(!this.querySynchronizer){if(!this.querySynchronizerResolver)throw"QuerySynchronizerResolver is not defined";this.querySynchronizer=this.querySynchronizerResolver(this.context)}return this.querySynchronizer},t.prototype.getDataFetcher=function(){if(!this.dataFetcher){if(!this.dataFetcherResolver)throw"DataFetcherResolver is not defined";this.dataFetcher=this.dataFetcherResolver(this.context)}return this.dataFetcher},t.prototype.getValueListResolver=function(){if(!this.valueListResolver){if(!this.vlrResolver)throw"Resolver for ValueListResolver is not defined";this.valueListResolver=this.vlrResolver(this.context)}return this.valueListResolver},t.prototype.getQueryFileLoader=function(){if(!this.queryFileLoader){if(!this.queryFileLoaderResolver)throw"Resolver for QueryFileLoader is not defined";this.queryFileLoader=this.queryFileLoaderResolver(this.context)}return this.queryFileLoader},t.prototype.getAggregatesCalculator=function(){if(!this.aggrCalculator){if(!this.aggrCalculatoResolver)throw"Resolver for AggregatesCalculator is not defined";this.aggrCalculator=this.aggrCalculatoResolver(this.context)}return this.aggrCalculator},t.prototype.registerDataModelResolver=function(t){this.modelResolver=t},t.prototype.registerQueryResolver=function(t){this.queryResolver=t},t.prototype.registerModelLoaderResolver=function(t){this.modelLoaderResolver=t},t.prototype.registerModelStorageResolver=function(t){this.modelStorageResolver=t},t.prototype.registerQueryStorageResolver=function(t){this.queryStorageResolver=t},t.prototype.registerDataFetcherResolver=function(t){this.dataFetcherResolver=t},t.prototype.registerQuerySyncronizerResolver=function(t){this.querySynchronizerResolver=t},t.prototype.registerValueListResolver=function(t){this.vlrResolver=t},t.prototype.registerQueryFileLoaderResolver=function(t){this.queryFileLoaderResolver=t},t.prototype.registerAggregatesCalculator=function(t){this.aggrCalculatoResolver=t},t}(),X=__webpack_require__(567),$=function(){function t(t){this.context=t}return t.prototype.loadChunk=function(t){var e=this;return this.dataLoadPromise=new X((function(n,o){var i={chunk:t,success:function(o){for(var i=new r.EasyDataTable({loader:e.context.dataLoader,chunkSize:e.context.resultTable.chunkSize}),s=o.resultSet,a=0,l=s.cols;a<l.length;a++){var u=l[a];i.columns.add(u)}i.setTotal(o.meta.totalRecords);for(var c=0,d=s.rows;c<d.length;c++){var h=d[c];i.addRow(h)}var p=0;o.meta&&o.meta.totalRecords&&(p=o.meta.totalRecords),n({table:i,total:p,hasNext:!t.needTotal||t.offset+t.limit<p})},error:function(t){return o(t)}};e.context.debugMode&&(i.debug="Data Chunk. Offset: ".concat(t.offset)),e.context.fetchDataChunk(i)})),this.dataLoadPromise},t}(),Z=__webpack_require__(18);!function(t){t[t.None=0]="None",t[t.Model=1]="Model",t[t.Query=2]="Query",t[t.Result=4]="Result",t[t.Statement=8]="Statement",t[t.QueryStatus=16]="QueryStatus",t[t.All=65535]="All"}(A||(A={})),function(t){t.LoadModel="LoadModel",t.LoadQuery="LoadQuery",t.LoadQueryList="LoadQueryList",t.NewQuery="NewQuery",t.SaveQuery="SaveQuery",t.RemoveQuery="RemoveQuery",t.SyncQuery="SyncQuery",t.FetchData="FetchData",t.GetValueList="GetValueList",t.ExportResult="ExportResult",t.GetQueryFile="GetQueryFile",t.UploadQueryFile="UploadQueryFile"}(_||(_={}));var tt,et=__webpack_require__(567),nt=function(){function t(t){this.models=[],t&&r.utils.assign(this.models,[],t)}return t.prototype.getModels=function(){var t=this;return new et((function(e,n){e(t.models)}))},t}();!function(t){t[t.Error=0]="Error",t[t.Success=1]="Success"}(tt||(tt={}));var ot=function(){function t(t){this.context=t}return t.prototype.setFormat=function(t,e){this.format=t,this.responseType=e},t.prototype.export=function(t){t=t||{};var e=this.context.getServices().getHttpClient(),n=this.format||"csv",o=t.query||this.context.getQuery(),i=o.getModel().getId(),r={settings:t.settings,chunk:u};void 0!==t.queryId?r.queryId=t.queryId:r.query=o.toJSONData(),t.data&&(r.data=t.data),t.options&&(r.options=t.options);var s=this.context.resolveEndpoint("ExportResult",{modelId:i,format:n}),a=e.post(s,r,{responseType:this.responseType}),l=a.getRequest();return a.then((function(t){var e=new Blob([t]),o=l.getXMLHttpRequest().getResponseHeader("Content-Disposition"),i=o?o.match(/filename="(.*)"/)[1]:"export-data."+n;if(window.navigator.msSaveOrOpenBlob)window.navigator.msSaveOrOpenBlob(e,i);else{var r=document.createElement("a");document.body.appendChild(r),r.style.display="none",r.href=window.URL.createObjectURL(e),r.download=i,r.click(),window.URL.revokeObjectURL(r.href),document.body.removeChild(r)}}))},t}(),it=function(){return it=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},it.apply(this,arguments)},rt=function(){function t(){var t=this;this.options={syncSortOrderWithColumnsOrder:!0},this.servicesInitialized=!1,this.internalListCache={},this.loadModelOnStart=!0,this.loadQueryOnStart=!1,this.useStoredQueryOnFetch=!1,this.debugMode=!1,this._backendInfo={type:"EQN-ANC",subType:"asp-net-core-razor"},this.endpointVarsRegex=/\{.*?\}/g,this.elasticPaging=!1,this._predefinedListRequestHandlers={_DSDE:function(e,n){return n(t.getModel().getAllDateMacros().map((function(t){return{id:"${{"+t+"}}",text:r.i18n.getText(t)}}))),!0},_DSTE:function(e,n){return n(t.getModel().getAllTimeMacros().map((function(t){return{id:"${{"+t+"}}",text:r.i18n.getText(t)}}))),!0}},this._listRequestHandler=function(e,n){if(null!=e&&e.listName){var o=t.getQuery(),i=r.utils.assign({listName:e.listName},e.editorParams),s={},a=/@{{(.+?)}}/;for(var l in i)if(i[l]){var u=i[l].match(a);if(u){var c=o.getOneValueForAttr(u[1]);c||(c=""),s[l]=i[l].replace(a,c)}}var d={listName:s.listName,editorId:e.editorId,queryParams:s},h=t.getListFromCache(e);if(h&&h.length>0)n(h);else{var p=!1,f=t._predefinedListRequestHandlers[e.editorId];f&&(p=f(e,n)),!p&&t.clientListRequestHandler&&(p=t.clientListRequestHandler(e,n)),p||t.loadValueList({params:d,success:function(o){o&&t.addListToCache(e,o),n(o)},error:function(t){n(null)}})}}},this.baseEndpoint="api/easyquery",this.eqServices=new K(this),this.widgets=new Array,this.eventEmitter=new r.EventEmitter(this),this.exporters=new Map,this.endpoints=new Map,this.dataLoader=new $(this),this.resultTable=new r.EasyDataTable({loader:this.dataLoader,onUpdate:this.onResultTableUpdate.bind(this)}),this.resultTable.id="ResultTable",this.errorHandlerId=this.addEventListener("error",(function(t,e){e.result=tt.Error;var n=e.action?e.action+" error":"Error",o=e.text?e.text:"";e.sourceError&&e.sourceError.message!==o&&(o+="\n"+e.sourceError),console.error(n+": "+o)}))}return t.prototype.getServices=function(){return this.eqServices},t.prototype.registerExporter=function(t,e){this.exporters.set(t,e)},t.prototype.registerServerExporter=function(t,e){this.registerExporter(t,(function(n){var o=new ot(n);return o.setFormat(t,e),o}))},t.prototype.getExporter=function(t){var e=this.exporters.get(t);return e?e(this):null},t.prototype.getExportFormats=function(){return Array.from(this.exporters.keys())},t.prototype.addDefaultExporters=function(){this.registerServerExporter("csv","arraybuffer"),this.registerServerExporter("excel-html","arraybuffer")},t.prototype.resolveEndpoint=function(t,e){e=e||{};var n=this.endpoints.get(t);if(!n)throw t+" endpoint is not defined";var o=n.match(this.endpointVarsRegex);if(o)for(var i=0,r=o;i<r.length;i++){var s=r[i],a=s.substring(1,s.length-1),l=e[a];if(!l)if("modelId"==a)l=this.getModel().getId();else{if("queryId"!=a)throw"Parameter [".concat(a,"] is not defined");l=this.getQuery().getId()}n=n.replace(s,l)}return n},t.prototype.setEndpoint=function(t,e){this.endpoints.set(t,e)},t.prototype.setEnpointIfNotExist=function(t,e){this.endpoints.has(t)||this.endpoints.set(t,e)},t.prototype.setDefaultEndpoints=function(t){this.setEnpointIfNotExist("GetModel",o.combinePath(t,"models/{modelId}")),this.setEnpointIfNotExist("GetQuery",o.combinePath(t,"models/{modelId}/queries/{queryId}")),this.setEnpointIfNotExist("SaveQuery",o.combinePath(t,"models/{modelId}/queries/{queryId}")),this.setEnpointIfNotExist("SyncQuery",o.combinePath(t,"models/{modelId}/queries/{queryId}/sync")),this.setEnpointIfNotExist("NewQuery",o.combinePath(t,"models/{modelId}/queries")),this.setEnpointIfNotExist("RemoveQuery",o.combinePath(t,"models/{modelId}/queries/{queryId}")),this.setEnpointIfNotExist("GetQueryList",o.combinePath(t,"models/{modelId}/queries")),this.setEnpointIfNotExist("FetchData",o.combinePath(t,"models/{modelId}/fetch")),this.setEnpointIfNotExist("GetValueList",o.combinePath(t,"models/{modelId}/valuelists/{listId}")),this.setEnpointIfNotExist("ExportResult",o.combinePath(t,"models/{modelId}/export/{format}")),this.setEnpointIfNotExist("GetQueryFile",o.combinePath(t,"models/{modelId}/getqueryfile/{format}")),this.setEnpointIfNotExist("UploadQueryFile",o.combinePath(t,"models/{modelId}/uploadqueryfile"))},t.prototype.initStart=function(){this.servicesInitialized=!0},t.prototype.init=function(t){var e=this;(this.servicesInitialized||this.initStart(),t=t||{},this.setOptions(t),void 0!==t.debugMode&&(this.debugMode=t.debugMode),void 0!==t.chunkSize&&(this.resultTable.chunkSize=t.chunkSize),void 0!==t.elasticPaging&&(this.elasticPaging=t.elasticPaging),t.listCache&&this.setExternalListCache(t.listCache),t.locale&&r.i18n.setCurrentLocale(t.locale),t.localeSettings&&r.i18n.updateLocaleSettings(t.localeSettings),t.endpoint&&(this.baseEndpoint=t.endpoint,console.warn("The `endpoint` option is deprecated.\nPlease use `context.useEndpoint(endpointURL)` function instead.")),this.setDefaultEndpoints(this.baseEndpoint),t.modelStorageResolver)&&this.getServices().registerModelStorageResolver(t.modelStorageResolver);if(this.loadQueryOnStart=!1,t.loadQueryOnStart&&(this.loadQueryOnStart=t.loadQueryOnStart),this.loadModelOnStart=!0,void 0!==t.loadModelOnStart&&(this.loadModelOnStart=t.loadModelOnStart),t.handlers&&(t.handlers.onInit&&this.addEventListener("ready",t.handlers.onInit),t.handlers.afterLoadModel&&this.addEventListener("loadModel",t.handlers.afterLoadModel),t.handlers.afterLoadQuery&&this.addEventListener("loadQuery",t.handlers.afterLoadQuery),t.handlers.afterSyncQuery&&this.addEventListener("syncQuery",t.handlers.afterSyncQuery),t.handlers.afterFetchData&&this.addEventListener("fetchData",t.handlers.afterFetchData),t.handlers.afterExportResult&&this.addEventListener("exportResult",t.handlers.afterExportResult),t.handlers.onProcessStart&&this.addEventListener("processStart",t.handlers.onProcessStart),t.handlers.onProcessEnd&&this.addEventListener("processEnd",t.handlers.onProcessEnd),t.handlers.onError&&(this.removeEventListener("error",this.errorHandlerId),this.addEventListener("error",t.handlers.onError)),t.handlers.onListRequest&&(this.clientListRequestHandler=t.handlers.onListRequest),t.handlers.beforeLoadModel&&(this.beforeLoadModel=t.handlers.beforeLoadModel),t.handlers.beforeLoadQuery&&(this.beforeLoadQuery=t.handlers.beforeLoadQuery),t.handlers.beforeSyncQuery&&(this.beforeSyncQuery=t.handlers.beforeSyncQuery),t.handlers.beforeFetchData&&(this.beforeFetchData=t.handlers.beforeFetchData),t.handlers.beforeExportResult&&(this.beforeExportResult=t.handlers.beforeExportResult)),this.initialQuery=t.initialQuery,this.defaultQueryId=t.defaultQueryId||"",this.defaultModelId=t.defaultModelId||"__default",this.eqServices.getModelLoader().init(t),this.eqServices.getQueryStorage().init(t),!1!==t.useDefaultExporters&&this.addDefaultExporters(),t.serverExporters){this.exporters.clear();for(var n=0,o=t.serverExporters;n<o.length;n++){var i=o[n];this.registerServerExporter(i,"arraybuffer")}}var s=this.getQuery();t.defaultQueryId&&s.setId(t.defaultQueryId),this.widgets.forEach((function(n){var o={};t.widgets&&t.widgets[n.getWidgetType()]&&(o=t.widgets[n.getWidgetType()]),n.init(e,o)})),this.loadModelOnStart?this.loadDefaultModel():this.fireEvent("ready")},t.prototype.setOptions=function(t){r.utils.assignDeep(this.options,t)},Object.defineProperty(t.prototype,"backendInfo",{get:function(){return this._backendInfo},enumerable:!1,configurable:!0}),t.prototype.useEndpoint=function(t){return this.baseEndpoint=t,this},t.prototype.useBackend=function(t){if(t.type&&(this._backendInfo.type=t.type),t.subType)this._backendInfo.subType=t.subType;else switch(this._backendInfo.type){case"EQN-ANC":this._backendInfo.subType="asp-net-core-razor";break;case"EQN-ASP":this._backendInfo.subType="asp-net-4-mvc";break;default:this._backendInfo.subType="other"}return this},t.prototype.addWidget=function(t){this.widgets.push(t)},t.prototype.getAllWidgetsByType=function(t){return this.widgets.filter((function(e){return e.getWidgetType()===t}))},t.prototype.getWidgetByType=function(t){var e=this.getAllWidgetsByType(t);return e.length>0?e[0]:null},t.prototype.refreshWidgets=function(t){void 0===t&&(t=A.All),this.widgets.forEach((function(e){e.belongsToGroup(t)&&e.refresh()}))},t.prototype.addQueryChangedCallback=function(t){this.getQuery().addChangedCallback(t)},t.prototype.removeQueryChangedCallback=function(t){this.getQuery().removeChangedCallback(t)},t.prototype.createQuery=function(){return this.eqServices.createQuery()},t.prototype.getQuery=function(){if(!this.query){if(!this.servicesInitialized)throw new Error("Can't create query until the context is initialized");this.query=this.createQuery()}return this.query},t.prototype.getModel=function(){return this.dataModel||(this.dataModel=this.eqServices.createDataModel()),this.dataModel},t.prototype.loadModelFromData=function(t){this.getQuery().loadModelData(t),this.dataModel=this.getQuery().getModel()},t.prototype.setDefaultModelId=function(t){this.defaultModelId=t},t.prototype.startProcess=function(t,e){this.eventEmitter.fire("processStart",t),this.widgets.forEach((function(t){t.belongsToGroup(e)&&t.onProcessStart()}))},t.prototype.endProcess=function(t,e){this.eventEmitter.fire("processEnd",t),t.result===tt.Error&&this.throwError(t),this.widgets.forEach((function(t){t.belongsToGroup(e)&&t.onProcessEnd()}))},t.prototype.throwError=function(t){t.result=tt.Error,this.eventEmitter.fire("error",t)},t.prototype.loadDefaultModel=function(){var t=this;this.loadModel({modelId:this.defaultModelId,silent:!0,success:function(){t.refreshWidgets(A.Model);var e=t.getQuery();t.fireEvent("initialModelLoad"),t.initialQuery&&e.loadFromData(t.initialQuery,{changeStatus:!1}),t.loadQueryOnStart?t.loadQuery({queryId:t.defaultQueryId,modelId:t.defaultModelId,success:function(){t.refreshWidgets(A.Query),t.fireEvent("ready")}}):(t.refreshWidgets(A.Query),t.fireEvent("ready"))}})},t.prototype.clearQuery=function(){var t=this.getQuery();t.clear(),t.fireChangedEvent({part:x.All})},t.prototype.clearResult=function(){this.resultTable.clear(),this.resultStatement=null,this.resultContent=null},t.prototype.setExternalListCache=function(t){this.externalListCache=t},t.prototype.getListFromCache=function(t){var e=this.getListCacheKey(t);return this.externalListCache?this.externalListCache.get(e):this.internalListCache[e]},t.prototype.getListCacheKey=function(t){var e="SQL"==t.listName?"SQL_"+t.editorId:t.listName;return t.queryParams&&(e+="_"+Object.keys(t.queryParams).filter((function(t){return"listName"!=t})).map((function(e){return t.queryParams[e]})).join("_")),e},t.prototype.addListToCache=function(t,e){var n=this.getListCacheKey(t);this.externalListCache?this.externalListCache.set(n,e):this.internalListCache[n]=e},t.prototype.resetListCache=function(){this.externalListCache?this.externalListCache.clear():this.internalListCache={}},t.prototype.getListRequestHandler=function(){return this._listRequestHandler},t.prototype.addLocale=function(t,e){r.i18n.addLocale(t,e)},t.prototype.addEventListener=function(t,e){var n=this;return this.eventEmitter.subscribe(t,(function(t){return e(n,t.data)}))},t.prototype.removeEventListener=function(t,e){this.eventEmitter.unsubscribe(t,e)},t.prototype.fireEvent=function(t,e){this.eventEmitter.fire(t,e)},t.prototype.getBaseEndpoint=function(){return this.baseEndpoint},t.prototype.loadValueList=function(t){var e=this;t=t||{},this.startProcess({action:_.GetValueList,text:"Loading values"},A.Result),this.eqServices.getValueListResolver().loadValueList(t).then((function(n){e.endProcess({result:tt.Success,action:_.GetValueList,text:"Values loaded"},A.Result),t.success&&t.success(n)})).catch((function(n){var o=t&&t.params?t.params.editorId:"undefined",i="Can't load the value list for editor ".concat(o,".\n ").concat(n.message);e.endProcess({result:tt.Error,action:_.GetValueList,text:i,sourceError:n},A.Result),t.error&&t.error(i,"GetValueList")}))},t.prototype.loadModel=function(t){var e=this;this.beforeLoadModel&&this.beforeLoadModel(this,t);var n=t.modelId||"__default",o=t.silent||!1;return this.startProcess({action:_.LoadModel,text:"Loading model: "+n},A.Model),this.eqServices.getModelLoader().startModelLoading(t).then((function(i){return i?(e.loadModelFromData(i),e.dataModel.isEmpty()&&console.warn("Empty model has been loaded. Model ID: ".concat(e.dataModel.getId()))):console.warn("Model has not been changed."),e.fireEvent("loadModel"),e.endProcess({result:tt.Success,action:_.LoadModel,text:"Model loaded: "+n},A.Model),o||(e.clearQuery(),e.clearResult(),e.refreshWidgets()),t.success&&t.success(e.getModel()),e.getModel()})).catch((function(o){var i="Can't load model ".concat(n,".\n ").concat(o.message);return e.endProcess({result:tt.Error,action:_.LoadModel,text:i,sourceError:o},A.Model),t.error&&t.error(i,"LoadModel"),e.getModel()}))},t.prototype.callWhenModelLoaded=function(t){this.eqServices.getModelLoader().getModelPromise().then((function(){t()}))},t.prototype.loadQuery=function(t){var e=this;t=t||{};var n=this.eqServices.getModelLoader();this.clearResult(),n.getModelPromise().then((function(){var n=(t=t||{}).queryId,o=t.silent||!1;e.beforeLoadQuery&&e.beforeLoadQuery(e,t),e.startProcess({action:_.LoadQuery,text:"Query loading: "+n},A.Query),e.eqServices.getQueryStorage().loadQuery(t).then((function(i){i&&e.query.loadFromData(i,{validate:!1}),e.limitCustomSqlColumns(),e.fireEvent("loadQuery"),e.endProcess({result:tt.Success,action:_.LoadQuery,text:"Query loaded: "+n},A.Query),e.query.resetModified(),o||(e.query.fireChangedEvent({part:x.Properties,wasModified:e.query.isModified()}),e.refreshWidgets()),t.success&&t.success(e.query)})).catch((function(n){var o=e.getQuery();n.message="Can't load query ["+o.getId()+"]\n"+(n.message||""),t.error&&t.error(n.message,_.LoadQuery),e.endProcess({result:tt.Error,action:_.LoadQuery,text:n.message,sourceError:n},A.Query)}))})).catch((function(t){console.error(t)}))},t.prototype.loadQueryList=function(t){var e=this;this.eqServices.getModelLoader().getModelPromise().then((function(){e.startQueryListLoading(t)})).catch((function(t){var n="Can't load the list of available queries.\n ".concat(t.message);e.throwError({action:_.LoadQueryList,text:n,sourceError:t})}))},t.prototype.startQueryListLoading=function(t){var e=this;t=t||{},this.eqServices.getQueryStorage().getQueryList(t).then((function(e){t.success&&t.success(e)})).catch((function(n){var o="Can't load the list of available queries.\n ".concat(n.message);t.error?t.error(o,"LoadQueryList"):e.throwError({action:_.LoadQueryList,text:o,sourceError:n})}))},t.prototype.newQuery=function(t){var e=this,n=void 0===(t=t||{}).clearQuery||t.clearQuery;this.query.reset(n),t.queryId&&this.query.setId(t.queryId),t.name&&this.query.setName(t.name),t.description&&this.query.setDescription(t.description);var o=t.silent||!1,i=!0;void 0!==t.useStorage&&(i=t.useStorage);var r=function(){var t=e.getQuery();t.isNewbie=!0,o||t.fireChangedEvent({part:x.All,wasModified:t.isModified()})};i?(this.startProcess({action:_.NewQuery,text:"New query creation..."},A.Query),this.eqServices.getQueryStorage().newQuery(t).then((function(n){n&&e.query.loadFromData(n),e.endProcess({result:tt.Success,action:_.NewQuery,text:"A new query has been created"},A.Query),r(),t.success&&t.success()})).catch((function(n){var o="Can't create a new query.\n".concat(n.message);e.endProcess({result:tt.Error,action:_.NewQuery,text:o,sourceError:n},A.Query),t.error&&t.error(o,"NewQuery")}))):r();return this.query},t.prototype.saveQuery=function(t){var e=this;t=t||{};var n=this.getQuery();this.startProcess({action:_.SaveQuery,text:"Query saving: "+n.getId()},A.Query),this.eqServices.getQueryStorage().saveQuery(t).then((function(o){e.endProcess({action:_.SaveQuery,result:tt.Success,text:"Query saved: "+n.getId()},A.Query),o&&n.loadFromData(o),n.resetModified(),n.isNewbie=!1,t.success&&t.success()})).catch((function(o){var i="Can't save query ".concat(n.getId(),".\n ").concat(o.message);e.endProcess({action:_.SaveQuery,result:tt.Error,text:i,sourceError:o},A.Query),t.error&&t.error(i,_.SaveQuery)}))},t.prototype.removeQuery=function(t){var e=this;t=t||{};var n=this.getQuery();this.startProcess({action:_.RemoveQuery,text:"Query deleting: "+n.getId()},A.Query),this.eqServices.getQueryStorage().removeQuery(t).then((function(){n.reset(),e.endProcess({action:_.RemoveQuery,result:tt.Success,text:"Query deleted: "+n.getId()},A.Query),t.success&&t.success()})).catch((function(o){var i="Can't remove query ".concat(n.getId(),".\n ").concat(o.message);e.endProcess({action:_.RemoveQuery,result:tt.Error,text:i,sourceError:o},A.Query),t.error&&t.error(i,"RemoveQuery")}))},t.prototype.syncQuery=function(t){var e=this;t=t||{};var n=this.getQuery();this.beforeSyncQuery&&this.beforeSyncQuery(this,t),this.startProcess({action:_.SyncQuery,text:"Query syncing: "+n.getId()},A.Query),this.eqServices.getQuerySynchronizer().syncQuery(t).then((function(o){if(e.resultStatement=o&&o.statement?o.statement:"",e.fireEvent("syncQuery"),e.refreshWidgets(A.Statement),e.endProcess({result:tt.Success,action:_.SyncQuery,text:"Query synced: "+n.getId()},A.Query),o){if(o.querySaved){var i=o.query;i&&(n.setId(i.id),n.setName(i.name),n.setDescription(i.desc),n.extraData=i.extraData),n.resetModified(),e.refreshWidgets(A.QueryStatus)}t.success&&t.success(o)}})).catch((function(o){var i="Can't synchronize query ".concat(n.getId(),".\n ").concat(o.message);e.endProcess({result:tt.Error,action:_.SyncQuery,text:i,sourceError:o},A.Query),t.error&&t.error(i,"SyncQuery")}))},t.prototype.fetchData=function(t){var e=this,n=void 0!==(t=t||{}).elasticPaging?t.elasticPaging:this.elasticPaging;this.resultTable.elasticChunks=n,t.chunk=t.chunk||{offset:0,limit:this.resultTable.chunkSize,needTotal:!n},this.debugMode&&(t.debug="Fetching the result set. Initial chunk"),this.query.tryValidate({checkExpressions:!0})&&(t.groupFetchSuccess&&(this.afterGroupFetch=t.groupFetchSuccess),this.resultTable.elasticChunks&&t.chunk.limit++,this.fetchDataChunk(it(it({},t),{success:function(n){if(n.statement&&(e.resultStatement=n.statement,e.refreshWidgets(A.Statement)),e.getServices().getAggregatesCalculator().reset(),e.resultContent=n,n.resultSet){e.resultTable.clear(),e.resultTable.id=e.query.getId();for(var o=n.resultSet,i=0,r=o.cols;i<r.length;i++){var s=r[i];e.resultTable.columns.add(s)}n.meta&&void 0!==n.meta.totalRecords&&e.resultTable.setTotal(n.meta.totalRecords);var a=o.rows.length;e.resultTable.elasticChunks&&a===t.chunk.limit&&o.rows.splice(o.rows.length-1,1);for(var l=0,u=o.rows;l<u.length;l++){var c=u[l];e.resultTable.addRow(c)}e.resultTable.elasticChunks&&(e.resultTable.total=a<t.chunk.limit?o.rows.length:0),e.resultTable.fireUpdated()}t.success&&t.success(n)}})))},t.prototype.getQueryFile=function(t){var e=this,n=this.getQuery();this.startProcess({action:_.GetQueryFile,text:"Getting query file: "+n.getId()},A.Query),this.getServices().getQueryFileLoader().getQueryFile(t).then((function(){e.endProcess({result:tt.Success,action:_.GetQueryFile,text:"Getting query file: "+n.getId()},A.Query),t.success&&t.success()})).catch((function(o){var i="Can't get file for query ".concat(n.getId(),".\n ").concat(o.message);e.endProcess({result:tt.Error,action:_.GetQueryFile,text:i,sourceError:o},A.Query),t.error&&t.error(i,"GetQueryFile")}))},t.prototype.uploadQueryFile=function(t){var e=this,n=this.getQuery();this.startProcess({action:_.UploadQueryFile,text:"Uploading query file: "+n.getId()},A.Query),this.getServices().getQueryFileLoader().uploadQueryFile(t).then((function(o){n.loadFromData(o),e.fireEvent("loadQuery"),e.refreshWidgets(),e.endProcess({result:tt.Success,action:_.UploadQueryFile,text:"Uploading query file: "+n.getId()},A.Query),t.success&&t.success()})).catch((function(o){var i="Can't upload a file for query ".concat(n.getId(),".\n ").concat(o.message);e.endProcess({result:tt.Error,action:_.UploadQueryFile,text:i,sourceError:o},A.Query),t.error&&t.error(i,"UploadQueryFile")}))},t.prototype.fetchDataChunk=function(t){var e=this,n=this.getQuery().getId(),o=t||{};this.useStoredQueryOnFetch&&(o.queryId=this.query.getId()),this.beforeFetchData&&this.beforeFetchData(this,o),this.startProcess({action:_.FetchData,text:"Fetching data for the query: "+n},A.Result),this.eqServices.getDataFetcher().fetchData(o).then((function(t){t.statement&&(e.resultStatement=t.statement),e.resultContent=t,o.success&&o.success(t),e.fireEvent("fetchData"),e.endProcess({result:tt.Success,action:_.FetchData,text:"Data fetching is finished for the query: "+n},A.Result)})).catch((function(t){var i="Data fetching error for the query ".concat(n,". \n").concat(t.message);e.endProcess({result:tt.Error,action:_.FetchData,text:i,sourceError:t},A.Result),o.error&&o.error(i,_.FetchData)}))},t.prototype.onResultTableUpdate=function(){var t=this,e=this.query.getAggregationSettings(),n=this.getServices().getAggregatesCalculator();e.needAggrCalculation()&&n.needRecalculation()&&n.calculate({maxLevel:e.getGroups().length+1,resultObtained:function(e,n){t.afterGroupFetch&&t.afterGroupFetch(e)},errorOccurred:function(e){var n="Data fetching error on group level ".concat(e.level," query. \n").concat(e.message);t.throwError({action:_.FetchData,text:n,sourceError:e})}})},t.prototype.fetchDrillDownData=function(t){var e=this;(t=t||{}).chunk=t.chunk||{offset:0,limit:this.resultTable.chunkSize,needTotal:!0};var n=t.query.getId();this.startProcess({action:_.FetchData,text:"DrillDown executing: "+n},A.Result),this.eqServices.getDataFetcher().fetchData(t).then((function(o){e.endProcess({result:tt.Success,action:_.FetchData,text:"DrillDown execution error: "+n},A.Result),t.success&&t.success(o)})).catch((function(o){var i="Drill-down data fetching error for query ".concat(n,". \n").concat(o.message);e.endProcess({result:tt.Error,action:_.FetchData,text:i},A.Result),t.error?t.error(i,"DrillDown"):e.throwError({action:_.FetchData,text:i})}))},t.prototype.exportResult=function(t){var e=this;(t=t||{}).chunk=t.chunk||u,this.beforeExportResult&&this.beforeExportResult(this,t);var n=t.format;if(n){var o=this.getExporter(n);if(o){var i=this.getQuery().getId();this.useStoredQueryOnFetch&&(t.queryId=i),this.startProcess({action:_.ExportResult,text:"Exporting result for query: "+i},A.Result);var s=r.i18n.getLocaleSettings();t.settings=s;var a=this.query.getAggregationSettings();a.hasAggregates()&&(a.hasGrandTotals()||a.hasGroups())&&(t.aggregates=a.saveToData()),o.export(t).then((function(n){e.fireEvent("exportResult"),e.endProcess({result:tt.Success,action:_.ExportResult,text:"The result set for query [".concat(i,"] has been successfully exported")},A.Result),t.success&&t.success()})).catch((function(n){var o="Error on exporting data for query ".concat(i,". \n").concat(n.message);e.endProcess({result:tt.Error,action:_.ExportResult,text:o,sourceError:n},A.Result),t.error&&t.error(o,"ExportResult")}))}}},t.prototype.limitCustomSqlColumns=function(){this.options.allowCustomExpressions||this.query.getColumns().forEach((function(t){t.expr.tag===p.CustomSql&&(t.enabled=!1)}))},t}(),st=function(){function t(t){this.slot=t,this._id=r.utils.generateId(this.getWidgetType())}return Object.defineProperty(t.prototype,"id",{get:function(){return this._id},enumerable:!1,configurable:!0}),t.prototype.init=function(t,e){this.context=t},t.prototype.getContext=function(){return this.context},t.prototype.refresh=function(){this.refreshCore()},t.prototype.refreshCore=function(){},t.prototype.onProcessStart=function(){this.onProcessStartCore()},t.prototype.onProcessStartCore=function(){},t.prototype.onProcessEnd=function(){this.onProcessEndCore()},t.prototype.onProcessEndCore=function(){},t.prototype.belongsToGroup=function(t){return void 0===t||null==t||0!=(t&this.group)},t.prototype.destroy=function(){this.destroyCore()},t.prototype.destroyCore=function(){},t}(),at=new(function(){function t(t,e,n){this.major=t,this.minor=e,this.update=n}return t.prototype.toString=function(){return"".concat(this.major,".").concat(this.minor,".").concat(this.update)},t}())(6,2,0);r.i18n.updateDefaultTexts({NewQueryName:"[New query]",Today:"Today",Yesterday:"Yesterday",Tomorrow:"Tomorrow",FirstDayOfMonth:"First day of the month",LastDayOfMonth:"Last day of the month",FirstDayOfWeek:"First day of the week",FirstDayOfYear:"First day of the year",FirstDayOfNextWeek:"First day of the next week",FirstDayOfNextMonth:"First day of the next month",FirstDayOfNextYear:"First day of the next year",Now:"Now",HourStart:"This hour start",Midnight:"Midnight",Noon:"Noon",Entities:{},Attributes:{},Operators:{},AggregateFunctions:{}});var lt,ut=__webpack_require__(514),ct=__webpack_require__(464),dt=__webpack_require__(305),ht=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),pt=function(t){function e(e){var n=t.call(this,e)||this;return n.queryChangedCallbackId=null,n.group=A.Model|A.Query,n.panel=e,n}return ht(e,t),Object.defineProperty(e.prototype,"cssPrefix",{get:function(){return"eqjs-ep"},enumerable:!1,configurable:!0}),e.prototype.getWidgetType=function(){return"entitiesPanel"},e.prototype.init=function(e,n){t.prototype.init.call(this,e,n),this.setOptions(n),this.renderProgressBlock()},e.prototype.refreshCore=function(){this.render(),this.options.syncWithColumns&&this.refreshCheckedStateByColumns()},e.prototype.onProcessStartCore=function(){this.options.showIndicatorOnLoad&&(this.progressBlock.parentNode||this.panel.appendChild(this.progressBlock))},e.prototype.onProcessEndCore=function(){this.options.showIndicatorOnLoad&&this.progressBlock.parentNode&&this.panel.removeChild(this.progressBlock)},e.prototype.destroyCore=function(){this.slot.innerHTML=""},e.prototype.setOptions=function(t){var e=this;(this.options={showToolbar:!0,syncWithColumns:!1,showSelectAllButton:!1,showClearSelectionButton:!0,showAddColumnButton:!0,showAddConditionButton:!0,showCheckboxes:!0,showTooltips:!0,draggableAttributes:!0,showAttributes:{useInConditions:!0,useInResult:!0,useInSorting:!1},showFilterBox:!1,filterBoxMode:0,showIndicatorOnLoad:!0,attrPlacement:0,sortEntities:!1,autoClearSelection:!0,entityRenderedCallback:null,attributeRenderedCallback:null,columnTitleFormat:"{attr}"},t&&r.utils.assignDeep(this.options,t),this.queryChangedCallbackId)&&(n=this.context.getQuery()).removeChangedCallback(this.queryChangedCallbackId);if(this.options.syncWithColumns){var n=this.context.getQuery();this.queryChangedCallbackId=n.addChangedCallback((function(t){var n=t.data;!n||n.part!=x.Columns&&n.part!=x.All||e.refreshCheckedStateByColumns()}))}},e.prototype.render=function(){var t=this.context.getModel();if(this.clear(),this.panel.classList.add("".concat(this.cssPrefix,"-panel")),this.panel.classList.add(dt.z.getMobileCssClass()),this.rootEntityBlock=document.createElement("div"),null!=t&&!t.isEmpty()){var e=t.getEntitiesTree({addUIC:this.options.showAttributes.useInConditions,addUIR:this.options.showAttributes.useInResult,addUIS:this.options.showAttributes.useInSorting,attrPlacement:this.options.attrPlacement,sortEntities:this.options.sortEntities,includeRootData:!0});this.entityTreeBlock=this.renderEntity(e,this.rootEntityBlock,0),this.panel.appendChild(this.entityTreeBlock)}this.options.showFilterBox?this.createFilterBox():this.rootEntityBlock.style.top="0",this.options.showToolbar&&!this.options.syncWithColumns?this.createToolPanel():this.rootEntityBlock.style.bottom="0"},e.prototype.renderEntity=function(t,e,n){var o,i=this,s=document.createElement("div");s.classList.add("".concat(this.cssPrefix,"-entity-node")),s.classList.add(dt.z.getMobileCssClass());var a=document.createElement("div");a.classList.add("".concat(this.cssPrefix,"-entity-children")),a.classList.add(dt.z.getMobileCssClass());var l=document.createElement("label");l.classList.add("".concat(this.cssPrefix,"-entity-node-label"));var u=document.createElement("input");u.type="checkbox",u.title=t.text;var c,d,h,f=document.createElement("a");f.href="javascript:void(0)",f.title="".concat(r.i18n.getText("EntityToggle")," ").concat(t.text),f.classList.add("".concat(this.cssPrefix,"-entity-node-button"));var g=n;if(e?(o=e).innerHTML="":o=document.createElement("div"),o.classList.add("".concat(this.cssPrefix,"-entity")),o.classList.add(dt.z.getMobileCssClass()),t.id&&""!=t.id){l.innerText=t.text,s.appendChild(l),this.options.showCheckboxes&&l.insertBefore(u,l.firstChild),s.insertBefore(f,s.firstChild),this.options.showTooltips&&t.description&&l.setAttribute("title",t.description);for(var y=0;y<g;y++){var m=document.createElement("div");m.classList.add("".concat(this.cssPrefix,"-entity-offset")),s.insertBefore(m,s.firstChild)}o.appendChild(s),a.hidden=!0,g++}var v=t.items?t.items.length:0,C=function(e){var n=t.items[e];if(n.isEntity)a.appendChild(b.renderEntity(n,null,g));else if(!n.lookupAttr||!function(t,e){return e.querySelectorAll(".".concat(i.cssPrefix,'-entity-attr[data-id="').concat(t,'"]')).length>0}(n.lookupAttr,a)){(d=document.createElement("label")).innerText=n.text,d.classList.add("".concat(b.cssPrefix,"-entity-attr-label")),b.options.showCheckboxes&&((h=document.createElement("input")).type="checkbox",h.title=n.text,d.insertBefore(h,d.firstChild),b.options.syncWithColumns&&h.addEventListener("change",(function(t){var e=i.context.getModel(),n=i.context.getQuery(),o=t.currentTarget,r=o.parentElement.parentElement.getAttribute("data-id");if(e.checkAttrProperty(r,"useInResult"))if(o.checked){var s=e.getAttributeById(r),a=e.getAttributeText(s,i.options.columnTitleFormat),l=n.addColumn({attribute:s,caption:a});n.fireColumnsChangedEvent(w.Add,l)}else{var u=n.getColumns().filter((function(t){return t.expr.tag===p.EntityAttribute&&t.expr.value===r}));u.length>0&&(n.removeColumn(u[0],null),n.fireColumnsChangedEvent(w.Delete,u[0]))}}))),b.options.showTooltips&&n.description&&d.setAttribute("title",n.description);for(var o=0;o<g+1;o++){var r=document.createElement("div");r.classList.add("".concat(b.cssPrefix,"-entity-offset")),d.insertBefore(r,d.firstChild)}(c=document.createElement("div")).classList.add("".concat(b.cssPrefix,"-entity-attr")),0==s.innerHTML.length&&c.classList.add("".concat(b.cssPrefix,"-entity-attr-root")),c.innerHTML="",c.appendChild(d),c.setAttribute("data-id",n.id),b.options.draggableAttributes&&ut.eqDragManager.registerDraggableItem({element:c,scope:"entityAttr",data:{attrId:n.id},renderer:function(t){t.innerHTML="";var e=document.createElement("span");e.innerText=n.text,t.appendChild(e)}}),b.options.attributeRenderedCallback&&b.options.attributeRenderedCallback(c),a.appendChild(c)}},b=this;for(y=0;y<v;y++)C(y);if(a.innerHTML.length&&(o.appendChild(a),f.addEventListener("click",(function(t){a.hidden=!a.hidden;var e=t.target,n="".concat(i.cssPrefix,"-entity-node-button-open");e.classList.contains(n)?e.classList.remove(n):e.classList.add(n),t.preventDefault()}))),a){var x=a.querySelectorAll(".".concat(this.cssPrefix,"-entity-attr > label > input"));for(y=0;y<x.length;y++){x[y].addEventListener("click",(function(t){t.target.checked&&!u.checked?u.checked=!0:0===a.querySelectorAll("input:checked").length&&(u.checked=!1),t.stopPropagation()}))}}return u.addEventListener("click",(function(t){for(var e=t.target,n=a.querySelectorAll("label input"),o=0;o<n.length;o++){n[o].checked=e.checked}if(i.options.syncWithColumns){for(var r=i.context.getQuery(),s=i.context.getModel(),l=[],u=0,c=Array.from(a.querySelectorAll(".".concat(i.cssPrefix,"-entity-attr")));u<c.length;u++){var d=c[u].getAttribute("data-id");s.checkAttrProperty(d,"useInResult")&&l.push(d)}if(e.checked)for(var h=0,f=l;h<f.length;h++){d=f[h];r.addColumn({attributeId:d})}else{var g=r.getColumns().filter((function(t){return t.expr.tag===p.EntityAttribute&&l.indexOf(t.expr.value)>=0}));r.removeColumns(g,null)}r.fireColumnsChangedEvent()}t.stopPropagation()})),e!=this.rootEntityBlock&&this.options.entityRenderedCallback&&this.options.entityRenderedCallback(o),o},e.prototype.createFilterBox=function(){var t=this;this.filterBoxBlock=document.createElement("div"),this.filterBoxBlock.classList.add("".concat(this.cssPrefix,"-filter-box")),this.filterBoxBlock.classList.add(dt.z.getMobileCssClass()),this.filterBoxInput=document.createElement("input"),this.filterBoxInput.classList.add("".concat(this.cssPrefix,"-filter-box-input")),this.filterBoxInput.addEventListener("input",(function(e){for(var n=t.panel.querySelectorAll(".".concat(t.cssPrefix,"-entity-attr")),o=0;o<n.length;o++){var i=n[o];i.hidden=!t.checkFilterAttribute(i)}var r=t.panel.querySelectorAll(":scope > .".concat(t.cssPrefix,"-entity"));for(o=0;o<r.length;o++){for(var s=r[o],a=s.querySelectorAll(".".concat(t.cssPrefix,"-entity-attr")),l=0,u=0;u<a.length;u++)"None"!==a[u].style.display&&l++;s.hidden=0===l}""===t.filterBoxInput.value?t.collapseAll():t.expandAll()})),this.filterBoxBlock.appendChild(this.filterBoxInput),this.panel.insertBefore(this.filterBoxBlock,this.panel.firstChild)},e.prototype.createToolPanel=function(){var t=this,e="".concat(this.cssPrefix,"-tool-panel"),n=document.createElement("div");n.classList.add(e),n.classList.add(dt.z.getMobileCssClass());var o=document.createElement("div");o.classList.add("".concat(e,"-select-all")),o.title="Select all";var i=document.createElement("div");i.classList.add("".concat(e,"-deselect-all")),i.title="Clear selection";var s=document.createElement("div");s.classList.add("".concat(e,"-add-columns")),s.title="Add column";var a=document.createElement("div");a.classList.add("".concat(e,"-add-cond")),a.title="Add condition";var l=document.createElement("div");l.classList.add("".concat(e,"-left-side"));var u=document.createElement("div");u.classList.add("".concat(e,"-right-side"));var c=this.context.getModel();this.options.showSelectAllButton&&(o.title=r.i18n.getText("ButtonSelectAll"),l.appendChild(o),o.addEventListener("click",(function(){t.selectAll()}))),this.options.showClearSelectionButton&&(i.title=r.i18n.getText("ButtonDeselectAll"),l.appendChild(i),i.addEventListener("click",(function(){t.deselectAll()}))),this.options.showAddColumnButton&&(s.title=r.i18n.getText("ButtonAddColumns"),u.appendChild(s),s.addEventListener("click",(function(){var e,n=t.panel.querySelectorAll(".".concat(t.cssPrefix,"-entity-attr")),o=[],i=t.context.getQuery();i.fireProcessEvent({source:self,status:"start"});for(var r=0;r<n.length;r++){var s=n[r];s.getElementsByTagName("input")[0].checked&&(e=s.getAttribute("data-id"),c.checkAttrProperty(e,"useInResult")&&o.push(e))}for(var a=0,l=o;a<l.length;a++){var u=l[a],d=c.getAttributeById(u),h=c.getAttributeText(d,t.options.columnTitleFormat);i.addColumn({attribute:d,caption:h})}i.fireChangedEvent(),t.options.autoClearSelection&&t.deselectAll(),i.fireProcessEvent({source:self,status:"finish"})}))),this.options.showAddConditionButton&&(a.title=r.i18n.getText("ButtonAddConditions"),u.appendChild(a),a.addEventListener("click",(function(){var e,n=t.panel.querySelectorAll(".".concat(t.cssPrefix,"-entity-attr")),o=[],i=t.context.getQuery();i.fireProcessEvent({source:self,status:"start"});for(var r=0;r<n.length;r++){var s=n[r];s.getElementsByTagName("input")[0].checked&&(e=s.getAttribute("data-id"),c.checkAttrProperty(e,"useInConditions")&&o.push(e))}for(var a=0,l=o;a<l.length;a++){var u=l[a];i.addSimpleCondition({attributeId:u})}i.fireChangedEvent(),t.options.autoClearSelection&&t.deselectAll(),i.fireProcessEvent({source:self,status:"finish"})}))),n.appendChild(l),n.appendChild(u),this.panel.appendChild(n)},e.prototype.checkFilterAttribute=function(t){if(t.querySelector("label input").checked)return!0;var e=t.querySelector("label").textContent;if(this.checkFilterText(e))return!0;var n=t.parentElement.parentElement.querySelector(".".concat(this.cssPrefix,"-entity-node")).querySelector("label").textContent;return!!this.checkFilterText(n)},e.prototype.checkFilterText=function(t){var e=this.filterBoxInput.value;return""==e||(0==this.options.filterBoxMode&&t.toLowerCase().indexOf(e.toLowerCase())>=0||1==this.options.filterBoxMode&&0==t.toLowerCase().indexOf(e.toLowerCase()))},e.prototype.refreshCheckedStateByColumns=function(){this.deselectAll();for(var t=0,e=this.context.getQuery().getColumns().filter((function(t){return t.expr.tag===p.EntityAttribute}));t<e.length;t++){var n=e[t],o=this.rootEntityBlock.querySelector(".".concat(this.cssPrefix,'-entity-attr[data-id="').concat(n.expr.value,'"]')),i=o.querySelector("label > input");i.checked=!0;for(var r=o.parentElement;r&&r.classList.contains("".concat(this.cssPrefix,"-entity-children"));){r.hidden=!1;var s=r.parentElement;if(!s||r===s.firstElementChild)break;(i=s.firstElementChild.querySelector("label > input")).checked=!0,r=s.parentElement}}},e.prototype.expandAll=function(){for(var t=0;t<this.rootEntityBlock.childNodes.length;t++)for(var e=this.rootEntityBlock.childNodes[0].querySelectorAll(".".concat(this.cssPrefix,"-entity-children")),n=0;n<e.length;n++){e[n].hidden=!1}var o=this.rootEntityBlock.querySelectorAll(".".concat(this.cssPrefix,"-entity-node-button"));for(t=0;t<o.length;t++){o[t].classList.add("".concat(this.cssPrefix,"-entity-node-button-open"))}},e.prototype.collapseAll=function(){for(var t=0;t<this.rootEntityBlock.childNodes.length;t++)for(var e=this.rootEntityBlock.childNodes[0].querySelectorAll(".".concat(this.cssPrefix,"-entity-children")),n=0;n<e.length;n++){e[n].hidden=!0}var o=this.rootEntityBlock.querySelectorAll(".".concat(this.cssPrefix,"-entity-node-button"));for(t=0;t<o.length;t++){o[t].classList.remove("".concat(this.cssPrefix,"-entity-node-button-open"))}},e.prototype.selectAll=function(){for(var t=this.entityTreeBlock.querySelectorAll("input"),e=0;e<t.length;e++){t[e].checked=!0}},e.prototype.deselectAll=function(){for(var t=this.entityTreeBlock.querySelectorAll("input"),e=0;e<t.length;e++){t[e].checked=!1}},e.prototype.renderProgressBlock=function(){this.progressBlock=document.createElement("div"),this.progressBlock.classList.add("".concat(ct.YR,"-progress-win8")),this.progressBlock.classList.add(dt.z.getMobileCssClass()),this.progressBlock.innerHTML='<div class="wBall" id="wBall_1"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_2"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_3"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_4"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_5"><div class="wInnerBall"></div></div>'},e.prototype.clear=function(){this.panel.innerHTML=""},e}(st),ft=function(){function t(t){this.isFilteringMode=!1,this.showSelected=!1,this.parentMenu=t.menu||null,this.parentLevel=t.parent||null,this.parentElement=t.container||document.body,this.levelIndex=t.levelIndex||0,this.levelDiv=null,this.domWriteItemsId=t.domWriteItemsId||!1,this.menuId=t.menuId||"",this.itemRenderedCallback=t.itemRenderedCallback||null,this._applyItem={id:null,text:null,itemDiv:null},this.items=t.items||[],this.activeItem=null,this.selectedItem=null,this.initialized=!1,this.showSelected=t.showSelected,this.updated=0,this.renderContent()}return Object.defineProperty(t.prototype,"applyItem",{get:function(){return this._applyItem},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cssPrefix",{get:function(){return"eqjs-menu"},enumerable:!1,configurable:!0}),t.prototype.getItems=function(){return this.items},t.prototype.setItems=function(t){this.items=t},t.prototype.renderContent=function(){var t=this;if(this.items){var e=this.parentMenu.style.colors.bgON||"white",n=this.parentMenu.style.colors.fgON||"black",o=(this.parentMenu.style.colors.bgOVER,this.parentMenu.style.itemStyle.fontFamily||""),i=this.parentMenu.style.itemStyle.fontSize||"14px",s=this.parentMenu.options.multiselect,a=this.parentMenu.options.isSubQuery,l=(0,ut.domel)("div").addClass(dt.z.getMobileCssClass());this.parentMenu.options.useDefaultStyles&&l.setStyle("backgroundColor",e).setStyle("border","1px solid").setStyle("borderColor",e).setStyle("backgroundColor",this.parentMenu.style.colors.border).setStyle("margin","-2px 2px 2px -2px").setStyle("width","auto").setStyle("height","auto"),l.setStyle("z-index",this.parentMenu.zIndex).setStyle("position","absolute").setStyle("display","none");var u=l.toDOM();u.menuLevel=this;var c=this._applyItem;if(s&&0===this.levelIndex&&!0!==this.parentMenu.options.hideButtons){var d=document.createElement("div");d.classList.add("".concat(this.cssPrefix,"-applyDiv")),d.menuItem=c,this.applyBtn=document.createElement("button"),this.parentMenu.options.useDefaultStyles&&(d.style.borderBottom="1px solid",d.style.padding="5px",d.style.marginBottom="5px",this.applyBtn.style.padding="0 5px",this.applyBtn.style.cursor="pointer");var h=document.createTextNode(this.parentMenu.options.buttons.submit);this.applyBtn.appendChild(h),d.appendChild(this.applyBtn);var p=document.createElement("button");p.classList.add("".concat(this.cssPrefix,"-cancel")),this.parentMenu.options.useDefaultStyles&&(p.style.padding="0 5px",p.style.cursor="pointer",p.style.marginLeft="15px");var f=document.createTextNode(this.parentMenu.options.buttons.cancel);p.appendChild(f),d.appendChild(p),u.appendChild(d),c.itemDiv=d,this.applyBtn.addEventListener("click",(function(){t.submit(t._applyItem)})),p.addEventListener("click",(function(){t.parentMenu.hideMenu()}))}if(null==this.parentLevel&&(this.parentMenu.options.searchBoxAlwaysShown||this.items.length>=this.parentMenu.options.showSearchBoxAfter)){var g=(0,ut.domel)("div").addClass("".concat(this.cssPrefix,"-searchDiv"));this.parentMenu.options.useDefaultStyles&&(g.setStyle("border-bottom","1px solid #666").setStyle("background-color",e).setStyle("border-color",this.parentMenu.style.colors.border),""!=o&&g.setStyle("font-family",o),g.setStyle("font-size",i).setStyle("color",n).setStyle("cursor","pointer").setStyle("text-align","left").setStyle("padding","5px"));var y=(0,ut.domel)("input").id("searchBox").name("searchBox").type("text").size(16).addClass("".concat(this.cssPrefix,"-searchBox")).on("input",(function(e){t.deactivateItem(t.activeItem),t.renderItems(t.searchBox.value)})).on("keydown",(function(e){switch(e.keyCode){case 13:t.activeItem&&t.activeItem.itemDiv.click();break;case 38:t.moveActiveItemUp();break;case 40:t.moveActiveItemDown();break;case 39:t.searchBox.value||t.openSubLevel(t.activeItem)}}));this.parentMenu.options.useDefaultStyles&&y.setStyle("font-family","monospace").setStyle("font-size","8pt").setStyle("width","100%"),a&&y.addClass("eqjs-dialog"),this.searchBox=y.toDOM(),this.searchDiv=g.toDOM(),this.searchDiv.appendChild(this.searchBox),u.appendChild(this.searchDiv)}var m=document.createElement("div");m.tabIndex=1,(0,ut.domel)(m).addClass("".concat(this.cssPrefix,"-scrollDiv")).addClass(dt.z.getMobileCssClass()),m.style.overflowX="hidden",m.style.overflowY="auto",m.style.position="relative",u.appendChild(m),this.levelDiv=u,this.scrollDiv=m,this.menuId&&(this.levelDiv.id=this.menuId),this.parentLevel&&(this.levelDiv.style.zIndex=this.parentLevel.levelDiv.style.zIndex),this.renderItems();m.addEventListener("keydown",(function(e){switch(e.which){case 13:t.parentMenu.options.multiselect?t.parentMenu.getRootLevel().applyBtn.click():t.activeItem&&t.activeItem.itemDiv.click();break;case 32:t.activeItem&&t.activeItem.itemDiv.click();break;case 37:t.parentLevel&&!t.isFilteringMode&&(t.deactivateItem(t.activeItem),t.parentLevel.focus());break;case 39:t.openSubLevel(t.activeItem);break;case 38:t.moveActiveItemUp();break;case 40:t.moveActiveItemDown();break;default:return}e.preventDefault()})),dt.z.isMobileMode()&&(this.closeDiv=(0,ut.domel)("div",u).addClass("eqjs-menu-close-btn").addText(r.i18n.getText("ButtonClose")).on("click",(function(){t.parentMenu.hideMenu()})).toDOM())}},t.prototype.moveActiveItemDown=function(){var t=this.isFilteringMode?this.filteredItems:this.items;if(this.activeItem){var e=t.indexOf(this.activeItem);e<t.length-1&&this.activateItem(t[e+1],!1)}else this.activateItem(t[0],!1)},t.prototype.moveActiveItemUp=function(){var t=this.isFilteringMode?this.filteredItems:this.items;if(this.activeItem){var e=t.indexOf(this.activeItem);e>0&&this.activateItem(t[e-1],!1)}else this.activateItem(t[t.length-1],!1)},t.prototype.openSubLevel=function(t){t&&t.items&&!this.isFilteringMode&&(this.showSubLevel(t),t.subLevel.activateItem(t.subLevel.items[0]))},t.prototype.focusScrollDiv=function(){this.scrollDiv.focus()},t.prototype.turnCheckboxes=function(t){for(var e=0;e<t.length;e++){var n=t[e];n.itemCheckbox&&(n.itemCheckbox.checked=this.isItemSelected(n)),n.items&&this.turnCheckboxes(n.items)}},t.prototype.isItemSelected=function(t){if(t.items){for(var e=0;e<t.items.length;e++)if(this.isItemSelected(t.items[e]))return!0;return!1}return t.selected},t.prototype.setItemSelected=function(t,e){if(t.items)for(var n=0;n<t.items.length;n++)this.setItemSelected(t.items[n],e);else t.selected=e},t.prototype.submitItems=function(t,e){for(var n=0;n<t.length;n++)t[n].items?this.submitItems(t[n].items,e):t[n].selected&&e.push(t[n])},t.prototype.allSubitemsAreFiltered=function(t,e){for(var n=0;n<t.length;n++)if(e(t[n]))return!1;return!0},t.prototype.isItemDiv=function(t){return!!t.menuItem},t.prototype.isLevelDiv=function(t){return!!t.menuLevel},t.prototype.getMenuItem=function(t){for(var e=t;!this.isItemDiv(e);){if(this.isLevelDiv(e))throw"Can't get menu item";e=e.parentElement}return e.menuItem},t.prototype.renderItemsWithoutFilter=function(){var t=this;this.isFilteringMode=!1;var e=this.scrollDiv,n=this.parentMenu.options.multiselect,o=this.parentMenu.options.activateOnMouseOver,i=this.parentMenu.style.colors.fgON||"black",r=(this.parentMenu.style.colors.bgOVER,this.parentMenu.style.itemStyle.fontSize||"14px"),s=this.parentMenu.getItemFilterCallback();e.innerHTML="";for(var a=0;a<this.items.length;a++){var l=this.items[a];if(l&&l.text){if(s){if(!s(l))continue;if(l.items&&this.allSubitemsAreFiltered(l.items,s))continue}l.data=function(e){return t[e]},void 0===l.selected&&(l.selected=!1),l.selected&&null==this.selectedItem&&(this.selectedItem=l);var u=document.createElement("div");if((0,ut.domel)(u).addClass("".concat(this.cssPrefix,"-itemDiv")).addClass(dt.z.getMobileCssClass()),l.selected&&this.showSelected&&!n&&u.classList.add("".concat(this.cssPrefix,"-selected")),this.domWriteItemsId&&this.menuId&&(u.id="item-"+this.menuId+"-"+l.id),e.appendChild(u),u.menuItem=l,u.menuLevel=this,l.itemDiv=u,this.parentMenu.options.useDefaultStyles&&(u.style.fontSize=r,u.style.color=i,u.style.paddingLeft="15px",u.style.paddingRight="6px",u.style.cursor="pointer"),"---"==l.text)u.appendChild(document.createElement("hr"));else{if(n){var c=document.createElement("input");c.type="checkbox",c.id="cb"+l.id,c.checked=this.isItemSelected(l),c.defaultChecked=this.isItemSelected(l),u.appendChild(c),l.itemCheckbox=c,this.parentMenu.options.useDefaultStyles&&(c.style.margin="4px 10px 0 0",c.style.verticalAlign="top")}var d=l.text;this.parentMenu.options.showItemIds&&(d=l.id+":"+d);var h=document.createTextNode(d);if(u.appendChild(h),l.items&&l.items.length>0){u.classList.add("".concat(this.cssPrefix,"-itemDiv-hasChildren"));var p=document.createElement("span");p.classList.add("".concat(this.cssPrefix,"-itemDiv-arrow")),u.appendChild(p);var f=document.createTextNode(">");p.appendChild(f)}var g=function(e){var o=t.getMenuItem(e.target);if(n)if(o.items&&e.target!=o.itemCheckbox)t.activateItem(o);else{var i=t.isItemSelected(o);t.setItemSelected(o,!i),o.itemCheckbox.checked=!i,t.parentMenu.refreshCheckboxes()}else t.activateItem(o),t.submit(o);return!1};u.removeEventListener("click",g),u.addEventListener("click",g),u.addEventListener("mouseenter",(function(e){var n=t.getMenuItem(e.target);t.parentMenu.isCursorInside=!0,o&&t.activateItem(n)})),u.addEventListener("mouseleave",(function(e){var n=t.getMenuItem(e.target);t.parentMenu.isCursorInside=!1,setTimeout((function(){t.parentMenu.isCursorInside||o&&n==t.activeItem&&!n.subLevel&&t.deactivateItem(n)}),200)}))}this.itemRenderedCallback&&this.itemRenderedCallback(this.menuId,u)}}},t.prototype.renderItemsWithFilter=function(t){this.isFilteringMode=!0,this.scrollDiv.innerHTML="";var e=t.split(">"),n=e.map((function(t){return t.replace(/\*/g,"")})),o=this.filterItems(this.items,e);this.filteredItems=[];for(var i=0;i<o.length;i++)this.renderItemWithFilter(o[i],n,0)},t.prototype.matchesFilter=function(t,e){return!t||!e||e.test(t)},t.prototype.filterItems=function(t,e){for(var n=[],o=e.length>0?e[0]:"",i=e.length>1?e.slice(1):e,s=o?new RegExp(o.replace(/\*/g,".+?"),"i"):null,a=0;a<t.length;a++){var l=t[a];if(l.items){var u=r.utils.assign({},l),c=this.matchesFilter(l.text,s);e.length<2?c&&e.length<2?u.items=r.utils.createArrayFrom(l.items):u.items=this.filterItems(l.items,i):u.items=c?this.filterItems(l.items,i):[],u.items.length>0&&n.push(u)}else this.matchesFilter(l.text,s)&&n.push(l)}return n},t.prototype.renderItemWithFilter=function(t,e,n){var o=this,i=this.scrollDiv,r=n<e.length?e[n]:e[e.length-1],s=this.parentMenu.options.multiselect,a=this.parentMenu.options.activateOnMouseOver,l=this.parentMenu.style.colors.fgON||"black",u=(this.parentMenu.style.colors.bgOVER,this.parentMenu.style.itemStyle.fontSize||"14px"),c=this.parentMenu.getItemFilterCallback();if(t&&t.text){if(c){if(!c(t))return;if(t.items&&this.allSubitemsAreFiltered(t.items,c))return}t.data=function(t){return this[t]},void 0===t.selected&&(t.selected=!1),t.selected&&null==this.selectedItem&&(this.selectedItem=t);var d=document.createElement("div");if((0,ut.domel)(d).addClass("".concat(this.cssPrefix,"-itemDiv")).addClass(dt.z.getMobileCssClass()),d.style.marginLeft="".concat(10*n,"px"),t.selected&&!s&&d.classList.add("".concat(this.cssPrefix,"-selected")),this.domWriteItemsId&&this.menuId&&(d.id="item-"+this.menuId+"-"+t.id),i.appendChild(d),d.menuItem=t,d.menuLevel=this,t.itemDiv=d,this.parentMenu.options.useDefaultStyles&&(d.style.fontSize=u,d.style.color=l,d.style.paddingLeft="15px",d.style.paddingRight="6px",d.style.cursor="pointer"),"---"==t.text)d.appendChild(document.createElement("hr"));else{if(s){var h=document.createElement("input");h.type="checkbox",h.id="cb"+t.id,h.checked=this.isItemSelected(t),h.defaultChecked=this.isItemSelected(t),d.appendChild(h),t.itemCheckbox=h,this.parentMenu.options.useDefaultStyles&&(h.style.margin="4px 10px 0 0",h.style.verticalAlign="top")}var p=document.createElement("span");if(p.innerHTML=this.highlightText(t.text,r),d.appendChild(p),t.items&&t.items.length>0)d.classList.add("".concat(this.cssPrefix,"-itemDiv-filter-hasChildren"));else{this.filteredItems.push(t);var f=function(e){if(s)if(t.items&&e.target!=t.itemCheckbox)o.activateItem(t);else{var n=o.isItemSelected(t);o.setItemSelected(t,!n),t.itemCheckbox.checked=!n,o.parentMenu.refreshCheckboxes()}else o.activateItem(t),o.submit(t);return!1};d.removeEventListener("click",f),d.addEventListener("click",f),d.addEventListener("mouseenter",(function(e){o.parentMenu.isCursorInside=!0,a&&o.activateItem(t)})),d.addEventListener("mouseleave",(function(e){o.parentMenu.isCursorInside=!1,setTimeout((function(){o.parentMenu.isCursorInside||a&&t==o.activeItem&&!t.subLevel&&o.deactivateItem(t)}),200)}))}}if(t.items)for(var g=0;g<t.items.length;g++)this.renderItemWithFilter(t.items[g],e,n+1);this.itemRenderedCallback&&this.itemRenderedCallback(this.menuId,d)}},t.prototype.highlightText=function(t,e){if(e&&e.length>0){var n=e.toLowerCase(),o=t.toLowerCase();if(o.indexOf(n)>=0){for(var i=0,r=t,s=[];;){var a=o.indexOf(n,i);if(a>=0?(s.push(a),i=a+e.length):i++,i>=r.length-1)break}if(s.length>0){t="";for(var l=0;l<s.length;l++)0===l&&(t+=r.substring(0,s[l])),t+="<span class='eqjs-menu-itemDiv-highlight'>"+r.substring(s[l],s[l]+e.length)+"</span>",l<s.length-1?t+=r.substring(s[l]+e.length,s[l+1]):t+=r.substring(s[l]+e.length)}}}return t},t.prototype.renderItems=function(t){t||dt.z.isMobileMode()?(t=t||"",this.renderItemsWithFilter(t.toLowerCase())):this.renderItemsWithoutFilter()},t.prototype.activateItem=function(t,e){void 0===e&&(e=!0),null!=this.activeItem&&this.deactivateItem(this.activeItem),this.activeItem=t;var n=t.itemDiv;if(n.classList.add("active"),this.parentMenu.options.useDefaultStyles){this.parentMenu.style.colors.bgON,this.parentMenu.style.colors.fgON;var o=this.parentMenu.style.colors.bgOVER,i=this.parentMenu.style.colors.fgOVER||"";this.parentMenu.style.itemClass;""!=(this.parentMenu.style.itemClassOver||"")?(n.style.backgroundColor="",n.style.color=""):(n.style.backgroundColor=o,n.style.color=i)}t.items&&!this.isFilteringMode&&e&&this.showSubLevel(t)},t.prototype.deactivateItem=function(t){if(t){var e=t.itemDiv;if(e.classList.remove("active"),this.parentMenu.options.useDefaultStyles){var n=this.parentMenu.style.colors.bgON,o=this.parentMenu.style.colors.fgON;""!=(this.parentMenu.style.itemClass||"")?(e.style.backgroundColor="",e.style.color=""):(e.style.backgroundColor=n,e.style.color=o)}t.subLevel&&t.subLevel.hide(),this.activeItem=null}},t.prototype.showSubLevel=function(e){if(!e.subLevel){var n="";this.menuId&&(n=this.menuId+"-"+e.id),e.subLevel=new t({showSelected:this.showSelected,menu:this.parentMenu,parent:this,container:this.parentElement,items:e.items,levelIndex:this.levelIndex+1,domWriteItemsId:this.domWriteItemsId,menuId:n,itemRenderedCallback:this.itemRenderedCallback})}var o=(0,ut.getElementAbsolutePos)(e.itemDiv),i=(0,ut.getScrollPos)(),r=(0,ut.getWinSize)(),s=o.x-i.left,a=r.width-s-e.itemDiv.offsetWidth;o.x+=e.itemDiv.offsetParent.offsetWidth,o.y+=1,e.subLevel.showAt(o.x,o.y,!0,!0),e.subLevel.levelDiv.style.width="",e.subLevel.levelDiv.style.right="",a>=e.subLevel.levelDiv.offsetWidth||a>=s?a<e.subLevel.levelDiv.offsetWidth&&(e.subLevel.levelDiv.style.right=-i.left+"px"):(s<e.subLevel.levelDiv.offsetWidth?e.subLevel.levelDiv.style.left=i.left+4+"px":e.subLevel.levelDiv.style.left="",e.subLevel.levelDiv.style.right=(0,ut.getViewportSize)().width-o.x+e.itemDiv.offsetWidth-6+"px"),e.subLevel.levelDiv.style.visibility="visible",e.subLevel.focus()},t.prototype.adjustTopPos=function(t){var e=(0,ut.getWinSize)(),n=t-(0,ut.getScrollPos)().top+this.levelDiv.offsetHeight,o=t;return n>e.height-5&&(o-=n-e.height+5)<(0,ut.getScrollPos)().top&&(o=(0,ut.getScrollPos)().top+10),o},t.prototype.showAt=function(t,e,n,o){if(this.items){this.initLevelDiv(),this.turnCheckboxes(this.items),this.renderItems();var i=this.levelDiv.style;o&&(this.levelDiv.style.visibility="hidden"),i.display="block",i.left=t+"px",i.top=e+"px",this.scrollDiv.style.width="auto",this.scrollDiv.style.height="auto",n&&(e=this.adjustTopPos(e),i.top=e+"px");var r=this.parentMenu.minItemWidth;if(r>0&&this.scrollDiv.offsetWidth<r)for(var s=0;s<this.items.length;s++)this.items[s].itemDiv.style.width=r+"px";var a=this.parentMenu.maxItemWidth;if(a>0&&this.scrollDiv.offsetWidth>a)for(s=0;s<this.items.length;s++)this.items[s].itemDiv.style.width=a+"px",this.items[s].itemDiv.style.overflowX="hidden";var l=(0,ut.getWinSize)().height-(e-(0,ut.getScrollPos)().top)-15;if(this.parentMenu.maxHeight>0&&l>this.parentMenu.maxHeight&&(l=this.parentMenu.maxHeight),null!=this._applyItem&&null!=this._applyItem.itemDiv&&(l-=this._applyItem.itemDiv.offsetHeight+5),null!=this.searchDiv&&(l-=this.searchDiv.offsetHeight),null!=this.closeDiv&&(l-=this.closeDiv.offsetHeight),this.levelDiv.offsetHeight>l){var u=l;u<50&&(u=50),this.scrollDiv.style.height=u+"px"}else this.scrollDiv.style.height="auto";this.activeItem=null}},t.prototype.focus=function(){var t=this;window.setTimeout((function(){t.scrollDiv.focus(),null!=t.searchBox&&(t.parentMenu.options.searchBoxAutoFocus&&t.searchBox.focus(),t.searchBox.value="")}),100)},t.prototype.hide=function(){(null!==this.activeItem&&this.activeItem.subLevel&&this.activeItem.subLevel.hide(),this.levelDiv)&&(this.levelDiv.style.display="none",this.initialized&&(this.parentElement.removeChild(this.levelDiv),this.initialized=!1))},t.prototype.initLevelDiv=function(){this.initialized||(this.parentElement.appendChild(this.levelDiv),(0,ut.domel)(this.levelDiv).addClass("".concat(this.cssPrefix,"-levelDiv")).addClass(dt.z.getMobileCssClass()),this.initialized=!0)},t.prototype.submit=function(t){if(null!=t&&!t.items){this.parentMenu.hideMenu();var e=[];t==this._applyItem&&this.submitItems(this.items,e),this.parentMenu.submitMenu(t,e)}},t.prototype.remove=function(){for(var t=0;t<this.items.length;t++){var e=this.items[t];e.subLevel&&e.subLevel.remove()}if(this.levelDiv){this.levelDiv.innerHTML="";var n=this.levelDiv.parentNode;null!=n&&n.removeChild(this.levelDiv)}this.levelDiv=null},t.prototype.update=function(t){this.remove(),this.items=t,this.activeItem=null,this.selectedItem=null,this._applyItem.itemDiv=null,this.initialized=!1,this.updated++,this.renderContent()},t.prototype.refreshCheckboxes=function(){for(var t=0;t<this.items.length;t++){var e=this.items[t];e.itemCheckbox&&(e.itemCheckbox.checked=this.isItemSelected(e)),e.subLevel&&e.subLevel.refreshCheckboxes()}},t.prototype.refreshItems=function(){for(var t=0;t<this.items.length;t++){var e=this.items[t];e.itemDiv&&(e.hidden?e.itemDiv.style.display="none":e.itemDiv.style.display="block"),e.subLevel&&e.subLevel.refreshItems()}},t.prototype.findItem=function(t){for(var e=t.toLowerCase(),n=0;n<this.items.length;n++){var o=this.items[n];if(0==o.text.toLowerCase().indexOf(e))return o}return null},t}(),gt=function(){function t(e){var n=this;this.isCursorInside=!1,this.mouseIsOverBlock=!1,this.mouseIsOverLink=!1,this.toId=null,this.active=!1,this.ancorFocused=null,this.options={items:[],buttons:{submit:r.i18n.getText("ButtonApply"),cancel:r.i18n.getText("ButtonCancel")},itemFilterCallback:null,useDefaultStyles:!1,multiselect:!1,adjustHeight:!0,showSearchBoxAfter:30,activateOnMouseOver:!0,container:document.body,domWriteItemsId:!1,itemRenderedCallback:null,showItemIds:!1},e&&r.utils.assignDeep(this.options,e),this.options.hideButtons&&(this.options.submitOnBlur=!0),this.menuId=t.lastMenuID++,this.updateProps(),this.rootLevel=new ft({menu:this,items:this.options.items,levelIndex:0,container:this.options.container,domWriteItemsId:this.options.domWriteItemsId,menuId:this.options.id,itemRenderedCallback:this.options.itemRenderedCallback,showSelected:this.options.showSelected}),this.rootLevel.levelDiv.classList.add("".concat(this.cssPrefix,"-rootLevel")),this.options.zIndex&&(this.rootLevel.levelDiv.style.zIndex="".concat(this.options.zIndex)),this.menuKeyUpHandler=function(t){27==t.which&&(n.hideMenu(),t.stopImmediatePropagation())},this.globalMouseDownHandler=function(t){if(!n.active)return!0;for(var e=window.event||t,o=e.srcElement||e.target,i=!0;o;){if(o.tagName&&"div"==o.tagName.toLowerCase()&&o.menuLevel&&o.menuLevel.parentMenu==n){i=!1;break}o=o.parentNode||o.parentElement}return i&&(n.options.submitOnBlur&&n.rootLevel.submit(n.rootLevel.applyItem),n.hideMenu()),!0},this.render()}return Object.defineProperty(t.prototype,"cssPrefix",{get:function(){return"eqjs-menu"},enumerable:!1,configurable:!0}),t.prototype.getItems=function(){return this.rootLevel.getItems()},t.prototype.updateProps=function(){this.style={},this.style.colors={border:"#666666",shadow:"#888888",bgON:"white",fgON:"black",bgOVER:"#B6BDD2",fgOVER:"black"},this.style.itemStyle={fontSize:"14px"},this.minItemWidth=0,this.maxItemWidth=0,this.maxHeight=0,this.zIndex="".concat(this.options.zIndex),this.commandTemplate="",this.args=[],this.active=!1},t.prototype.render=function(){},t.prototype.clearItemsMenuProps=function(t){if(t)for(var e=0;e<t.length;e++)this.clearItemMenuProps(t[e])},t.prototype.clearItemMenuProps=function(t){t.subLevel&&t.subLevel.parentMenu==this||(t.subLevel&&(t.subLevel.remove(),t.subLevel=null),t.itemDiv&&(t.itemDiv=null),t.items&&this.clearItemsMenuProps(t.items))},t.prototype.setSelectedItems=function(t,e){for(var n=t?t.length:0,o=0;o<n;o++){var i=t[o];i.items?this.setSelectedItems(i.items,e):i.selected=e.indexOf(i.id)>=0}},t.prototype.getRootLevel=function(){return this.rootLevel},t.prototype.getItemFilterCallback=function(){return this.itemFilterCallback},t.prototype.showMenu=function(t){this.ancorFocused=t.anchor==document.activeElement?t.anchor:null,this.clearItemsMenuProps(this.options.items),this.itemSelectedCallback=t.itemSelectedCallback||null,this.menuClosedCallback=t.menuClosedCallback||null,this.itemFilterCallback=t.itemFilterCallback||null,t.items&&(this.options.items=t.items,this.rootLevel.setItems(t.items)),t.onMenuItemSelected&&(this.options.onMenuItemSelected=t.onMenuItemSelected);var e=t.selectedIds||null;if(e?"string"==typeof e&&(e=e.split(",")):e=[],this.active=!0,this.setSelectedItems(this.options.items,e),dt.z.isMobileMode())this.rootLevel.showAt(0,0,!0,!0),this.rootLevel.levelDiv.style.top="0px",this.rootLevel.levelDiv.style.bottom="0px",this.rootLevel.levelDiv.style.right="0px",this.rootLevel.levelDiv.style.position="fixed",this.rootLevel.levelDiv.style.fontSize="20px";else{var n=t.anchor||document.documentElement,o=(0,ut.getElementAbsolutePos)(n),i=n.offsetHeight,r=n.offsetWidth,s={x:o.x,y:o.y+i+2},a=(0,ut.getScrollPos)(),l=(0,ut.getWinSize)(),u=s.x+r-a.left,c=l.width-u+r;s.x+=2,this.rootLevel.showAt(s.x,s.y,!0,!0),this.rootLevel.levelDiv.style.width="",this.rootLevel.levelDiv.style.right="",this.rootLevel.levelDiv.style.zIndex||(this.rootLevel.levelDiv.style.zIndex="".concat(Math.max(1e4,(0,ct.X1)(n)+1))),c>=this.rootLevel.levelDiv.offsetWidth||c>=u?c<this.rootLevel.levelDiv.offsetWidth&&(this.rootLevel.levelDiv.style.right=-a.left+"px"):(u<this.rootLevel.levelDiv.offsetWidth?this.rootLevel.levelDiv.style.left=a.left+4+"px":this.rootLevel.levelDiv.style.left="",this.rootLevel.levelDiv.style.right=(0,ut.getViewportSize)().width-s.x-r+"px"),this.rootLevel.levelDiv.style.fontSize="14px"}this.rootLevel.levelDiv.style.visibility="visible",this.rootLevel.focus(),document.addEventListener("keyup",this.menuKeyUpHandler),document.addEventListener("mousedown",this.globalMouseDownHandler,!0)},t.prototype.hideMenu=function(){document.removeEventListener("mousedown",this.globalMouseDownHandler,!0),document.removeEventListener("keyup",this.menuKeyUpHandler),this.rootLevel.hide(),this.ancorFocused&&this.ancorFocused.focus(),this.menuClosedCallback&&this.menuClosedCallback()},t.prototype.submitMenu=function(t,e){this.itemSelectedCallback&&this.itemSelectedCallback(t,e)},t.prototype.knockMenuStyle=function(t){t.removeAttribute("style");var e=t.querySelectorAll("ul").item(0);!1!==!(!e||!e.style)&&e.setAttribute("style","")},t.prototype.refreshItems=function(){this.rootLevel.refreshItems()},t.prototype.refreshCheckboxes=function(){this.rootLevel.refreshCheckboxes()},t.lastMenuID=0,t}(),yt=function(){function t(){this.formatStr="",this.pos=0,this.token="text",this.tokenText=""}return t.prototype.start=function(t){this.formatStr=t,this.pos=0,this.tokenText=""},t.prototype.skipSpaces=function(){for(;this.pos<this.formatStr.length&&" "===this.formatStr.charAt(this.pos);)this.pos++},t.prototype.getToken=function(){return this.token},t.prototype.getTokenText=function(){return this.tokenText},t.prototype.next=function(){if(this.skipSpaces(),this.pos>=this.formatStr.length)return!1;var t=0;if("{"===this.formatStr.charAt(this.pos)){if((t=this.formatStr.indexOf("}",this.pos))<0)return!1;this.tokenText=this.formatStr.substring(this.pos,t+1),0!==this.tokenText.indexOf("{expr")&&0!==this.tokenText.indexOf("{attr")||(this.token="expression"),this.pos=t+1}else if("["===this.formatStr.charAt(this.pos)&&this.pos<this.formatStr.length-1&&"["===this.formatStr.charAt(this.pos+1))this.pos+=2,t=this.formatStr.indexOf("]]",this.pos),this.token="function",this.tokenText=this.formatStr.substring(this.pos,t),this.pos=t+2;else{this.token="text";var e=this.formatStr.indexOf("{",this.pos);e<0&&(e=this.formatStr.length);var n=this.formatStr.indexOf("[[",this.pos);n<0&&(n=this.formatStr.length),t=Math.min(e,n),this.tokenText=this.formatStr.substring(this.pos,t).trim(),this.pos=t}return!0},t}(),mt=function(t,e,n){if(n||2===arguments.length)for(var o,i=0,r=e.length;i<r;i++)!o&&i in e||(o||(o=Array.prototype.slice.call(e,0,i)),o[i]=e[i]);return t.concat(o||Array.prototype.slice.call(e))};!function(t){t[t.Enable=0]="Enable",t[t.Delete=1]="Delete",t[t.Hidden=2]="Hidden",t[t.SortingNone=3]="SortingNone",t[t.SortingAsc=4]="SortingAsc",t[t.SortingDesc=5]="SortingDesc",t[t.MoveTop=6]="MoveTop",t[t.MoveUp=7]="MoveUp",t[t.MoveDown=8]="MoveDown",t[t.MoveBottom=9]="MoveBottom",t[t.Menu=10]="Menu",t[t.Type=11]="Type",t[t.Format=12]="Format"}(lt||(lt={}));var vt,Ct=function(){function t(t,e,n){this.functionMenu=null,this.formatsMenu=null,this.buttonMenu=null,this.isMouseOverBlock=!1,this.keepShowingButtons=!1,this.panel=t,this.column=e,this.element=n}return Object.defineProperty(t.prototype,"cssPrefix",{get:function(){return"eqjs-qc"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"columnEnabled",{get:function(){return this.column.enabled},set:function(t){this.column.enabled=t},enumerable:!1,configurable:!0}),t.prototype.render=function(){var t=this;this.baseAttr=this.getAttribute(),this.getButtonsToShow().indexOf("sorting")>=0&&this.columnEnabled&&(this.sortingButton=this.renderSoringButton(this.column.sorting),this.column.sorting!==E.None&&(this.sortingButton.style.display="block"));var e=(0,ut.domel)("div");return e.data("id",this.column.id),this.element&&this.element.parentNode.replaceChild(e.toDOM(),this.element),this.element=e.toDOM(),this.panel.options.allowDragDrop&&!dt.z.isMobileMode()&&ut.eqDragManager.registerDraggableItem({element:this.element,scope:"entityAttrSort",data:{column:this.column},beforeDragStart:function(){t.hideButtons()},renderer:function(e){e.innerHTML="";var n=document.createElement("span");n.innerText=t.column.caption,e.classList.add("eqjs-sortable-helper"),e.appendChild(n)},onDragStart:function(e){t.element.style.display="none",e.dropEffect=ut.DropEffect.Allow},onDragEnd:function(e){e.data.finishedSuccessfully||t.element.style.removeProperty("display")}}),this.isEditable()&&(this.createFunctionMenu(),this.createFormatsMenu()),this.createButtonMenu(),e.addClass(this.getClassesToAdd()).addClass(dt.z.getMobileCssClass()).addChildElement(this.renderCheckbox()).addChild("div",(function(e){return e.addClass("".concat(ct.YR,"-button-placeholder"),"".concat(t.cssPrefix,"-button-placeholder"),"".concat(t.cssPrefix,"-colelement"),"".concat(t.cssPrefix,"-sortbutton-placeholder")).addChildElement(t.sortingButton)})).addChildElement(this.renderExpressionBlock()),!1===this.panel.options.showColumnTitles||dt.z.isMobileMode()||e.addChildElement(this.renderCaptionBlock()),e.addChild("div",(function(e){e.addClass("".concat(ct.YR,"-column-buttonsBlock"),"".concat(t.cssPrefix,"-buttonsBlock")).addClass(dt.z.getMobileCssClass()),t.getButtonsToShow().indexOf("enable")>=0&&!t.column.isReadOnly()&&e.addChildElement(t.renderEnabledButton()),t.getButtonsToShow().indexOf("type")>=0&&t.columnEnabled&&e.addChildElement(t.renderColumnTypeButton()),t.getButtonsToShow().indexOf("format")>=0&&t.columnEnabled&&e.addChildElement(t.renderColumnFormatButton()),t.getButtonsToShow().indexOf("delete")>=0&&!t.column.isReadOnly()&&e.addChildElement(t.renderDeleteButton()),t.getButtonsToShow().indexOf("menu")>=0&&!t.column.isReadOnly()&&e.addChildElement(t.renderMenuButton())})),dt.z.isMobileMode()||e.on("mouseenter",this.onMouseEnter.bind(this)).on("mouseleave",this.onMouseLeave.bind(this)),(this.panel.options.accentActiveColumn||dt.z.isMobileMode())&&e.on("click",this.onMouseClick.bind(this)),this.panel.options.alwaysShowButtons&&this.showButtons(),this.element},t.prototype.onMouseClick=function(t){return t.stopPropagation(),this.panel.toggleColumnPicked(this.column),this.adjustButtonsVisibility(),dt.z.isMobileMode()||this.element.dispatchEvent((0,ut.createBrowserEvent)("mouseenter")),!1},t.prototype.fireColumnChanged=function(){this.column.fireChangedEvent()},t.prototype.refresh=function(){this.render()},t.prototype.getAttribute=function(){return this.panel.getContext().getModel().getAttributeByIdSafe(this.column.expr.value)},t.prototype.renderCaptionBlock=function(){var t=this;this.column.caption&&""!=this.column.caption||(this.column.caption=this.getDefaultColumnCaption());var e=(0,ut.domel)("div").addClass("".concat(this.cssPrefix,"-colelement"),"".concat(this.cssPrefix,"-captionelement")).addClass(dt.z.getMobileCssClass());return this.isEditable()?e.addChild("a",(function(e){return e.attr("href","javascript:void(0)").title(t.column.caption).text(t.column.caption).on("click",(function(e){e.stopPropagation();var n=e.target,o=n.parentElement.querySelector("input");return o&&(n.style.display="none",o.style.removeProperty("display"),o.style.minWidth="".concat(n.clientWidth),o.focus(),t.element.setAttribute(ut.eqDragManager.DRAG_DISABLED_ATTR,"")),!1}))})).addChild("input",(function(e){return e.hide().value(t.column.caption).on("blur keydown",(function(e){var n=!1,o=!0;if(e instanceof KeyboardEvent?13===e.keyCode?n=!0:27===e.keyCode&&(n=!0,o=!1):e instanceof FocusEvent&&(n=!0),n){var i=e.target,r=i.parentElement.querySelector("a");r&&(r.style.removeProperty("display"),i.style.display="none"),o&&t.column.caption!==i.value?(t.column.caption=i.value,t.fireColumnChanged()):(i.value=t.column.caption,(0,ct.n6)(r)),t.element.removeAttribute(ut.eqDragManager.DRAG_DISABLED_ATTR)}return!0}))})):e.addChild("span",(function(e){e.text(t.column.caption).title(t.column.caption)})),e.toDOM()},t.prototype.renderSoringButton=function(t){var e,n=this,o="".concat(ct.YR,"-column-sortbutton");switch(t){case E.Ascending:e="".concat(o,"-asc");break;case E.Descending:e="".concat(o,"-desc");break;default:e="".concat(o,"-none")}return this.isEditable()?(0,ut.domel)("div").addClass(o,"".concat(ct.YR,"-button"),e).data("btnplaceholder","").title(r.i18n.getText("ButtonSorting")).attr("tabIndex","0").on("click",(function(t){t.stopPropagation(),n.keepShowingButtons=!0,(n.getUIS()&&n.panel.sortMenu||n.panel.moveMenu).showMenu({anchor:n.sortingButton,selectedIds:n.column.isHidden()?["IsHidden"]:null,itemSelectedCallback:function(t,e){var o;switch(t.id){case"IsHidden":o=lt.Hidden;break;case"MoveTop":o=lt.MoveTop;break;case"MoveDown":o=lt.MoveDown;break;case"MoveUp":o=lt.MoveUp;break;case"MoveBottom":o=lt.MoveBottom;break;case"None":o=lt.SortingNone;break;case"Ascending":o=lt.SortingAsc;break;case"Descending":o=lt.SortingDesc}n.buttonMenuHandler(o,null)},menuClosedCallback:function(){n.keepShowingButtons=!1,n.isMouseOverBlock||n.leaveButtonBlock()}})})).on("keypress",(function(t){13==t.keyCode&&t.target.click()})).toDOM():t===E.Ascending||t===E.Descending?(0,ut.domel)("div").addClass(o,"".concat(ct.YR,"-button"),e).title(r.i18n.getText("ButtonSorting")).toDOM():null},t.prototype.renderCheckbox=function(){var t=this;return this.panel.options.showCheckboxes&&!this.column.isReadOnly()?(0,ut.domel)("div").title(r.i18n.getText("CmdToggleEnable")).attr("tabIndex","0").addClass("".concat(this.cssPrefix,"-colelement ").concat(this.cssPrefix,"-column-checkbox")).addClass("".concat(this.columnEnabled?"enabled":"")).on("click",(function(){return t.columnEnabled=!t.columnEnabled,t.column.fireChangedEvent(),!1})).on("keypress",(function(t){[13,32].includes(t.keyCode)&&t.target.click()})).toDOM():null},t.prototype.renderDeleteButton=function(){var t=this;return(0,ut.domel)("div").addClass("".concat(ct.YR,"-button-placeholder"),"".concat(this.cssPrefix,"-button-placeholder"),"".concat(this.cssPrefix,"-deletebutton-placeholder")).data("btnplaceholder","").addChild("div",(function(e){return e.addClass("".concat(ct.YR,"-button"),"".concat(ct.YR,"-column-button"),"".concat(ct.YR,"-column-button-delete")).title(r.i18n.getText("CmdDelete")).attr("tabIndex","0").on("click",(function(e){return t.buttonMenuHandler(lt.Delete,e)})).on("keypress",(function(t){13==t.keyCode&&t.target.click()}))})).toDOM()},t.prototype.renderMenuButton=function(){var t=this;return(0,ut.domel)("div").addClass("".concat(ct.YR,"-button-placeholder"),"".concat(this.cssPrefix,"-button-placeholder"),"".concat(this.cssPrefix,"-menubutton-placeholder")).data("btnplaceholder","").addChild("div",(function(e){return e.addClass("".concat(ct.YR,"-button"),"".concat(ct.YR,"-column-button"),"".concat(ct.YR,"-column-button-menu")).title(r.i18n.getText("ButtonMenu")).attr("tabIndex","0").on("click",(function(e){return t.buttonMenuHandler(lt.Menu,e)})).on("keypress",(function(t){13==t.keyCode&&t.target.click()}))})).toDOM()},t.prototype.getDefaultColumnCaption=function(){return this.getDefaultTitleText(this.baseAttr)},t.prototype.getDefaultTitleText=function(t){return this.getAttributeCaption(t,this.panel.options.titleElementFormat)},t.prototype.getAttributeCaption=function(t,e){return e=e||this.panel.options.attrElementFormat,this.panel.getContext().getModel().getAttributeText(t,e)},t.prototype.getClassesToAdd=function(){var t="";return t+=this.columnEnabled?"":" ".concat(this.cssPrefix,"-disabled"),this.columnEnabled&&(t+=this.column.isReadOnly()?" ".concat(this.cssPrefix,"-readonly"):""),t+=this.column.isHidden()?" ".concat(this.cssPrefix,"-hidden"):""},t.prototype.renderColumnTypeButton=function(){var t=this;return this.isEditable()&&!1!==this.panel.options.allowAggrColumns?(0,ut.domel)("div").addClass("".concat(ct.YR,"-button-placeholder"),"".concat(this.cssPrefix,"-button-placeholder"),"".concat(this.cssPrefix,"-typebutton-placeholder"),"".concat(this.cssPrefix,"-button-active")).data("btnplaceholder","").addChild("div",(function(e){return e.addClass("".concat(ct.YR,"-button"),"".concat(ct.YR,"-column-button"),"".concat(ct.YR,"-column-button-type")).title(r.i18n.getText("ButtonToAggr")).attr("tabIndex","0").on("click",(function(e){e.stopPropagation(),t.keepShowingButtons=!0,t.changeTypeHandler(e)})).on("keypress",(function(t){13==t.keyCode&&t.target.click()}))})).toDOM():null},t.prototype.renderColumnFormatButton=function(){var t=this,e=this.getFormatsMenuItems();return this.isEditable()&&!1!==this.panel.options.allowDisplayFormatChange&&e.length>1?(0,ut.domel)("div").addClass("".concat(ct.YR,"-button-placeholder"),"".concat(this.cssPrefix,"-button-placeholder"),"".concat(this.cssPrefix,"-formatbutton-placeholder"),"".concat(this.cssPrefix,"-button-active")).data("btnplaceholder","").addChild("div",(function(e){return e.addClass("".concat(ct.YR,"-button"),"".concat(ct.YR,"-column-button"),"".concat(ct.YR,"-column-button-format")).title(r.i18n.getText("ButtonFormat")).attr("tabIndex","0").on("click",(function(e){e.stopPropagation(),t.keepShowingButtons=!0,t.changeFormatHandler(e)})).on("keypress",(function(t){13==t.keyCode&&t.target.click()}))})).toDOM():null},t.prototype.renderEnabledButton=function(){var t=this;return(0,ut.domel)("div").addClass("".concat(ct.YR,"-button-placeholder"),"".concat(this.cssPrefix,"-button-placeholder"),"".concat(this.cssPrefix,"-enablebutton-placeholder"),"".concat(this.cssPrefix,"-button-active")).data("btnplaceholder","").addChild("div",(function(e){return e.addClass("".concat(ct.YR,"-button"),"".concat(ct.YR,"-column-button"),"".concat(ct.YR,"-column-button-enable")).title(r.i18n.getText("CmdToggleEnable")).addClass(t.columnEnabled?"enabled":"").attr("tabIndex","0").on("click",(function(e){return t.buttonMenuHandler(lt.Enable,e)})).on("keypress",(function(t){13==t.keyCode&&t.target.click()}))})).toDOM()},t.prototype.isEditable=function(){return this.columnEnabled&&!this.column.isReadOnly()},t.prototype.changeFormatHandler=function(t){var e=this,n=this.panel.getContext().getModel().getDisplayFormatsForType(this.column.getDataType()),o="{0:__default}";n.filter((function(t){return t.format==e.column.displayFormat})).length>0&&(o=this.column.displayFormat),this.formatsMenu.showMenu({anchor:t.target,selectedIds:o,itemSelectedCallback:function(t,n){return t.id!=o&&("{0:__default}"==t.id?e.column.displayFormat="":e.column.displayFormat=t.id,e.column.fireChangedEvent()),!1},menuClosedCallback:function(){e.keepShowingButtons=!1,e.isMouseOverBlock||e.element.dispatchEvent((0,ut.createBrowserEvent)("mouseleave"))}})},t.prototype.getUIS=function(){return this.panel.getContext().getModel().checkAttrProperty(this.column.expr.value,"useInSorting")},t.prototype.onMouseEnter=function(t){return this.isMouseOverBlock=!0,this.enterButtonBlock(),t.stopPropagation(),!1},t.prototype.onMouseLeave=function(t){return this.isMouseOverBlock=!1,this.leaveButtonBlock(),t.stopPropagation(),!1},t.prototype.isColumnActive=function(){return this.element.classList.contains("active")},t.prototype.hideButtons=function(){(0,ut.domel)(this.element).data("show-buttons",null)},t.prototype.showButtons=function(){(0,ut.domel)(this.element).data("show-buttons","")},t.prototype.adjustButtonsVisibility=function(){(this.panel.options.alwaysShowButtons||(this.panel.options.accentActiveColumn||dt.z.isMobileMode())&&this.isColumnActive())&&this.showButtons()},t.prototype.enterButtonBlock=function(){this.showButtons()},t.prototype.leaveButtonBlock=function(){this.keepShowingButtons||!0===this.panel.options.alwaysShowButtons||this.isColumnActive()&&1==this.panel.options.accentActiveColumn||this.hideButtons()},t.prototype.createFunctionMenu=function(){for(var t,e=[],n=this.panel.getContext().getModel().getAggrFunctions(),o=!0,i=null,s=this.column.getDataType(),a=0,l=n;a<l.length;a++){var u=l[a];if(u){var c=u.getAppliedTypesOrDefault().indexOf(s)>=0;this.column.expr.func!==u.id||c||(o=!1),c&&(t=this.panel.getContext().getModel().getAggrFunctionCaption(u.id),i={id:u.id,text:t},e.push(i))}}o||(this.column.expr.func=e[0].id),this.panel.areCustomExpressionsAllowed()&&(i={id:"CustomSqlDivider",text:"---"},e.push(i),i={id:"CUSTOMSQL",text:t=r.i18n.getText("CustomExpression")},e.push(i));var d=this.column.id;d&&(d+="-FunctionsMenu");var h={items:e,id:d,searchBoxAlwaysShown:!1,domWriteItemsId:!0};this.functionMenu=new gt(h)},t.prototype.createFormatsMenu=function(){if(0!=this.panel.options.allowDisplayFormatChange){var t=this.column.id;t&&(t+="-FormatsMenu");var e={items:this.getFormatsMenuItems(),id:t,searchBoxAlwaysShown:!1,showSelected:!0,domWriteItemsId:!0};this.formatsMenu=new gt(e)}},t.prototype.getFormatsMenuItems=function(){var t=this.panel.getContext().getModel().getDisplayFormatsForType(this.column.getDataType());return[{id:"{0:__default}",text:"Default"}].concat(t.map((function(t){return{id:t.format,text:r.i18n.getText("DisplayFormats",t.name)||t.name}})))},t.prototype.getButtonsToShow=function(){return this.panel.options.buttons&&Array.isArray(this.panel.options.buttons)?this.panel.options.buttons:["enable","delete","type","sorting","format"]},t.prototype.buttonMenuHandler=function(t,e){var n=this;switch(t){case lt.Delete:var o=this.column.getQuery();o.removeColumn(this.column,this.panel),o.fireColumnsChangedEvent(w.Delete,this.column);break;case lt.Enable:this.columnEnabled=!this.columnEnabled,this.fireColumnChanged();break;case lt.Hidden:this.column.setHidden(!this.column.isHidden()),this.fireColumnChanged();break;case lt.MoveTop:this.panel.moveColumn(this.column,"MoveTop");break;case lt.MoveBottom:this.panel.moveColumn(this.column,"MoveBottom");break;case lt.MoveUp:this.panel.moveColumn(this.column,"MoveUp");break;case lt.MoveDown:this.panel.moveColumn(this.column,"MoveDown");break;case lt.SortingAsc:this.column.sorting=E.Ascending,this.column.fireChangedEvent();break;case lt.SortingDesc:this.column.sorting=E.Descending,this.column.fireChangedEvent();break;case lt.SortingNone:this.column.sorting=E.None,this.column.fireChangedEvent();break;case lt.Menu:var i=this.buttonMenu;this.keepShowingButtons=!0,i.showMenu({anchor:e?e.target:null,selectedIds:this.getButtonMenuSelectedItems(),itemSelectedCallback:function(t){var o=t.id;switch(t.id){case"enable":o=lt.Enable;break;case"delete":o=lt.Delete;break;case"hidden":o=lt.Hidden;break;case"MoveTop":o=lt.MoveTop;break;case"MoveBottom":o=lt.MoveBottom;break;case"MoveUp":o=lt.MoveUp;break;case"MoveDown":o=lt.MoveDown;break;case"None":o=lt.SortingNone;break;case"Ascending":case"Descending":o=lt.SortingAsc}n.buttonMenuHandler(o,e)},itemFilterCallback:function(t){return n.columnEnabled||"__group"===t.id||"enable"===t.id||"delete"===t.id},menuClosedCallback:function(){n.keepShowingButtons=!1,n.isMouseOverBlock||n.leaveButtonBlock()}});break;default:this.processFormatsButtonMenuItems(t,e)||this.processExtraButtonMenuItems(t,e)}return e&&e.stopPropagation(),!1},t.prototype.createButtonMenu=function(){if(!this.buttonMenu){var t=this.column.id;t&&(t+="-ButtonMenu");var e=[];e.push({id:"enable",text:r.i18n.getText("MenuEnable")}),this.panel.options.allowHiddenColumns&&e.push({id:"hidden",text:r.i18n.getText("CmdHiddenColumn")}),e.push({id:"delete",text:r.i18n.getText("CmdDelete")});var n=[];n.push({id:"__group",text:" ",items:e});var o=this.panel.options.allowSorting?mt(mt([],this.panel.getSortMenuList(),!0),this.panel.getMoveMenuList(),!0):this.panel.getMoveMenuList();n.push({id:"__group",text:r.i18n.getText("CmdGroupSort"),items:o});var i=this.getExtraButtonMenuItems();i&&Array.isArray(i)&&(n=mt(mt([],n,!0),i,!0));var s=this.getFormatsMenuItems();s.length>1&&n.push({id:"__group",text:r.i18n.getText("CmdGroupFormat"),items:s});var a={items:n,id:t,searchBoxAlwaysShown:!1,domWriteItemsId:!0,showSelected:!0};this.buttonMenu=new gt(a)}},t.prototype.processFormatsButtonMenuItems=function(t,e){var n=this.panel.getContext().getModel().getDisplayFormatsForType(this.column.getDataType());if("{0:__default}"==t)this.column.displayFormat="";else{if(!(n.filter((function(e){return e.format==t})).length>0))return!1;this.column.displayFormat=t}return this.column.fireChangedEvent(),!0},t.prototype.getButtonMenuSelectedItems=function(){var t=this,e=[];this.columnEnabled&&e.push("enable"),this.column.isHidden()&&e.push("hidden");var n="{0:__default}";return this.panel.getContext().getModel().getDisplayFormatsForType(this.column.getDataType()).filter((function(e){return e.format==t.column.displayFormat})).length>0&&(n=this.column.displayFormat),e.push(n),e},t}(),bt=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),xt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return bt(e,t),e.prototype.getClassesToAdd=function(){return"".concat(t.prototype.getClassesToAdd.call(this)," ").concat(this.cssPrefix,"-row ").concat(this.cssPrefix,"-row-column-entattr")},e.prototype.renderExpressionBlock=function(){var t=this;return(0,ut.domel)("div").addClass("".concat(this.cssPrefix,"-expr-block")).addClass(dt.z.getMobileCssClass()).addChild("div",(function(e){return e.addClass("".concat(t.cssPrefix,"-colelement"),"".concat(t.cssPrefix,"-attrelement")).addClass(dt.z.getMobileCssClass()).addChildElement(t.renderBaseExpression())})).toDOM()},e.prototype.renderBaseExpression=function(){var t=this,e=this.getAttributeCaption(this.baseAttr);return this.isEditable()?(0,ut.domel)("a").attr("href","javascript:void(0)").title(e).text(e).on("click",(function(e){return e.stopPropagation(),t.panel.showEntitiesMenu({anchor:e.target,selectedIds:null,itemSelectedCallback:t.baseExpressionItemSelectedCallback.bind(t),itemFilterCallback:function(t){return"__AddAll__"!==t.id}}),!1})).toDOM():(0,ut.domel)("span").text(e).title(e).toDOM()},e.prototype.baseExpressionItemSelectedCallback=function(t,e){var n=t.id;return this.column.expr.setValue(n,!0),this.column.caption="",this.fireColumnChanged(),!1},e.prototype.getUIS=function(){var t=this.column.expr.args[0];return!t||this.panel.getContext().getModel().checkAttrProperty(t.value,"useInSorting")},e.prototype.changeTypeHandler=function(t){var e=this;this.keepShowingButtons=!0,this.functionMenu.showMenu({anchor:t.target,selectedIds:null,itemSelectedCallback:function(t,n){return e.processExtraButtonMenuItems(t.id,null),!1},menuClosedCallback:function(){e.keepShowingButtons=!1,e.isMouseOverBlock||e.element.dispatchEvent((0,ut.createBrowserEvent)("mouseleave"))}})},e.prototype.changeTypeToCustomSql=function(){var t=this;this.column.getQuery().changeColumnType(this.column,p.CustomSql);var e=this.element.parentElement;setTimeout((function(){var n=e.querySelector("div[data-id='".concat(t.column.id,"'] div[class*='").concat(t.cssPrefix,"-expr-block'] div[class*='").concat(t.cssPrefix,"-colelement'] a"));n&&n.click()}),500),this.fireColumnChanged()},e.prototype.changeTypeToAggr=function(t){this.column.getQuery().changeColumnType(this.column,p.AggregateFunction,{funcId:t}),this.fireColumnChanged()},e.prototype.processExtraButtonMenuItems=function(t,e){return"CUSTOMSQL"===t?this.changeTypeToCustomSql():this.changeTypeToAggr(t),!0},e.prototype.getExtraButtonMenuItems=function(){for(var t,e=[],n=this.panel.getContext().getModel().getAggrFunctions(),o=!0,i=!0,s=null,a=this.getAttribute(),l=0,u=n;l<u.length;l++){var c=u[l];o=c.getAppliedTypesOrDefault().indexOf(a.dataType)>=0,this.column.expr.func!==c.id||o||(i=!1),o&&(t=this.panel.getContext().getModel().getAggrFunctionCaption(c.id),s={id:c.id,text:t},e.push(s))}for(var d=0;d<n.length;d++)n[d];return i||(this.column.expr.func=e[0].id),this.panel.areCustomExpressionsAllowed()&&(s={id:"CustomSqlDivider",text:"---"},e.push(s),s={id:"CUSTOMSQL",text:t=r.i18n.getText("CustomExpression")},e.push(s)),[{id:"__group",text:r.i18n.getText("ColTypeGroup"),items:e}]},e}(Ct),wt=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Et=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.displayFormatParser=new yt,e}return wt(e,t),e.prototype.getClassesToAdd=function(){return"".concat(t.prototype.getClassesToAdd.call(this)," ").concat(this.cssPrefix,"-row ").concat(this.cssPrefix,"-row-column-aggr")},e.prototype.getAttribute=function(){return this.panel.getContext().getModel().getAttributeByIdSafe(this.column.expr.args[0].value)},e.prototype.getDefaultColumnCaption=function(){return this.getDefaultTitleText(this.baseAttr)+" "+this.panel.getContext().getModel().getAggrFunctionCaption(this.column.expr.func)},e.prototype.renderExpressionBlock=function(){var t=this,e=this.panel.getContext().getModel(),n=(0,ut.domel)("div").addClass("".concat(this.cssPrefix,"-expr-block"),"".concat(this.cssPrefix,"-expr-block-aggr")).addClass(dt.z.getMobileCssClass()),o=e.getAggrFunctionFormat(this.column.expr.func);if(o&&""!==o){var i=this.parseDisplayFormat(o);if(0!==i.length){for(var r=null,s=i.length,a=function(e){if(1===(r=i[e]).type)if(l.isEditable()){var o=(0,ut.domel)("a").attr("href","javascript:void(0)").text(r.text).on("click",(function(e){e.stopPropagation(),t.functionMenu.showMenu({anchor:o.toDOM(),selectedIds:null,itemSelectedCallback:function(e,n){"CUSTOMSQL"===e.id?t.changeTypeToCustomSql():(t.column.expr.func=e.id,t.column.caption="",t.fireColumnChanged())}})}));n.addChild("div",(function(e){return e.addClass("".concat(t.cssPrefix,"-colelement"),"".concat(t.cssPrefix,"-aggrfuncelement")).addClass(dt.z.getMobileCssClass()).addChildElement(o.toDOM())}))}else n.addChild("div",(function(e){return e.addClass("".concat(t.cssPrefix,"-colelement"),"".concat(t.cssPrefix,"-aggrfuncelement")).addClass(dt.z.getMobileCssClass()).addChild("span",(function(t){return t.text(r.text).title(r.text)}))}));else 2===r.type?n.addChild("div",(function(e){return e.addClass("".concat(t.cssPrefix,"-colelement"),"".concat(t.cssPrefix,"-attrelement")).addClass(dt.z.getMobileCssClass()).addChildElement(t.renderBaseExpression())})):3===r.type&&n.addChild("span",(function(e){return e.addClass("".concat(t.cssPrefix,"-colelement")).addClass(dt.z.getMobileCssClass()).text(r.text).title(r.text)}))},l=this,u=0;u<s;u++)a(u);return n.toDOM()}}},e.prototype.renderColumnTypeButton=function(){var e=t.prototype.renderColumnTypeButton.call(this);return e&&(e.firstElementChild.classList.add("aggregated"),e.firstElementChild.setAttribute("title",r.i18n.getText("ButtonToSimple"))),e},e.prototype.baseExpressionItemSelectedCallback=function(t,e){var n=t.id;return this.column.expr.args[0].setValue(n,!0),this.column.caption="",this.fireColumnChanged(),!1},e.prototype.changeTypeToSimple=function(){this.column.getQuery().changeColumnType(this.column,p.EntityAttribute),this.fireColumnChanged()},e.prototype.parseDisplayFormat=function(t){if(!t)return[];var e=[],n=this.displayFormatParser;for(n.start(t);n.next();){var o=n.getToken(),i=n.getTokenText();"function"===o?e.push({type:1,text:i}):"expression"===o?e.push({type:2}):"text"===o&&e.push({type:3,text:i})}return e},e.prototype.changeTypeHandler=function(t){this.changeTypeToSimple()},e.prototype.processExtraButtonMenuItems=function(t,e){return this.changeTypeToSimple(),!0},e.prototype.getExtraButtonMenuItems=function(){return[{id:"__group",text:r.i18n.getText("ColTypeGroup"),items:[{id:"type",text:r.i18n.getText("ColTypeSimple")}]}]},e}(xt),Tt=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Dt=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.dataTypeMenu=null,e}return Tt(e,t),e.prototype.renderEnabledButton=function(){var e=t.prototype.renderEnabledButton.call(this);return e.children[0].title=r.i18n.getText("CmdToggleEnableCustom"),e},e.prototype.getClassesToAdd=function(){return"".concat(this.cssPrefix,"-row ").concat(this.cssPrefix,"-row-column-entattr")+t.prototype.getClassesToAdd.call(this)},Object.defineProperty(e.prototype,"columnEnabled",{get:function(){return!!this.panel.areCustomExpressionsAllowed()&&this.column.enabled},set:function(t){this.panel.areCustomExpressionsAllowed()?this.column.enabled=t:this.column.enabled=!1},enumerable:!1,configurable:!0}),e.prototype.renderColumnTypeButton=function(){var e=t.prototype.renderColumnTypeButton.call(this);return e&&(e.firstElementChild.classList.add("aggregated"),e.firstElementChild.setAttribute("title",r.i18n.getText("ButtonToSimple"))),e},e.prototype.renderExpressionBlock=function(){var t=this;this.column.caption&&""!=this.column.caption||(this.column.caption=this.getDefaultColumnCaption());var e=(0,ut.domel)("div").addClass("".concat(this.cssPrefix,"-expr-block")).addClass(dt.z.getMobileCssClass()).toDOM(),n=(0,ut.domel)("div",e).addClass("".concat(this.cssPrefix,"-colelement"),"".concat(this.cssPrefix,"-attrelement")).addClass(dt.z.getMobileCssClass());return this.isEditable()?n.addChild("a",(function(e){return e.attr("href","javascript:void(0)").title(t.column.caption).text(t.column.caption).on("touchstart click",(function(e){e.stopPropagation();var n=e.target,o=n.parentElement.querySelector("input");o&&(n.style.display="none",o.style.removeProperty("display"),o.style.width="100%",o.focus(),t.element.setAttribute(ut.eqDragManager.DRAG_DISABLED_ATTR,""))}))})).addChild("input",(function(e){return e.hide().value(t.column.expr.sql).on("blur keydown",(function(e){var n=!1,o=!0;if(e instanceof KeyboardEvent?13===e.keyCode?n=!0:27===e.keyCode&&(n=!0,o=!1):e instanceof FocusEvent&&(n=!0),n){var i=e.target,r=i.parentElement.querySelector("a");r&&(r.style.removeProperty("display"),i.style.display="none"),o&&t.column.expr.sql!==i.value?(t.column.expr.sql=i.value,t.fireColumnChanged()):i.value=t.column.expr.sql,t.element.removeAttribute(ut.eqDragManager.DRAG_DISABLED_ATTR)}}))})):n.addChild("span",(function(e){e.text(t.column.caption).title(t.column.caption)})),n=(0,ut.domel)("div",e).addClass("".concat(this.cssPrefix,"-colelement")).addChild("span",(function(t){t.text(":").title(":")})),n=(0,ut.domel)("div",e).addClass("".concat(this.cssPrefix,"-colelement"),"".concat(this.cssPrefix,"-attrelement")).addClass(dt.z.getMobileCssClass()),this.isEditable()?(this.createDataTypeMenu(),n.addChild("a",(function(e){return e.attr("href","javascript:void(0)").title(r.DataType[t.column.expr.dataType]).text(r.DataType[t.column.expr.dataType]).on("touchstart click",(function(n){n.stopPropagation(),t.dataTypeMenu.showMenu({anchor:e.toDOM(),selectedIds:null,itemSelectedCallback:function(e,n){t.column.expr.dataType=e.id,t.fireColumnChanged()}})}))}))):(this.column.expr.dataType,n.addChild("span",(function(e){e.text(r.DataType[t.column.expr.dataType]).title(r.DataType[t.column.expr.dataType])}))),e},e.prototype.changeTypeToSimple=function(){this.column.getQuery().changeColumnType(this.column,p.EntityAttribute),this.fireColumnChanged()},e.prototype.getDefaultColumnCaption=function(){return"Custom SQL Column"},e.prototype.getDefaultValue=function(){return this.column.expr.sql},e.prototype.getUIS=function(){return!0},e.prototype.changeTypeHandler=function(t){this.changeTypeToSimple()},e.prototype.processExtraButtonMenuItems=function(t,e){return this.changeTypeToSimple(),!0},e.prototype.createFunctionMenu=function(){},e.prototype.getExtraButtonMenuItems=function(){return[{id:"__group",text:r.i18n.getText("ColTypeGroup"),items:[{id:"type",text:r.i18n.getText("ColTypeSimple")}]}]},e.prototype.createDataTypeMenu=function(){var t=[];for(var e in r.DataType)if(!isNaN(Number(e))){var n={id:e,text:r.DataType[e]};t.push(n)}var o=this.column.id;o&&(o+="-DataTypeMenu");var i={items:t,id:o,searchBoxAlwaysShown:!1,domWriteItemsId:!0};this.dataTypeMenu=new gt(i)},e}(xt),St=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),kt=function(t){function e(e){var n=t.call(this,e)||this;return n.options={isSubQuery:!1,activeColumn:null,showAddRow:!0,showHeader:!0,showColumnTitles:!0,allowAggrColumns:!0,allowDuplicates:!0,allowCustomExpressions:!1,allowSorting:!0,attrElementFormat:"{entity} {attr}",titleElementFormat:null,buttons:null,alwaysShowButtons:!1,accentActiveColumn:!0,allowDragDrop:!0,menuOptions:{showSearchBoxAfter:30,searchBoxAutoFocus:!0,activateOnMouseOver:!0,adjustHeight:!0,itemRenderedCallback:null},attrPlacement:0,sortEntities:!1,columnRenderedCallback:null,customExpressionText:0,allowHiddenColumns:!1,showAddAllForEntity:!1,showIndicatorOnLoad:!0},n.landingSlot=(0,ut.domel)("div").addClass("".concat(n.cssPrefix,"-col-landing-slot")).addChildElement((0,ut.domel)("div").toDOM()).toDOM(),n.landingIndex=-1,n.slot.classList.add("".concat(n.cssPrefix,"-panel")),n.group=A.Query,n}return St(e,t),Object.defineProperty(e.prototype,"cssPrefix",{get:function(){return"eqjs-qc"},enumerable:!1,configurable:!0}),e.prototype.getWidgetType=function(){return"columnsPanel"},e.prototype.init=function(e,n){var o=this;t.prototype.init.call(this,e,n),this.setOptions(n),this.renderProgressBlock();var i=e.getModel();this.detachQueryObserver(),this.attachQueryObserver(),ut.eqDragManager.removeDropContainer(this.slot),this.options.allowDragDrop&&ut.eqDragManager.registerDropContainer({element:this.slot,scopes:["entityAttr","entityAttrSort"],onDragEnter:function(t,e){if(o.slot.classList.add("".concat(ct.YR,"-drophover")),"entityAttrSort"===e.item.scope)o.showLandingSlot(e.pageX,e.pageY);else{var n=e.data.attrId;i.checkAttrProperty(n,"useInResult")||(e.dropEffect=ut.DropEffect.Forbid),e.dragImage.classList.add("eqjs-sortable-helper")}},onDragOver:function(t,e){var n=e.data.attrId;("entityAttrSort"===e.item.scope||i.checkAttrProperty(n,"useInResult"))&&o.showLandingSlot(e.pageX,e.pageY)},onDragLeave:function(t,e){"entityAttrSort"===e.item.scope?e.dropEffect=ut.DropEffect.Forbid:(e.dragImage.classList.remove("eqjs-sortable-helper"),e.dragImage.style.removeProperty("width")),o.slot.classList.remove("".concat(ct.YR,"-drophover")),o.hideLandingSlot()},onDrop:function(t,e){if("entityAttrSort"==e.item.scope){var n=o.getQuery().getColumns().indexOf(e.data.column);o.moveColumnCore(n,o.landingIndex)}else{var i=e.data.attrId;o.addNewColumn(i,o.landingIndex)}}})},e.prototype.renderBaseElements=function(){var t=this,e=0;if(this.options.showHeader){var n=(0,ut.domel)("div",this.slot).hide().addClass("".concat(this.cssPrefix,"-header")).addClass(dt.z.getMobileCssClass()).addChild("div",(function(e){return e.addClass("".concat(t.cssPrefix,"-header-expression")).text(r.i18n.getText("HeaderExpression"))}));!1!==this.options.showColumnTitles&&n.addChild("div",(function(e){return e.addClass("".concat(t.cssPrefix,"-header-title")).text(r.i18n.getText("HeaderTitle"))})),this.headerElement=n.toDOM(),e+=this.headerElement.offsetHeight}this.columnsBlock=(0,ut.domel)("div",this.slot).addClass("".concat(this.cssPrefix,"-columns")).addClass(dt.z.getMobileCssClass()).toDOM(),this.options.showAddRow&&(this.addRowElement=(0,ut.domel)("div",this.slot).addClass("".concat(ct.YR,"-addrow"),"".concat(this.cssPrefix,"-addrow"),"".concat(ct.YR,"-addrow-empty")).addClass(dt.z.getMobileCssClass()).addChild("a",(function(e){return e.attr("href","javascript:void(0)").text(r.i18n.getText("CmdClickToAddColumn")).on("click",(function(e){e.preventDefault(),t.showEntitiesMenu({anchor:e.target,selectedIds:null,itemSelectedCallback:function(e,n){if("__AddAll__"===e.id&&e.extra&&Array.isArray(e.extra.ids))e.extra.ids.forEach((function(e){return t.addNewColumn(e)}));else{var o=e.id;t.addNewColumn(o)}return!1}})}))})).toDOM(),e+=this.addRowElement.offsetHeight),this.columnsBlock.style.maxHeight="".concat(this.slot.offsetHeight-e-25,"px")},e.prototype.destroyCore=function(){ut.eqDragManager.removeDropContainer(this.slot),this.detachQueryObserver(),this.slot.innerHTML=""},e.prototype.attachQueryObserver=function(){var t=this,e=this.getQuery();this.queryEventCallbackId=e.addChangedCallback((function(n){var o=n.data;if(o&&(o.part==x.Columns||o.part==x.Aggregation||o.part==x.All)){var i=document.activeElement,r=t.slot.contains(i)||i==document.body;switch(o.action){case w.Modify:var s=o.changee,a=function(e){var n=t.columnsBlock.querySelector("div[data-id='".concat(e.id,"']"));if(n){var o=t.getColumnRenderer(e,n);if(o){var i=o.render();if(r){var s=i.querySelector("a")||i.querySelector(".eqjs-column-button");s&&s.focus()}}}};Array.isArray(s)?s.forEach((function(t){return a(t)})):a(s),t.agjustHeaderVisibility();break;case w.Add:s=o.changee;var l=function(n){var o=e.getColumns().indexOf(n),i=t.addColumnElement(n,o);r&&i.querySelector("a").focus()};Array.isArray(s)?s.forEach((function(t){return l(t)})):l(s),t.agjustHeaderVisibility();break;case w.Delete:s=o.changee;var u=function(e){var n=t.columnsBlock.querySelector("div[data-id='".concat(e.id,"']"));if(n){var o=n.nextSibling,i=n.previousSibling;if(t.columnsBlock.removeChild(n),r){var s=o||i||t.addRowElement,a=s.querySelector("a")||s.querySelector(".eqjs-column-button");a&&a.focus()}}};t.agjustHeaderVisibility(),Array.isArray(s)?s.forEach((function(t){return u(t)})):u(s);break;default:t.refresh()}}}))},e.prototype.detachQueryObserver=function(){this.queryEventCallbackId&&this.getQuery().removeChangedCallback(this.queryEventCallbackId)},e.prototype.getQuery=function(){return this.getContext().getQuery()},e.prototype.showLandingSlot=function(t,e){for(var n=this.columnsBlock.querySelectorAll("[class*=".concat(this.cssPrefix,"-row]")),o=[],i=0;i<n.length;i++){var r=n[i];"none"!==r.style.display&&o.push(r)}if(0===o.length)return this.landingIndex=0,void this.columnsBlock.appendChild(this.landingSlot);var s=(0,ut.getElementAbsolutePos)(this.landingSlot);if(!(e>=s.y&&e<=s.y+this.landingSlot.offsetHeight)){var a=o[0],l=a.offsetHeight,u=(0,ut.getElementAbsolutePos)(a),c=e>u.y+l/2?Math.round((e-u.y+l/2)/l):0;c>o.length&&(c=o.length),c!=this.landingIndex&&(this.landingIndex=c,this.landingIndex<o.length?this.columnsBlock.insertBefore(this.landingSlot,o[this.landingIndex]):this.columnsBlock.appendChild(this.landingSlot),this.landingSlot.scrollIntoView({block:"center",behavior:"smooth"}))}},e.prototype.hideLandingSlot=function(){var t=this;this.landingIndex=-1,setTimeout((function(){t.landingSlot.parentElement&&t.landingSlot.parentElement.removeChild(t.landingSlot)}),10)},e.prototype.setOptions=function(t){r.utils.assignDeep(this.options,t),this.getContext().options.allowCustomExpressions=t.allowCustomExpressions,dt.z.isMobileMode()&&(this.options.buttons=["menu"],this.options.showHeader=!1)},e.prototype.onProcessStartCore=function(){this.options.showIndicatorOnLoad&&(this.progressBlock.parentNode||this.slot.appendChild(this.progressBlock))},e.prototype.onProcessEndCore=function(){this.options.showIndicatorOnLoad&&this.progressBlock.parentNode&&this.slot.removeChild(this.progressBlock)},e.prototype.refreshCore=function(){this.clear(),this.render()},e.prototype.clear=function(){this.slot.innerHTML=""},e.prototype.render=function(){try{this.renderBaseElements(),this.createEntitiesMenu(),this.createColumnMenus(),this.agjustHeaderVisibility(),(0,ut.domel)(this.slot).removeClass(ct.XD).addClass(dt.z.getMobileCssClass());for(var t=this.context.getQuery().getColumns(),e=0,n=t;e<n.length;e++){var o=n[e];this.columnsBlock.appendChild(this.renderColumn(o))}}catch(t){var i=t;this.context.throwError({action:"ColumnsPanel rendering",text:i.message,sourceError:i})}},e.prototype.agjustHeaderVisibility=function(){if(this.headerElement){var t=this.context.getQuery().getColumns();this.headerElement.style.display=t.length?"":"none"}},e.prototype.renderColumn=function(t){var e=this.getColumnRenderer(t);return e?e.render():null},e.prototype.toggleColumnPicked=function(t){var e,n;t&&(e=this.columnsBlock.querySelector("div[data-id=".concat(t.id,"]")))&&(n=e.classList.contains("active"));for(var o=this.columnsBlock.querySelectorAll(".".concat(this.cssPrefix,"-row")),i=0;i<o.length;i++){var r=o[i];(0,ut.domel)(r).removeClass("active"),this.options.alwaysShowButtons||(0,ut.domel)(r).data("show-buttons",null)}e&&!n&&(0,ut.domel)(e).addClass("active").data("show-buttons","")},e.prototype.addNewColumn=function(t,e){var n,o,i=this,r=this.getContext().getModel(),s=this.getQuery(),a=function(t){var e=r.getAttributeById(t);if(!e)return null;if(!e.useInResult){if(!e.lookupAttr)return null;if(t=e.lookupAttr,!(e=r.getAttributeById(t))||!e.useInResult)return null}var n=s.createColumn();return n.caption=i.getDefaultColumnCaption(e),n.sorting=E.None,n.sortIndex=-1,n.expr.tag=p.EntityAttribute,n.expr.kind=l.Attribute,n.expr.dataType=e.dataType,n.expr.setValue(t,!0),n.params.concat(e.params),n};if(Array.isArray(t)){n=[];for(var u=0;u<t.length;u++)(o=a(t[u]))&&n.push(o)}else n=a(t);return this.addColumn(n,e),n},e.prototype.addColumn=function(t,e){var n=this.getQuery();n&&(!(t=Array.isArray(t)?this.checkColumnsArray(t):this.checkColumn(t))||Array.isArray(t)&&0==t.length||(n.addColumnObj(t,e,self),n.fireColumnsChangedEvent(w.Add,t)))},e.prototype.addColumnElement=function(t,e){var n=this.columnsBlock.querySelectorAll("[class*=".concat(this.cssPrefix,"-row]")),o=this.renderColumn(t);return n.length>0&&e<n.length?this.columnsBlock.insertBefore(o,n[e]):(this.columnsBlock.appendChild(o),this.scrollToBottom()),this.options.columnRenderedCallback&&this.options.columnRenderedCallback(o),o},e.prototype.scrollToBottom=function(){this.columnsBlock.scrollTop=this.columnsBlock.scrollHeight-this.columnsBlock.clientHeight},e.prototype.checkColumnsArray=function(t){for(var e=t.length,n=[],o=0;o<e;o++)this.checkColumn(t[o])&&n.push(t[o]);return n},e.prototype.checkColumn=function(t){if(!this.options.allowDuplicates)for(var e=this.getQuery().getColumns(),n=0;n<e.length;n++)if((t.expr.tag===p.EntityAttribute&&e[n].expr.tag===p.EntityAttribute||t.expr.tag===p.ParentEntityAttribute&&e[n].expr.tag===p.ParentEntityAttribute)&&t.expr.value===e[n].expr.value)return null;return t},e.prototype.getDefaultColumnCaption=function(t){var e=this.options.titleElementFormat||this.options.attrElementFormat;return this.getContext().getModel().getAttributeText(t,e)},e.prototype.getColumnsBlock=function(){return this.columnsBlock},e.prototype.getColumnRenderer=function(t,e){switch(t.expr.tag){case p.AggregateFunction:return new Et(this,t,e);case p.CustomSql:return new Dt(this,t,e);case p.EntityAttribute:case p.ParentEntityAttribute:return new xt(this,t,e)}return null},e.prototype.areCustomExpressionsAllowed=function(){return this.getQuery().isEx()&&this.getContext().options.allowCustomExpressions},e.prototype.addAllColumnsToEntitiesList=function(t){var e=this,n=t.filter((function(t){return!t.isEntity})).map((function(t){return t.id}));n.length>0&&t.unshift({id:"__AddAll__",text:r.i18n.getText("AddAllForEntityText"),extra:{ids:n}}),t.forEach((function(t){t.items&&e.addAllColumnsToEntitiesList(t.items)}))},e.prototype.createEntitiesMenu=function(){var t=this.getContext().getModel();if(!t||t.isEmpty())return null;var e=this.slot.id;e&&(e+="-EntitiesMenu");var n=t.getEntitiesTree({addUIC:!1,addUIR:!0,addUIS:!1,attrPlacement:this.options.attrPlacement,sortEntities:this.options.sortEntities});this.options.showAddAllForEntity&&this.addAllColumnsToEntitiesList(n);var o={id:e,items:n,adjustHeight:this.options.adjustEntitiesMenuHeight,domWriteItemsId:this.options.domWriteItemsId};r.utils.assign(o,this.options.menuOptions),this.entitiesMenu=new gt(o)},e.prototype.getSortMenuList=function(){return[{id:"None",text:r.i18n.getText("CmdNotSorted")},{id:"Ascending",text:r.i18n.getText("CmdAscending")},{id:"Descending",text:r.i18n.getText("CmdDescending")},{id:"---",text:"---"}]},e.prototype.getMoveMenuList=function(){return[{id:"MoveTop",text:r.i18n.getText("CmdMoveToFirst")},{id:"MoveUp",text:r.i18n.getText("CmdMoveToPrev")},{id:"MoveDown",text:r.i18n.getText("CmdMoveToNext")},{id:"MoveBottom",text:r.i18n.getText("CmdMoveToLast")}]},e.prototype.createSortMenu=function(){var t=this.getContext().getModel();if(!t||t.isEmpty())return null;var e=this.slot.id;e&&(e+="-SortMenu");var n={id:e,items:this.getSortMenuList().concat(this.moveMenu.getItems()),domWriteItemsId:this.options.domWriteItemsId,showSelected:!0};r.utils.assign(n,this.options.menuOptions),n.searchBoxAlwaysShown=!1,this.sortMenu=new gt(n)},e.prototype.createMoveMenu=function(){var t=this.getContext().getModel();if(!t||t.isEmpty())return null;var e=this.slot.id;e&&(e+="-MoveMenu");var n=r.utils.createArrayFrom(this.getMoveMenuList());this.options.allowHiddenColumns&&(n.push({id:"---",text:"---"}),n.push({id:"IsHidden",text:r.i18n.getText("CmdHiddenColumn")}));var o={items:n,id:e,domWriteItemsId:this.options.domWriteItemsId,showSelected:!0};r.utils.assign(o,this.options.menuOptions),this.moveMenu=new gt(o),o.searchBoxAlwaysShown=!1},e.prototype.showEntitiesMenu=function(t){this.entitiesMenu.showMenu(t)},e.prototype.moveColumn=function(t,e){var n=this.getQuery().getColumns(),o=n.indexOf(t);if(o>=0)switch(e){case"MoveTop":if(0==o)return;this.moveColumnCore(o,0);break;case"MoveUp":if(0==o)return;this.moveColumnCore(o,o-1);break;case"MoveDown":if(o==n.length-1)return;this.moveColumnCore(o,o+1);break;case"MoveBottom":if(o==n.length-1)return;this.moveColumnCore(o,n.length-1)}},e.prototype.moveColumnCore=function(t,e){var n=this.getQuery();if(n){var o=this.columnsBlock.querySelectorAll("[class*=".concat(this.cssPrefix,"-row]")),i=o[t];0==e?this.columnsBlock.insertBefore(i,this.columnsBlock[0]):e>0&&e<o.length-1?t<e?this.columnsBlock.insertBefore(i,o[e+1]):this.columnsBlock.insertBefore(i,o[e]):this.columnsBlock.appendChild(i),n.moveColumn(t,e),n.fireColumnsChangedEvent()}},e.prototype.createColumnMenus=function(){this.createMoveMenu(),this.options.allowSorting&&this.createSortMenu()},e.prototype.renderProgressBlock=function(){this.progressBlock=document.createElement("div"),this.progressBlock.classList.add("".concat(ct.YR,"-progress-win8")),this.progressBlock.classList.add(dt.z.getMobileCssClass()),this.progressBlock.innerHTML='<div class="wBall" id="wBall_1"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_2"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_3"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_4"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_5"><div class="wInnerBall"></div></div>'},e}(st),Mt=function(){function t(t,e,n){this.functionMenu=null,this.formatsMenu=null,this.isMouseOverBlock=!1,this.keepShowingButtons=!1,this.tapedTwice=!1,this.bar=t,this.column=e,this.element=n}return Object.defineProperty(t.prototype,"cssPrefix",{get:function(){return"eqjs-cb"},enumerable:!1,configurable:!0}),t.prototype.render=function(){var t=this;this.baseAttr=this.getAttribute();var e=(0,ut.domel)("div");return e.data("id",this.column.id),this.element&&this.element.parentNode.replaceChild(e.toDOM(),this.element),this.element=e.toDOM(),this.bar.options.allowDragDrop&&ut.eqDragManager.registerDraggableItem({element:this.element,scope:"entityAttrSort",beforeDragStart:function(){return t.element.dispatchEvent((0,ut.createBrowserEvent)("mouseleave"))},onDragStart:function(e){t.hideButtons(),t.element.style.display="none",e.dropEffect=ut.DropEffect.Allow},onDragEnd:function(e){e.data.finishedSuccessfully||t.element.removeAttribute("style")},data:{column:this.column}}),this.column.isReadOnly()||(this.createFunctionMenu(),this.createFormatsMenu()),e.addClass(this.getClassesToAdd()).addClass(dt.z.getMobileCssClass()).addChildElement(this.renderCaptionBlock()).addChildElement(this.renderSortingImage()),dt.z.isMobileMode()||e.addChildElement(this.renderButtonsBlock()),e.on("mouseenter",this.onMouseEnter.bind(this)).on("mouseleave",this.onMouseLeave.bind(this)),(this.bar.options.accentActiveColumn||dt.z.isMobileMode())&&e.on("touchstart click",this.onMouseClick.bind(this)),this.element},t.prototype.fireColumnChanged=function(){this.column.fireChangedEvent()},t.prototype.refresh=function(){this.render()},t.prototype.getAttribute=function(){return this.bar.getContext().getModel().getAttributeByIdSafe(this.column.expr.value)},t.prototype.isEditable=function(){return this.column.enabled&&!this.column.isReadOnly()},t.prototype.renderButtonsBlock=function(){return(0,ut.domel)("div",this.element).addClass("".concat(ct.YR,"-column-buttonsBlock"),"".concat(this.cssPrefix,"-buttonsBlock")).addChildElement(this.renderSortingButton()).addChildElement(this.renderColumnTypeButton()).addChildElement(this.renderColumnFormatButton()).addChildElement(this.renderDeleteButton()).toDOM()},t.prototype.renderCaptionBlock=function(){var t=this;this.column.caption&&""!=this.column.caption||(this.column.caption=this.getDefaultCaption());var e=this.column.getModel(),n=this.baseAttr!==e.nullAttribute?this.column.caption:e.getAttributeText(e.nullAttribute,"{attr}");if(!this.isEditable())return(0,ut.domel)("div").addClass("".concat(this.cssPrefix,"-colelement"),"".concat(this.cssPrefix,"-captionelement")).addClass(dt.z.getMobileCssClass()).addChild("div",(function(e){return e.title(t.column.caption).text(n).attr("tabIndex","0")})).toDOM();var o=!1;return(0,ut.domel)(this.element).on("touchstart dblclick",(function(e){if(e instanceof TouchEvent&&!t.tapedTwice)return t.tapedTwice||(t.tapedTwice=!0,setTimeout((function(){t.tapedTwice=!1}),300)),!0;e.stopPropagation(),o=t.element.querySelector("a")==document.activeElement;var n=t.element.querySelector(".".concat(t.cssPrefix,"-captionelement input")),i=t.element.querySelector(".".concat(t.cssPrefix,"-captionelement a"));return n&&(n.style.width="".concat(t.element.clientWidth,"px"),i.style.display="none",n.style.removeProperty("display"),n.focus(),t.element.setAttribute(ut.eqDragManager.DRAG_DISABLED_ATTR,"")),!1})),(0,ut.domel)("div").addClass("".concat(this.cssPrefix,"-colelement"),"".concat(this.cssPrefix,"-captionelement")).addClass(dt.z.getMobileCssClass()).addChild("a",(function(e){return e.attr("href","javascript:void(0)").title(t.column.caption).text(n).on("keydown",(function(e){var n=e;if((n.ctrlKey||n.metaKey)&&(13==n.keyCode||10==n.keyCode)&&t.isColumnActive()){var o=document.createEvent("MouseEvents");return o.initEvent("dblclick",!0,!0),t.element.dispatchEvent(o),n.stopPropagation(),!1}return!0}))})).addChild("input",(function(e){return e.hide().value(t.column.caption).on("blur keydown",(function(e){var n=!1,i=!0;if(e instanceof KeyboardEvent?13===e.keyCode?n=!0:27===e.keyCode&&(n=!0,i=!1):e instanceof FocusEvent&&(n=!0),n){var r=e.target,s=r.parentElement.querySelector("a");s&&(s.style.removeProperty("display"),r.style.display="none"),i&&t.column.caption!==r.value?(t.column.caption=r.value,t.fireColumnChanged()):r.value=t.column.caption,t.element.removeAttribute(ut.eqDragManager.DRAG_DISABLED_ATTR),o&&t.element.querySelector("a").focus()}}))})).toDOM()},t.prototype.renderSortingImage=function(){var t=this,e="".concat(ct.YR,"-column-sortbutton"),n=e;switch(this.column.sorting){case E.Ascending:n="".concat(e,"-asc");break;case E.Descending:n="".concat(e,"-desc")}return this.column.sorting==E.None?null:(0,ut.domel)("div").addClass("".concat(this.cssPrefix,"-colelement"),"".concat(this.cssPrefix,"-sortimage-placeholder")).addClass(dt.z.getMobileCssClass()).addChild("div",(function(e){return e.addClass("".concat(t.cssPrefix,"-img-sorting"),n).title(r.i18n.getText("ButtonSorting"))})).toDOM()},t.prototype.buttonSortingClickHandler=function(t,e){var n=this;return t.stopPropagation(),this.keepShowingButtons=!0,(this.getUIS()&&this.bar.sortMenu||this.bar.moveMenu).showMenu({anchor:e,selectedIds:null,itemSelectedCallback:function(t,e){var o;if("None"==t.id||"Ascending"==t.id||"Descending"==t.id){var i=n.bar.getQuery();n.column.sorting="None"==(o=t.id)?E.None:"Ascending"==o?E.Ascending:"Descending"==o?E.Descending:void 0,n.column._sortIndex=i.getColumnSortIndex(n.column),n.fireColumnChanged()}else n.bar.moveColumn(n.column,t.id)},menuClosedCallback:function(){n.keepShowingButtons=!1,n.isMouseOverBlock||n.leaveButtonBlock()}}),!1},t.prototype.renderSortingButton=function(){var t=this;if(!this.isEditable())return null;var e=(0,ut.domel)("div").addClass("".concat(ct.YR,"-column-button"),"".concat(ct.YR,"-column-sortbutton"),"".concat(ct.YR,"-column-sortbutton-none")).title(r.i18n.getText("ButtonSorting")).attr("tabIndex","0").on("touchstart click",(function(n){return t.buttonSortingClickHandler(n,e.toDOM())})).on("keypress",(function(t){13==t.keyCode&&t.target.click()}));return e.toDOM()},t.prototype.buttonDeleteClickHandler=function(t){t.stopPropagation();var e=this.bar.getQuery();return e.removeColumn(this.column,this.bar),e.fireColumnsChangedEvent(w.Delete,this.column),!1},t.prototype.renderDeleteButton=function(){var t=this;return this.column.isReadOnly()?null:(0,ut.domel)("div").addClass("".concat(ct.YR,"-column-button"),"".concat(ct.YR,"-column-button-delete")).title(r.i18n.getText("CmdDelete")).attr("tabIndex","0").on("touchstart click",(function(e){return t.buttonDeleteClickHandler(e)})).on("keypress",(function(t){13==t.keyCode&&t.target.click()})).toDOM()},t.prototype.getDefaultCaption=function(){return this.getDefaultTitleText(this.baseAttr)},t.prototype.getDefaultTitleText=function(t){var e=this.bar.options.titleElementFormat||this.bar.options.attrElementFormat;return this.bar.getContext().getModel().getAttributeText(t,e)},t.prototype.getClassesToAdd=function(){var t="";return t+=this.column.enabled?"":" ".concat(this.cssPrefix,"-disabled"),this.column.enabled&&(t+=this.column.isReadOnly()?" ".concat(this.cssPrefix,"-readonly"):""),t},t.prototype.buttonTypeClickHandler=function(t){return t.stopPropagation(),this.keepShowingButtons=!0,this.changeColumnTypeHandler(t),!1},t.prototype.buttonFormatClickHandler=function(t){return t.stopPropagation(),this.keepShowingButtons=!0,this.changeFormatHandler(t),!1},t.prototype.formatButtonIsShown=function(){return!1!==this.bar.options.allowDisplayFormatChange&&this.bar.getContext().getModel().getDisplayFormatsForType(this.column.getDataType()).length>0},t.prototype.changeFormatHandler=function(t){var e=this,n=this.bar.getContext().getModel().getDisplayFormatsForType(this.column.getDataType()),o="{0:__default}";n.filter((function(t){return t.format==e.column.displayFormat})).length>0&&(o=this.column.displayFormat),this.formatsMenu.showMenu({anchor:t.target,selectedIds:o,itemSelectedCallback:function(t,n){return t.id!=o&&("{0:__default}"==t.id?e.column.displayFormat="":e.column.displayFormat=t.id,e.column.fireChangedEvent()),!1},menuClosedCallback:function(){e.keepShowingButtons=!1,e.isMouseOverBlock||e.element.dispatchEvent((0,ut.createBrowserEvent)("mouseleave"))}})},t.prototype.renderColumnTypeButton=function(){var t=this;return this.isEditable()&&!1!==this.bar.options.allowAggrColumns?(0,ut.domel)("div").addClass("".concat(ct.YR,"-column-button"),"".concat(ct.YR,"-column-button-type")).title(r.i18n.getText("ButtonToAggr")).attr("tabIndex","0").on("touchstart click",(function(e){return t.buttonTypeClickHandler(e)})).on("keypress",(function(t){13==t.keyCode&&t.target.click()})).toDOM():null},t.prototype.renderColumnFormatButton=function(){var t=this;return this.isEditable()&&this.formatButtonIsShown()?(0,ut.domel)("div").addClass("".concat(ct.YR,"-column-button"),"".concat(ct.YR,"-column-button-format")).title(r.i18n.getText("ButtonFormat")).attr("tabIndex","0").on("touchstart click",(function(e){return t.buttonFormatClickHandler(e)})).on("keypress",(function(t){13==t.keyCode&&t.target.click()})).toDOM():null},t.prototype.getUIS=function(){return this.bar.getContext().getModel().checkAttrProperty(this.column.expr.value,"useInSorting")},t.prototype.onMouseClick=function(t){this.bar.toggleColumnPicked(this.column),this.adjustButtonsVisibility()},t.prototype.onMouseEnter=function(t){if(!dt.z.isMobileMode())return this.isMouseOverBlock=!0,this.enterButtonBlock(),t.stopPropagation(),!1},t.prototype.onMouseLeave=function(t){if(!dt.z.isMobileMode())return this.isMouseOverBlock=!1,this.leaveButtonBlock(),t.stopPropagation(),!1},t.prototype.isColumnActive=function(){return this.element.classList.contains("active")},t.prototype.hideButtons=function(){dt.z.isMobileMode()?this.onHideButtonsMobile&&this.onHideButtonsMobile():(0,ut.domel)(this.element).data("show-buttons",null)},t.prototype.showButtons=function(){dt.z.isMobileMode()?this.onShowButtonsMobile&&this.onShowButtonsMobile():(0,ut.domel)(this.element).data("show-buttons","")},t.prototype.adjustButtonsVisibility=function(){this.bar.options.alwaysShowButtons||(this.bar.options.accentActiveColumn||dt.z.isMobileMode())&&this.isColumnActive()?this.showButtons():this.hideButtons()},t.prototype.enterButtonBlock=function(){this.showButtons()},t.prototype.leaveButtonBlock=function(){1==this.bar.options.alwaysShowButtons||this.isColumnActive()&&1==this.bar.options.accentActiveColumn||this.hideButtons()},t.prototype.createFunctionMenu=function(){for(var t,e=[],n=this.bar.getContext().getModel().getAggrFunctions(),o=!0,i=null,s=this.column.getDataType(),a=0,l=n;a<l.length;a++){var u=l[a];if(u){var c=u.getAppliedTypesOrDefault().indexOf(s)>=0;this.column.expr.func!==u.id||c||(o=!1),c&&(t=this.bar.getContext().getModel().getAggrFunctionCaption(u.id),i={id:u.id,text:t},e.push(i))}}o||(this.column.expr.func=e[0].id),this.bar.areCustomExpressionsAllowed()&&(i={id:"CustomSqlDivider",text:"---"},e.push(i),i={id:"CUSTOMSQL",text:t=r.i18n.getText("CustomExpression")},e.push(i));var d=this.element.id;d&&(d+="-FunctionsMenu");var h={items:e,id:d,searchBoxAlwaysShown:!1,domWriteItemsId:!0};this.functionMenu=new gt(h)},t.prototype.createFormatsMenu=function(){if(0!=this.bar.options.allowDisplayFormatChange){var t=this.column.id;t&&(t+="-FormatsMenu");var e={items:this.getFormatsMenuItems(),id:t,searchBoxAlwaysShown:!1,showSelected:!0,domWriteItemsId:!0};this.formatsMenu=new gt(e)}},t.prototype.getFormatsMenuItems=function(){var t=this.bar.getContext().getModel().getDisplayFormatsForType(this.column.getDataType());return[{id:"{0:__default}",text:"Default"}].concat(t.map((function(t){return{id:t.format,text:r.i18n.getText("DisplayFormats",t.name)||t.name}})))},t}(),It=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Bt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return It(e,t),e.prototype.getClassesToAdd=function(){return"".concat(t.prototype.getClassesToAdd.call(this)," ").concat(this.cssPrefix,"-row ").concat(this.cssPrefix,"-row-column-entattr")},e.prototype.baseExpressionItemSelectedCallback=function(t,e){var n=t.id;this.column.expr.setValue(n,!0),this.column.caption="",this.refresh(),this.fireColumnChanged()},e.prototype.getUIS=function(){var t=this.column.expr.args[0];return!t||this.bar.getContext().getModel().checkAttrProperty(t.value,"useInSorting")},e.prototype.changeTypeToCustomSql=function(){this.column.getQuery().changeColumnType(this.column,p.CustomSql),this.fireColumnChanged()},e.prototype.changeTypeToAggr=function(t){this.column.getQuery().changeColumnType(this.column,p.AggregateFunction,{funcId:t}),this.fireColumnChanged()},e.prototype.changeColumnTypeHandler=function(t){var e=this;this.functionMenu.showMenu({anchor:t.target,selectedIds:null,itemSelectedCallback:function(t,n){return"CUSTOMSQL"==t.id?e.changeTypeToCustomSql():e.changeTypeToAggr(t.id),!1},menuClosedCallback:function(){e.keepShowingButtons=!1,e.isMouseOverBlock||e.element.dispatchEvent((0,ut.createBrowserEvent)("mouseleave"))}})},e}(Mt),At=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),_t=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return At(e,t),e.prototype.getClassesToAdd=function(){return"".concat(t.prototype.getClassesToAdd.call(this)," ").concat(this.cssPrefix,"-row ").concat(this.cssPrefix,"-row-column-aggr")},e.prototype.getAttribute=function(){return this.bar.getContext().getModel().getAttributeByIdSafe(this.column.expr.args[0].value)},e.prototype.getDefaultCaption=function(){return this.getDefaultTitleText(this.baseAttr)+" "+this.bar.getContext().getModel().getAggrFunctionCaption(this.column.expr.func)},e.prototype.renderColumnTypeButton=function(){var e=t.prototype.renderColumnTypeButton.call(this);return e&&(e.classList.add("aggregated"),e.title=r.i18n.getText("ButtonToSimple")),e},e.prototype.baseExpressionItemSelectedCallback=function(t,e){var n=t.id;this.column.expr.args[0].setValue(n,!0),this.column.caption="",this.fireColumnChanged()},e.prototype.changeTypeToSimple=function(){this.column.getQuery().changeColumnType(this.column,p.EntityAttribute),this.fireColumnChanged()},e.prototype.changeColumnTypeHandler=function(t){this.changeTypeToSimple()},e}(Bt),Pt=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Ot=function(t){function e(e,n){var o=t.call(this,e)||this;return o.options={isSubQuery:!1,activeColumn:null,showAddRow:!0,showHeader:!0,showColumnTitles:!0,allowAggrColumns:!0,allowDuplicates:!0,allowCustomExpressions:!1,allowSorting:!0,attrElementFormat:"{entity} {attr}",titleElementFormat:null,alwaysShowButtons:!1,accentActiveColumn:!0,allowDragDrop:!0,menuOptions:{showSearchBoxAfter:30,searchBoxAutoFocus:!0,activateOnMouseOver:!0,adjustHeight:!0,itemRenderedCallback:null},attrPlacement:0,sortEntities:!1,columnRenderedCallback:null,customExpressionText:0},o.landingSlot=(0,ut.domel)("div").addClass("".concat(ct.YR,"-highlight")).toDOM(),o.landingIndex=-1,o.sortMenuList=[{id:"None",text:r.i18n.getText("CmdNotSorted")},{id:"Ascending",text:r.i18n.getText("CmdAscending")},{id:"Descending",text:r.i18n.getText("CmdDescending")},{id:"---",text:"---"}],o.moveMenuList=[{id:"MoveTop",text:r.i18n.getText("CmdMoveToFirst")},{id:"MoveUp",text:r.i18n.getText("CmdMoveToPrev")},{id:"MoveDown",text:r.i18n.getText("CmdMoveToNext")},{id:"MoveBottom",text:r.i18n.getText("CmdMoveToLast")}],(0,ut.domel)(o.slot).addClass("".concat(o.cssPrefix,"-panel")).addClass(dt.z.getMobileCssClass()),o.group=A.Query,o.customQuery=n,o}return Pt(e,t),Object.defineProperty(e.prototype,"cssPrefix",{get:function(){return"eqjs-cb"},enumerable:!1,configurable:!0}),e.prototype.getWidgetType=function(){return"columnsBar"},e.prototype.init=function(e,n){var o=this;t.prototype.init.call(this,e,n),this.setOptions(n),this.detachQueryObserver(),this.attachQueryObserver(),ut.eqDragManager.removeDropContainer(this.slot),this.options.allowDragDrop&&ut.eqDragManager.registerDropContainer({element:this.slot,scopes:["entityAttrSort"],onDragEnter:function(t,e){o.showLandingSlot(e.pageX,e.pageY)},onDragOver:function(t,e){o.showLandingSlot(e.pageX,e.pageY)},onDragLeave:function(t,e){e.dropEffect=ut.DropEffect.Forbid,o.hideLandingSlot()},onDrop:function(t,e){if(o.landingIndex>=0){var n=o.getQuery().getColumns().indexOf(e.data.column);o.moveColumnCore(n,o.landingIndex)}else e.item.element.removeAttribute("style")}})},e.prototype.attachQueryObserver=function(){var t=this,e=this.getQuery();this.queryEventCallbackId=e.addChangedCallback((function(n){var o=n.data;if(o&&(o.part==x.Columns||o.part==x.Aggregation||o.part==x.All)){var i=document.activeElement,r=t.slot.contains(i)||i==document.body;switch(o.action){case w.Modify:var s=o.changee,a=function(e){var n=t.columnsBlock.querySelector("div[data-id='".concat(e.id,"']"));if(n){var o=t.renderColumn(e,n);if(r){var i=o.querySelector("a");i&&i.focus()}}};Array.isArray(s)?s.forEach((function(t){return a(t)})):a(s);break;case w.Add:s=o.changee;var l=function(n){var o=e.getColumns().indexOf(n);t.addColumnElement(n,o)};Array.isArray(s)?s.forEach((function(t){return l(t)})):l(s);break;case w.Delete:s=o.changee;var u=function(e){var n=t.columnsBlock.querySelector("div[data-id='".concat(e.id,"']"));if(n){var o=n.nextSibling,i=n.previousSibling;if(t.columnsBlock.removeChild(n),r){var s=(o||i||t.addRowButton).querySelector("a");s&&s.focus()}}};Array.isArray(s)?s.forEach((function(t){return u(t)})):u(s);break;default:t.refresh()}}}))},e.prototype.getQuery=function(){return this.customQuery?this.customQuery:this.getContext().getQuery()},e.prototype.destroyCore=function(){ut.eqDragManager.removeDropContainer(this.slot),this.detachQueryObserver(),this.slot.innerHTML=""},e.prototype.detachQueryObserver=function(){this.queryEventCallbackId&&this.getQuery().removeChangedCallback(this.queryEventCallbackId)},e.prototype.setOptions=function(t){this.options=r.utils.assignDeep(this.options,t)},e.prototype.showLandingSlot=function(t,e){for(var n=this.columnsBlock.querySelectorAll("[class*=".concat(this.cssPrefix,"-row]")),o=[],i=0;i<n.length;i++)"none"!==n[i].style.display&&o.push(n[i]);if(0!==o.length){var r=(0,ut.getElementAbsolutePos)(this.landingSlot);if(!(t>=r.x&&t<=r.x+this.landingSlot.offsetWidth&&e>=r.y&&e<=r.y+this.landingSlot.offsetHeight)){var s=this.landingIndex;for(i=0;i<o.length;i++){var a=o[i],l=(0,ut.getElementAbsolutePos)(a),u=a.offsetWidth,c=a.offsetHeight,d=.2*u;if(t>=l.x+d&&t<=l.x+u-d&&e>=l.y+2&&e<=l.y+c-2){s=t>r.x?i+1:i;break}}(s!=this.landingIndex||this.landingSlot.parentElement)&&(this.landingIndex=s,this.landingIndex<=0&&this.columnsBlock.insertBefore(this.landingSlot,o[0]),this.landingIndex<o.length?this.columnsBlock.insertBefore(this.landingSlot,o[this.landingIndex]):this.columnsBlock.appendChild(this.landingSlot))}}else this.landingIndex=0},e.prototype.hideLandingSlot=function(){this.landingIndex=-1,this.landingSlot.parentElement&&this.landingSlot.parentElement.removeChild(this.landingSlot)},e.prototype.onProcessStartCore=function(){},e.prototype.onProcessEndCore=function(){},e.prototype.refreshCore=function(){this.clear(),this.render()},e.prototype.clear=function(){this.slot.innerHTML=""},e.prototype.renderAddRowButton=function(){var t=this;(0,ut.domel)(this.addRowButton).addClass("".concat(ct.YR,"-addrow"),"".concat(this.cssPrefix,"-addrow"),"".concat(ct.YR,"-addrow-empty")).addClass(dt.z.getMobileCssClass()).title(r.i18n.getText("CmdClickToAddColumn")).addChild("a",(function(e){return e.attr("href","javascript:void(0)").on("click",(function(e){e.preventDefault(),t.showEntitiesMenu({anchor:e.target,selectedIds:null,itemSelectedCallback:function(e,n){var o=e.id;return t.addNewColumn(o),!1}})}))})),dt.z.isMobileMode()&&(0,ut.domel)(this.columnsBlock).addChildElement(this.addRowButton)},e.prototype.render=function(){var t=this;this.createEntitiesMenu(),this.options.allowSorting&&this.createSortMenu(),this.createMoveMenu(),this.columnsBlock=(0,ut.domel)("div").addClass("".concat(this.cssPrefix,"-columns")).addClass(dt.z.getMobileCssClass()).toDOM(),this.options.showAddRow&&(this.addRowButton=(0,ut.domel)("div").toDOM(),dt.z.isMobileMode()?(0,ut.domel)(this.columnsBlock).addChildElement(this.addRowButton):(0,ut.domel)(this.slot).addChildElement(this.addRowButton),this.renderAddRowButton()),(0,ut.domel)(this.slot).addChildElement(this.columnsBlock).addChildElement(this.renderColumnButtonsBlockMobile()),this.getQuery().getColumns().forEach((function(e,n){var o=t.renderColumn(e);t.columnsBlock.appendChild(o)}))},e.prototype.renderColumnButtonsBlockMobile=function(){var t=this;return this.columnButtonsBlockMobileArrow=(0,ut.domel)("i").toDOM(),this.columnButtonsBlockMobile=(0,ut.domel)("div").addClass("".concat(this.cssPrefix,"-column-buttonsBlock")).addClass(dt.z.getMobileCssClass()).addChildElement(this.columnButtonsBlockMobileArrow).hide().toDOM(),this.buttonsBlockSortingButton=(0,ut.domel)("div",this.columnButtonsBlockMobile).addClass("".concat(this.cssPrefix,"-column-button"),"".concat(this.cssPrefix,"-column-sortbutton-none")).toDOM(),(0,ut.domel)(this.buttonsBlockSortingButton).on("touchstart click",(function(e){return e.stopPropagation(),t.currentColumnRenderer.buttonSortingClickHandler.call(t.currentColumnRenderer,e,t.buttonsBlockSortingButton),t.toggleColumnPicked(null),t.hideColumnButtonsMobile(),!1})),this.buttonsBlockTypeButton=(0,ut.domel)("div",this.columnButtonsBlockMobile).addClass("".concat(this.cssPrefix,"-column-button"),"".concat(this.cssPrefix,"-column-button-type")).on("touchstart click",(function(e){return e.stopPropagation(),t.currentColumnRenderer.buttonTypeClickHandler.call(t.currentColumnRenderer,e),t.toggleColumnPicked(null),t.hideColumnButtonsMobile(),!1})).toDOM(),this.buttonsBlockFormatButton=(0,ut.domel)("div",this.columnButtonsBlockMobile).addClass("".concat(this.cssPrefix,"-column-button"),"".concat(this.cssPrefix,"-column-button-format")).on("touchstart click",(function(e){return e.stopPropagation(),t.currentColumnRenderer.buttonFormatClickHandler.call(t.currentColumnRenderer,e),t.toggleColumnPicked(null),t.hideColumnButtonsMobile(),!1})).toDOM(),this.buttonsBlockDeleteButton=(0,ut.domel)("div",this.columnButtonsBlockMobile).addClass("".concat(this.cssPrefix,"-column-button"),"".concat(this.cssPrefix,"-column-button-delete")).on("touchstart click",(function(e){return e.stopPropagation(),t.currentColumnRenderer.buttonDeleteClickHandler.call(t.currentColumnRenderer,e),t.toggleColumnPicked(null),t.hideColumnButtonsMobile(),!1})).toDOM(),(0,ut.domel)("div",this.columnButtonsBlockMobile).addClass("".concat(this.cssPrefix,"-column-button-close-block")).on("touchstart click",(function(){t.toggleColumnPicked(null),t.hideColumnButtonsMobile()})),this.columnButtonsBlockMobile},e.prototype.showColumnButtonsMobile=function(t,e,n){this.currentActiveColumn=t,this.currentColumnRenderer=e;var o=n.getBoundingClientRect(),i=n.offsetTop,r=n.offsetLeft;(0,ut.domel)(this.columnButtonsBlockMobileArrow).setStyle("left",(r+o.width/2).toString()+"px"),o.top>100?(0,ut.domel)(this.columnButtonsBlockMobile).removeClass("show-below").setStyle("top",(i-o.height).toString()+"px"):(0,ut.domel)(this.columnButtonsBlockMobile).addClass("show-below").setStyle("top",(i+o.height).toString()+"px"),t.enabled&&!t.isReadOnly()?((0,ut.domel)(this.buttonsBlockSortingButton).show(),(0,ut.domel)(this.buttonsBlockTypeButton).show(),e.formatButtonIsShown()?(0,ut.domel)(this.buttonsBlockFormatButton).show():(0,ut.domel)(this.buttonsBlockFormatButton).hide()):((0,ut.domel)(this.buttonsBlockSortingButton).hide(),(0,ut.domel)(this.buttonsBlockTypeButton).hide()),t.isReadOnly()?(0,ut.domel)(this.columnButtonsBlockMobile).hide():(0,ut.domel)(this.columnButtonsBlockMobile).show()},e.prototype.hideColumnButtonsMobile=function(){(0,ut.domel)(this.columnButtonsBlockMobile).hide()},e.prototype.renderColumn=function(t,e){var n=this,o=this.getColumnRenderer(t,e);if(o){var i=o.render();return o.onShowButtonsMobile=function(){n.showColumnButtonsMobile(t,o,i)},o.onHideButtonsMobile=function(){n.hideColumnButtonsMobile()},i}return null},e.prototype.getColumnRenderer=function(t,e){switch(t.expr.tag){case p.AggregateFunction:return new _t(this,t,e);case p.CustomSql:case p.EntityAttribute:case p.ParentEntityAttribute:return new Bt(this,t,e)}return null},e.prototype.addNewColumn=function(t,e){var n=this,o=this.getContext().getModel(),i=this.getQuery(),r=function(t){var e=o.getAttributeById(t);if(!e)return null;if(!e.useInResult){if(!e.lookupAttr)return null;if(t=e.lookupAttr,!(e=o.getAttributeById(t))||!e.useInResult)return null}var r=i.createColumn();return r.caption=n.getDefaultColumnCaption(e),r.sorting=E.None,r.sortIndex=-1,r.expr.tag=p.EntityAttribute,r.expr.kind=l.Attribute,r.expr.dataType=e.dataType,r.expr.setValue(t,!0),r.params.concat(e.params),r};if(this.getQuery()){var s,a;if(Array.isArray(t)){s=[];for(var u=0;u<t.length;u++)(a=r(t[u]))&&s.push(a)}else s=r(t);return this.addColumn(s,e),s}},e.prototype.toggleColumnPicked=function(t){var e,n;t&&(e=this.columnsBlock.querySelector("div[data-id=".concat(t.id,"]")))&&(n=e.classList.contains("active"));for(var o=this.columnsBlock.querySelectorAll(".".concat(this.cssPrefix,"-row")),i=0;i<o.length;i++){var r=o[i];(0,ut.domel)(r).removeClass("active").data("show-buttons",null)}e&&!n&&(0,ut.domel)(e).addClass("active").data("show-buttons","")},e.prototype.addColumn=function(t,e){var n=this.getQuery();n&&(!(t=Array.isArray(t)?this.checkColumnsArray(t):this.checkColumn(t))||Array.isArray(t)&&0==t.length||(n.addColumnObj(t,e,self),n.fireChangedEvent({part:x.Columns,action:w.Add,changee:t})))},e.prototype.addColumnElement=function(t,e){var n=this.columnsBlock.querySelectorAll("[class*=".concat(this.cssPrefix,"-row]")),o=this.renderColumn(t);n.length>0&&e<n.length-1?this.columnsBlock.insertBefore(o,n[e]):this.columnsBlock.appendChild(o),this.options.columnRenderedCallback&&this.options.columnRenderedCallback(o)},e.prototype.checkColumnsArray=function(t){for(var e=t.length,n=[],o=0;o<e;o++)this.checkColumn(t[o])&&n.push(t[o]);return n},e.prototype.checkColumn=function(t){if(!this.options.allowDuplicates)for(var e=this.getQuery().getColumns(),n=JSON.stringify(t.expr),o=0;o<e.length;o++){if(JSON.stringify(e[o].expr)===n)return null}return t},e.prototype.getDefaultColumnCaption=function(t){var e=this.options.titleElementFormat||this.options.attrElementFormat;return this.getContext().getModel().getAttributeText(t,e)},e.prototype.getColumnsBlock=function(){return this.columnsBlock},e.prototype.showEntitiesMenu=function(t){this.entitiesMenu&&this.entitiesMenu.showMenu(t)},e.prototype.createEntitiesMenu=function(){var t=this.getContext().getModel();if(!t||t.isEmpty())return null;var e=this.slot.id;e&&(e+="-EntitiesMenu");var n={items:t.getEntitiesTree({addUIC:!1,addUIR:!0,addUIS:!1,attrPlacement:this.options.attrPlacement,sortEntities:this.options.sortEntities}),adjustHeight:this.options.adjustEntitiesMenuHeight,id:e,domWriteItemsId:this.options.domWriteItemsId};r.utils.assign(n,this.options.menuOptions),this.entitiesMenu=new gt(n)},e.prototype.createSortMenu=function(){var t=this.getContext().getModel();if(!t||t.isEmpty())return null;var e=this.slot.id;e&&(e+="-SortMenu");var n={items:this.sortMenuList.concat(this.moveMenuList),id:e,domWriteItemsId:this.options.domWriteItemsId};r.utils.assign(n,this.options.menuOptions),n.searchBoxAlwaysShown=!1,this.sortMenu=new gt(n)},e.prototype.createMoveMenu=function(){var t=this.getContext().getModel();if(!t||t.isEmpty())return null;var e=this.slot.id;e&&(e+="-MoveMenu");var n={items:this.moveMenuList,id:e,domWriteItemsId:this.options.domWriteItemsId};r.utils.assign(n,this.options.menuOptions),this.moveMenu=new gt(n),n.searchBoxAlwaysShown=!1},e.prototype.moveColumn=function(t,e){var n=this.getQuery().getColumns(),o=n.indexOf(t);if(o>=0)switch(e){case"MoveTop":if(0==o)return;this.moveColumnCore(o,0);break;case"MoveUp":if(0==o)return;this.moveColumnCore(o,o-1);break;case"MoveDown":if(o==n.length-1)return;this.moveColumnCore(o,o+1);break;case"MoveBottom":if(o==n.length-1)return;this.moveColumnCore(o,n.length-1)}},e.prototype.moveColumnCore=function(t,e){var n=this.getQuery();if(n){var o=this.columnsBlock.querySelectorAll("[class*=".concat(this.cssPrefix,"-row]")),i=o[t];e<=0?this.columnsBlock.insertBefore(i,this.columnsBlock[0]):e<o.length?this.columnsBlock.insertBefore(i,o[e]):this.columnsBlock.appendChild(i),n.moveColumn(t,e),n.fireColumnsChangedEvent(w.All)}},e.prototype.areCustomExpressionsAllowed=function(){return this.getQuery().isEx()&&this.options.allowCustomExpressions},e.globalCounter=0,e}(st),Lt=function(){function t(t,e,n){this.functionMenu=null,this.isMouseOverBlock=!1,this.keepShowingButtons=!1,this.bar=t,this.column=e,this.element=n}return Object.defineProperty(t.prototype,"cssPrefix",{get:function(){return"eqjs-sb"},enumerable:!1,configurable:!0}),t.prototype.render=function(){var t=this;this.baseAttr=this.getAttribute();var e=(0,ut.domel)("div");return e.data("id",this.column.id),this.element&&this.element.parentNode.replaceChild(e.toDOM(),this.element),this.element=e.toDOM(),this.bar.options.allowDragDrop&&ut.eqDragManager.registerDraggableItem({element:this.element,scope:"entityAttrSortSB",beforeDragStart:function(){return t.element.dispatchEvent((0,ut.createBrowserEvent)("mouseleave"))},onDragStart:function(e){t.element.style.display="none",e.dropEffect=ut.DropEffect.Allow},onDragEnd:function(e){e.data.finishedSuccessfully||t.element.removeAttribute("style")},data:{column:this.column}}),e.addClass(this.getClassesToAdd()).addClass(dt.z.getMobileCssClass()).addChildElement(this.renderCaptionBlock()),this.isEditable()&&e.addChildElement(this.renderSortingButton()),this.element},t.prototype.fireColumnChanged=function(){this.column.fireChangedEvent()},t.prototype.refresh=function(){this.render()},t.prototype.getAttribute=function(){return this.bar.getContext().getModel().getAttributeById(this.column.expr.value)},t.prototype.isEditable=function(){return this.column.enabled&&!this.column.isReadOnly()},t.prototype.renderCaptionBlock=function(){var t=this;this.column.caption&&""!=this.column.caption||(this.column.caption=this.getDefaultCaption());var e=this.column.caption;return this.isEditable()||(e+=function(t){switch(t){case E.Ascending:return" ↑";case E.Descending:return" ↓";default:return""}}(this.column.sorting)),(0,ut.domel)("div").addClass("".concat(this.cssPrefix,"-colelement"),"".concat(this.cssPrefix,"-captionelement")).addClass(dt.z.getMobileCssClass()).addChild("div",(function(n){return n.title(t.column.caption).text(e)})).toDOM()},t.prototype.renderSortingButton=function(){var t=this,e="".concat(ct.YR,"-column-sortbutton"),n=e;switch(this.column.sorting){case E.None:n="".concat(e,"-none");break;case E.Ascending:n="".concat(e,"-asc");break;case E.Descending:n="".concat(e,"-desc")}var o=(0,ut.domel)("div").addClass("".concat(this.cssPrefix,"-colelement"),"".concat(this.cssPrefix,"-sortimage-placeholder")).addClass(dt.z.getMobileCssClass()).addChild("div",(function(e){return e.addClass("".concat(t.cssPrefix,"-img-sorting"),n).title(r.i18n.getText("ButtonSorting"))})).on("touchstart click",(function(e){return t.buttonSortingClickHandler(e,o.toDOM())}));return o.toDOM()},t.prototype.buttonSortingClickHandler=function(t,e){var n=this;return t.stopPropagation(),this.keepShowingButtons=!0,this.bar.sortMenu.showMenu({anchor:e,selectedIds:null,itemSelectedCallback:function(t,e){var o;if("None"==t.id||"Ascending"==t.id||"Descending"==t.id){var i=n.bar.getContext().getQuery();n.column.isJustSorted()&&"None"==t.id?(i.removeColumn(n.column,n.bar),i.fireColumnsChangedEvent(w.Delete,n.column,!0)):(n.column.sorting="None"==(o=t.id)?E.None:"Ascending"==o?E.Ascending:"Descending"==o?E.Descending:void 0,n.column._sortIndex=i.getColumnSortIndex(n.column),n.fireColumnChanged())}else n.bar.moveColumn(n.column,t.id)},menuClosedCallback:function(){n.keepShowingButtons=!1}}),!1},t.prototype.getDefaultCaption=function(){return this.getDefaultTitleText(this.baseAttr)},t.prototype.getDefaultTitleText=function(t){var e=this.bar.options.titleElementFormat||this.bar.options.attrElementFormat;return this.bar.getContext().getModel().getAttributeText(t,e)},t.prototype.getClassesToAdd=function(){return"".concat(this.cssPrefix,"-row ").concat(this.cssPrefix,"-row-column-entattr")},t.prototype.getUIS=function(){return this.bar.getContext().getModel().checkAttrProperty(this.column.expr.value,"useInSorting")},t}(),Rt=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Ft=function(t){function e(e){var n=t.call(this,e)||this;return n.options={showAddRow:!0,attrElementFormat:"{entity} {attr}",titleElementFormat:null,allowDragDrop:!0,menuOptions:{showSearchBoxAfter:30,searchBoxAutoFocus:!0,activateOnMouseOver:!0,adjustHeight:!0,itemRenderedCallback:null}},n.sortMenuList=[{id:"None",text:r.i18n.getText("CmdNotSorted")},{id:"Ascending",text:r.i18n.getText("CmdAscending")},{id:"Descending",text:r.i18n.getText("CmdDescending")},{id:"---",text:"---"},{id:"MoveTop",text:r.i18n.getText("CmdMoveToFirst")},{id:"MoveUp",text:r.i18n.getText("CmdMoveToPrev")},{id:"MoveDown",text:r.i18n.getText("CmdMoveToNext")},{id:"MoveBottom",text:r.i18n.getText("CmdMoveToLast")}],n.landingSlot=(0,ut.domel)("div").addClass("".concat(ct.YR,"-highlight")).toDOM(),n.landingIndex=-1,(0,ut.domel)(n.slot).addClass("".concat(n.cssPrefix,"-panel")).addClass(dt.z.getMobileCssClass()),n.group=A.Query,n}return Rt(e,t),Object.defineProperty(e.prototype,"cssPrefix",{get:function(){return"eqjs-sb"},enumerable:!1,configurable:!0}),e.prototype.getWidgetType=function(){return"sortingBar"},e.prototype.init=function(e,n){var o=this;t.prototype.init.call(this,e,n),this.setOptions(n),this.destroyCore(),this.attachQueryObserver(),ut.eqDragManager.removeDropContainer(this.slot),this.options.allowDragDrop&&ut.eqDragManager.registerDropContainer({element:this.slot,scopes:["entityAttrSortSB"],onDragEnter:function(t,e){o.showLandingSlot(e.pageX,e.pageY)},onDragOver:function(t,e){o.showLandingSlot(e.pageX,e.pageY)},onDragLeave:function(t,e){e.dropEffect=ut.DropEffect.Forbid,o.hideLandingSlot()},onDrop:function(t,e){o.landingIndex>=0?o.getQuery().setColumnSortIndex(e.data.column,o.landingIndex):e.item.element.removeAttribute("style")}})},e.prototype.setOptions=function(t){r.utils.assignDeep(this.options,t)},e.prototype.attachQueryObserver=function(){var t=this,e=this.getQuery();this.queryEventCallbackId=e.addChangedCallback((function(e){var n=e.data;!n||n.part!=x.SortingColumns&&n.part!=x.Columns&&n.part!=x.All||t.refresh()}))},e.prototype.detachQueryObserver=function(){this.queryEventCallbackId&&this.getQuery().removeChangedCallback(this.queryEventCallbackId)},e.prototype.getQuery=function(){return this.getContext().getQuery()},e.prototype.getModel=function(){return this.getContext().getModel()},e.prototype.destroyCore=function(){this.detachQueryObserver(),this.clear()},e.prototype.refreshCore=function(){this.clear(),this.render()},e.prototype.renderAddRowButton=function(){var t=this;(0,ut.domel)(this.addRowButton).addClass("".concat(ct.YR,"-addrow"),"".concat(this.cssPrefix,"-addrow"),"".concat(ct.YR,"-addrow-empty")).addClass(dt.z.getMobileCssClass()).title(r.i18n.getText("CmdClickToAddColumn")).addChild("a",(function(e){return e.attr("href","javascript:void(0)").on("click",(function(e){e.preventDefault(),t.showEntitiesMenu({anchor:e.target,selectedIds:null,itemSelectedCallback:function(e,n){var o=e.id;return t.addNewColumn(o),!1}})}))})),dt.z.isMobileMode()&&(0,ut.domel)(this.columnsBlock).addChildElement(this.addRowButton)},e.prototype.showEntitiesMenu=function(t){this.entitiesMenu.showMenu(t)},e.prototype.createEntitiesMenu=function(){var t=this.getModel();if(!t||t.isEmpty())return null;var e=this.slot.id;e&&(e+="-EntitiesMenu");var n={items:t.getEntitiesTree({addUIC:!1,addUIR:!1,addUIS:!0}),adjustHeight:this.options.adjustEntitiesMenuHeight,id:e,domWriteItemsId:this.options.domWriteItemsId};this.entitiesMenu=new gt(n)},e.prototype.createSortMenu=function(){var t=this.getModel();if(!t||t.isEmpty())return null;var e=this.slot.id;e&&(e+="-SortMenu");var n={items:this.sortMenuList,id:e,searchBoxAlwaysShown:!1};this.sortMenu=new gt(n)},e.prototype.render=function(){var t=this;this.createEntitiesMenu(),this.createSortMenu(),this.columnsBlock=(0,ut.domel)("div").addClass("".concat(this.cssPrefix,"-columns")).addClass(dt.z.getMobileCssClass()).toDOM(),this.options.showAddRow&&(this.addRowButton=(0,ut.domel)("div").toDOM(),dt.z.isMobileMode()?(0,ut.domel)(this.columnsBlock).addChildElement(this.addRowButton):(0,ut.domel)(this.slot).addChildElement(this.addRowButton),this.renderAddRowButton()),(0,ut.domel)(this.slot).addChildElement(this.columnsBlock),this.getQuery().getSortedColumns().forEach((function(e,n){var o=t.renderColumn(e);t.columnsBlock.appendChild(o)}))},e.prototype.addNewColumn=function(t){var e=this,n=this.getModel(),o=this.getQuery();if(this.getQuery()){var i=function(t){var i=n.getAttributeById(t);if(!i)return null;if(!i.useInSorting){if(!i.lookupAttr)return null;if(t=i.lookupAttr,!(i=n.getAttributeById(t))||!i.useInSorting)return null}var r=o.createColumn(!0);return r.caption=e.getDefaultColumnCaption(i),r._sorting=E.Ascending,r.expr.tag=p.EntityAttribute,r.expr.dataType=i.dataType,r.expr.setValue(t,!0),r.params.concat(i.params),r}(t);return this.getQuery().addColumn({column:i})}},e.prototype.getDefaultColumnCaption=function(t){var e=this.options.titleElementFormat||this.options.attrElementFormat;return this.getModel().getAttributeText(t,e)},e.prototype.renderColumn=function(t,e){var n=new Lt(this,t,e);return n?n.render():null},e.prototype.clear=function(){this.slot.innerHTML=""},e.prototype.moveColumn=function(t,e){var n=this.getQuery(),o=n.getSortedColumns(),i=n.getColumnSortIndex(t);if(i>=0)switch(e){case"MoveTop":n.setColumnSortIndex(t,0);break;case"MoveUp":n.setColumnSortIndex(t,i>0?i-1:0);break;case"MoveDown":n.setColumnSortIndex(t,i<o.length-1?i+1:o.length-1);break;case"MoveBottom":n.setColumnSortIndex(t,o.length-1)}},e.prototype.showLandingSlot=function(t,e){for(var n=this.columnsBlock.querySelectorAll("[class*=".concat(this.cssPrefix,"-row]")),o=[],i=0;i<n.length;i++)"none"!==n[i].style.display&&o.push(n[i]);if(0!==o.length){var r=(0,ut.getElementAbsolutePos)(this.landingSlot);if(!(t>=r.x&&t<=r.x+this.landingSlot.offsetWidth&&e>=r.y&&e<=r.y+this.landingSlot.offsetHeight)){var s=this.landingIndex;for(i=0;i<o.length;i++){var a=o[i],l=(0,ut.getElementAbsolutePos)(a),u=a.offsetWidth,c=a.offsetHeight,d=.2*u;if(t>=l.x+d&&t<=l.x+u-d&&e>=l.y+2&&e<=l.y+c-2){s=t>r.x?i+1:i;break}}(s!=this.landingIndex||this.landingSlot.parentElement)&&(this.landingIndex=s,this.landingIndex<=0&&this.columnsBlock.insertBefore(this.landingSlot,o[0]),this.landingIndex<o.length?this.columnsBlock.insertBefore(this.landingSlot,o[this.landingIndex]):this.columnsBlock.appendChild(this.landingSlot))}}else this.landingIndex=0},e.prototype.hideLandingSlot=function(){this.landingIndex=-1,this.landingSlot.parentElement&&this.landingSlot.parentElement.removeChild(this.landingSlot)},e}(st);!function(t){t[t.None=0]="None",t[t.Value=1]="Value",t[t.Attribute=2]="Attribute",t[t.Operator=4]="Operator",t[t.Addition=8]="Addition",t[t.Removal=16]="Removal",t[t.All=255]="All",t[t.NoAddition=-9]="NoAddition",t[t.NoRemoval=-17]="NoRemoval",t[t.FixedConditionList=5]="FixedConditionList"}(vt||(vt={}));var qt,Qt=function(){function t(t,e,n){this.panel=t,this.text=e,this.element=n||(0,ut.domel)("div").toDOM()}return Object.defineProperty(t.prototype,"cssPrefix",{get:function(){return"eqjs-qp"},enumerable:!1,configurable:!0}),t.prototype.refresh=function(){this.render()},t.prototype.render=function(){var t=this;return(0,ut.domel)(this.element).html("").addClass(this.getClassesToAdd()).addClass(dt.z.getMobileCssClass()).addChild("span",(function(e){return e.text(t.text).title(t.text)})).toDOM(),this.element},t.prototype.getClassesToAdd=function(){return"".concat(this.cssPrefix,"-condelement")},t}(),Nt=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}();!function(t){t[t.AddCondition=0]="AddCondition",t[t.AddGroup=1]="AddGroup",t[t.Enable=2]="Enable",t[t.Delete=4]="Delete",t[t.Menu=5]="Menu",t[t.Parameterized=6]="Parameterized",t[t.InJoin=7]="InJoin"}(qt||(qt={}));var jt=function(){function t(t,e,n){this.panel=t,this.condition=e,this.element=n||(0,ut.domel)("div").toDOM()}return Object.defineProperty(t.prototype,"cssPrefix",{get:function(){return"eqjs-qp"},enumerable:!1,configurable:!0}),t.prototype.refresh=function(){this.render()},t.prototype.clear=function(){this.element&&(this.element.className="",this.element.removeAttribute("data-id"),this.element.removeAttribute("style"),(0,ut.domel)(this.element).html(""))},t.prototype.render=function(t){return this.clear(),this.coreRender(t),this.panel.options.onConditionRendered&&this.panel.options.onConditionRendered(this.condition,this.element),this.element},t.prototype.isEditable=function(){return this.condition.enabled&&!this.condition.isReadOnly()},t}(),Ht=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Nt(e,t),e.prototype.getClassesToAdd=function(){var t="".concat(this.cssPrefix,"-row ").concat(this.cssPrefix,"-row-condition");if(t+=this.condition.isInJoin()?" ".concat(this.cssPrefix,"-condition-injoin"):"",t+=this.condition.isParameterized()?" ".concat(this.cssPrefix,"-condition-parameterized"):"",!dt.z.isMobileMode()){var e=this.condition.getLevel();e>0&&(t+=" ".concat(this.cssPrefix,"-level-").concat(e))}return t+=this.condition.enabled?"":" ".concat(this.cssPrefix,"-disabled"),this.condition.enabled&&(t+=this.condition.isReadOnly()?" ".concat(this.cssPrefix,"-readonly"):""),t},e.prototype.coreRender=function(t){var e=this,n=this.panel.getContext().getModel(),i=n.getOperatorById(this.condition.getOperatorId()),r=o.parseOperatorFormat(i),s=null,a=r.length,l=(0,ut.domel)("div");this.element&&this.element.parentNode&&this.element.parentNode.replaceChild(l.toDOM(),this.element),this.element=l.toDOM(),l.addClass(this.getClassesToAdd()).addClass(dt.z.getMobileCssClass()).data("id",this.condition.id).data("condrow","").addChildElement(this.renderCheckbox()).addChildElement(this.renderConjunction());for(var u=t,c=i==n.nullOperator?Math.min(a,this.condition.expressions.length+1):a,d=function(t){if("operator"===(s=r[t]).type){var e=h.panel.getOperatorRenderer(h.condition,s.text);e&&l.addChildElement(e.render())}else if("expression"===s.type){var n=u&&s.index>0,o=h.panel.getExpressionRenderer(h.condition.expressions[s.index]);if(o){var i=o.render(n);l.addChildElement(i),setTimeout((function(){o.adjustWidth()}),100)}u=u&&!n}else"text"===s.type&&l.addChildElement(new Qt(h.panel,s.text).render())},h=this,p=0;p<c;p++)d(p);(this.panel.options.accentActiveCondition||dt.z.isMobileMode())&&l.on("click",(function(t){return t.stopPropagation(),e.panel.toggleConditionPicked(e.condition),e.adjustButtonsVisibility(),dt.z.isMobileMode()||e.element.dispatchEvent((0,ut.createBrowserEvent)("mouseenter")),!1})),l.addChildElement(this.renderButtonsBlock()),dt.z.isMobileMode()||l.on("mouseenter",(function(t){return e.isMouseOverBlock=!0,e.enterButtonBlock(),t.stopPropagation(),!1})).on("mouseleave",(function(t){return e.isMouseOverBlock=!1,!e.keepShowingButtons&&(0,ut.domel)(e.buttonsBlock).isVisible()&&e.leaveButtonBlock(),t.stopPropagation(),!1}))},e.prototype.setConditionParameterized=function(t){this.condition.setParameterized(t),this.condition.fireChangedEvent()},e.prototype.setConditionInJoin=function(t){this.condition.setInJoin(t),this.condition.fireChangedEvent()},e.prototype.getConditionMenu=function(){return this.panel.getConditionMenu()},e.prototype.renderConjunction=function(){var t=this.condition.getParent();if(!t)return null;var e=0==r.utils.findItemIndexById(t.getConditions(),this.condition.id);if(this.panel.options.showConjunctions&&!e){var n=o.linkTypeToStr(this.condition.getParent().linkType),i=r.i18n.getText("Conj"+n);return(0,ut.domel)("span").text(i).title(i).addClass("".concat(this.cssPrefix,"-condelement ").concat(this.cssPrefix,"-condition-conjuction")).toDOM()}return null},e.prototype.renderCheckbox=function(){var t=this;return this.panel.options.showCheckboxes&&!this.condition.isReadOnly()?(0,ut.domel)("div").title(r.i18n.getText("CmdToggleEnable")).attr("tabIndex","0").addClass("".concat(this.cssPrefix,"-condelement ").concat(this.cssPrefix,"-condition-checkbox")).addClass("".concat(this.condition.enabled?"enabled":"")).on("click",(function(){return t.condition.enabled=!t.condition.enabled,t.condition.fireChangedEvent(),!1})).on("keypress",(function(t){[13,32].includes(t.keyCode)&&t.target.click()})).toDOM():null},e.prototype.isConditionActive=function(){return this.element.classList.contains("active")},e.prototype.hideButtons=function(){(0,ut.domel)(this.element).data("show-buttons",null)},e.prototype.showButtons=function(){(0,ut.domel)(this.element).data("show-buttons","")},e.prototype.adjustButtonsVisibility=function(){(this.panel.options.alwaysShowButtonsInConditions||this.panel.options.accentActiveCondition&&this.isConditionActive())&&this.showButtons()},e.prototype.enterButtonBlock=function(){this.showButtons()},e.prototype.leaveButtonBlock=function(){this.panel.options.alwaysShowButtonsInConditions||this.isConditionActive()&&this.panel.options.accentActiveCondition||this.hideButtons()},e.prototype.conditionMenuHandler=function(t,e){var n=this;switch(t){case qt.AddCondition:if(!this.condition.isGroup())return;var o=this.panel.getEntitiesMenu();o&&o.showMenu({anchor:e.target,itemSelectedCallback:function(t){var e=n.panel.getQuery(),o={parent:n.condition,attributeId:t.id},i=e.addSimpleCondition(o);return i&&e.fireConditionsChangedEvent(w.Add,i),!1}});break;case qt.AddGroup:if(!this.condition.isGroup())return;var i=this.panel.getQuery(),r={parent:this.condition},s=this.panel.getQuery().addConditionGroup(r);s&&i.fireConditionsChangedEvent(w.Add,s);break;case qt.Enable:this.condition.enabled=!this.condition.enabled,this.condition.fireChangedEvent();break;case qt.Delete:var a=this.condition.getParent();if(!a)return;var l=a.getConditions(),u=l.indexOf(this.condition);u>=0&&(l.splice(u,1),this.condition.getQuery().fireConditionsChangedEvent(w.Delete,this.condition));break;case qt.Menu:var c=this.getConditionMenu();this.keepShowingButtons=!0,c.showMenu({anchor:e.target,selectedIds:this.getConditionMenuSelectedItems(),itemSelectedCallback:function(t){var o;switch(t.id){case"enable":o=qt.Enable;break;case"delete":o=qt.Delete;break;case"param":o=qt.Parameterized;break;case"inJoin":o=qt.InJoin;break;case"addCondition":o=qt.AddCondition;break;case"addGroup":o=qt.AddGroup}n.conditionMenuHandler(o,e)},itemFilterCallback:function(t){var e=n.condition.enabled||"enable"===t.id||"delete"===t.id;if("enable"===t.id){var o=n.condition.getParent();e=e&&o&&o.enabled}else"delete"===t.id?e=e&&(n.panel.options.editableParts&vt.Removal)===vt.Removal:"addGroup"!==t.id&&"addCondition"!==t.id||(e=e&&(n.panel.options.editableParts&vt.Addition)===vt.Addition);return e},menuClosedCallback:function(){n.keepShowingButtons=!1,n.isMouseOverBlock||n.leaveButtonBlock()}});break;case qt.Parameterized:this.condition.setParameterized(!this.condition.isParameterized()),this.condition.fireChangedEvent();break;case qt.InJoin:this.condition.setInJoin(!this.condition.isInJoin()),this.condition.fireChangedEvent()}return e.stopPropagation(),!1},e.prototype.getConditionMenuSelectedItems=function(){var t=[];return this.condition.enabled&&t.push("enable"),this.condition.isParameterized()&&t.push("param"),this.condition.isInJoin()&&t.push("inJoin"),t},e.prototype.renderButtonsBlock=function(){var t=this,e=function(e){(0,ut.domel)(e.target).addClass("".concat(t.cssPrefix,"-condition-button-active"))},n=function(e){(0,ut.domel)(e.target).removeClass("".concat(t.cssPrefix,"-condition-button-active"))},o=(0,ut.domel)("div").addClass("".concat(this.cssPrefix,"-condition-buttonsBlock")).addClass(dt.z.getMobileCssClass());if(this.buttonsBlock=o.toDOM(),this.condition.isReadOnly())return this.buttonsBlock;var i=this.getButtonsToShow();return i.indexOf("addCondition")>=0&&this.condition.enabled&&(this.panel.options.editableParts&vt.Addition)==vt.Addition&&o.addChild("div",(function(o){o.addClass("".concat(t.cssPrefix,"-button-placeholder")).data("btnplaceholder","").addChild("div",(function(o){o.addClass("".concat(t.cssPrefix,"-condition-button ").concat(t.cssPrefix,"-condition-button-addCondition")).attr("tabIndex","0").data("button","").title(r.i18n.getText("CmdAddCondition")).on("click",(function(e){return t.conditionMenuHandler(qt.AddCondition,e)})).on("keypress",(function(t){13==t.keyCode&&t.target.click()})).on("mouseenter",e).on("mouseleave",n)}))})),(i.indexOf("addGroup")>=0||i.indexOf("addPredicate")>=0)&&this.condition.enabled&&(this.panel.options.editableParts&vt.Addition)==vt.Addition&&o.addChild("div",(function(o){o.addClass("".concat(t.cssPrefix,"-button-placeholder")).data("btnplaceholder","").addChild("div",(function(o){o.addClass("".concat(t.cssPrefix,"-condition-button ").concat(t.cssPrefix,"-condition-button-addPredicate")).attr("tabIndex","0").data("button","").title(r.i18n.getText("CmdAddCondGroup")).on("click",(function(e){return t.conditionMenuHandler(qt.AddGroup,e)})).on("keypress",(function(t){13==t.keyCode&&t.target.click()})).on("mouseenter",e).on("mouseleave",n)}))})),this.getButtonsToShow().indexOf("enable")>=0&&this.condition.getParent()&&this.condition.getParent().enabled&&o.addChild("div",(function(o){o.addClass("".concat(t.cssPrefix,"-button-placeholder")).data("btnplaceholder","").addChild("div",(function(o){o.addClass("".concat(t.cssPrefix,"-condition-button ").concat(t.cssPrefix,"-condition-button-enable")).attr("tabIndex","0").data("button","").title(r.i18n.getText("CmdToggleEnable")).addClass(t.condition.enabled?"enabled":"").on("click",(function(e){return t.conditionMenuHandler(qt.Enable,e)})).on("keypress",(function(t){13==t.keyCode&&t.target.click()})).on("mouseenter",e).on("mouseleave",n)}))})),this.getButtonsToShow().indexOf("delete")>=0&&this.condition.getParent()&&(this.panel.options.editableParts&vt.Removal)==vt.Removal&&o.addChild("div",(function(o){o.addClass("".concat(t.cssPrefix,"-button-placeholder")).data("btnplaceholder","").addChild("div",(function(o){o.addClass("".concat(t.cssPrefix,"-condition-button ").concat(t.cssPrefix,"-condition-button-delete")).attr("tabIndex","0").data("button","").title(r.i18n.getText("CmdDelete")).on("click",(function(e){return t.conditionMenuHandler(qt.Delete,e)})).on("keypress",(function(t){13==t.keyCode&&t.target.click()})).on("mouseenter",e).on("mouseleave",n)}))})),this.getButtonsToShow().indexOf("menu")>=0&&o.addChild("div",(function(o){o.addClass("".concat(t.cssPrefix,"-button-placeholder")).data("btnplaceholder","").addChild("div",(function(o){o.addClass("".concat(t.cssPrefix,"-condition-button ").concat(t.cssPrefix,"-condition-button-menu")).attr("tabIndex","0").data("button","").title(r.i18n.getText("ButtonMenu")).on("click",(function(e){return t.conditionMenuHandler(qt.Menu,e)})),dt.z.isMobileMode()||o.on("keypress",(function(t){13==t.keyCode&&t.target.click()})).on("mouseenter",e).on("mouseleave",n)}))})),this.adjustButtonsVisibility(),this.buttonsBlock},e.prototype.getButtonsToShow=function(){return this.panel.options.buttons&&this.panel.options.buttons.condition&&Array.isArray(this.panel.options.buttons.condition)?this.panel.options.buttons.condition:["enable","delete"]},e}(jt),Wt=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Gt=function(t){function e(e){var n=t.call(this,"a",e)||this;return n.attr("href","javascript:void(0)"),n.on("click",(function(t){return t.preventDefault(),n.appear(),!1})),n}return Wt(e,t),e.prototype.onGetMenu=function(t){return this._onGetMenu=t,this},e.prototype.onItemSelected=function(t){return this._onItemSelected=t,this},e.prototype.appear=function(){var t=this,e=this._onGetMenu?this._onGetMenu():null;e&&e.showMenu({anchor:this.element,itemSelectedCallback:function(e){return t._onItemSelected&&t._onItemSelected(e.id),!1}})},e}(ut.DomElementBuilder);function zt(t){return new Gt(t)}var Vt,Ut=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Yt=function(t){function e(e,n,o){var i=t.call(this,e,n,o)||this;return i.isRoot=!n.getParent(),i}return Ut(e,t),e.prototype.getClassesToAdd=function(){var t="".concat(this.cssPrefix,"-group");return this.isRoot&&(t+=" ".concat(this.cssPrefix,"-group-root")),t},e.prototype.coreRender=function(t){(0,ut.domel)(this.element).addClass(this.getClassesToAdd()).addClass(dt.z.getMobileCssClass()).addChildElement(this.renderGroupRow()).addChildElement(this.renderConditions(t)).data("id",this.condition.id).data("group","")},e.prototype.renderGroupRow=function(){return this.isRoot&&!this.panel.options.showRootRow?null:new Jt(this.panel,this.condition).render()},e.prototype.renderConditions=function(t){var e=this,n=(0,ut.domel)("div");return n.addClass("".concat(this.cssPrefix,"-conditions")).addClass("".concat(dt.z.getMobileCssClass())).data("conditions",""),this.isRoot&&n.addClass("".concat(this.cssPrefix,"-conditions-root")),this.condition.getConditions().forEach((function(o,i,r){var s=e.panel.getConditionRenderer(o);s&&n.addChildElement(s.render(t&&i==r.length-1))})),n.toDOM()},e}(jt),Jt=function(t){function e(e,n,o){var i=t.call(this,e,n,o)||this;return i.isRoot=!i.condition.getParent(),i}return Ut(e,t),e.prototype.getButtonsToShow=function(){return this.panel.options.buttons&&this.panel.options.buttons.group&&Array.isArray(this.panel.options.buttons.group)?this.panel.options.buttons.group:["addCondition","addGroup","enable","delete"]},e.prototype.getClassesToAdd=function(){var t;if(this.isRoot)t="".concat(this.cssPrefix,"-row ").concat(this.cssPrefix,"-row-group ").concat(this.cssPrefix,"-row-group-root");else{t="".concat(this.cssPrefix,"-row ").concat(this.cssPrefix,"-row-group");var e=this.condition.getLevel();e>0&&(t+=" ".concat(this.cssPrefix,"-level-").concat(e)),t+=this.condition.enabled?"":" ".concat(this.cssPrefix,"-disabled"),this.condition.enabled&&(t+=this.condition.isReadOnly()?" ".concat(this.cssPrefix,"-readonly"):"")}return t},e.prototype.coreRender=function(t){var e=this,n=(0,ut.domel)(this.element).addClass(this.getClassesToAdd()).addClass(dt.z.getMobileCssClass()).data("group-row","").addChildElement(this.renderCheckbox()).addChildElement(this.renderConjunction()),o=this.condition.getLevel();o>0&&n.addClass("".concat(this.cssPrefix,"-level-").concat(o)),this.buildGroupElements(n,this.getGroupTitle()),this.panel.options.accentActiveCondition&&n.on("click",(function(t){e.panel.toggleConditionPicked(e.condition),e.adjustButtonsVisibility(),dt.z.isMobileMode()||n.toDOM().dispatchEvent((0,ut.createBrowserEvent)("mouseenter"))})),n.addChildElement(this.renderButtonsBlock()),dt.z.isMobileMode()||n.on("mouseenter",(function(t){return e.isMouseOverBlock=!0,e.enterButtonBlock(),t.stopPropagation(),!1})).on("mouseleave",(function(t){return e.isMouseOverBlock=!1,!e.keepShowingButtons&&(0,ut.domel)(e.buttonsBlock).isVisible()&&e.leaveButtonBlock(),t.stopPropagation(),!1}))},e.prototype.getGroupTitle=function(){var t;return this.isRoot&&!dt.z.isMobileMode()?(t=r.i18n.getText("RootConditionGroupTitle"))||(t=r.i18n.getText("RootPredicateTitle")):(t=r.i18n.getText("ConditionGroupTitle"))||(t=r.i18n.getText("PredicateTitle")),t},e.prototype.buildGroupElements=function(t,e){var n=this,s=e.indexOf("{lt}");if(s<0)t.addText(r.i18n.getText("ErrIncorrectGroupTitleFormat")),t.addClass("".concat(this.cssPrefix,"-error"));else{s>0&&t.addChild("span",(function(t){t.addClass("".concat(n.cssPrefix,"-grelement")).addText(e.substring(0,s))}));var a=o.linkTypeToStr(this.condition.linkType),l=r.utils.findItemById(i.predicateLinkTypeList,a);l||(l=i.predicateLinkTypeList[0]),this.isEditable()?zt(t.toDOM()).onGetMenu((function(){return n.getLinkTypeMenu()})).onItemSelected((function(t){n.condition.linkType=o.strToLinkType(t),n.condition.fireChangedEvent()})).addText(r.i18n.getText(l.key)).title(r.i18n.getText(l.key)).addClass("".concat(this.cssPrefix,"-grelement")):t.addChild("span",(function(t){t.text(r.i18n.getText(l.key)).title(r.i18n.getText(l.key)).addClass("".concat(n.cssPrefix,"-grelement"))})),t.addChild("span",(function(t){t.addClass("".concat(n.cssPrefix,"-grelement")).addText(e.substring(s+4))}))}},e.prototype.getConditionMenu=function(){return this.panel.getConditionGroupMenu(null==this.condition.getParent())},e.prototype.getLinkTypeMenu=function(){return this.panel.getLinkTypeMenu()},e.prototype.renderConjunction=function(){return this.isRoot?null:t.prototype.renderConjunction.call(this)},e.prototype.renderCheckbox=function(){return this.isRoot?null:t.prototype.renderCheckbox.call(this)},e.prototype.leaveButtonBlock=function(){this.panel.options.alwaysShowButtonsInGroups||this.isConditionActive()&&this.panel.options.accentActiveCondition||this.hideButtons()},e.prototype.adjustButtonsVisibility=function(){(this.panel.options.alwaysShowButtonsInGroups||this.panel.options.accentActiveCondition&&this.isConditionActive())&&this.showButtons()},e}(Ht),Kt=function(){function t(t){this.element=t||(0,ut.domel)("div").toDOM()}return t.prototype.refresh=function(){this.render()},t.prototype.render=function(t){var e=this;return void 0===t&&(t=!1),this.labelElement=this.renderLabelElement(),(0,ut.domel)(this.element).html("").addClass(this.getClassesToAdd()).addClass(dt.z.getMobileCssClass()).addChildElement(this.labelElement),this.isEditable()&&(this.renderEditor(),t&&setTimeout((function(){return e.showEditor()}),50)),this.element},t.prototype.isEditable=function(){return!0},t.prototype.renderLabelElement=function(){var t=this,e=this.getLabelText();return this.isEditable()?(0,ut.domel)("a").attr("href","javascript:void(0)").title(e).text(e).on("click",(function(e){return e.preventDefault(),t.showEditor(),!1})).toDOM():(0,ut.domel)("span").title(e).text(e).toDOM()},t.prototype.getClassesToAdd=function(){return""},t.prototype.getLabelText=function(){return this.getEmptyText()},t.prototype.getEmptyText=function(){return"<empty>"},t}(),Xt=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),$t=function(t){function e(e,n,o,i){var r=t.call(this,i)||this;return r.panel=e,r.expression=n,r.valueEditor=o,r}return Xt(e,t),Object.defineProperty(e.prototype,"cssPrefix",{get:function(){return"eqjs-qp"},enumerable:!1,configurable:!0}),e.prototype.render=function(e){return void 0===e&&(e=!1),t.prototype.render.call(this,e),this.panel.options.onExpressionRendered&&this.panel.options.onExpressionRendered(this.expression,this.element),this.element},e.prototype.getContext=function(){return this.panel.getContext()},e.prototype.isReadOnly=function(){var t=this.expression.getParent();return!t.enabled||t.isReadOnly()},e.prototype.isEditable=function(){return!this.isReadOnly()},e.prototype.getClassesToAdd=function(){return"".concat(this.cssPrefix,"-condelement ").concat(this.cssPrefix,"-valueelement")},e.prototype.getLabelText=function(){return this.expression.isEmpty()?this.getEmptyText():this.expression.value},e.prototype.getEmptyText=function(){return this.panel.options.emptyTextValue||r.i18n.getText("MsgEmptyScalarValue")},e.prototype.setValue=function(t,e){this.expression.setValue(t),e||this.expression.getParent().fireChangedEvent(I.Value)},e.prototype.getValue=function(){return this.expression.value},e.prototype.validateInput=function(t){return{success:!0,value:t}},e.prototype.showValidationError=function(t,e){this.getContext().throwError({action:"ui.validation",text:t})},e.prototype.isEmptyValue=function(){var t=this.getValue();return null==t||!t},e.prototype.adjustWidth=function(){},e}(Kt),Zt=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),te=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Zt(e,t),e.prototype.renderEditor=function(){var t=this;this.inputBuilder=(0,ut.domel)("input").hide().addClass("".concat(this.cssPrefix,"-ve-editbox")).type("text").on("blur",(function(e){if(t.inputBuilder.isVisible()&&!t.dontProcessBlur){var n=t.validateInput(t.inputElement.value);return n.success?(t.setValue(t.inputElement.value),t.closeEditor()):(t.dontProcessBlur=!0,t.inputElement.focus(),setTimeout((function(){t.dontProcessBlur=!1}),200),t.showValidationError(n.message,e.target)),e.stopPropagation(),!1}})).on("keydown",(function(e){if(27===e.keyCode)return t.closeEditor(),e.stopPropagation(),!1;if(13===e.keyCode&&t.inputBuilder.isVisible()){t.dontProcessBlur=!0;var n=t.validateInput(t.inputElement.value);return n.success?(t.setValue(t.inputElement.value),t.closeEditor(),t.dontProcessBlur=!1):(t.inputElement.focus(),t.showValidationError(n.message,e.target),setTimeout((function(){t.dontProcessBlur=!1}),200)),e.stopPropagation(),!1}})),this.inputElement=this.inputBuilder.toDOM(),(0,ut.domel)(this.element).addChildElement(this.inputElement)},e.prototype.showEditor=function(){var t=200;if(!dt.z.isMobileMode()){var e=this.element.offsetLeft,n=this.element.offsetWidth>t?this.element.offsetWidth:t,o=this.element.parentElement.clientWidth-e-55;this.inputBuilder.removeStyle("left").removeStyle("right"),o<t?this.inputBuilder.setStyle("right","55px").setStyle("width","".concat(t,"px")):o<n?this.inputBuilder.setStyle("left","".concat(e,"px")).setStyle("width","".concat(o,"px")):this.inputBuilder.setStyle("left","".concat(e,"px")).setStyle("width","".concat(n,"px"))}(0,ut.domel)(this.labelElement).hide(),this.inputBuilder.value(this.getValue()).show(),this.inputElement.focus()},e.prototype.closeEditor=function(){this.inputBuilder.hide(),(0,ut.domel)(this.labelElement).show(),this.labelElement.focus()},e.prototype.validateInput=function(t){this.inputBuilder.removeClass("eqjs-invalid");var e={success:!0,value:t};return this.expression.kind==l.List?this.validateListInput(t,e):this.validateScalarInput(t,e),e},e.prototype.validateListInput=function(t,e){for(var n=0,o=t.split(/\s*,\s*/);n<o.length;n++){var i=o[n];if(this.validateScalarInput(i,e),!e.success)return}},e.prototype.validateScalarInput=function(t,e){if(t&&r.utils.isNumericType(this.expression.dataType)){var n=+t;isNaN(n)&&(e.success=!1,e.message='"'+t+'" '+r.i18n.getText("ErrNotNumber")),r.utils.isIntType(this.expression.dataType)&&n!=parseInt(t,10)&&(e.success=!1,e.message='"'+t+'" '+r.i18n.getText("ErrIncorrectInteger"))}},e.prototype.showValidationError=function(e,n){t.prototype.showValidationError.call(this,e,n),this.inputBuilder.addClass("eqjs-invalid")},e.prototype.isEditable=function(){return t.prototype.isEditable.call(this)&&(this.panel.options.editableParts&vt.Value)===vt.Value},e}($t),ee=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),ne=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.menuItemsList=[],e.showWhenReady=!1,e}return ee(e,t),e.prototype.isEditable=function(){return!this.isReadOnly()&&(this.panel.options.editableParts&vt.Value)===vt.Value},e.prototype.setValue=function(t,e){void 0===e&&(e=!1);var n=this.adjustNewValue(t);if(t!==this.expression.value){var o=this.getValueText(t);this.expression.setContent(n,o),e||this.expression.getParent().fireChangedEvent(I.Value)}return!0},e.prototype.getValueText=function(t){var e="";if(Array.isArray(t))for(var n=0,o=this.menuItemsList;n<o.length;n++){var i=o[n];t.indexOf(i.id)>=0&&(e+=i.text+",")}else for(var r=0,s=this.menuItemsList;r<s.length;r++){(i=s[r]).id===t&&(e+=i.text+",")}return e&&(e=e.substring(0,e.length-1)),e},e.prototype.getEmptyText=function(){return this.panel.options.emptyTextList||r.i18n.getText("MsgEmptyListValue")},e.prototype.getListName=function(){return this.valueEditor.name},e.prototype.renderEditor=function(){var t=this;this.fillMenuItemsList((function(){t.renderMenuBlock()}))},e.prototype.getLabelText=function(){return this.expression.isEmpty()?this.getEmptyText():this.expression.getText()},e.prototype.showLoader=function(){},e.prototype.hideLoader=function(){},e.prototype.showEditor=function(){var t=this;this.menu?this.menu.showMenu({anchor:this.labelElement,selectedIds:this.getValuesAsArray(),itemSelectedCallback:function(e,n){if(t.menu.options.multiselect){if(n){for(var o=[],i=n.length,r=0;r<i;r++)o.push(n[r].id);t.setValue(o)}}else t.setValue(e.id);return!1}}):(this.showWhenReady=!0,this.showLoader())},e.prototype.closeEditor=function(){this.menu.hideMenu()},e.prototype.renderMenuBlock=function(){var t=!1;this.expression&&(t=this.expression.kind===l.List);var e=this.panel,n={items:this.menuItemsList,multiselect:t,container:e?e.options.menuContainer:null,showSelected:!0,showItemIds:!!e&&e.options.showIdsForListItems};e&&r.utils.assignDeep(n,e.options.menuOptions);var o=this.element.id;o&&(n.id=o+"-EditorMenu"),e&&(n.domWriteItemsId=e.options.domWriteItemsId),n.buttons={submit:r.i18n.getText("ButtonApply"),cancel:r.i18n.getText("ButtonCancel")},this.menu=new gt(n)},e.prototype.getValuesAsArray=function(){if(this.expression.kind!==l.List)return[this.expression.value];if(this.expression.value){var t=this.expression.value.match(/"[^"\\]*(?:\\.[^"\\]*)*"|[^,]+/g);return t?t.map((function(t){return'"'==t.charAt(0)&&'"'==t.charAt(t.length-1)?(t=t.substring(1,t.length-1)).replace(/\"/g,'"'):t})):[]}return[]},e.prototype.adjustNewValue=function(t){return Array.isArray(t)?t.map((function(t){return t.indexOf(",")>=0?'"'+(t=t.replace(/"/g,'"'))+'"':t})).join(","):t},e.prototype.fillMenuItemsList=function(t){this.menuItemsList=this.valueEditor.values,t&&t()},e.prototype.takeDefaultValue=function(){if(this.menuItemsList)for(var t=this.menuItemsList.length,e=this.valueEditor.defValue,n=0;n<t;n++){var o=this.menuItemsList[n];if(o.isDefault||e==o.id){this.setValue(o.id,!0);break}}},e}($t),oe=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.isLoading=!1,e.onClickTemp=null,e}return ee(e,t),e.prototype.renderEditor=function(){var t=this;this.isLoading||(this.isLoading=!0,this.fillMenuItemsList((function(){if(t.isLoading=!1,t.isEmptyValue()&&t.takeDefaultValue(),!t.expression.isEmpty()&&t.expression._isDefaultValue){var e=t.getValueText(t.expression.value);t.expression.setContent(t.expression.value,e),t.expression.getParent().fireChangedEvent()}t.renderMenuBlock(),t.showWhenReady&&(t.showWhenReady=!1,t.hideLoader(),t.showEditor())})))},e.prototype.showLoader=function(){this.labelElement.style.display="none",this.loaderElement||(this.loaderElement=(0,ut.domel)("div",this.element).addClass("".concat(this.cssPrefix,"-ve-loader")).toDOM()),this.loaderElement.style.display="block"},e.prototype.hideLoader=function(){this.loaderElement.style.display="none",this.labelElement.removeAttribute("style")},e.prototype.fillMenuItemsList=function(t){var e=this,n=this.getListName(),o=this.panel.getContext().getListRequestHandler();i.constLists[n]?(this.menuItemsList=i.constLists[n],t&&t()):o&&o({listName:n,editorId:this.valueEditor.id,editorParams:this.valueEditor.extraParams,value:this.getValue()},(function(n){e.menuItemsList=n,t&&t()}))},e}(ne),ie=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return ee(e,t),e.prototype.fillMenuItemsList=function(t){var e=this,n=this.panel.getContext(),o=(this.valueEditor,n.getListRequestHandler());o&&o({listName:"SQL",editorId:this.valueEditor.id,editorParams:this.valueEditor.extraParams,value:this.getValue()},(function(n){e.menuItemsList=n,t&&t()}))},e}(oe),re=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),se=function(t){function e(e,n,o,i){var r=t.call(this,e,n,null,i)||this;return r.menu=o,r}return re(e,t),e.prototype.renderEditor=function(){},e.prototype.getLabelText=function(){var t=this.panel.getContext().getModel(),e=this.expression.value,n=e?t.getAttributeByIdSafe(e):null,o=this.panel.options.attrElementFormat;return n?t.getAttributeText(n,o):this.getEmptyText()},e.prototype.setValue=function(e,n){void 0===n&&(n=!1),n=n&&e!==this.expression.value;var o=t.prototype.setValue.call(this,e,!0);return n||this.expression.getParent().fireChangedEvent(I.EntityAttr|I.Operator),o},e.prototype.isEditable=function(){return!this.isReadOnly()&&(this.panel.options.editableParts&vt.Attribute)===vt.Attribute},e.prototype.getEmptyText=function(){return this.panel.options.emptyTextAttribute||r.i18n.getText("MsgEmptyAttrValue")},e.prototype.getClassesToAdd=function(){return"".concat(this.cssPrefix,"-condelement ").concat(this.cssPrefix,"-attrelement")},e.prototype.adjustWidth=function(){dt.z.isMobileMode()||this.element.clientWidth>this.element.parentElement.clientWidth/2&&(0,ut.domel)(this.element).addClass("".concat(this.cssPrefix,"-attrelement-wide"))},e}(ne),ae=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),le=function(t){function e(e){return t.call(this,e)||this}return ae(e,t),e.prototype.showEditor=function(){var t=this,e=this.getMenu();e&&e.showMenu({anchor:this.labelElement,itemSelectedCallback:function(e){return t.itemSelected(e.id),!1}})},e.prototype.closeEditor=function(){var t=this.getMenu();t&&t.hideMenu()},e}(Kt),ue=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),ce=function(t){function e(e,n,o){var i=t.call(this,o)||this;return i.panel=e,i.menu=n,i}return ue(e,t),Object.defineProperty(e.prototype,"cssPrefix",{get:function(){return"eqjs-qp"},enumerable:!1,configurable:!0}),e.prototype.getLabelText=function(){return r.i18n.getText("CmdClickToAddCondition")},e.prototype.getClassesToAdd=function(){return"".concat(ct.YR,"-addrow ").concat(this.cssPrefix,"-addrow")},e.prototype.isEditable=function(){return t.prototype.isEditable.call(this)&&(this.panel.options.editableParts&vt.Addition)===vt.Addition},e.prototype.renderLabelElement=function(){var t=this,e=this.getLabelText();return this.isEditable()?this.labelElement=(0,ut.domel)("a").attr("href","javascript:void(0)").title(e).text(e).on("click",(function(e){return e.preventDefault(),t.showEditor(),!1})).toDOM():this.labelElement=(0,ut.domel)("div").toDOM(),this.labelElement},e.prototype.renderEditor=function(){},e.prototype.itemSelected=function(t){var e=this.panel.getQuery(),n={parent:e.getRootCondition(),attributeId:t},o=e.addSimpleCondition(n);o&&e.fireConditionsChangedEvent(w.Add,o)},e.prototype.getMenu=function(){return this.menu},e}(le),de=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),he=function(t){function e(e,n,o,i){var r=t.call(this,i)||this;return r.panel=e,r.condition=n,r.displayedText=o,r}return de(e,t),Object.defineProperty(e.prototype,"cssPrefix",{get:function(){return"eqjs-qp"},enumerable:!1,configurable:!0}),e.prototype.renderEditor=function(){var t=this,e=this.panel.getContext().getModel(),n=this.panel.getQuery(),o=[],i=(this.condition&&this.condition.expressions&&this.condition.expressions[0]?this.condition.expressions[0].value:null)?e.getAttributeById(this.condition.expressions[0].value):null;i&&i.operators&&i.operators.forEach((function(i){var s=e.getOperatorById(i),a=function(t){return t.defaultOperand.kind==l.Query}(s);!n.isEx()&&a||!s||t.panel.options.isSubQuery&&a||o.push({id:i,text:r.i18n.getText("Operators",i,"caption")||s.caption})}));var s={items:o,adjustHeight:this.panel.options.adjustEntitiesMenuHeight,id:r.utils.generateId("opmn"),domWriteItemsId:this.panel.options.domWriteItemsId};r.utils.assign(s,this.panel.options.menuOptions),this.menu=new gt(s)},e.prototype.getLabelText=function(){return this.displayedText},e.prototype.getEmptyText=function(){return this.panel.options.emptyTextOperator||r.i18n.getText("MsgEmptyOperator")},e.prototype.getClassesToAdd=function(){return"".concat(this.cssPrefix,"-condelement ").concat(this.cssPrefix,"-operelement")},e.prototype.isEditable=function(){return this.condition.enabled&&!this.condition.isReadOnly()&&(this.panel.options.editableParts&vt.Operator)===vt.Operator},e.prototype.itemSelected=function(t){this.condition.setOperatorId(t),this.condition.fireChangedEvent(I.Operator)},e.prototype.getMenu=function(){return this.menu},e}(le),pe=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),fe=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.dtp=null,e.internalDateFormat="yyyy-MM-dd",e.internalTimeFormat="HH:mm",e}return pe(e,t),e.prototype.renderEditor=function(){},e.prototype.showEditor=function(){var t=this;if(!this.dtp){var e={yearRange:this.panel.options.yearRange,showCalendar:this.expression.dataType!==r.DataType.Time,showTimePicker:this.expression.dataType!==r.DataType.Date,oneClickDateSelection:this.panel.options.oneClickDateSelection,showDateTimeInput:this.panel.options.showDateTimeInput,onApply:function(e){var n=t.convertToInternalFormat(e);t.setValue(n),t.dtp=null,setTimeout((function(){return t.labelElement.focus()}),100)},onCancel:function(){t.labelElement.innerText=t.getLabelText(),t.dtp=null,setTimeout((function(){return t.labelElement.focus()}),100)},onDateTimeChanged:function(e){var n=r.i18n.dateTimeToStr(e,t.expression.dataType);t.labelElement.innerText=n}};this.dtp=this.panel.options.dateTimePickerResolver?this.panel.options.dateTimePickerResolver(e):new ut.DefaultDateTimePicker(e);var n=this.expression.getModel(),o=this.expression.value,i=new Date;i=this.expression.dataType!=r.DataType.Time&&n.isDateMacro(o)?n.getDateMacroValue(o):this.expression.dataType==r.DataType.Time&&n.isTimeMacro(o)?n.getTimeMacroValue(o):this.convertFromInternalFormat(o),this.dtp.setDateTime(i),this.dtp.show(this.element)}},e.prototype.closeEditor=function(){this.dtp.cancel(),this.dtp=null},e.prototype.getLabelText=function(){if(!this.expression.value)return this.getEmptyText();var t=this.expression.value,e=this.expression.getModel();if(!e)throw new Error("DataModel is not defined for "+this.expression.value);if(e.isDateMacro(t)||e.isTimeMacro(t)){var n=t.substring(3,t.length-2),o=r.i18n.getText(n);return o||"${{Today}}"}return r.i18n.dateTimeToStr(this.convertFromInternalFormat(t),this.expression.dataType)},e.prototype.isEditable=function(){return t.prototype.isEditable.call(this)&&(this.panel.options.editableParts&vt.Value)===vt.Value},e.prototype.convertFromInternalFormat=function(t){return r.utils.strToDateTime(t,this.internalDateFormat+" "+this.internalTimeFormat)},e.prototype.convertToInternalFormat=function(t){return r.utils.dateTimeToStr(t,this.internalDateFormat+" "+this.internalTimeFormat)},e}($t),ge=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),ye=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return ge(e,t),e.prototype.renderEditor=function(){this.dialogBlockBody=(0,ut.domel)("div").addClass("kfrm-form").toDOM(),this.createEntitiesMenu(),this.renderColumnBlock(),this.renderQueryPanelBlock()},e.prototype.isEditable=function(){return t.prototype.isEditable.call(this)&&(this.panel.options.editableParts&vt.Value)===vt.Value},e.prototype.setValue=function(t,e){t instanceof R&&(this.expression.subQuery=t,e||this.expression.getParent().fireChangedEvent(I.Value))},e.prototype.createEntitiesMenu=function(){var t=this.getContext().getModel(),e=this.expression.dataType;if(this.colEntitiesList=t.getEntitiesTreeWithFilter((function(t,n){return n?n.useInConditions&&n.dataType===e:t.attributes&&t.useInConditions})),!t||t.isEmpty())return null;var n=this.element.getAttribute("data-id");n&&(n+="-SubColumnMenu");var o={items:this.colEntitiesList,adjustHeight:this.panel.options.adjustEntitiesMenuHeight,id:n,isSubQuery:!0,domWriteItemsId:this.panel.options.domWriteItemsId};r.utils.assign(o,this.panel.options.menuOptions),this.colEntitiesMenu=new gt(o)},e.prototype.renderColumnBlock=function(){var t=this;this.columnBlock=(0,ut.domel)("div",this.dialogBlockBody).addClass("kfrm-field").addChild("label",(function(t){return t.addText(r.i18n.getText("SubQueryColumnTitle"))})).addChild("a",(function(e){return t.columnElement=e.attr("href","javascript:void(0)").on("click",(function(e){t.colEntitiesMenu.showMenu({anchor:t.columnElement,selectedIds:null,itemSelectedCallback:function(e,n){var o=e.id;return t.setResultAttributeId(o),!1}})})).toDOM()})).toDOM()},e.prototype.getEmptyText=function(){return this.panel.options.emptyTextValue||r.i18n.getText("MsgSubQueryValue")},e.prototype.renderQueryPanelBlock=function(){var t=(0,ut.domel)("div",this.dialogBlockBody).addClass("kfrm-field").addChild("label",(function(t){return t.addText(r.i18n.getText("SubQueryQueryPanelCaption"))})).toDOM();this.queryPanelBlock=(0,ut.domel)("div",t).toDOM();var e=this.element.getAttribute("data-id");e&&(this.queryPanelBlock.id=e+"-SubQueryPanel")},e.prototype.setResultAttributeId=function(t){var e=this.getContext().getModel().getAttributeById(t);if(e){var n=this.getSubQuery(),o=n.getColumns(),i=void 0;if(o.length>0)(i=o[0]).expr.setValue(t),i.expr.dataType=e.dataType,i.fireChangedEvent();else{(i=n.createColumn()).sorting=E.None,i.sortIndex=-1;var r=new k(i);r.setValue(t),r.tag=p.EntityAttribute,r.kind=l.Attribute,r.dataType=e.dataType,i.expr=r,o.push(i),n.fireColumnsChangedEvent(w.Add,i)}this.columnElement.innerText=this.getAttributeText(e)}},e.prototype.getSubQuery=function(){return this.queryPanel.getQuery()},e.prototype.getAttributeText=function(t){if(!t)return r.i18n.getText("SubQueryEmptyColumn");var e=r.i18n.getText("Attributes",t.id);e||(e=t.caption);var n=this.panel.options.attrElementFormat;if(!n)return e;var o=n.replace(new RegExp("{attr}","g"),e),i=this.getContext().getModel().getFullEntityPathByAttr(t.id,".");return o.replace(new RegExp("{entity}","g"),i)},e.prototype.showEditor=function(){var t=this,e=this.panel,n=this.getContext();this.queryPanelBlock.innerHTML="";var o=n.createQuery();this.expression.subQuery&&o.loadFromData(this.expression.subQuery.toJSONData());var i=r.utils.assign({},e.options);i.isSubQuery=!0,i.showAddRow=!0,i.menuContainer=document.body,i.menuOptions.isSubQuery=!0,i.entitiesListFilter=function(t,n){if(e.options.entitiesListFilter){var o=n||{};o.isSubQuery=!0,e.options.entitiesListFilter(t,o)}},this.queryPanel=new be(this.queryPanelBlock,o),this.queryPanel.init(this.panel.getContext(),i);var s=null,a=o.getColumns();if(0==a.length){var u=this.expression.getParent();if(u.expressions.length>0){var c=u.expressions[0];s=c.tag==p.EntityAttribute||c.kind==l.Attribute?c.value:null}}else s=a[0].expr.value;s?this.setResultAttributeId(s):this.columnElement.innerText=r.i18n.getText("SubQueryEmptyColumn"),this.queryPanel.refresh();var d=this.queryPanelBlock.querySelector(".eqjs-qp-conditions-root");d&&(d.style.minHeight="100px"),this.panel.getContext().getServices().getDialogService().open({title:r.i18n.getText("SubQueryDialogTitle"),body:this.dialogBlockBody,width:this.panel.options.subQueryDialogWidth,closable:!0,cancelable:!0,onSubmit:function(){var e=t.queryPanel.getQuery();return!!e.tryValidate({checkExpressions:!0})&&(t.setValue(e),!0)}})},e.prototype.closeEditor=function(){},e}($t),me=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),ve=function(t){function e(e,n,o,i){var r=t.call(this,e,n,o,i)||this;return r.expression.tag=p.ParentColumn,r}return me(e,t),e.prototype.fillMenuItemsList=function(t){var e=this.panel.getQuery().getParentQuery(),n=this.expression.getParent().expressions[0].dataType;this.menuItemsList=e.getColumns().filter((function(t){return t.expr.dataType==n})).map((function(t){return{id:t.id,text:t.caption}})),t&&t()},e}(oe),Ce=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),be=function(t){function e(e,n){var o=t.call(this,e)||this;return o.options={editableParts:vt.All,isSubQuery:!1,activeCondition:null,entitiesPopupHandler:null,entitiesListFilter:null,menuContainer:document.body,showRootRow:!0,showAddRow:!0,showCheckboxes:!1,allowParameterization:!1,allowInJoinConditions:!1,showPoweredBy:!1,buttons:{condition:null,group:null},alwaysShowButtonsInGroups:!1,alwaysShowButtonsInConditions:!1,showConjunctions:!0,accentActiveCondition:!0,activateRootOnStart:!0,yearRange:"c-10:c+10",oneClickDateSelection:!0,showDateTimeInput:!1,attrElementFormat:"{entity} {attr}",menuOptions:{showSearchBoxAfter:30,searchBoxAutoFocus:!0,activateOnMouseOver:!0,itemRenderedCallback:null},allowDragDrop:!0,attrPlacement:0,sortEntities:!1,subQueryDialogWidth:600,subQueryDialogHeight:300,dialogZIndex:1e5,numberListSeparators:[",",";"],autoEditNewCondition:!1,onConditionRendered:null,onGetConditionRenderer:null,onGetExpressionRenderer:null,onGetOperatorRenderer:null,onOperatorRendered:null,onGetAddRowRenderer:null,defaultQuery:null,showIndicatorOnLoad:!0},o.customQuery=null,o.landingSlot=(0,ut.domel)("div").addClass("".concat(o.cssPrefix,"-cond-landing-slot")).addChildElement((0,ut.domel)("div").toDOM()).toDOM(),o.slot.classList.contains("".concat(o.cssPrefix,"-panel"))||o.slot.classList.add("".concat(o.cssPrefix,"-panel")),o.group=A.Query,n&&(o.customQuery=n),o}return Ce(e,t),Object.defineProperty(e.prototype,"cssPrefix",{get:function(){return"eqjs-qp"},enumerable:!1,configurable:!0}),e.prototype.getWidgetType=function(){return"queryPanel"},e.prototype.init=function(e,n){var o=this;if(t.prototype.init.call(this,e,n),this.setOptions(n),this.renderProgressBlock(),this.detachQueryObserver(),this.attachQueryObserver(),ut.eqDragManager.removeDropContainer(this.slot),this.options.allowDragDrop){var i=this.getContext().getModel();ut.eqDragManager.registerDropContainer({element:this.slot,scopes:["entityAttr"],onDragEnter:function(t,e){o.slot.classList.add("".concat(ct.YR,"-drophover")),e.dragImage.classList.add("eqjs-sortable-helper"),o.showLandingSlot();var n=e.data.attrId;i.checkAttrProperty(n,"useInConditions")||(e.dropEffect=ut.DropEffect.Forbid)},onDragOver:function(t,e){},onDragLeave:function(t,e){e.dragImage.classList.remove("eqjs-sortable-helper"),e.dragImage.style.removeProperty("width"),o.slot.classList.remove("".concat(ct.YR,"-drophover")),o.hideLangindSlot()},onDrop:function(t,e){var n=o.getQuery(),i={parent:n.getRootCondition(),attributeId:e.data.attrId},r=n.addSimpleCondition(i);r&&n.fireConditionsChangedEvent(w.Add,r)}})}},e.prototype.destroyCore=function(){ut.eqDragManager.removeDropContainer(this.slot),this.detachQueryObserver(),this.slot.innerHTML=""},e.prototype.getEntitiesMenu=function(){return this.entitiesMenu},e.prototype.getConditionMenu=function(){return this.conditionMenu},e.prototype.getLinkTypeMenu=function(){return this.linkTypeMenu},e.prototype.getConditionGroupMenu=function(t){return void 0===t&&(t=!1),t?this.rootGroupMenu:this.groupMenu},e.prototype.attachQueryObserver=function(){var t=this,e=this.getQuery();this.queryEventCallbackId=e.addChangedCallback((function(e){var n=e.data;if(n&&(n.part==x.Conditions||n.part==x.All)){var o=document.activeElement,i=t.slot.contains(o)||o==document.body;switch(n.action){case w.Modify:var r=n.changee,s=function(e,o){var r=t.slot.querySelector("div[data-id=".concat(e.id,"]"));if(r){o=o&&(n.condPart&I.Operator)===I.Operator&&e.expressions.length>1&&(e.expressions[1]._isDefaultValue||""==e.expressions[1].value||null==e.expressions[1].value);var s=r.classList.contains("active"),a=t.getConditionRenderer(e,r);if(a){var l=a.render(o);if(s&&t.toggleConditionPicked(e),i&&!o){var u=l.querySelector("a")||l.querySelector(".eqjs-qp-condition-button");u&&(0,ct.n6)(u)}}}},a=t.options.autoEditNewCondition;Array.isArray(r)?(r.forEach((function(t){return s(t,a)})),a=!1):s(r,a);break;case w.Add:r=n.changee;var l=function(e){var n=t.getConditionRenderer(e);if(n){var o=e.getParent(),r=t.slot.querySelector("div[data-id=".concat(o.id,"]"));if(r){var s=r.lastChild;if(s){var a=n.render(t.options.autoEditNewCondition);s.appendChild(a),a.scrollIntoView(!1),i&&!t.options.autoEditNewCondition&&a.querySelector("a").focus()}}}};Array.isArray(r)?r.forEach((function(t){return l(t)})):l(r);break;case w.Delete:r=n.changee;var u=function(e){var n=t.slot.querySelector("div[data-id=".concat(e.id,"]"));if(n){var o=t.slot.querySelector("div[data-id=".concat(e.getParent().id,"] > .eqjs-qp-row-group")),r=n.nextSibling,s=n.previousSibling;if(n.parentElement.removeChild(n),i){var a=r||s||o,l=a.querySelector("a")||a.querySelector(".eqjs-qp-condition-button");l&&l.focus()}}};Array.isArray(r)?r.forEach((function(t){return u(t)})):u(r);break;default:t.refresh()}}}))},e.prototype.detachQueryObserver=function(){this.queryEventCallbackId&&this.getQuery().removeChangedCallback(this.queryEventCallbackId)},e.prototype.getQuery=function(){return this.customQuery?this.customQuery:this.context.getQuery()},e.prototype.refreshCore=function(){this.clear(),this.render()},e.prototype.setOptions=function(t){r.utils.assignDeep(this.options,t),this.options.dateFormatValue&&r.i18n.updateLocaleSettings({editDateFormat:this.options.dateFormatValue}),this.options.dateFormatDisplay&&r.i18n.updateLocaleSettings({shortDateFormat:this.options.dateFormatDisplay}),void 0===this.options.editableParts&&(this.options.editableParts=vt.All),dt.z.isMobileMode()&&(this.options.buttons=this.options.buttons||{},this.options.buttons.condition=["menu"],this.options.buttons.group=["menu"])},e.prototype.clear=function(){this.slot.innerHTML=""},e.prototype.render=function(){try{this.entitiesMenu=this.createEntitiesMenu(),this.createConditionMenus(),this.createLinkTypeMenu(),this.rootContainer=(0,ut.domel)("div",this.slot).toDOM(),(0,ut.domel)(this.slot).removeClass(ct.XD).addClass(dt.z.getMobileCssClass());var t=this.getQuery().getRootCondition(),e=this.getConditionRenderer(t,this.rootContainer);if(e&&e.render(),this.options.showAddRow){this.addRowElement=(0,ut.domel)("div",this.slot).toDOM();var n=this.getAddRowRenderer(this.addRowElement);n&&n.render()}}catch(t){var o=t;this.context.throwError({action:"QueryPanel rendering",text:o.message,sourceError:o})}},e.prototype.getConditionRenderer=function(t,e){var n;if(this.options.onGetConditionRenderer&&(n=this.options.onGetConditionRenderer(t,e)))return n;switch(t.tag){case M.Simple:return new Ht(this,t,e);case M.Group:return new Yt(this,t,e)}return null},e.prototype.getExpressionRenderer=function(t,e){if(!t)throw"Expression is not defined in the condition";var n,o,i=this.getContext().getModel(),s=t.getParent(),a=i.getOperatorById(s.getOperatorId()),u=i.getAttributeByIdSafe(s.expressions[0].value),c=i.getOperand(u,a,t.getIndex());o=(n=c&&c.editor&&c.editor.tag!==b.Unknown?c.editor:u&&u.defaultEditor?u.defaultEditor:new h).tag;var d=t.dataType;if(d==r.DataType.Unknown&&(d=u.dataType),t.kind===l.Attribute){if(0===t.getIndex())return new se(this,t,this.entitiesMenu,e);var p=this.createEntitiesMenu((function(t,e){return!e||e.useInConditions&&e.dataType===d}));return new se(this,t,p,e)}if(t.kind===l.Query?o=b.SubQuery:t.kind===l.Scalar?o!=b.Unknown||t.dataType!==r.DataType.Date&&t.dataType!==r.DataType.DateTime&&t.dataType!==r.DataType.Time||(o=b.DateTime):t.kind==l.ParentColumn&&(o=b.BindToParentColumn),this.options.onGetExpressionRenderer){var f=this.options.onGetExpressionRenderer(this,t,n,e);if(f)return f}switch(o){case b.List:return new ne(this,t,n,e);case b.SqlList:return new ie(this,t,n,e);case b.CustomList:return new oe(this,t,n,e);case b.DateTime:return new fe(this,t,n,e);case b.SubQuery:return new ye(this,t,n,e);case b.BindToParentColumn:return new ve(this,t,n,e);default:return new te(this,t,n,e)}},e.prototype.getOperatorRenderer=function(t,e,n){var o;return this.options.onGetOperatorRenderer&&(o=this.options.onGetOperatorRenderer(t,e,n)),o||new he(this,t,e,n)},e.prototype.getAddRowRenderer=function(t){var e;return this.options.onGetAddRowRenderer&&(e=this.options.onGetAddRowRenderer(t)),e||new ce(this,this.entitiesMenu,t)},e.prototype.createEntitiesMenu=function(t){var e=this.getContext().getModel();if(!e||e.isEmpty())return null;var n=this.slot.id||"eq-querypanel";n+="-EntitiesMenu";var o={items:e.getEntitiesTree({addUIC:!0,addUIR:!1,addUIS:!1,attrPlacement:this.options.attrPlacement,sortEntities:this.options.sortEntities},t),adjustHeight:this.options.adjustEntitiesMenuHeight,id:n,domWriteItemsId:this.options.domWriteItemsId};return r.utils.assign(o,this.options.menuOptions),new gt(o)},e.prototype.showEntitiesMenu=function(t){this.entitiesMenu.showMenu(t)},e.prototype.createConditionMenus=function(){var t=this.getQuery(),e=this.slot.id||"eq-querypanel";e+="-ConditionMenu";var n=[{id:"enable",text:r.i18n.getText("MenuEnable")},{id:"delete",text:r.i18n.getText("CmdDelete")}];t.isEx()&&((this.options.allowParameterization||this.options.allowInJoinConditions)&&n.push({id:"delimiter",text:"---"}),this.options.allowParameterization&&n.push({id:"param",text:r.i18n.getText("MenuParameterization")}),this.options.allowInJoinConditions&&n.push({id:"inJoin",text:r.i18n.getText("MenuJoinCond")}));var o={items:n,adjustHeight:this.options.adjustEntitiesMenuHeight,id:e,domWriteItemsId:this.options.domWriteItemsId,showSearchBoxAfter:100,showSelected:!0};r.utils.assign(o,this.options.menuOptions),this.conditionMenu=new gt(o);e=this.slot.id||"eq-querypanel";e+="-GroupMenu";o={items:n=[{id:"enable",text:r.i18n.getText("MenuEnable")},{id:"delete",text:r.i18n.getText("CmdDelete")},{id:"delimiter",text:"---"},{id:"addCondition",text:r.i18n.getText("CmdAddCondition")},{id:"addGroup",text:r.i18n.getText("CmdAddCondGroup")}],adjustHeight:this.options.adjustEntitiesMenuHeight,id:e,domWriteItemsId:this.options.domWriteItemsId,showSearchBoxAfter:100,showSelected:!0};r.utils.assign(o,this.options.menuOptions),this.groupMenu=new gt(o);e=this.slot.id||"eq-querypanel";e+="-RootGroupMenu";o={items:n=[{id:"addCondition",text:r.i18n.getText("CmdAddCondition")},{id:"addGroup",text:r.i18n.getText("CmdAddCondGroup")}],adjustHeight:this.options.adjustEntitiesMenuHeight,id:e,domWriteItemsId:this.options.domWriteItemsId,showSearchBoxAfter:100,showSelected:!0};r.utils.assign(o,this.options.menuOptions),this.rootGroupMenu=new gt(o)},e.prototype.createLinkTypeMenu=function(){var t=this.slot.id;t&&(t+="-LinkTypeMenu");var e={items:i.predicateLinkTypeList.map((function(t){return{id:t.id,text:r.i18n.getText(t.key)}})),adjustHeight:this.options.adjustEntitiesMenuHeight,id:t,domWriteItemsId:this.options.domWriteItemsId};r.utils.assign(e,this.options.menuOptions),this.linkTypeMenu=new gt(e)},e.prototype.toggleConditionPicked=function(t,e){var n,o;void 0===e&&(e=void 0),t&&(n=this.slot.querySelector("div[data-id=".concat(t.id,"][data-condrow], div[data-id=").concat(t.id,"] > div[data-group-row]")))&&(o=n.classList.contains("active"));for(var i=this.slot.querySelectorAll(".".concat(this.cssPrefix,"-row")),r=0;r<i.length;r++){var s=i[r];s.hasAttribute("data-group-row")?this.options.alwaysShowButtonsInGroups||(0,ut.domel)(s).data("show-buttons",null):this.options.alwaysShowButtonsInConditions||(0,ut.domel)(s).data("show-buttons",null),(0,ut.domel)(s).removeClass("active")}n&&!o&&(0,ut.domel)(n).addClass("active").data("show-buttons","")},e.prototype.showLandingSlot=function(){var t=this.slot.querySelector(".eqjs-qp-conditions-root");t&&(t.appendChild(this.landingSlot),this.landingSlot.scrollIntoView({block:"center",behavior:"smooth"}))},e.prototype.hideLangindSlot=function(){this.landingSlot.parentElement&&this.landingSlot.parentElement.removeChild(this.landingSlot)},e.prototype.onProcessStartCore=function(){this.options.showIndicatorOnLoad&&(this.progressBlock.parentNode||this.slot.appendChild(this.progressBlock))},e.prototype.onProcessEndCore=function(){this.options.showIndicatorOnLoad&&this.progressBlock.parentNode&&this.slot.removeChild(this.progressBlock)},e.prototype.renderProgressBlock=function(){this.progressBlock=document.createElement("div"),this.progressBlock.classList.add("".concat(ct.YR,"-progress-win8")),this.progressBlock.classList.add(dt.z.getMobileCssClass()),this.progressBlock.innerHTML='<div class="wBall" id="wBall_1"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_2"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_3"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_4"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_5"><div class="wInnerBall"></div></div>'},e}(st),xe=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),we=function(t){function e(e){var n=t.call(this,e)||this;return n.options={applyOnClose:!0,showApplyButton:!0,showClearButton:!0,queryPanel:{showAddRow:!0,showCheckboxes:!0,alwaysShowButtonsInGroups:!0}},n.headerClickListener=n.headerClickHandler.bind(n),n.group=A.Query,n}return xe(e,t),e.prototype.getWidgetType=function(){return"filterBar"},Object.defineProperty(e.prototype,"cssPrefix",{get:function(){return"eqjs-fb"},enumerable:!1,configurable:!0}),e.prototype.init=function(e,n){t.prototype.init.call(this,e,n),this.setOptions(n),this.destroyCore(),this.qpElement=(0,ut.domel)("div").addClass("".concat(this.cssPrefix,"-querypanel")).toDOM(),this.queryPanel=new be(this.qpElement),this.queryPanel.init(e,this.options.queryPanel||{}),this.attachQueryObserver()},e.prototype.setOptions=function(t){this.options=r.utils.assignDeep(this.options,t)},e.prototype.applyBtnClick=function(t){this.applyFilter()},e.prototype.clearBtnClick=function(t){this.clearFilter()},e.prototype.showQueryPanel=function(t){var e=this;(0,ut.slideDown)(this.qpBlock,200,(function(){e.updateHeader(),t&&t()}))},e.prototype.hideQueryPanel=function(){var t=this;(0,ut.slideUp)(this.qpBlock,200,(function(){t.updateHeader(),t.options.applyOnClose&&t.applyFilter()}))},e.prototype.headerClickHandler=function(t){t.preventDefault(),(0,ut.domel)(this.qpBlock).isVisible()?this.hideQueryPanel():this.showQueryPanel()},e.prototype.updateHeader=function(){if(this.headerTextElement){var t="",e=this.getContext().getQuery();e&&(t=e.getConditionsText()),""==t&&(t=r.i18n.getText("StrNoFilterDefined")),(0,ut.domel)(this.headerTextElement).text(t).attr("title",t),!e||e.isEmptyConditions()?((0,ut.domel)(this.headerTextElement).hide(),(0,ut.domel)(this.headerLinkElement).show(),(0,ut.domel)(this.qpBlock).isVisible()||((0,ut.domel)(this.headerArrowBlock).hide(),this.headerElement.style.cursor="",this.headerElement.removeEventListener("click",this.headerClickListener))):(this.headerElement.style.cursor="pointer",this.headerElement.removeEventListener("click",this.headerClickListener),this.headerElement.addEventListener("click",this.headerClickListener),(0,ut.domel)(this.headerTextElement).show(),(0,ut.domel)(this.headerLinkElement).hide(),(0,ut.domel)(this.headerArrowBlock).show()),(0,ut.domel)(this.qpBlock).isVisible()?this.headerArrowElement.classList.add("".concat(this.cssPrefix,"-header-arrowUp")):this.headerArrowElement.classList.remove("".concat(this.cssPrefix,"-header-arrowUp")),this.textResize()}},e.prototype.render=function(){var t=this;(0,ut.domel)(this.slot).addClass("".concat(this.cssPrefix,"-container")).addClass(dt.z.getMobileCssClass()).addChild("div",(function(e){return t.headerElement=e.addClass("".concat(t.cssPrefix,"-header")).addChild("div",(function(e){return t.headerIconElement=e.addClass("".concat(t.cssPrefix,"-header-icon")).toDOM()})).addChild("div",(function(e){return t.headerTextBlock=e.addClass("".concat(t.cssPrefix,"-header-textblock")).addChild("div",(function(e){return t.headerTextElement=e.addClass("".concat(t.cssPrefix,"-header-text")).toDOM()})).addChild("div",(function(e){return t.headerLinkElement=e.addClass("".concat(t.cssPrefix,"-header-text ").concat(t.cssPrefix,"-header-link")).text(r.i18n.getText("StrNoFilterClickToAdd")).hide().on("click",(function(){t.queryPanel.showEntitiesMenu({anchor:t.headerLinkElement,selectedIds:null,itemSelectedCallback:function(e,n){var o=e.id;t.showQueryPanel((function(){var e=t.getContext().getQuery(),n={parent:e.getRootCondition(),attributeId:o},i=e.addSimpleCondition(n);i&&e.fireConditionsChangedEvent(w.Add,i)}))}})})).toDOM()})).toDOM()})).addChild("div",(function(e){return t.headerArrowBlock=e.addClass("".concat(t.cssPrefix,"-header-arrowblock")).addChild("div",(function(e){return t.headerArrowElement=e.addClass("".concat(t.cssPrefix,"-header-arrow")).toDOM()})).toDOM()})).toDOM()})).addChild("div",(function(e){return t.qpBlock=e.addClass("".concat(t.cssPrefix,"-querypanelblock")).addClass(dt.z.getMobileCssClass()).hide().addChildElement(t.qpElement).toDOM()})),(this.options.showApplyButton||this.options.showClearButton)&&(this.buttonsBlock=(0,ut.domel)("div",this.qpBlock).addClass("".concat(this.cssPrefix,"-buttonsblock")).addClass(dt.z.getMobileCssClass()).toDOM()),this.options.showApplyButton&&(0,ut.domel)("a",this.buttonsBlock).attr("href","javascript:void(0)").addClass("".concat(this.cssPrefix,"-button ").concat(this.cssPrefix,"-button-apply")).text(r.i18n.getText("ButtonApply")).on("click",this.applyBtnClick.bind(this)),this.options.showClearButton&&(0,ut.domel)("a",this.buttonsBlock).attr("href","javascript:void(0)").addClass("".concat(this.cssPrefix,"-button ").concat(this.cssPrefix,"-button-clear")).text(r.i18n.getText("CmdClear")).on("click",this.clearBtnClick.bind(this)),window.addEventListener("resize",(function(){t.textResize()})),this.updateHeader(),this.queryPanel.refresh(),setTimeout((function(){return t.textResize()}),500)},e.prototype.refreshCore=function(){this.clear(),this.render()},e.prototype.clear=function(){this.slot.innerHTML=""},e.prototype.applyFilter=function(){this.options.applyFilterCallback&&this.options.applyFilterCallback()},e.prototype.clearFilter=function(){var t=this.getContext().getQuery();t&&(t.clearConditions(),t.fireConditionsChangedEvent(w.All))},e.prototype.textResize=function(){this.headerTextBlock.style.width=this.slot.clientWidth-this.headerIconElement.offsetWidth-((0,ut.domel)(this.headerArrowBlock).isVisible()?this.headerArrowBlock.offsetWidth:0)+"px"},e.prototype.destroyCore=function(){this.queryPanel&&this.queryPanel.destroy(),this.detachQueryObserver(),this.slot.innerHTML=""},e.prototype.attachQueryObserver=function(){var t=this,e=this.getContext().getQuery();this.queryEventCallbackId=e.addChangedCallback((function(e){t.updateHeader()}))},e.prototype.detachQueryObserver=function(){var t=this.getContext().getQuery();t&&t.removeChangedCallback(this.queryEventCallbackId)},e}(st),Ee=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Te=function(t){function e(e){var n=t.call(this,e)||this;return n.contentElement=e,n.group=A.Result,n}return Ee(e,t),e.prototype.getWidgetType=function(){return"htmlContent"},e.prototype.init=function(e,n){t.prototype.init.call(this,e,n)},e.prototype.refreshCore=function(){this.clear(),this.context.resultContent&&this.render()},e.prototype.render=function(){this.context.resultContent&&(this.contentElement.innerHTML+=this.context.resultContent)},e.prototype.clear=function(){this.contentElement.innerHTML=""},e.prototype.destroyCore=function(){this.clear()},e}(st),De=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Se=function(t){function e(e){var n=t.call(this,e)||this;return n.options={maxButtonCount:10,useBootstrap:!1},n}return De(e,t),e.prototype.getWidgetType=function(){return"eqHtmlGrid"},e.prototype.init=function(e,n){t.prototype.init.call(this,e,n),this.setOptions(n)},e.prototype.setOptions=function(t){r.utils.assignDeep(this.options,t)},e.prototype.refreshCore=function(){t.prototype.refreshCore.call(this),this.renderPageNavigator()},e.prototype.destroyCore=function(){this.slot.innerHTML=""},e.prototype.renderPageNavigator=function(){var t=this,e=document.getElementById("PageNavigator");if(e){var n=parseInt(e.getAttribute("data-pagecount")),o=parseInt(e.getAttribute("data-pageindex"));if(n>1){var i=function(e){var n=e.target;if(n.hasAttribute("data-page")){var o=parseInt(n.getAttribute("data-page"));t.context.fetchDataChunk({chunk:{page:o},success:function(){t.context.refreshWidgets(A.Result)}})}},r=this.options.maxButtonCount||10,s=o-1,a=s-s%r+1,l=a+r-1;l>n&&(l=n);var u=document.createElement("ul");this.options.useBootstrap?u.className="pagination":u.className="eqv-pagination",this.options.pageItemCssClass&&(u.className+=" "+this.options.pageItemCssClass);var c=document.createElement("li");this.options.useBootstrap&&(c.className="page-item");var d=document.createElement("span");if(d.setAttribute("aria-hidden","true"),this.options.useBootstrap&&(d.className="page-link"),1==a)c.className+=" disabled";else{if(this.options.useBootstrap)(d=document.createElement("a")).setAttribute("href","javascript:void(0)"),d.setAttribute("data-page","".concat(a-1)),d.className="page-link";else(p=document.createElement("a")).setAttribute("href","javascript:void(0)"),p.setAttribute("data-page","".concat(a-1)),d=p;d.addEventListener("click",i)}d.innerHTML="&laquo;",c.appendChild(d),u.appendChild(c);for(var h=a;h<=l;h++)c=document.createElement("li"),this.options.useBootstrap&&(c.className="page-item"),h==o&&(c.className+=" active"),(d=document.createElement("a")).setAttribute("href","javascript:void(0)"),d.innerHTML=h.toString(),d.setAttribute("data-page",h.toString()),d.className="page-link",d.addEventListener("click",i),c.appendChild(d),u.appendChild(c);if(c=document.createElement("li"),this.options.useBootstrap&&(c.className="page-item"),(d=document.createElement("span")).setAttribute("aria-hidden","true"),this.options.useBootstrap&&(d.className="page-link"),l==n)c.className+="disabled";else{var p;if(this.options.useBootstrap)(d=document.createElement("a")).setAttribute("href","javascript:void(0)"),d.setAttribute("data-page","".concat(l+1)),d.className+=" page-link";else(p=document.createElement("a")).setAttribute("href","javascript:void(0)"),p.setAttribute("data-page","".concat(l+1)),d=p;d.addEventListener("click",i)}d.innerHTML="&raquo;",c.appendChild(d),u.appendChild(c),e.appendChild(u)}}},e}(Te),ke=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Me=function(t){function e(e){var n=t.call(this,e)||this;return n.options={useCustomLocaleSettings:!1},n.slot=e,n.group=A.Result,n}return ke(e,t),e.prototype.getWidgetType=function(){return"grid"},e.prototype.init=function(e,n){t.prototype.init.call(this,e,n),n&&r.utils.assignDeep(this.options,n)},e.prototype.refreshCore=function(){this.clear(),this.context.resultTable&&this.render()},e.prototype.render=function(){this.options.beforeTableRendering&&this.options.beforeTableRendering(this.context.resultTable),this.applyDisplayFormats()},e.prototype.applyDisplayFormats=function(){},e.prototype.clear=function(){this.slot.innerHTML=""},e}(st),Ie=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Be=function(){return Be=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Be.apply(this,arguments)},Ae=function(t){function e(e){var n=t.call(this,e)||this;return n.hasCustomTotalsSettings=!1,n.options={autoRefresh:!0},n.group=A.Result,n}return Ie(e,t),e.prototype.getWidgetType=function(){return"easyGrid"},e.prototype.init=function(e,n){var o=this;t.prototype.init.call(this,e,n);var i=Be(Be({},n),{slot:this.slot,dataTable:e.resultTable});this.options=r.utils.assign(this.options,n),i.onPlusButtonClick=function(t){return o.addColumnClickHandler(t)},i.onColumnMoved=function(t){return o.columnMovedHandler(t)},i.aggregates?this.hasCustomTotalsSettings=!0:i.aggregates={settings:e.getQuery().getAggregationSettings(),calculator:null},i.aggregates.calculator=this.context.getServices().getAggregatesCalculator(),this.destroy(),this.grid=new ut.EasyGrid(i),this.options.autoRefresh&&this.attachQueryObserver()},e.prototype.refreshCore=function(){this.clear(),this.updateTotalsSettings(),this.render()},e.prototype.render=function(){this.createEntitiesMenu(),this.grid.refresh()},e.prototype.attachQueryObserver=function(){},e.prototype.destroyCore=function(){this.detachQueryObserver(),this.grid&&this.grid.destroy(),this.slot.innerHTML=""},e.prototype.detachQueryObserver=function(){this.queryEventCallbackId&&this.getContext().getQuery().removeChangedCallback(this.queryEventCallbackId)},e.prototype.updateTotalsSettings=function(){var t=this.getContext();if(!this.hasCustomTotalsSettings){var e=t.getQuery().getAggregationSettings();this.grid.options.aggregates.settings=e}},e.prototype.createEntitiesMenu=function(){var t=this.getContext().getModel();if(t&&!t.isEmpty()){var e=this.slot.id;e&&(e+="-EntitiesMenu");var n={items:t.getEntitiesTree({addUIC:!1,addUIR:!0,addUIS:!1}),id:e};r.utils.assign(n,this.options.menuOptions),this.entitiesMenu=new gt(n)}},e.prototype.getModel=function(){return this.context.getModel()},e.prototype.getQuery=function(){return this.context.getQuery()},e.prototype.clear=function(){this.grid&&this.grid.clear()},e.prototype.addColumnClickHandler=function(t){var e=this;this.entitiesMenu.showMenu({anchor:t.sourceEvent.target,selectedIds:null,itemSelectedCallback:function(t,n){var o=t.id;return e.addNewColumn(o),!1}})},e.prototype.columnMovedHandler=function(t){var e=this.getQuery(),n=r.utils.findItemIndexById(e.getColumns(),t.columnId);n>=0&&(e.moveColumn(n,t.newIndex),e.fireChangedEvent({part:x.Columns,action:w.All,source:this}))},e.prototype.addNewColumn=function(t){var e=this,n=this.getContext().getModel(),o=this.getContext().getQuery();if(this.getContext().getQuery())return this.addColumn(function(t){var i=n.getAttributeById(t);if(!i)return null;if(!i.useInSorting){if(!i.lookupAttr)return null;if(t=i.lookupAttr,!(i=n.getAttributeById(t))||!i.useInSorting)return null}var r=o.createColumn();return r.caption=e.getDefaultColumnCaption(i),r.sorting=E.None,r.sortIndex=-1,r.expr.tag=p.EntityAttribute,r.expr.setValue(t,!0),r.params.concat(i.params),r}(t))},e.prototype.getDefaultColumnCaption=function(t){var e=this.options.titleElementFormat||this.options.attrElementFormat;return this.getContext().getModel().getAttributeText(t,e)},e.prototype.addColumn=function(t){var e=this.getContext().getQuery();if(e&&(t=this.checkColumn(t)))return t=e.addColumn({caption:t.caption,attributeId:t.expr.value,sorting:t.sorting,sortIndex:t.sortIndex}),e.fireChangedEvent({part:x.Columns,action:w.Add,changee:t,source:this}),t},e.prototype.checkColumn=function(t){for(var e=this.getContext().getQuery().getColumns(),n=JSON.stringify(t.expr.saveToData()),o=0;o<e.length;o++){if(JSON.stringify(e[o].expr.saveToData())===n)return null}return t},e}(Me),_e=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Pe=function(t){function e(e){var n=t.call(this,e)||this;return n.panel=e,n.group=A.Statement,"TEXTAREA"!==n.panel.tagName&&(n.panel.innerHTML='<div class="eqv-sql-panel-result"></div>',n.panel=n.panel.querySelector("div")),n}return _e(e,t),e.prototype.getWidgetType=function(){return"statementPanel"},e.prototype.refreshCore=function(){this.clear(),this.render()},e.prototype.render=function(){this.panel.textContent=this.context.resultStatement?this.context.resultStatement:"";var t=this.panel.innerHTML.replace(/\r\n/g,"<br />").replace(/ /g,"&nbsp;&nbsp;");this.panel.innerHTML=t},e.prototype.destroyCore=function(){this.clear()},e.prototype.clear=function(){this.panel.innerHTML=""},e}(st),Oe=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Le=function(t){function e(e){var n=t.call(this,e)||this;return n.element=e,n.element.style.display="none",n.group=A.All,n}return Oe(e,t),e.prototype.getWidgetType=function(){return"processIndicator"},e.prototype.onProcessStartCore=function(){this.element.style.display=""},e.prototype.onProcessEndCore=function(){this.element.style.display="none"},e}(st),Re=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Fe=function(t){function e(e){var n=t.call(this,e)||this;return n.clickHandler=function(){return n.openDialog()},n.columnsBar=null,n.queryPanel=null,n.ddQuery=null,n.cssPrefix=ct.YR,n.group=A.None,n}return Re(e,t),e.prototype.getWidgetType=function(){return"manageDrillDown"},e.prototype.init=function(e,n){t.prototype.init.call(this,e,n),this.options=n,this.refresh(),this.slot.addEventListener("click",this.clickHandler)},e.prototype.destroyCore=function(){this.slot.removeEventListener("click",this.clickHandler)},e.prototype.openDialog=function(){var t=this,e=this.context.getServices().getDialogService(),n=this.context.getQuery(),o=this.context.getModel(),i=(0,ut.domel)("div").addClass("".concat(this.cssPrefix,"-manage-drilldown")).addChildElement(this.renderColumnsBarBlock()).addChildElement(this.renderQueryPanelBlock()).toDOM(),s=o.addOrUpdateOperator({id:"BindToParentColumn",caption:"is bound to",format:"{expr1} [[is bound to]] {expr2}",paramCount:2,kind:l.ParentColumn,appliedTypes:[r.DataType.String,r.DataType.Bool,r.DataType.Float,r.DataType.Int32,r.DataType.Int64,r.DataType.Word]});s.defaultOperand.dataType=r.DataType.String,s.defaultOperand.kind=l.ParentColumn,o.runThroughEntities((function(t){var e=t.operators.indexOf(s.id);e>0&&r.utils.moveArrayItem(t.operators,e,0)}),null),this.ddQuery=new R(o,null,{parent:n,context:this.context});var a=this.context.getQuery().getDrillDowns();if(a.length){var u=a[0];this.ddQuery.loadFromData(u.toJSONData())}e.open({title:"Manage Drill Down",body:i,cancelable:!0,closable:!1,beforeOpen:function(){var e=i.getElementsByClassName("".concat(t.cssPrefix,"-columnsbar-slot"))[0];t.columnsBar=new Ot(e,t.ddQuery),t.columnsBar.init(t.context,t.options.columnsBar);var n=i.getElementsByClassName("".concat(t.cssPrefix,"-querypanel-slot"))[0];t.queryPanel=new be(n,t.ddQuery),t.queryPanel.init(t.context,t.options.queryPanel),t.columnsBar.refresh(),t.queryPanel.refresh()},onSubmit:function(){return t.submitDialog()},onDestroy:function(){t.destroyDialog()}})},e.prototype.renderQueryPanelBlock=function(){var t=this;return(0,ut.domel)("div").addClass("".concat(this.cssPrefix,"-querypanel-block")).addChild("div",(function(e){return e.addClass("".concat(t.cssPrefix,"-querypanel-caption"))})).addChild("div",(function(e){return e.addClass("".concat(t.cssPrefix,"-querypanel-slot"))})).toDOM()},e.prototype.renderColumnsBarBlock=function(){var t=this;return(0,ut.domel)("div").addClass("".concat(this.cssPrefix,"-columnsbar-block")).addChild("div",(function(e){return e.addClass("".concat(t.cssPrefix,"-columnsbar-caption"))})).addChild("div",(function(e){return e.addClass("".concat(t.cssPrefix,"-columnsbar-slot"))})).toDOM()},e.prototype.submitDialog=function(){if(this.ddQuery.tryValidate({checkExpressions:!0})){var t=this.context.getQuery().getDrillDowns();if(t.length)t[0].loadFromData(this.ddQuery.toJSONData()),this.context.getQuery().fireChangedEvent();else if(!this.ddQuery.isEmpty())this.context.getQuery().addDrillDown().loadFromData(this.ddQuery.toJSONData()),this.context.getQuery().fireChangedEvent();return!0}return!1},e.prototype.destroyDialog=function(){this.context.getModel().removeOperator("BindToParentColumn",!0),this.ddQuery=null,this.columnsBar&&this.columnsBar.destroy(),this.columnsBar=null,this.queryPanel&&this.queryPanel.destroy(),this.queryPanel=null},e}(st);!function(t){t.DataGrid="DATA_GRID",t.Chart="CHART",t.PivotTable="PIVOT_TABLE"}(Vt||(Vt={}));var qe,Qe=__webpack_require__(702),Ne=function(){function t(t){this.context=t,this.promise=null}return t.prototype.show=function(t){var e=this;if(void 0===t&&(t=null),!this.promise){var n=this.context.getExportFormats();if(0==n.length)throw Error("No exporter has been registered.");t=t||n[0],this.promise=new Qe((function(n,o){var i=e.context.getServices().getDialogService(),s=(0,ut.domel)("div").addClass("kdlg-form-section").addChild("div",(function(n){return n.addClass("kfrm-form").addChild("div",(function(n){return n.addClass("kfrm-fields col-a-1 label-align-right").addChild("label",(function(t){return t.addClass("kdlg-form-label","kflex-20").attr("for","export_format").addText(r.i18n.getText("ExportDlgFmtLabel"))})).addChild("div",(function(n){return n.addClass("kfrm-select").addChild("select",(function(n){n.attr("name","export_format").id("exportFormat");for(var o=0,i=e.context.getExportFormats();o<i.length;o++){var s=i[o];n.addOption({value:s,title:r.i18n.getText(s)||s,selected:t==s})}}))}))}))})).toDOM();i.open({title:r.i18n.getText("ExportDlgTitle"),body:s,onSubmit:function(){var t=s.querySelector("#exportFormat").value;return e.context.exportResult({format:t,success:n,error:o}),!0}})}))}return this.promise.finally((function(){return e.promise=null}))},t}(),je=__webpack_require__(702),He=function(t,e,n,o){return new(n||(n=je))((function(i,r){function s(t){try{l(o.next(t))}catch(t){r(t)}}function a(t){try{l(o.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((o=o.apply(t,e||[])).next())}))},We=function(t,e){var n,o,i,r,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;r&&(r=0,a[0]&&(s=0)),s;)try{if(n=1,o&&(i=2&a[0]?o.return:a[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,a[1])).done)return i;switch(o=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,o=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],o=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}},Ge=function(){function t(t,e){var n=this;this.container=t,this.title=r.i18n.getText("Facets","DefaultFacetTitle"),this.cssPrefix="eqjs-facet",this.dialogTitle=r.i18n.getText("Facets","DefaultDlgTitle"),this.options={},this.canDisplayFlag=!0,this.downloadAllClickHandler=function(){var t=n.getContext().resultTable;if(t.elasticChunks){var e=n.getDialogService().openProgress({title:r.i18n.getText("Facets","LoadDataDlgTitle"),onSubmit:function(){return n.refresh()},determinated:!1});n.loadElasticChunk().then((function(t){e.submit()})).catch((function(t){e.submit(),n.getContext().throwError(t)}))}else{var o=t.getCachedRows().length,i=t.getTotal()-t.getCachedCount(),s=n.getDialogService().openProgress({title:r.i18n.getText("Facets","LoadDataDlgTitle"),content:r.i18n.getText("Facets","LoadDataDlgContent").replace("{loadedRecs}","0").replace("{totalRecs}","".concat(i)),onSubmit:function(){return n.refresh()},determinated:!0}),a=0;setTimeout((function(){t.getRows({offset:o,limit:i}).then((function(t){var e=(a+=t.length)/i;s.updateContent(r.i18n.getText("Facets","LoadDataDlgContent").replace("{loadedRecs}","".concat(a)).replace("{totalRecs}","".concat(i))),s.updateProgress(e)})).catch((function(t){s.submit(),n.getContext().throwError(t)}))}),10)}},r.utils.assignDeep(this.options,e)}return t.prototype.init=function(t){this.slot=t,this.contentDiv=(0,ut.domel)("div",this.slot).addClass("".concat(this.cssPrefix,"-content")).toDOM(),this.displayMessageDiv=(0,ut.domel)("div",this.slot).hide().toDOM()},t.prototype.showSettingsDialog=function(){var t=this;return new je((function(e){var n=t.getDialogService(),o=t.renderDialogContent(),i=n.open({title:t.dialogTitle,body:o,cancelable:!0,closable:!1,onSubmit:function(){var n=t.submitSettingsDialog();return n&&e(!0),n},onCancel:function(){e(!1)}});t.afterDialogOpened(i)}))},t.prototype.afterDialogOpened=function(t){},t.prototype.renderDialogContent=function(){var t,e=(0,ut.domel)("div").addClass("kfrm-form").addChild("div",(function(e){return t=e.addClass("".concat(dt.z.isIE()?"kfrm-fields-ie col-ie-1-4 label-align-right":"kfrm-fields col-a-1 label-align-right")).toDOM()}));return this.renderFormFields(e.toDOM(),t),e.toDOM()},t.prototype.renderFormFields=function(t,e){var n=this,o=e;dt.z.isIE()&&(o=(0,ut.domel)("div",e).addClass("kfrm-field-ie").toDOM()),(0,ut.domel)(o).addChild("label",(function(t){return t.attr("for","tab_name").addText(r.i18n.getText("Facets","TabNameLabel"))})).addChild("input",(function(t){return t.id("facetTabName").name("tab_name").type("text").attr("value",n.title)}))},t.prototype.submitSettingsDialog=function(){var t=document.querySelector("#facetTabName");return 0!=t.value.length&&(this.title=t.value,!0)},t.prototype.getDialogService=function(){return this.getContext().getServices().getDialogService()},t.prototype.canDisplay=function(){var t=this.getContext().resultTable;return t.getCachedCount()==t.getTotal()},t.prototype.showErrorMessage=function(t){this.displayMessageDiv.innerHTML=t,this.displayMessageDiv.classList.add("".concat(this.cssPrefix,"-error-message")),(0,ut.domel)(this.displayMessageDiv).show()},t.prototype.showUnableDisplayMessage=function(t){var e=this.getContext().resultTable;this.displayMessageDiv.innerHTML=t||r.i18n.getText("Facets","ErrNotEnoughData").replace("{totalRecs}","".concat(e.getTotal())).replace("{cachedRecs}","".concat(e.getCachedCount())).replace(/\[(.*)\]/g,"<a href='javascript:void(0)' class=\"".concat(this.cssPrefix,'-download-all-link">$1</a>'));var n=this.displayMessageDiv.querySelector("a.".concat(this.cssPrefix,"-download-all-link"));n&&n.addEventListener("click",this.downloadAllClickHandler),(0,ut.domel)(this.contentDiv).hide(),(0,ut.domel)(this.displayMessageDiv).show()},t.prototype.hideUnableDisplayMessage=function(){(0,ut.domel)(this.displayMessageDiv).hide(),(0,ut.domel)(this.contentDiv).show()},t.prototype.getContext=function(){return this.container.getContext()},t.prototype.getQuery=function(){return this.getContext().getQuery()},t.prototype.saveToData=function(){return{title:this.title,type:this.getType()}},t.prototype.loadFromData=function(t){t&&(this.title=t.title)},t.prototype.refresh=function(){this.hideUnableDisplayMessage(),this.canDisplay()?this.refreshCore():this.showUnableDisplayMessage()},t.prototype.loadElasticChunk=function(){return He(this,void 0,void 0,(function(){var t,e,n=this;return We(this,(function(o){return t=this.getContext().resultTable,e=t.getCachedRows().length,[2,t.getRows({offset:e,limit:t.chunkSize}).then((function(e){return t.totalIsKnown()?je.resolve():n.loadElasticChunk()}))]}))}))},t.prototype.onResize=function(){},t}();!function(t){t[t.Column=3]="Column",t[t.Histogram=4]="Histogram",t[t.Bar=5]="Bar",t[t.Combo=6]="Combo",t[t.Area=7]="Area",t[t.Line=9]="Line",t[t.Pie=10]="Pie",t[t.Polar=11]="Polar",t[t.Doughnut=12]="Doughnut",t[t.Radar=13]="Radar",t[t.SteppedLine=14]="SteppedLine"}(qe||(qe={}));var ze,Ve,Ue=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Ye=function(t){function e(e){var n=t.call(this,e)||this;return n.chartType=qe.Pie,n.supportedChartTypes=[],n.dataTable=null,n.potentialLabelColumns=[],n.potentialDataColumns=[],n.labelColumn=-1,n.dataColumns=[],n.options={chartType:qe.Pie,showOnPaging:!1,hideSettings:!1,legend:{show:!1,position:"right"}},n.element=e,n.group=A.Result,n}return Ue(e,t),Object.defineProperty(e.prototype,"cssPrefix",{get:function(){return"eqjs-chart"},enumerable:!1,configurable:!0}),e.prototype.init=function(e,n){t.prototype.init.call(this,e,n),this.dataTable=e.resultTable,this.setOptions(n)},e.prototype.hasData=function(){var t=null!=this.dataTable;return t&&(t=this.dataTable.getCachedCount()>0),t},e.prototype.hasColumnsForChart=function(){return this.potentialLabelColumns.length>0&&this.potentialDataColumns.length>0},e.prototype.refreshCore=function(){this.prepareChartData(),this.render()},e.prototype.setOptions=function(t){if(r.utils.assignDeep(this.options,t),this.supportedChartTypes=this.getSupportedChartTypes(),0==this.supportedChartTypes.length)throw Error("Chart widget should support at least one chart type");t.chartType&&this.supportedChartTypes.indexOf(t.chartType)>=0?this.chartType=t.chartType:this.chartType=this.supportedChartTypes[0]},e.prototype.getOptions=function(){return this.options},e.prototype.getChartTypeName=function(t){switch(t){case qe.Area:return r.i18n.getText("ChartType","Area");case qe.Bar:return r.i18n.getText("ChartType","Bar");case qe.Column:return r.i18n.getText("ChartType","Column");case qe.Combo:return r.i18n.getText("ChartType","Combo");case qe.Doughnut:return r.i18n.getText("ChartType","Doughnut");case qe.Polar:return r.i18n.getText("ChartType","Polar");case qe.Radar:return r.i18n.getText("ChartType","Radar");case qe.Histogram:return r.i18n.getText("ChartType","Histogram");case qe.Line:return r.i18n.getText("ChartType","Line");case qe.SteppedLine:return r.i18n.getText("ChartType","SteppedLine");default:return r.i18n.getText("ChartType","Pie")}},e.prototype.updateSettings=function(t,e){void 0===e&&(e=!0),void 0!==t.showLegend&&(this.options.legend=this.options.legend||{},this.options.legend.show=t.showLegend),this.chartType=t.type,this.labelColumn=t.labelColumn,this.dataColumns[0]=t.dataColumn,e&&this.updateChartColumns()},e.prototype.prepareChartData=function(){var t=this;if(this.dataTable){this.potentialLabelColumns=[],this.potentialDataColumns=[];for(var e=this.dataTable.columns.count,n=0;n<e;n++){var o=this.dataTable.columns.get(n),i=o.type,s=o.label;this.potentialLabelColumns.push({idx:n,label:s}),r.utils.isNumericType(i)&&this.potentialDataColumns.push({idx:n,label:s})}if(-1!=this.labelColumn?this.potentialLabelColumns.filter((function(e){return e.idx==t.labelColumn})).length||(this.labelColumn=-1):this.labelColumn=this.potentialLabelColumns.length>0?this.potentialLabelColumns[0].idx:-1,this.dataColumns.length){var a=this.potentialDataColumns.map((function(t){return t.idx}));this.dataColumns=this.dataColumns.filter((function(t){return a.indexOf(t)>=0})),this.dataColumns.length||(this.dataColumns=this.potentialDataColumns.length>0?[].concat(this.potentialDataColumns[0].idx):[])}else this.dataColumns=this.potentialDataColumns.length>0?[].concat(this.potentialDataColumns[0].idx):[];this.initChart()}},e.prototype.getSupportedChartTypes=function(){var t=this;return(this.options.supportedChartTypes?this.options.supportedChartTypes:Object.keys(qe).map((function(t){return qe[t]}))).filter((function(e){return t.hasChartTypes.indexOf(e)>=0}))},e.prototype.getCurrentChartType=function(){return this.chartType},e.prototype.render=function(){var t=this;if(this.clear(),this.hasData()&&this.hasColumnsForChart()&&this.context.resultTable.getTotal()==this.context.resultTable.getCachedCount()){var e=document.createElement("div");(0,ut.addCssClass)(e,"".concat(this.cssPrefix,"-header"));var n=document.createElement("div");if((0,ut.addCssClass)(n,"".concat(this.cssPrefix,"-main")),this.canDraw()){for(var o=document.createElement("select"),i=0,r=this.supportedChartTypes;i<r.length;i++){var s=r[i],a=document.createElement("option");a.value=s.toString(),a.text=this.getChartTypeName(s),o.appendChild(a)}o.value=this.chartType.toString(),e.appendChild(o),o.addEventListener("change",(function(e){var n=e.target.value;t.chartType=parseInt(n),t.refresh()})),this.settingsDiv=document.createElement("div"),(0,ut.addCssClass)(this.settingsDiv,"".concat(this.cssPrefix,"-settings")),(0,ut.hideElement)(this.settingsDiv),n.appendChild(this.settingsDiv),this.chartDiv=document.createElement("div"),(0,ut.addCssClass)(this.chartDiv,"".concat(this.cssPrefix,"-content")),(0,ut.hideElement)(this.chartDiv),n.appendChild(this.chartDiv),this.initSettingsDiv();var l=document.createElement("div");(0,ut.addCssClass)(l,"".concat(this.cssPrefix,"-settings-icon")),l.title="Settings",e.appendChild(l),l.addEventListener("click",(function(e){t.toggleSettings()})),this.drawChart(100)}else this.addContentDiv(n,"Unable to render the chart. None of the supported chart libraries (ChartJS, Google Charts, etc) is found.");this.options.hideSettings||this.element.appendChild(e),this.element.appendChild(n),this.element.style.display=""}else this.element.style.display="none"},e.prototype.addContentDiv=function(t,e){var n=document.createElement("div");(0,ut.addCssClass)(n,"".concat(this.cssPrefix,"-no-data")),n.innerText=e,t.appendChild(n)},e.prototype.clear=function(){this.element.innerHTML=""},e.prototype.drawChart=function(t){var e=this;(0,ut.showElement)(this.chartDiv),t>0?setTimeout((function(){return e.drawCore()}),t):this.drawCore()},e.prototype.initSettingsDiv=function(){var t=this,e=document.createElement("div");e.textContent="SETTINGS",(0,ut.addCssClass)(e,"".concat(this.cssPrefix,"-settings-header")),this.settingsDiv.appendChild(e);var n=document.createElement("div");(0,ut.addCssClass)(n,"".concat(this.cssPrefix,"-settings-single")),this.settingsDiv.appendChild(n);var o=document.createElement("span");(0,ut.showElement)(o),o.textContent="Label column",n.appendChild(o);var i=document.createElement("select");(0,ut.showElement)(i),n.appendChild(i);for(var r=0,s=this.potentialLabelColumns;r<s.length;r++){var a=s[r];(p=document.createElement("option")).value=a.idx.toString(),p.text=a.label,i.appendChild(p)}this.labelColumn>=0&&(i.value=this.labelColumn.toString()),i.addEventListener("change",(function(e){t.labelColumn=parseInt(e.target.value),t.updateChartColumns(),t.toggleSettings((function(){t.drawChart(100)}))}));var l=document.createElement("div");(0,ut.addCssClass)(l,"".concat(this.cssPrefix,"-settings-single")),this.settingsDiv.appendChild(l);var u=document.createElement("span");(0,ut.showElement)(u),u.textContent="Data column",l.appendChild(u);var c=document.createElement("select");(0,ut.showElement)(c),l.appendChild(c);for(var d=0,h=this.potentialDataColumns;d<h.length;d++){var p;a=h[d];(p=document.createElement("option")).value=a.idx.toString(),p.text=a.label,c.appendChild(p)}this.dataColumns.length>0&&this.dataColumns[0]>=0&&(c.value=this.dataColumns[0].toString()),c.addEventListener("change",(function(e){t.dataColumns[0]=parseInt(e.target.value),t.updateChartColumns(),t.toggleSettings((function(){t.drawChart(100)}))}))},e.prototype.getPotentialLabelColumns=function(){return this.potentialLabelColumns},e.prototype.getPotentialDataColumns=function(){return this.potentialDataColumns},e.prototype.getLabelColumnIndex=function(){return this.labelColumn},e.prototype.getDataColumnIndex=function(){return this.dataColumns[0]},e.prototype.toggleSettings=function(t){var e,n;(0,ut.isVisible)(this.chartDiv)?(e=this.chartDiv,n=this.settingsDiv):(e=this.settingsDiv,n=this.chartDiv),(0,ut.toggleVisibility)(e,n,{complete:t})},e}(st),Je=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Ke=function(t){function e(e){var n=t.call(this,e)||this;return n.colors=["#4dc9f6","#f67019","#f53794","#537bc4","#acc236","#166a8f","#00a950","#58595b","#8549ba"],n.chartLabels=[],n.chartColumns=[],n.hasChartTypes=[qe.Column,qe.Bar,qe.Area,qe.Line,qe.SteppedLine,qe.Doughnut,qe.Polar,qe.Radar,qe.Pie],n.options.legend={show:!1,position:"bottom"},n}return Je(e,t),e.prototype.getWidgetType=function(){return"chartChartJs"},e.hasChartJs=function(){return"undefined"!=typeof Chart},e.prototype.canDraw=function(){return e.hasChartJs()},e.prototype.initChart=function(){e.hasChartJs()&&this.labelColumn>=0&&this.dataColumns&&this.dataColumns.length>0&&this.updateChartColumns()},e.prototype.drawCore=function(){if(e.hasChartJs()&&this.dataTable&&this.dataTable.getCachedCount()>0){var t=this.generateConfig(),n=this.getChartCanvas(this.chartDiv).getContext("2d");new Chart(n,t)}},e.prototype.updateChartColumns=function(){if(this.dataTable){this.chartLabels=[],this.chartColumns=[];for(var t=this.dataTable.getCachedRows(),e=0;e<t.length;e++)this.chartLabels.push(t[e].getValue(this.labelColumn)),this.chartColumns.push(t[e].getValue(this.dataColumns[0]))}},e.prototype.getChartCanvas=function(t){var e=t.getElementsByTagName("canvas");return e&&e.length>0?e[0]:(0,ut.addElement)(t,"canvas")},e.prototype.generateConfig=function(){var t,e=[],n=this.dataTable.columns.get(this.dataColumns[0]).label,o=!0;if(this.chartType==qe.Pie||this.chartType==qe.Doughnut||this.chartType==qe.Polar||this.chartType==qe.Bar||this.chartType==qe.Column)for(var i=0;i<this.chartLabels.length;i++)e.push(this.colors[i%this.colors.length]);else e=[this.colors[3]];this.chartType!=qe.Line&&this.chartType!=qe.SteppedLine||(o=!1,t=this.colors[3]),this.options.legend=this.options.legend||{};var r={data:this.chartColumns,backgroundColor:e,borderColor:t,label:n,fill:o};this.chartType==qe.SteppedLine&&(r.stepped=this.chartType===qe.SteppedLine,r.steppedLine=this.chartType===qe.SteppedLine);var s=this.options.legend.show&&(this.chartType==qe.Pie||this.chartType==qe.Radar||this.chartType==qe.Polar||this.chartType==qe.Doughnut);return{type:this.getChartType(),data:{datasets:[r],labels:this.chartLabels},options:{legend:{display:s,position:this.options.legend.position||"bottom"},title:{display:!0,text:n}}}},e.prototype.getChartType=function(){switch(this.chartType){case qe.Column:return"bar";case qe.Bar:return"horizontalBar";case qe.Area:case qe.SteppedLine:case qe.Line:return"line";case qe.Doughnut:return"doughnut";case qe.Polar:return"polarArea";case qe.Radar:return"radar";case qe.Pie:default:return"pie"}},e}(Ye),Xe=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),$e=function(t){function e(e){var n=t.call(this,e)||this;return n.hasChartTypes=[qe.Column,qe.Bar,qe.Histogram,qe.Combo,qe.Area,qe.Line,qe.SteppedLine,qe.Pie,qe.Doughnut],n.options.legend={show:!0,position:"right"},n}return Xe(e,t),e.prototype.getWidgetType=function(){return"chartGoogle"},e.prototype.canDraw=function(){return e.hasGoogleCharts()},e.hasGoogleCharts=function(){return"undefined"!=typeof google&&void 0!==google.charts},e.prototype.initChart=function(){e.hasGoogleCharts()&&this.labelColumn>=0&&this.dataColumns&&this.dataColumns.length>0&&(this.googleDataView=new google.visualization.DataView(this.convertToGoogleFormat()),this.updateChartColumns())},e.prototype.convertToGoogleType=function(t){switch(t){case r.DataType.Date:return"date";case r.DataType.DateTime:return"datetime";case r.DataType.Time:return"timeofday";case r.DataType.Byte:case r.DataType.Word:case r.DataType.Int32:case r.DataType.Int64:case r.DataType.Currency:case r.DataType.Float:return"number";default:return"string"}},e.prototype.convertToGoogleValue=function(t,e){return e===r.DataType.Bool?t?t.toString():null:t},e.prototype.convertToGoogleFormat=function(){for(var t=new google.visualization.DataTable,e=this.dataTable.columns,n=0;n<e.count;n++){var o=e.get(n);t.addColumn(this.convertToGoogleType(o.type),o.label,o.id)}var i=this.dataTable.getCachedRows();t.addRows(i.length);for(n=0;n<i.length;n++)for(var r=i[n],s=0;s<e.count;s++)t.setCell(n,s,this.convertToGoogleValue(r.getValue(s),e.get(s).type));return t},e.prototype.drawCore=function(){if(null!=this.googleDataView){this.options.legend=this.options.legend||{};var t={width:"100%",height:"100%",chartArea:{width:this.getChartAreaWidth}};this.chartType==qe.Doughnut&&(t.pieHole=.4),this.options.legend.show?t.legend={position:this.options.legend.position}:t.legend="none",this.createChart(this.chartDiv).draw(this.googleDataView,t)}},e.prototype.getChartAreaWidth=function(t){return t==qe.Pie?"100%":"50%"},e.prototype.updateChartColumns=function(){this.googleDataView&&this.googleDataView.setColumns([].concat(this.labelColumn).concat(this.dataColumns))},e.prototype.createChart=function(t){switch(this.chartType){case qe.Column:return new google.visualization.ColumnChart(t);case qe.Histogram:return new google.visualization.Histogram(t);case qe.Bar:return new google.visualization.BarChart(t);case qe.Combo:return new google.visualization.ComboChart(t);case qe.Area:return new google.visualization.AreaChart(t);case qe.Line:return new google.visualization.LineChart(t);case qe.SteppedLine:return new google.visualization.SteppedAreaChart(t);case qe.Pie:case qe.Doughnut:default:return new google.visualization.PieChart(t)}},e}(Ye),Ze=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),tn=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.title=r.i18n.getText("Facets","Chart","FacetTitle"),e.dialogTitle=r.i18n.getText("Facets","Chart","DlgTitle"),e}return Ze(e,t),e.prototype.init=function(e){t.prototype.init.call(this,e),$e.hasGoogleCharts()?this.chart=new $e(this.contentDiv):this.chart=new Ke(this.contentDiv);var n=this.container.options?this.container.options.supportedChartTypes:null;this.chart.init(this.getContext(),{legend:{show:!1},showOnPaging:!0,hideSettings:!0,supportedChartTypes:n}),(0,ut.domel)(this.slot).hide()},e.prototype.destroy=function(){this.chart&&this.chart.destroy()},e.prototype.getType=function(){return Vt.Chart},e.prototype.renderFormFields=function(e,n){var o=this;t.prototype.renderFormFields.call(this,e,n);var i=dt.z.isIE(),s=i?"kfrm-fields-ie is-horizontal":"kfrm-fields is-horizontal",a=document.createElement("select");a.id="chart_type_selector",a.name="chart_type_selector";for(var l=0,u=this.chart.getSupportedChartTypes();l<u.length;l++){var c=u[l];(v=document.createElement("option")).value=c.toString(),v.text=this.chart.getChartTypeName(c),a.appendChild(v)}a.value=this.chart.getCurrentChartType().toString(),this.settings||(this.chart.prepareChartData(),this.settings={type:this.chart.getCurrentChartType().toString(),labelColumn:"".concat(this.chart.getLabelColumnIndex()>=0?this.chart.getLabelColumnIndex():""),dataColumn:"".concat(this.chart.getDataColumnIndex()>=0?this.chart.getDataColumnIndex():""),showLegend:!1});var d=document.createElement("select");d.name="label_column_selector",d.id="label_column_selector";for(var h=0,p=this.chart.getPotentialLabelColumns();h<p.length;h++){var f=p[h];(v=document.createElement("option")).value=f.idx.toString(),v.text=f.label,d.appendChild(v)}d.value=this.settings.labelColumn;var g=document.createElement("select");g.id="data_column_selector",g.name="data_column_selector";for(var y=0,m=this.chart.getPotentialDataColumns();y<m.length;y++){var v;f=m[y];(v=document.createElement("option")).value=f.idx.toString(),v.text=f.label,g.appendChild(v)}g.value=this.settings.dataColumn.toString();var C=n,b=function(){return i?(0,ut.domel)("div",n).addClass("kfrm-field-ie").toDOM():n};i?(0,ut.domel)(e).addChildElement(b()):(0,ut.domel)(n).addChild("div").addChild("div"),C=b(),(0,ut.domel)(C).addChild("label",(function(t){return t.attr("for","chart_type_selector").text(r.i18n.getText("Facets","Chart","ChartTypeSelectorLabel"))})).addChild("div",(function(t){return t.addClass("kfrm-select").addChildElement(a)})),C=b(),(0,ut.domel)(C).addChild("label",(function(t){return t.attr("for","label_column_selector").text(r.i18n.getText("Facets","Chart","LabelColumnSelectorLabel"))})).addChild("div",(function(t){return t.addClass("kfrm-select").addChildElement(d)})),C=b(),(0,ut.domel)(C).addChild("label",(function(t){return t.attr("for","data_column_selector").text(r.i18n.getText("Facets","Chart","DataColumnSelectorLabel"))})).addChild("div",(function(t){return t.addClass("kfrm-select").addChildElement(g)})),C=b(),(0,ut.domel)(C).addChild("div").addChild("div",(function(t){return t.addClass(s).addChild("label",(function(t){return t.addClass("checkbox").addChild("input",(function(t){t.id("show_legend").type("checkbox"),o.settings.showLegend&&t.attr("checked","")})).addText(" "+r.i18n.getText("Facets","Chart","ShowLegendLabel"))}))}))},e.prototype.afterDialogOpened=function(t){this.getContext().resultTable.columns.getItems().filter((function(t){return r.utils.isNumericType(t.type)})).length<=0&&(t.showAlert("The dataset should contain at least one numeric column to build a chart","error"),t.getSubmitButtonElement().disabled=!0)},e.prototype.submitSettingsDialog=function(){var e=t.prototype.submitSettingsDialog.call(this),n=document.getElementById("chart_type_selector"),o=parseInt(n.value),i=document.getElementById("label_column_selector"),r=parseInt(i.value),s=document.getElementById("data_column_selector"),a=parseInt(s.value),l=document.getElementById("show_legend").checked;return e&&(this.settings={type:o,labelColumn:r,dataColumn:a,showLegend:l},this.canDisplay()&&this.refresh()),e},e.prototype.getSettings=function(){return this.settings},e.prototype.saveToData=function(){var e=t.prototype.saveToData.call(this);return this.settings&&(e.chartType=this.settings.type,e.labelCol=this.settings.labelColumn,e.dataCol=this.settings.dataColumn,e.showLeg=this.settings.showLegend),e},e.prototype.loadFromData=function(e){t.prototype.loadFromData.call(this,e),e&&(this.settings={type:e.chartType,dataColumn:e.dataCol,labelColumn:e.labelCol,showLegend:e.showLeg})},e.prototype.refreshCore=function(){this.chart&&(this.settings&&this.chart.updateSettings(this.settings),this.chart.prepareChartData(),this.chart.refresh())},e.prototype.onResize=function(){this.refresh()},e}(Ge),en=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}();!function(t){t.Sum="SUM",t.Average="AVG",t.Min="MIN",t.Max="MAX",t.Count="COUNT"}(ze||(ze={})),function(t){t[t.ColumnField=0]="ColumnField",t[t.RowField=1]="RowField",t[t.CellData=2]="CellData"}(Ve||(Ve={}));var nn=/{0:(.*?)}/g,on=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.title=r.i18n.getText("Facets","Pivot","FacetTitle"),e.dialogTitle=r.i18n.getText("Facets","Pivot","DlgTitle"),e.pivotTable=new r.EasyDataTable,e}return en(e,t),e.prototype.init=function(e){var n=this;t.prototype.init.call(this,e),this.options.maxRowCount=this.options.maxRowCount||500,this.options.viewportRowsCount=this.options.viewportRowsCount||50,this.grid=new ut.EasyGrid({slot:this.contentDiv,dataTable:this.pivotTable,paging:{enabled:!1,pageSize:this.options.maxRowCount},viewportRowsCount:this.options.viewportRowsCount,useRowNumeration:!1,showPlusButton:!1,allowDragDrop:!1,onGetCellRenderer:function(t,e){if(t.dataColumn){if("total"==t.dataColumn.id)return function(t,n,o,i){e(t,n,o,i),o.classList.add("pivot-cell-total")};if(n.settings.totalsRow)if(0===n.pivotTable.columns.getIndex(t.dataColumn.id))return function(t,o,i,s){Number.parseInt(s.getAttribute("data-row-idx"))===n.pivotTable.getCachedCount()-1&&(t=r.i18n.getText("Facets","Pivot","TotalGridLabel")),e(t,o,i,s)}}}})},e.prototype.getType=function(){return Vt.PivotTable},e.prototype.destroy=function(){this.grid&&this.grid.destroy()},e.prototype.createAggrFuncSelectBuilder=function(t){for(var e=this.getContext().getModel(),n=(0,ut.domel)("select"),o=function(t){n.addChild("option",(function(n){n.attr("value",t).text(e.getAggrFunctionCaption(t))}))},i=0,r=Object.keys(ze).map((function(t){return ze[t]}));i<r.length;i++){o(r[i])}var s=n.toDOM().querySelectorAll("option");return null!=t?s.forEach((function(e){e.value==t&&(e.selected=!0)})):s[0].selected=!0,n},e.prototype.createColumnsSelectBuilder=function(t,e,n){for(var o=this.getContextDataTable(),i=(0,ut.domel)("select"),s=null,a=0,l=function(e){var n=o.columns.get(e),l=n.label,u=n.type,c=n.id;if(t&&t.indexOf(u)<0)return"continue";null===s&&r.utils.isNumericType(u)&&(s=a),i.addChild("option",(function(t){t.attr("value",c).text(l)})),a++},u=0;u<o.columns.count;u++)l(u);var c=Array.from(i.toDOM().querySelectorAll("option"));if(c.length>0)if(null!=e)for(var d=0,h=c;d<h.length;d++){var p=h[d];if(p.value==e){i.toDOM().value=p.value;break}}else switch(n){case Ve.ColumnField:i.toDOM().value=c[0].value;break;case Ve.RowField:i.toDOM().value=c.length>1?c[1].value:c[0].value;break;case Ve.CellData:i.toDOM().value=null===s?c[0].value:c[s].value}return i},e.prototype.renderFormFields=function(e,n){var o=this;t.prototype.renderFormFields.call(this,e,n);var i=this.settings||{totalsRow:!0,totalsCol:!0},s=[r.DataType.String,r.DataType.Date,r.DataType.DateTime,r.DataType.Int32,r.DataType.Int64,r.DataType.Word,r.DataType.Byte],a=[r.DataType.String,r.DataType.Float,r.DataType.Int32,r.DataType.Int64,r.DataType.Word,r.DataType.Byte,r.DataType.Currency],l=dt.z.isIE(),u=n,c=l?"kfrm-fields-ie is-horizontal":"kfrm-fields is-horizontal",d=function(){return l?(0,ut.domel)("div",n).addClass("kfrm-field-ie").toDOM():n};l?(0,ut.domel)(n).addChildElement(d()):(0,ut.domel)(n).addChild("div").addChild("div"),u=d(),(0,ut.domel)(u).addChild("label",(function(t){return t.attr("for","column_field").text(r.i18n.getText("Facets","Pivot","ColumnFieldSelectorLabel"))})).addChild("div",(function(t){return t.addClass(c).addChild("div",(function(t){return t.addClass("kfrm-select").attr("name","column_field").addChildElement(o.createColumnsSelectBuilder(s,i.colName,Ve.ColumnField).id("pivotTableColFieldSelector").toDOM())})).addChild("button",(function(t){return t.addClass("kfrm-button").addClass("eqjs-facets-button-swap").attr("title",r.i18n.getText("Facets","Pivot","SwapBtnTitle")).on("click",(function(){var t=document.getElementById("pivotTableColFieldSelector"),e=document.getElementById("pivotTableRowFieldSelector"),n=t.value;t.value=e.value,e.value=n}))}))})),u=d(),(0,ut.domel)(u).addChild("label",(function(t){return t.attr("for","row_field").text(r.i18n.getText("Facets","Pivot","RowFieldSelectorLabel"))})).addChild("div",(function(t){return t.addClass("kfrm-select").attr("name","row_field").addChildElement(o.createColumnsSelectBuilder(s,i.rowName,Ve.RowField).id("pivotTableRowFieldSelector").toDOM())})),u=d(),(0,ut.domel)(u).addChild("label",(function(t){return t.attr("for","data_function").text(r.i18n.getText("Facets","Pivot","CellDataSelectorLabel"))})).addChild("div",(function(t){return t.addClass(c).addChild("div",(function(t){return t.addClass("kfrm-select").attr("name","data_function").addChildElement(o.createAggrFuncSelectBuilder(i.aggrFunc).id("pivotTableAggrFuncSelector").toDOM())})).addChild("label",(function(t){return t.addText("of ")})).addChild("div",(function(t){return t.addClass("kfrm-select").attr("name","data_column").addChildElement(o.createColumnsSelectBuilder(a,i.fieldName,Ve.CellData).on("change",(function(t){var e=t.target.value;o.validateSelectedField(e)})).id("pivotTableCellFieldSelector").toDOM())}))})),u=d(),(0,ut.domel)(u).addChild("div").addChild("div",(function(t){return t.addClass(c).addChild("label",(function(t){return t.addClass("checkbox").addChild("input",(function(t){t.id("pivotTableHasTotalsRow").type("checkbox"),i.totalsRow&&t.attr("checked","")})).addText(" "+r.i18n.getText("Facets","Pivot","TotalsRowLabel"))})).addChild("label",(function(t){return t.addClass("checkbox").addChild("input",(function(t){t.id("pivotTableHasTotalsCol").type("checkbox"),i.totalsCol&&t.attr("checked","")})).addText(" "+r.i18n.getText("Facets","Pivot","TotalsColLabel"))}))}))},e.prototype.afterDialogOpened=function(t){var e=document.getElementById("pivotTableCellFieldSelector").value;e&&this.validateSelectedField(e),this.getQuery().getColumns().length<=2&&(t.showAlert("The dataset should contain at least three columns to build a pivot table","error"),t.getSubmitButtonElement().disabled=!0)},e.prototype.validateSelectedField=function(t){var e=this.getContextDataTable(),n=e.columns.getIndex(t),o=e.columns.get(n),i=document.getElementById("pivotTableAggrFuncSelector");o.type==r.DataType.String?(i.disabled=!0,i.value=ze.Count):i.disabled=!1},e.prototype.submitSettingsDialog=function(){var e=t.prototype.submitSettingsDialog.call(this);return e&&(this.settings={colName:document.getElementById("pivotTableColFieldSelector").value,rowName:document.getElementById("pivotTableRowFieldSelector").value,aggrFunc:document.getElementById("pivotTableAggrFuncSelector").value,fieldName:document.getElementById("pivotTableCellFieldSelector").value,totalsRow:document.getElementById("pivotTableHasTotalsRow").checked,totalsCol:document.getElementById("pivotTableHasTotalsCol").checked},this.refresh()),e},e.prototype.saveToData=function(){var e=t.prototype.saveToData.call(this);return this.settings&&r.utils.assignDeep(e,this.settings),e},e.prototype.loadFromData=function(e){t.prototype.loadFromData.call(this,e),e&&(this.settings=r.utils.assignDeep(this.settings,e),"AVERAGE"==this.settings.aggrFunc&&(this.settings.aggrFunc=ze.Average))},e.prototype.refreshCore=function(){if(this.updatePivotData(),this.grid){var t=this.pivotTable.getTotal();t>this.grid.options.paging.pageSize&&(this.contentDiv.classList.remove("pivot-grid-with-totals"),this.showErrorMessage(r.i18n.getText("Facets","ErrTooMuchData"))),this.options.viewportRowsCount>t?this.grid.options.viewportRowsCount=t:this.grid.options.viewportRowsCount=this.options.viewportRowsCount,this.grid.refresh()}},e.prototype.getContextDataTable=function(){return this.getContext().resultTable},e.prototype.updatePivotData=function(){this.pivotTable.clear();var t=this.getContextDataTable();if(t&&0!=t.getTotal()&&this.settings){var e=this.settings.colName,n=this.settings.rowName,o=this.settings.fieldName,i=t.columns.getIndex(e),s=t.columns.getIndex(n),a=t.columns.getIndex(o);if(null!=i&&null!=s&&null!=a){for(var l=t.columns.get(a),u=t.columns.get(i),c=t.columns.get(s),d=c.label,h=c.type,p=u.label,f=[],g=[],y=t.getCachedRows(),m=0;m<y.length;m++){var v=y[m].getValue(i);f.indexOf(v)<0&&f.push(v);var C=y[m].getValue(s);g.indexOf(C)<0&&g.push(C)}this.pivotTable.columns.add({id:d+"\\"+p,label:d+"\\"+p,description:"",type:h,dfmt:c.displayFormat,style:c.style});var b=[],x=null;r.utils.isNumericType(u.type)?x=this.formatNumber:r.utils.getDateDataTypes().indexOf(u.type)>=0&&(x=this.formatDate);for(m=0;m<f.length;m++){if(v=f[m]){var w=x?x(u,v):v;this.pivotTable.columns.add({id:v,label:w,description:"",dfmt:l.displayFormat,type:this.settings.aggrFunc!==ze.Count?l.type:r.DataType.Int64,style:l.style})}else b.push(m)}var E=[];for(m=0;m<g.length;m++)E.push([]),E[m].push(g[m]);for(m=0;m<g.length;m++)for(var T=0;T<f.length;T++)b.indexOf(T)>=0||E[m].push(this.calcAggrFunc(this.settings.aggrFunc,{colName:this.settings.colName,rowName:this.settings.rowName,fieldName:this.settings.fieldName,rowValue:g[m],colValue:f[T]}));if(this.settings.totalsCol){this.pivotTable.columns.add({id:"total",label:r.i18n.getText("Facets","Pivot","TotalGridLabel"),description:"",dfmt:l.displayFormat,type:this.settings.aggrFunc!==ze.Count?l.type:r.DataType.Int64});for(m=0;m<E.length;m++){var D=E[m],S=0;this.settings.aggrFunc!=ze.Min&&this.settings.aggrFunc!=ze.Max||(S=D[1]);for(T=1;T<D.length;T++){null!==(_=D[T])&&(this.settings.aggrFunc===ze.Min?_<S&&(S=_):this.settings.aggrFunc===ze.Max?_>S&&(S=_):S+=_)}this.settings.aggrFunc===ze.Average&&(S/=D.length-1),D.push(S)}}for(var k=0,M=E;k<M.length;k++){D=M[k];this.pivotTable.addRow(D)}if(this.settings.totalsRow){var I=[];I.push(null);for(m=1;m<this.pivotTable.columns.count;m++){var B=this.pivotTable.getCachedRows(),A=0;this.settings.aggrFunc!=ze.Min&&this.settings.aggrFunc!=ze.Max||(A=B[0].getValue(m));for(T=0;T<B.length;T++){var _;null!==(_=B[T].getValue(m))&&(this.settings.aggrFunc===ze.Min?_<A&&(A=_):this.settings.aggrFunc===ze.Max?_>A&&(A=_):A+=_)}this.settings.aggrFunc===ze.Average&&(A/=B.length),I.push(A)}this.pivotTable.addRow(I),this.contentDiv.classList.add("pivot-grid-with-totals")}else this.contentDiv.classList.remove("pivot-grid-with-totals")}else this.showUnableDisplayMessage(r.i18n.getText("Facets","ErrQueryChanged"))}},e.prototype.calcAggrFunc=function(t,e){switch(t){case ze.Sum:return this.sum(e);case ze.Average:return this.average(e);case ze.Min:return this.min(e);case ze.Max:return this.max(e);case ze.Count:return this.count(e);default:return 0}},e.prototype.getSettings=function(){return this.settings},e.prototype.formatDate=function(t,e){var n="[object Date]"===Object.prototype.toString.call(e),o=(e||"").toString();if(n)if(t&&t.displayFormat&&nn.test(t.displayFormat))o=t.displayFormat.replace(nn,(function(n,o){return r.i18n.dateTimeToStr(e,t.type,o)}));else{var i=r.i18n.getCurrentLocale(),s={hour:"numeric",minute:"numeric",second:"numeric"};switch(t.type){case r.DataType.Date:o=e.toLocaleDateString(i);break;case r.DataType.Time:o=e.toLocaleTimeString(i,s);break;case r.DataType.DateTime:o="".concat(e.toLocaleDateString(i)," ").concat(e.toLocaleTimeString(i,s))}}return o},e.prototype.formatNumber=function(t,e){var n=(e||"").toString();return"number"==typeof e&&(n=t&&t.displayFormat&&nn.test(t.displayFormat)?t.displayFormat.replace(nn,(function(t,n){return r.i18n.numberToStr(e,n)})):e.toLocaleString()),n},e.prototype.sum=function(t){for(var e=0,n=this.getContextDataTable().getCachedRows(),o=0;o<n.length;o++){var i=n[o].getValue(t.rowName),r=n[o].getValue(t.colName);if(i===t.rowValue&&r===t.colValue)e+=n[o].getValue(t.fieldName)}return e},e.prototype.average=function(t){for(var e=0,n=0,o=this.getContextDataTable().getCachedRows(),i=0;i<o.length;i++){var r=o[i].getValue(t.rowName),s=o[i].getValue(t.colName);if(r===t.rowValue&&s===t.colValue)e+=o[i].getValue(t.fieldName),n++}return 0!=n&&(e/=n),e},e.prototype.min=function(t){for(var e=Number.MAX_SAFE_INTEGER,n=this.getContextDataTable().getCachedRows(),o=0;o<n.length;o++){var i=n[o].getValue(t.rowName),r=n[o].getValue(t.colName);if(i===t.rowValue&&r===t.colValue){var s=n[o].getValue(t.fieldName);s<e&&(e=s)}}return e==Number.MAX_SAFE_INTEGER?null:e},e.prototype.max=function(t){for(var e=Number.MIN_SAFE_INTEGER,n=this.getContextDataTable().getCachedRows(),o=0;o<n.length;o++){var i=n[o].getValue(t.rowName),r=n[o].getValue(t.colName);if(i===t.rowValue&&r===t.colValue){var s=n[o].getValue(t.fieldName);s>e&&(e=s)}}return e==Number.MIN_SAFE_INTEGER?null:e},e.prototype.count=function(t){for(var e=0,n=this.getContextDataTable().getCachedRows(),o=0;o<n.length;o++){var i=n[o].getValue(t.rowName),r=n[o].getValue(t.colName);i===t.rowValue&&r===t.colValue&&e++}return e},e}(Ge),rn=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),sn=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.grid=null,e.title=r.i18n.getText("Facets","DataTable","FacetTitle"),e.dialogTitle=r.i18n.getText("Facets","DataTable","DlgTitle"),e}return rn(e,t),e.prototype.init=function(e){t.prototype.init.call(this,e),this.reinitGrid()},e.prototype.getSettings=function(){return this.settings},e.prototype.reinitGrid=function(){this.grid&&this.grid.destroy();var t=this.container.options||{};t.gridResolver&&(this.grid=t.gridResolver(this.contentDiv,this.getType())),null==this.grid&&(this.grid=new Ae(this.contentDiv)),t.grid=t.grid||{},t.grid.autoRefresh=!1,t.grid.addColumns=!1;var e=this.getContext();t.grid.totals=this.settings,this.grid.init(e,t.grid)},e.prototype.getType=function(){return Vt.DataGrid},e.prototype.canDisplay=function(){return!0},e.prototype.refreshCore=function(){this.grid&&this.grid.refresh()},e.prototype.destroy=function(){this.grid&&this.grid.destroy()},e}(Ge),an=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),ln=function(t){function e(e){var n=t.call(this,e)||this;return n.facets=[],n.options={},n.group=A.Result,n}return an(e,t),e.prototype.destroyCore=function(){for(var t=0,e=this.facets;t<e.length;t++){e[t].destroy()}this.clear()},e.prototype.createFacetTab=function(t){var e=this.options[t];switch(t){case Vt.Chart:return new tn(this,e);case Vt.PivotTable:return new on(this,e);default:return new sn(this,e)}},e.prototype.getQuery=function(){return this.getContext().getQuery()},e}(st),un=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),cn=function(t){function e(e){var n=t.call(this,e)||this;return n.activeFacetIndex=-1,n.firstRender=!0,n.options={showExportButton:!0,showRefreshButton:!0,showMaximizeButton:!0,maximize2Window:!1,showProcessIndicator:!0,facetTypes:[Vt.DataGrid,Vt.Chart,Vt.PivotTable]},n.menuItems=[{id:Vt.DataGrid,text:r.i18n.getText("Facets","AddMenuItems","DataTable")},{id:Vt.Chart,text:r.i18n.getText("Facets","AddMenuItems","Chart")},{id:Vt.PivotTable,text:r.i18n.getText("Facets","AddMenuItems","Pivot")}],n.menuItemsFilter=function(t){return!(n.options.facetTypes.indexOf(t.id)<0)&&(t.id!==Vt.DataGrid||0===n.facets.filter((function(t){return t.getType()==Vt.DataGrid})).length)},n.slot.classList.contains("".concat(n.cssPrefix,"-panel"))||n.slot.classList.add("".concat(n.cssPrefix,"-panel")),n.renderProcessBlock(),n}return un(e,t),Object.defineProperty(e.prototype,"cssPrefix",{get:function(){return"eqjs-facets"},enumerable:!1,configurable:!0}),e.prototype.getWidgetType=function(){return"facetsPanel"},e.prototype.init=function(e,n){t.prototype.init.call(this,e,n),this.setOptions(n),this.destroyCore(),this.attachQueryObserver(),this.loadFacets()},e.prototype.attachQueryObserver=function(){var t=this,e=this.getQuery();this.queryEventCallbackId&&e.removeChangedCallback(this.queryEventCallbackId),this.queryEventCallbackId=e.addChangedCallback((function(e){var n=e.data;n.part==x.All&&n.source!=t&&(t.reloadFacets(),t.refreshCore(!0))}))},e.prototype.refreshCore=function(t){void 0===t&&(t=!1),(this.firstRender||t)&&(this.clear(),this.createAddMenu(),this.render()),this.validateAddFacetButton(),this.renderActiveFacet(),this.updateTotalRecords()},e.prototype.createAddMenu=function(){this.addMenu=new gt({items:this.menuItems,id:"FacetType-List"})},e.prototype.updateTotalRecords=function(){var t=this.getContext().resultTable.getTotal();this.recordsDiv.innerHTML=r.i18n.getText("Facets","TotalRecordsLabel")+" "+t,0==t?(0,ut.domel)(this.exportDiv).hide():(0,ut.domel)(this.exportDiv).show()},e.prototype.renderProcessBlock=function(){this._processBlock=(0,ut.domel)("div").addClass("".concat(this.cssPrefix,"-spinner")).addChild("div",(function(t){return t.addClass("".concat(ct.YR,"-progress-win8"),dt.z.getMobileCssClass()).addHtml('<div class="wBall" id="wBall_1"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_2"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_3"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_4"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_5"><div class="wInnerBall"></div></div>')})).toDOM()},e.prototype.onProcessStartCore=function(){this.options.showProcessIndicator&&!this._processBlock.parentNode&&this.bodyDiv&&(this.bodyDiv.childNodes.forEach((function(t){(0,ut.domel)(t).hide()})),this.bodyDiv.appendChild(this._processBlock))},e.prototype.onProcessEndCore=function(){if(this.options.showProcessIndicator&&this._processBlock.parentNode)try{this._processBlock.parentNode.removeChild(this._processBlock)}catch(t){}finally{this.renderActiveFacet(!1)}},e.prototype.render=function(){var t=this;this.firstRender=!1,this.headerDiv=(0,ut.domel)("div",this.slot).addClass("".concat(this.cssPrefix,"-header")).toDOM(),this.tabsDiv=(0,ut.domel)("div",this.headerDiv).addClass("".concat(this.cssPrefix,"-tabs")).toDOM(),this.tabsUl=(0,ut.domel)("ul",this.tabsDiv).addClass("".concat(this.cssPrefix,"-nav-tabs")).toDOM(),this.bodyDiv=(0,ut.domel)("div",this.slot).addClass("".concat(this.cssPrefix,"-body")).toDOM();for(var e=0,n=this.facets;e<n.length;e++){var o=n[e];this.renderFacet(o)}(0,ut.domel)(this.tabsDiv).addChild("div",(function(e){return t.addFacetButton=e.addClass("".concat(t.cssPrefix,"-add-button")).title(r.i18n.getText("Facets","NewFacetTitle")).addChild("a",(function(t){return t.attr("href","javascript:void(0)")})).on("click",(function(e){return t.addClickHandler(e)})).toDOM()}));var i=(0,ut.domel)("div",this.headerDiv).addClass("".concat(this.cssPrefix,"-manage")).toDOM();if(this.recordsDiv=(0,ut.domel)("div",i).addClass("".concat(this.cssPrefix,"-total-recs")).toDOM(),this.options.showRefreshButton||this.options.showExportButton||this.options.showMaximizeButton){var s=(0,ut.domel)("div",i).addClass("".concat(this.cssPrefix,"-total-buttons")).toDOM();this.options.showExportButton&&(this.exportDiv=(0,ut.domel)("button",s).on("click",(function(){return t.exportHandler()})).addClass("".concat(this.cssPrefix,"-button")).addClass("".concat(this.cssPrefix,"-button-export")).title(r.i18n.getText("Facets","ExportBtnTitle")).toDOM()),this.options.showRefreshButton&&(0,ut.domel)("button",s).on("click",(function(){return t.refreshHandler()})).addClass("".concat(this.cssPrefix,"-button")).addClass("".concat(this.cssPrefix,"-button-refresh")).title(r.i18n.getText("Facets","RefreshBtnTitle")),this.options.showMaximizeButton&&(this.maximizeButton=(0,ut.domel)("button",s).on("click",(function(){return t.options.maximize2Window?t.maximizeHandler(!0):t.maximizeHandler()})).addClass("".concat(this.cssPrefix,"-button")).addClass("".concat(this.cssPrefix,"-button-maximize")).title(r.i18n.getText("Facets","MaximizeBtnTitle")).toDOM())}},e.prototype.refreshHandler=function(){var t=this.getContext();t.fetchData({success:function(){t.refreshWidgets(A.Result)}})},e.prototype.exportHandler=function(){var t=this.getContext();new Ne(t).show()},e.prototype.maximizeHandler=function(t){var e=(0,ut.domel)(this.slot);if(t)e.toggleClass("".concat(ct.YR,"-maximized-2window")),this.slot.classList.contains("".concat(ct.YR,"-maximized-2window"))?(this.maximizeButton.title=r.i18n.getText("Facets","RestoreBtnTitle"),this.maximizeButton.classList.toggle("".concat(this.cssPrefix,"-button-maximize"),!1),this.maximizeButton.classList.toggle("".concat(this.cssPrefix,"-button-restore"),!0)):(this.maximizeButton.title=r.i18n.getText("Facets","MaximizeBtnTitle"),this.maximizeButton.classList.toggle("".concat(this.cssPrefix,"-button-restore"),!1),this.maximizeButton.classList.toggle("".concat(this.cssPrefix,"-button-maximize"),!0));else{var n=!this.slot.hasAttribute("data-is-maximized");n?(this.slot.setAttribute("data-is-maximized",""),this.maximizeButton.title=r.i18n.getText("Facets","RestoreBtnTitle"),this.maximizeButton.classList.toggle("".concat(this.cssPrefix,"-button-maximize"),!1),this.maximizeButton.classList.toggle("".concat(this.cssPrefix,"-button-restore"),!0)):(this.slot.removeAttribute("data-is-maximized"),this.maximizeButton.title=r.i18n.getText("Facets","MaximizeBtnTitle"),this.maximizeButton.classList.toggle("".concat(this.cssPrefix,"-button-restore"),!1),this.maximizeButton.classList.toggle("".concat(this.cssPrefix,"-button-maximize"),!0)),document.querySelectorAll("[data-hide-on-max]").forEach((function(t){n?t.setAttribute("style","display: none;"):t.removeAttribute("style")}))}this.facets.forEach((function(t){return t.onResize()}))},e.prototype.renderActiveFacet=function(t){var e=this;void 0===t&&(t=!0),this.tabsUl.querySelectorAll("li").forEach((function(t,n){t.classList.contains("active")&&t.classList.remove("active"),e.activeFacetIndex===n&&t.classList.add("active")})),this.bodyDiv.querySelectorAll(".".concat(ct.YR,"-facet")).forEach((function(n,o){(0,ut.domel)(n).hide(),e.activeFacetIndex===o&&((0,ut.domel)(n).show(),t&&e.facets[o].refresh())}))},e.prototype.renderFacet=function(t){this.renderFacetTab(t);var e=this.renderFacetSlot(t);t.init(e)},e.prototype.renderFacetTab=function(t){var e=this;return(0,ut.domel)("li",this.tabsUl).addChild("span",(function(n){return n.addClass("".concat(ct.YR,"-facet-settings")).on("click",(function(n){n.stopPropagation(),e.settingsClickHandler(t)}))})).addChild("a",(function(e){return e.addText(t.title).attr("href","javascript:void(0)")})).addChild("span",(function(n){return n.addClass("".concat(ct.YR,"-facet-close")).on("click",(function(n){n.stopPropagation(),e.closeClickHandler(t)}))})).on("click",(function(n){return e.selectClickHandler(t)})).toDOM()},e.prototype.renderFacetSlot=function(t){return(0,ut.domel)("div",this.bodyDiv).addClass("".concat(ct.YR,"-facet")).hide().toDOM()},e.prototype.refreshFacetTabs=function(){var t=this;this.tabsUl.querySelectorAll("li").forEach((function(e){t.tabsUl.removeChild(e)}));for(var e=0,n=this.facets;e<n.length;e++){var o=n[e];this.renderFacetTab(o)}},e.prototype.removeFacet=function(t){var e=this.facets.indexOf(t);if(e>=0){this.facets.splice(e,1);var n=this.tabsUl.childNodes[e];this.tabsUl.removeChild(n);var o=this.bodyDiv.childNodes[e];this.bodyDiv.removeChild(o),this.facets.length>0?this.activeFacetIndex=e<this.facets.length?e:this.facets.length-1:this.activeFacetIndex=-1,this.renderActiveFacet(),this.validateAddFacetButton()}},e.prototype.addClickHandler=function(t){var e=this;this.addMenu.showMenu({anchor:t.target,itemFilterCallback:this.menuItemsFilter,itemSelectedCallback:function(t){var n=e.createFacetTab(t.id),o=e.renderFacetSlot(n);n.init(o),n.showSettingsDialog().then((function(t){t?(e.facets.push(n),e.activeFacetIndex=e.facets.length-1,e.renderFacetTab(n),e.renderActiveFacet(),e.saveFacets()):e.bodyDiv.removeChild(o)})).catch((function(t){return console.error(t)}))}})},e.prototype.selectClickHandler=function(t){var e=this.facets.indexOf(t);this.setActiveFacet(e)},e.prototype.settingsClickHandler=function(t){var e=this;t.showSettingsDialog().then((function(t){t&&(e.refreshFacetTabs(),e.renderActiveFacet(),e.saveFacets())})).catch((function(t){return console.error(t)}))},e.prototype.closeClickHandler=function(t){var e=this;this.getDialogService().openConfirm(r.i18n.getText("Facets","RemoveFacetDlgTitle"),r.i18n.getText("Facets","RemoveFacetDlgContent").replace("{facetTitle}",t.title)).then((function(n){n&&(e.removeFacet(t),e.saveFacets())})).catch((function(t){return console.error(t)}))},e.prototype.clear=function(){this.firstRender=!0,this.slot.innerHTML=""},e.prototype.createDefaultFacetIfNotExist=function(){if(0===this.facets.length){var t=this.createFacetTab(Vt.DataGrid);this.facets.push(t),this.activeFacetIndex=0}},e.prototype.validateAddFacetButton=function(){this.addFacetButton.hidden=0==this.addMenu.getItems().filter(this.menuItemsFilter).length},e.prototype.setActiveFacet=function(t){this.activeFacetIndex!=t&&(this.activeFacetIndex=t,this.renderActiveFacet(),this.saveFacets(!0))},e.prototype.setOptions=function(t){r.utils.assignDeep(this.options,t)},e.prototype.getDialogService=function(){return this.getContext().getServices().getDialogService()},e.prototype.saveFacets=function(t){void 0===t&&(t=!1);var e=this.getQuery();e.innerData=e.innerData||{},e.innerData.facets={active:this.activeFacetIndex,items:this.facets.map((function(t){return t.saveToData()}))},e.fireChangedEvent({part:x.Facets,action:t?w.Activate:w.All,source:this})},e.prototype.reloadFacets=function(){for(var t=0,e=this.facets;t<e.length;t++){e[t].destroy()}this.loadFacets()},e.prototype.loadFacets=function(){var t=this.getQuery();if(this.facets=[],t.innerData&&t.innerData.facets){for(var e=0,n=t.innerData.facets.items;e<n.length;e++){var o=n[e],i=this.createFacetTab(o.type);i.loadFromData(o),this.facets.push(i)}var r=t.innerData.facets.active;this.activeFacetIndex=r>=0?r:this.facets.length-1}else this.createDefaultFacetIfNotExist()},e}(ln),dn=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),hn=function(t){function e(e){var n=t.call(this,e)||this;return n.options={defFormat:"csv",enableExport:!0},n.clickHandler=function(t){n.slot.hasAttribute("disabled")||new Ne(n.context).show(n.options.defFormat)},n.group=A.All,n}return dn(e,t),e.prototype.getWidgetType=function(){return"exportWidget"},e.prototype.init=function(e,n){t.prototype.init.call(this,e,n),this.options=r.utils.assignDeep(this.options,n),this.slot.addEventListener("click",this.clickHandler)},e.prototype.refreshCore=function(){this.options.enableExport&&this.context.resultTable&&this.context.resultTable.getCachedCount()>0?this.slot.removeAttribute("disabled"):this.slot.setAttribute("disabled","")},e.prototype.destroyCore=function(){this.slot.removeAttribute("disabled"),this.slot.removeEventListener("click",this.clickHandler)},e}(st),pn=function(){function t(t){if(this.selectState={columns:[]},this.funcMap={},!t||!t.slot)throw new Error("slot is required");if(!t||!t.query)throw new Error("query is required");this.slot=t.slot,this.query=t.query,this.onChanged=t.onChanged,this.dropSelectState(),this.dropState()}return Object.defineProperty(t.prototype,"cssPrefix",{get:function(){return"eqjs-as"},enumerable:!1,configurable:!0}),t.prototype.render=function(){this.createFunctionMenu(),this.setInitialState(),this.changed()},t.prototype.setInitialState=function(){for(var t=this.query.getAggregationSettings(),e=t.getInternalGroups(),n=t.getAggregates(),o=0,i=e;o<i.length;o++){var r=i[o];this.state.groups.push({columns:r.columns})}for(var s=0,a=n;s<a.length;s++){var l=a[s];this.state.aggregates.push({colId:l.colId,funcId:l.funcId})}this.state.grandTotals=t.hasGrandTotals(),this.state.recordCount=t.hasRecordCount()},t.prototype.getAvailableColumns=function(){return this.query.getColumns().filter((function(t){return t.enabled}))},t.prototype.renderCore=function(){var t=this;this.slot.innerHTML="";for(var e=this.getAvailableColumns(),n=(0,ut.domel)(this.slot),o=null,i=null,s=null,a=this.state.aggregates,l=-1,u=function(e){if(o&&o.columns.indexOf(e.id)>=0)return c.renderColumn(i,e,!0),"continue";if(null!=(o=c.getGroupForColumn(e.id))){l++;var u=(0,ut.domel)("div",c.slot).addClass("".concat(c.cssPrefix,"-group")).data("gindex","".concat(l));return i=(0,ut.domel)("div",u.toDOM()).addClass("".concat(c.cssPrefix,"-columns")),c.renderColumn(i,e,!0),"continue"}var d=a.filter((function(t){return t.colId==e.id}))[0];if(d){var h=(0,ut.domel)("div",c.slot).addClass("".concat(c.cssPrefix,"-aggr"));return c.renderColumn(h,e,!0,d.funcId),h.addChild("div",(function(e){return e.addClass("".concat(t.cssPrefix,"-buttons")).addChild("button",(function(e){return e.addClass("".concat(t.cssPrefix,"-unaggr-btn")).title(r.i18n.getText("AggrSettings","UnaggrBtn")).on("click",t.removeAggrBtnClickHandler.bind(t))}))})),"continue"}if(c.selectState.columns.indexOf(e.id)>=0){if(null==s){var p=(0,ut.domel)("div",c.slot).addClass("".concat(c.cssPrefix,"-selected"));s=(0,ut.domel)("div",p.toDOM()).addClass("".concat(c.cssPrefix,"-columns"))}return c.renderColumn(s,e,!1),"continue"}c.renderColumn(n,e,!1)},c=this,d=0,h=e;d<h.length;d++){u(h[d])}if(s){var p=(0,ut.domel)("div",s.toDOM().parentElement).addClass("".concat(this.cssPrefix,"-buttons"));p.addChild("button",(function(e){return e.addClass("".concat(t.cssPrefix,"-group-btn")).title(r.i18n.getText("AggrSettings","GroupBtn")).on("click",t.groupBtnClickHandler.bind(t))})),1==this.selectState.columns.length&&p.addChild("button",(function(e){return e.addClass("".concat(t.cssPrefix,"-aggr-btn")).title(r.i18n.getText("AggrSettings","AggrBtn")).on("click",t.aggrBtnClickHandler.bind(t))}))}(0,ut.domel)(this.slot).addChild("div",(function(e){return e.addClass("".concat(t.cssPrefix,"-counts")).addChild("label",(function(e){return e.addClass("eqjs-ctrl-switch").addChild("input",(function(e){e.attr("type","checkbox"),t.state.recordCount&&e.attr("checked",""),e.on("change",t.countsCheckboxChangeHandler.bind(t))})).addChild("span",(function(t){return t.addClass("slider round")})).addChild("span",(function(t){return t.addClass("switch-text").addText(r.i18n.getText("AggrSettings","GroupCountsLabel"))}))}))})).addChild("div",(function(e){return e.addClass("".concat(t.cssPrefix,"-grandtotals")).addChild("label",(function(e){return e.addClass("eqjs-ctrl-switch").addChild("input",(function(e){e.attr("type","checkbox"),t.state.grandTotals&&e.attr("checked",""),e.on("change",t.grandCheckboxChangeHandler.bind(t))})).addChild("span",(function(t){return t.addClass("slider round")})).addChild("span",(function(t){return t.addClass("switch-text").addText(r.i18n.getText("AggrSettings","GrandTotalsLabel"))}))}))})),this.slot.querySelectorAll(".".concat(this.cssPrefix,"-group")).forEach((function(e){(0,ut.domel)(e).addChild("div",(function(e){return e.addClass("".concat(t.cssPrefix,"-buttons")).addChild("button",(function(e){return e.addClass("".concat(t.cssPrefix,"-ungroup-btn")).title(r.i18n.getText("AggrSettings","UngroupBtn")).on("click",t.removeGroupBtnClickHandler.bind(t))}))}))})),this.validateCheckboxes()},t.prototype.validateCheckboxes=function(){if(0!==this.selectState.columns.length){for(var t,e,n=null,o=0;o<this.slot.childNodes.length;o++){(s=this.slot.childNodes[o]).classList.contains("".concat(this.cssPrefix,"-selected"))?t&&t.classList.contains("".concat(this.cssPrefix,"-column"))&&(e=t):s.classList.contains("".concat(this.cssPrefix,"-column"))&&t&&t.classList.contains("".concat(this.cssPrefix,"-selected"))&&(n=s),t=s}for(o=0;o<this.slot.childNodes.length;o++){(s=this.slot.childNodes[o]).classList.contains("".concat(this.cssPrefix,"-column"))&&s!=e&&s!=n&&s.firstElementChild.firstElementChild.setAttribute("disabled","")}var i=".".concat(this.cssPrefix,"-selected>.").concat(this.cssPrefix,"-columns>.").concat(this.cssPrefix,"-column"),r=this.slot.querySelectorAll(i);for(o=1;o<r.length-1;o++){var s;(s=r[o]).firstElementChild.firstElementChild.setAttribute("disabled","")}}},t.prototype.isValid=function(){var t=this.selectState.columns.length,e=this.state.aggregates.length>0,n=this.state.groups.length>0,o=this.state.grandTotals,i=this.state.recordCount;return!t&&(n?e||i:!!e&&(n||o))},t.prototype.getValidationMessage=function(){var t=this.selectState.columns.length,e=this.state.aggregates.length>0,n=this.state.groups.length>0,o=this.state.grandTotals,i=this.state.recordCount;return"".concat(t?r.i18n.getText("AggrSettings","SelectedError"):!n||e||i?!e||n||o?r.i18n.getText("AggrSettings","NoGroupsOrAggrError"):r.i18n.getText("AggrSettings","NoGroupsOrGrandError"):r.i18n.getText("AggrSettings","NoAggrOrCountError")," ")},t.prototype.getSettings=function(){for(var t=new r.AggregationSettings(this.query),e=0,n=this.state.groups;e<n.length;e++){var o=n[e];t.addGroup({columns:o.columns})}for(var i=0,s=this.state.aggregates;i<s.length;i++){var a=s[i];t.addAggregateColumn(a.colId,a.funcId)}return this.state.grandTotals&&t.addGrandTotals(),this.state.recordCount&&t.addCounts(),t},t.prototype.renderColumn=function(t,e,n,o){var i=this;void 0===o&&(o=null),t.addChild("div",(function(t){t.data("colid",e.id);var r=o?"".concat(e.caption," (").concat(i.funcMap[o].caption,")"):e.caption;n?t.addClass("".concat(i.cssPrefix,"-column-used")).addText(r):t.addClass("".concat(i.cssPrefix,"-column")).addChild("label",(function(t){return t.addClass("checkbox").addChild("input",(function(t){t.attr("type","checkbox"),i.selectState.columns.indexOf(e.id)>=0&&t.attr("checked",""),t.on("change",i.colCheckboxChangeHandler.bind(i))})).addText(r)}))}))},t.prototype.getGroupForColumn=function(t){var e=this.getGroupIndexForColumn(t);return e>=0?this.state.groups[e]:null},t.prototype.getGroupIndexForColumn=function(t){for(var e=0;e<this.state.groups.length;e++){if(this.state.groups[e].columns.indexOf(t)>=0)return e}return-1},t.prototype.grandCheckboxChangeHandler=function(t){this.state.grandTotals=!this.state.grandTotals,this.onChanged&&this.onChanged()},t.prototype.countsCheckboxChangeHandler=function(t){this.state.recordCount=!this.state.recordCount,this.onChanged&&this.onChanged()},t.prototype.colCheckboxChangeHandler=function(t){var e=t.target.parentElement.parentElement.getAttribute("data-colid"),n=this.selectState.columns.indexOf(e);if(n>=0)this.selectState.columns.splice(n,1);else{this.selectState.columns.push(e);var o=this.getAvailableColumns();this.selectState.columns=this.selectState.columns.sort((function(t,e){return o.findIndex((function(e){return e.id==t}))-o.findIndex((function(t){return t.id==e}))}))}this.changed()},t.prototype.groupBtnClickHandler=function(){this.state.groups.push({columns:this.selectState.columns});var t=this.getAvailableColumns();this.state.groups=this.state.groups.sort((function(e,n){return t.findIndex((function(t){return t.id==e.columns[0]}))-t.findIndex((function(t){return t.id==n.columns[0]}))})),this.dropSelectState(),this.changed()},t.prototype.removeGroupBtnClickHandler=function(t){var e=t.target,n=Number.parseInt(e.parentElement.parentElement.getAttribute("data-gindex"));this.state.groups.splice(n,1),this.changed()},t.prototype.removeAggrBtnClickHandler=function(t){var e=t.target.parentElement.parentElement.querySelector(".".concat(this.cssPrefix,"-column-used")).getAttribute("data-colid"),n=this.state.aggregates.findIndex((function(t){return t.colId==e}));n>=0&&(this.state.aggregates.splice(n,1),this.changed())},t.prototype.aggrBtnClickHandler=function(t){var e=this,n=(this.query.getModel(),this.selectState.columns[0]),o=this.getAvailableColumns().filter((function(t){return t.id==n}))[0];this.functionMenu.showMenu({anchor:t.target,itemFilterCallback:function(t){return e.funcMap[t.id].appliedTypes.indexOf(o.expr.dataType)>=0},itemSelectedCallback:function(t){e.state.aggregates.push({colId:n,funcId:t.id}),e.dropSelectState(),e.changed()}})},t.prototype.clear=function(){this.dropSelectState(),this.dropState(),this.changed()},t.prototype.dropSelectState=function(){this.selectState={columns:[]}},t.prototype.dropState=function(){this.state={groups:[],aggregates:[],recordCount:!0,grandTotals:!1}},t.prototype.changed=function(){this.onChanged&&this.onChanged(),this.renderCore()},t.prototype.createFunctionMenu=function(){for(var t=this.query.getModel(),e=[],n=0,o=this.query.getModel().getAggrFunctions();n<o.length;n++){var i=o[n];if(i){this.funcMap[i.id]=i;var r=t.getAggrFunctionCaption(i.id),s={id:i.id,text:r};e.push(s)}}var a=this.slot.id;a&&(a+="-FunctionsMenu");var l={items:e,id:a,searchBoxAlwaysShown:!1,domWriteItemsId:!0};this.functionMenu=new gt(l)},t}(),fn=__webpack_require__(702),gn=function(){function t(t){this.context=t,this.promise=null}return t.prototype.show=function(t){var e=this,n=t||this.context.getQuery();return this.query=this.context.createQuery(),this.query.loadFromData(n.toJSONData()),this.promise||(this.promise=new fn((function(t,o){var i=e.context.getServices().getDialogService();e.body=e.renderBody();var s=i.open({title:r.i18n.getText("AggrSettings","AggrDialogTitle"),body:e.body,onSubmit:function(){return!(e.query.enableAggregation&&!e.renderer.isValid())&&(n.enableAggregation=e.query.enableAggregation,n.enableAggregation&&n.useAggregation((function(t){var n=e.renderer.getSettings();t.loadFromData(n.saveToData())})),n.fireChangedEvent({part:x.Aggregation,wasModified:!1}),t(),!0)},onCancel:function(){t()}});e.renderer=new pn({slot:e.body.querySelector("#AggrSettingsComponent"),query:e.query,onChanged:function(){s.clearAlert();var t=e.renderer.isValid();if(!t){var n=e.renderer.getValidationMessage();s.showAlert(n,"warning")}s.getRootElement().querySelector(".kfrm-button.is-info").disabled=!t&&e.query.enableAggregation}}),e.query.enableAggregation&&e.renderer.render()}))),this.promise.catch((function(t){return console.error(t)})).finally((function(){return e.promise=null}))},t.prototype.renderBody=function(){var t=this;return(0,ut.domel)("div").addChild("div",(function(e){return e.addClass("eqjs-as-enableaggr").addChild("label",(function(e){return e.addClass("eqjs-ctrl-switch").addChild("input",(function(e){e.attr("type","checkbox"),t.query.enableAggregation&&e.attr("checked",""),e.on("change",t.enableAggrCheckBoxChangeHandler.bind(t))})).addChild("span",(function(t){return t.addClass("slider round")})).addChild("span",(function(t){return t.addClass("switch-text").addText(r.i18n.getText("AggrSettings","EnableAggrLabel"))}))}))})).addChild("div",(function(t){return t.id("AggrSettingsComponent")})).toDOM()},t.prototype.enableAggrCheckBoxChangeHandler=function(t){if(this.query.enableAggregation=!this.query.enableAggregation,this.body.querySelector("#AggrSettingsComponent").innerHTML="",this.query.enableAggregation)this.renderer.render();else{var e=this.body?this.body.closest(".kdlg-modal").querySelector("footer .kfrm-button.is-info"):null;e&&(e.disabled=!1)}},t}(),yn=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),mn=function(t){function e(e,n){var o=t.call(this,e)||this;return o.linkClickCallback=function(){new gn(o.context).show(o.getQuery())},o.queryEventCallbackId=null,o.customQuery=n,o.group=A.Query|A.QueryStatus,o}return yn(e,t),e.prototype.init=function(e,n){t.prototype.init.call(this,e,n),this.destroyCore(),this.attachQueryObserver()},Object.defineProperty(e.prototype,"cssPrefix",{get:function(){return"eqjs-aggrb"},enumerable:!1,configurable:!0}),e.prototype.getWidgetType=function(){return"aggregationBar"},e.prototype.refreshCore=function(){this.render()},e.prototype.getLinkText=function(){var t=this.getQuery();if(t.enableAggregation){for(var e=t.getAggregationSettings(),n=e.getInternalGroups(),o=e.getAggregates(),i=[],s=t.getColumns(),a=0,l=n;a<l.length;a++){var u=l[a].columns.map((function(t){var e=s.find((function(e){return e.id==t}));return e?e.caption:""}));i.push("[".concat(u.join(", "),"]"))}for(var c=i.join(", "),d=[],h=t.getModel().getAggrFunctions(),p=function(t){var e=s.find((function(e){return e.id==t.colId})),n=h.find((function(e){return e.id==t.funcId}));e&&n&&d.push("".concat(e.caption," (").concat(n.caption,")"))},f=0,g=o;f<g.length;f++){p(g[f])}var y=d.join(", ");return"".concat(c||r.i18n.getText("AggrSettings","NoGroupsLabel")," ::: ").concat(y?"<".concat(y,">"):r.i18n.getText("AggrSettings","NoAggrsLabel"))}return r.i18n.getText("AggrSettings","EmptySettingsLabel")},e.prototype.render=function(){this.slot.classList.add("".concat(this.cssPrefix,"-panel"));var t=dt.z.getMobileCssClass();t&&this.slot.classList.add(t),this.dialogLink||(this.dialogLink=document.createElement("a"),this.dialogLink.setAttribute("href","javascript:void(0)"),this.slot.appendChild(this.dialogLink)),this.dialogLink.textContent=this.getLinkText(),this.dialogLink.removeEventListener("click",this.linkClickCallback),this.dialogLink.addEventListener("click",this.linkClickCallback)},e.prototype.clear=function(){this.slot.innerHTML="",this.dialogLink=null},e.prototype.attachQueryObserver=function(){var t=this,e=this.getQuery();this.queryEventCallbackId=e.addChangedCallback((function(e){t.refreshCore()}))},e.prototype.detachQueryObserver=function(){this.queryEventCallbackId&&this.getQuery().removeChangedCallback(this.queryEventCallbackId)},e.prototype.destroyCore=function(){this.clear(),this.detachQueryObserver()},e.prototype.getQuery=function(){return this.customQuery||this.context.getQuery()},e}(st),vn=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Cn=function(t){function e(e){var n=t.call(this,e)||this;return n.changeLocale=function(){var t=n.selectEl.value;r.i18n.setCurrentLocale(t),n.context.refreshWidgets(A.All)},n.group=A.None,n}return vn(e,t),e.prototype.init=function(e,n){t.prototype.init.call(this,e,n),this.clear(),this.render()},e.prototype.getWidgetType=function(){return"changeLocale"},e.prototype.render=function(){var t=r.i18n.getLocales();if(t.length>1){this.selectEl=document.createElement("select");for(var e=0,n=t;e<n.length;e++){var o=n[e],i=document.createElement("option");i.value=o.locale,i.innerHTML=this.displayLocaleName(o),this.selectEl.appendChild(i)}this.selectEl.value=r.i18n.getCurrentLocale(),this.selectEl.classList.add("eqv-select"),this.selectEl.addEventListener("change",this.changeLocale),this.slot.appendChild(this.selectEl)}},e.prototype.displayLocaleName=function(t){return t.englishName&&t.displayName?"".concat(t.englishName," - ").concat(t.displayName):t.englishName?t.englishName:t.displayName?t.displayName:t.locale},e.prototype.clear=function(){this.slot.innerHTML=""},e.prototype.destroyCore=function(){this.clear()},e}(st),bn=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),xn=function(t){function e(e){var n=t.call(this,e)||this;return n.queryEventCallbackId=null,n.group=A.Query|A.QueryStatus,n}return bn(e,t),e.prototype.init=function(e,n){t.prototype.init.call(this,e,n),this.destroyCore(),this.attachQueryObserver()},Object.defineProperty(e.prototype,"cssPrefix",{get:function(){return"eqjs-query-name"},enumerable:!1,configurable:!0}),e.prototype.getWidgetType=function(){return"queryName"},e.prototype.refreshCore=function(){this.render()},e.prototype.render=function(){this.slot.classList.add("".concat(this.cssPrefix));var t=dt.z.getMobileCssClass();t&&this.slot.classList.add(t),this.nameSlot||(this.nameSlot=document.createElement("div"),this.nameSlot.classList.add("".concat(this.cssPrefix,"-text")),this.nameSlot.classList.add("".concat(this.cssPrefix,"-theme")),this.slot.appendChild(this.nameSlot)),this.asteriskSlot||(this.asteriskSlot=document.createElement("span"),this.asteriskSlot.innerHTML="*",this.asteriskSlot.classList.add("".concat(this.cssPrefix,"-asterisk")),this.slot.appendChild(this.asteriskSlot)),this.tooltipSlot||(this.tooltipSlot=document.createElement("span"),this.tooltipSlot.classList.add("".concat(this.cssPrefix,"-tooltip")),this.tooltipSlot.classList.add("".concat(this.cssPrefix,"-theme")),this.slot.appendChild(this.tooltipSlot));var e=this.context.getQuery().getName();this.nameSlot.textContent=e,this.tooltipSlot.textContent=e,this.asteriskSlot.style.visibility=this.context.getQuery().isModified()?"visible":"hidden"},e.prototype.clear=function(){this.slot.innerHTML="",this.nameSlot=null,this.tooltipSlot=null,this.asteriskSlot=null},e.prototype.attachQueryObserver=function(){var t=this,e=this.context.getQuery();this.queryEventCallbackId=e.addChangedCallback((function(e){t.refreshCore()}))},e.prototype.detachQueryObserver=function(){this.queryEventCallbackId&&this.context.getQuery().removeChangedCallback(this.queryEventCallbackId)},e.prototype.destroyCore=function(){this.clear(),this.detachQueryObserver()},e}(st),wn=function(){function t(){this.domRoots=[document],this.defaultViewOptions={enableExport:!0,disableConfirmationOnQueryChange:!1,queryFileExtensions:"text/xml,application/json",result:{clearResultOnQueryChange:!0,showChart:!0,showProcessIndicator:!0},widgets:{resultGrid:{addColumns:!1}},handlers:{}},this.viewOptions={},this.resultOptions={},this.enableExport=!1,this.resetContext(),this.renderSpinner()}return t.prototype.resetContext=function(){this.context=new rt,this.context.getServices().registerDialogServiceResolver((function(){return new ut.DefaultDialogService}))},t.prototype.init=function(t){try{this.context.initStart(),t&&t.shadowRoots&&(this.domRoots=this.domRoots.concat(t.shadowRoots)),this.viewOptions=this.initOptions(t),this.resultOptions=r.utils.assignDeep(this.defaultViewOptions.result,this.viewOptions.result),this.initWidgets(this.viewOptions),this.context.init(this.viewOptions),this.initDone()}catch(t){this.context.throwError({action:"Init",sourceError:t})}},t.prototype.initOptions=function(t){return(t=r.utils.assignDeep(this.defaultViewOptions,t)).widgets.easyGrid||(t.widgets.easyGrid=t.widgets.resultGrid||{}),t.columnTitleFormat&&(t.widgets.entitiesPanel=t.widgets.entitiesPanel||{},t.widgets.entitiesPanel.columnTitleFormat=t.widgets.entitiesPanel.columnTitleFormat||t.columnTitleFormat,t.widgets.columnsBar=t.widgets.columnsBar||{},t.widgets.columnsBar.titleElementFormat=t.widgets.columnsBar.titleElementFormat||t.columnTitleFormat,t.widgets.columnsPanel=t.widgets.columnsPanel||{},t.widgets.columnsPanel.titleElementFormat=t.widgets.columnsPanel.titleElementFormat||t.columnTitleFormat),t.widgets.easyGrid.paging=r.utils.assignDeep({},t.result.paging,t.widgets.easyGrid.paging),this.enableExport=t.enableExport||!1,t.widgets.exportWidget||(t.widgets.exportWidget={}),t.widgets.exportWidget.enableExport=this.enableExport,t},t.prototype.initWidgets=function(t){var e="QueryPanel",n="ColumnsPanel",o="EntitiesPanel",i="ResultPanel",r="ColumnsBar",s="FilterBar",a="ProcessBar",l="StatementPanel",u="ChangeLocale",c="QueryNameLabel",d="ResultFacetsPanel",h="ResultCount",p="ExportButton",f="AggregationBar";t.slots&&(c=t.slots.queryNameLabel||c,e=t.slots.queryPanel||e,n=t.slots.columnsPanel||n,r=t.slots.columnsBar||r,o=t.slots.entitiesPanel||o,i=t.slots.resultPanel||i,l=t.slots.statementPanel||l,a=t.slots.processBar||a,u=t.slots.changeLocale||u,d=t.slots.facetsPanel||d,h=t.slots.resultCountSpan||h,s=t.slots.filterBar||s,p=t.slots.exportButtons||p,f=t.slots.aggregationBar||f);var g=this.resolveElement(o);g&&!this.entitiesPanelWidget&&(this.entitiesPanelWidget=this.createEntitiesPanelWidget(g),this.context.addWidget(this.entitiesPanelWidget));var y=this.resolveElement(n);y&&!this.columnsPanelWidget&&(this.columnsPanelWidget=this.createColumnsPanelWidget(y),this.context.addWidget(this.columnsPanelWidget));var m=this.resolveElement(r);m&&!this.columnsBarWidget&&(this.columnsBarWidget=this.createColumnsBarWidget(m),this.context.addWidget(this.columnsBarWidget));var v=this.resolveElement(e);if(v&&!this.queryPanelWidget&&(this.queryPanelWidget=this.createQueryPanelWidget(v),this.context.addWidget(this.queryPanelWidget)),this.resultPanelSlot=this.resolveElement(i),this.resultPanelSlot){if(!this.resultGridWidget){var C=(0,ut.addElement)(this.resultPanelSlot,"div",{cssClass:"eqv-result-grid"});this.resultGridWidget=this.createResultGridWidget(C),this.context.addWidget(this.resultGridWidget)}if(this.resultOptions.showChart&&!this.chartWidget){var b=(0,ut.addElement)(this.resultPanelSlot,"div",{cssClass:"eqv-chart-panel"});b.style.display="none",this.chartWidget=this.createChartWidget(b),this.context.addWidget(this.chartWidget)}}var x=this.resolveElement(c);x&&!this.queryNameWidget&&(this.queryNameWidget=this.createQueryNameWidget(x),this.context.addWidget(this.queryNameWidget));var w=this.resolveElement(s);w&&!this.filterBarWidget&&(this.filterBarWidget=this.createFilterBarWidget(w),this.context.addWidget(this.filterBarWidget));var E=this.resolveElement("SortingBar");E&&!this.sortingBarWidget&&(this.sortingBarWidget=this.createSortingBarWidget(E),this.context.addWidget(this.sortingBarWidget));var T=this.resolveElement(a);T&&!this.processWidget&&(this.processWidget=this.createProcessWidget(T),this.context.addWidget(this.processWidget));var D=this.resolveElement(l);D&&!this.statementPanelWidget&&(this.statementPanelWidget=this.createStatementPanelWidget(D),this.context.addWidget(this.statementPanelWidget));var S=this.resolveElement(u);if(S){var k=this.createLocaleWidget(S);this.context.addWidget(k)}var M=this.resolveElement(d);M&&!this.resultFacetPanelWidget&&(this.resultFacetPanelWidget=this.createResultFacetsPanel(M),this.context.addWidget(this.resultFacetPanelWidget));var I=this.resolveElement(p);I&&!this.exportWidget&&(this.exportWidget=this.createExportWidget(I),this.context.addWidget(this.exportWidget)),this.resultCountSlot=this.resolveElement(h);var B=this.resolveElement(f);B&&!this.aggregationBarWidget&&(this.aggregationBarWidget=this.createAggregationBarWidget(B),this.context.addWidget(this.aggregationBarWidget))},t.prototype.initDone=function(){},t.prototype.resolveElement=function(t){if("string"==typeof t){for(var e=0,n=this.domRoots;e<n.length;e++){var o=n[e].getElementById(t);if(o)return o}return null}return t},t.prototype.resolveElementsByClassName=function(t){for(var e=[],n=0,o=this.domRoots;n<o.length;n++)for(var i=o[n].querySelectorAll("."+t),r=0;r<i.length;r++)e.push(i[r]);return e},t.prototype.displayRecordsCount=function(t){this.resultCountSlot&&void 0!==t&&(this.resultCountSlot.style.display="inline",this.resultCountSlot.innerHTML=r.i18n.getText("MsgResultCount").replace("{0}",t.toString()))},t.prototype.getContext=function(){return this.context},t.prototype.setDialogService=function(t){this.context.getServices().registerDialogServiceResolver((function(){return t}))},t.prototype.executeQuery=function(t){console.warn("`executeQuery` is deprecated. Use `fetchData` instead"),this.fetchData(t)},t.prototype.fetchData=function(t){var e=this;t=t||{refresh:!0},this.context.clearResult(),this.context.getQuery().isEmpty()&&!this.resultOptions.fetchEmptyQueries||(this.showResultSpinner(),this.context.fetchData({elasticPaging:t.elasticPaging,success:function(n){e.hideResultSpinner(),e.toggleExportButtons(),e.displayRecordsCount(e.context.resultTable.getTotal()),!0===t.refresh&&e.context.refreshWidgets(A.Result),t.callback&&t.callback(),t.success&&t.success()},error:function(){e.hideResultSpinner()}}))},t.prototype.toggleExportButtons=function(){this.enableExport&&this.context.resultTable&&this.context.resultTable.getCachedCount()>0?this.enableExportButtons():this.disableExportButtons()},t.prototype.enableExportButtons=function(){},t.prototype.disableExportButtons=function(){},t.prototype.renderSpinner=function(){this._spinnerDiv=(0,ut.domel)("div").addClass("eqjs-result-spinner").addChild("div",(function(t){return t.addClass("".concat(ct.YR,"-progress-win8"),dt.z.getMobileCssClass()).addHtml('<div class="wBall" id="wBall_1"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_2"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_3"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_4"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_5"><div class="wInnerBall"></div></div>')})).toDOM()},t.prototype.showResultSpinner=function(){if(this.resultOptions.showProcessIndicator&&this.resultPanelSlot&&!this._spinnerDiv.parentNode){for(var t=0;t<this.resultPanelSlot.children.length;t++){var e=this.resultPanelSlot.children[t];(0,ut.domel)(e).hide()}this.resultPanelSlot.appendChild(this._spinnerDiv)}},t.prototype.hideResultSpinner=function(){if(this.resultOptions.showProcessIndicator&&this.resultPanelSlot&&this._spinnerDiv.parentNode){this._spinnerDiv.parentNode.removeChild(this._spinnerDiv);for(var t=0;t<this.resultPanelSlot.children.length;t++){var e=this.resultPanelSlot.children[t];(0,ut.domel)(e).show()}}},t.prototype.createChartWidget=function(t){return this.resultOptions.chartWidgetResolver?this.resultOptions.chartWidgetResolver(t):new Ke(t)},t.prototype.createResultGridWidget=function(t){return this.resultOptions.resultGridResolver?this.resultOptions.resultGridResolver(t):new Ae(t)},t.prototype.createEntitiesPanelWidget=function(t){return new pt(t)},t.prototype.createColumnsPanelWidget=function(t){return new kt(t)},t.prototype.createQueryPanelWidget=function(t){return new be(t)},t.prototype.createLocaleWidget=function(t){return new Cn(t)},t.prototype.createProcessWidget=function(t){return new Le(t)},t.prototype.createColumnsBarWidget=function(t){return new Ot(t)},t.prototype.createFilterBarWidget=function(t){return new we(t)},t.prototype.createSortingBarWidget=function(t){return new Ft(t)},t.prototype.createQueryNameWidget=function(t){return new xn(t)},t.prototype.createStatementPanelWidget=function(t){return new Pe(t)},t.prototype.createResultFacetsPanel=function(t){return new cn(t)},t.prototype.createExportWidget=function(t){return new hn(t)},t.prototype.createAggregationBarWidget=function(t){return new mn(t)},t.prototype.detach=function(){this.entitiesPanelWidget&&(this.entitiesPanelWidget.destroy(),this.entitiesPanelWidget=null),this.columnsPanelWidget&&(this.columnsPanelWidget.destroy(),this.columnsPanelWidget=null),this.queryPanelWidget&&(this.queryPanelWidget.destroy(),this.queryPanelWidget=null),this.columnsBarWidget&&(this.columnsBarWidget.destroy(),this.columnsBarWidget=null),this.resultGridWidget&&(this.resultGridWidget.destroy(),this.resultGridWidget=null),this.chartWidget&&(this.chartWidget.destroy(),this.chartWidget=null),this.queryNameWidget&&(this.queryNameWidget.destroy(),this.queryNameWidget=null),this.processWidget&&(this.processWidget.destroy(),this.processWidget=null),this.localeWidget&&(this.localeWidget.destroy(),this.localeWidget=null),this.statementPanelWidget&&(this.statementPanelWidget.destroy(),this.statementPanelWidget=null),this.filterBarWidget&&(this.filterBarWidget.destroy(),this.filterBarWidget=null),this.sortingBarWidget&&(this.sortingBarWidget.destroy(),this.sortingBarWidget=null),this.statementWidget&&(this.statementWidget.destroy(),this.statementWidget=null),this.exportWidget&&(this.exportWidget.destroy(),this.exportWidget=null),this.resultFacetPanelWidget&&(this.resultFacetPanelWidget.destroy(),this.resultFacetPanelWidget=null),this.resultCountSlot&&(this.resultCountSlot.innerHTML="",this.resultCountSlot=null),this.resultPanelSlot&&(this.resultPanelSlot.innerHTML="",this.resultPanelSlot=null),this.domRoots=[document],this.resetContext()},t}(),En=__webpack_require__(702),Tn=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Dn=function(t){function e(){var e=t.call(this)||this;e.exportButtons=[],e.disabledClass="eqjs-disabled",e.dropdownContainerClass="eqv-dropdown-container",e.dropdownButtonClass="eqv-drop-button",e.dropdownContentClass="eqv-dropdown-content",e.dropdownShowClass="eqv-dropdown-show",e._querySaveTemplate='<div id="kdlg-dialog-form" class="kfrm-form">\n <div class="kfrm-fields label-above">\n <label for="kdlg-dialog-form-input" id="kdlg-dialog-form-content"></label>\n <input type="text" name="kdlg-dialog-form-input" id="kdlg-dialog-form-input" />\n </div>\n </div>',e.queryListMenu=null,e.fetchDataButtonClickHandler=e.fetchDataButtonClick.bind(e),e.clearQueryButtonClickHandler=e.clearQueryButtonClick.bind(e),e.newQueryButtonClickHandler=e.newQueryButtonClick.bind(e),e.loadQueryButtonClickHandler=e.loadQueryButtonClick.bind(e),e.saveQueryButtonClickHandler=e.saveQueryButtonClick.bind(e),e.copyQueryButtonClickHandler=e.copyQueryButtonClick.bind(e),e.removeQueryButtonClickHandler=e.removeQueryButtonClick.bind(e),e.storageButtonClickHandler=e.storageDropButtonClick.bind(e),e.saveQueryToFileButtonClickHandler=e.saveQueryToFileButtonClick.bind(e),e.loadQueryFromFileButtonClickHandler=e.loadQueryFromFileButtonClick.bind(e);var n=e;return e.exportButtonClickHandler=function(t){if(!this.classList.contains(n.disabledClass)){var e=this.getAttribute("data-format");n.getContext().exportResult({format:e})}},e.queryChangedHandler=function(t){var n=t.data;e.resultOptions.clearResultOnQueryChange&&(e.context.clearResult(),e.context.refreshWidgets(A.Result)),e.disableExportButtons(),e.resultCountSlot&&(e.resultCountSlot.style.display="none"),e.viewOptions.syncQueryOnChange&&e.syncQuery(),e.viewOptions.fetchDataOnChange&&(!n||n.part!=x.ExtraData&&n.part!=x.Facets)&&e.fetchData()},e.outsideClickHandler=function(t){var n=null;t.target.matches(".".concat(e.dropdownButtonClass))?n=t.target.parentElement.querySelector(".".concat(e.dropdownContentClass)):t.target.matches(".".concat(e.dropdownButtonClass," > span"))&&(n=t.target.parentElement.parentElement.querySelector(".".concat(e.dropdownContentClass)));for(var o=e.resolveElementsByClassName(e.dropdownContentClass),i=0;i<o.length;i++){var r=o[i];n!=r&&r.classList.contains(e.dropdownShowClass)&&r.classList.remove(e.dropdownShowClass)}},e}return Tn(e,t),e.prototype.refreshQueryList=function(){var t=this;this.queryListPanel&&(this.queryListPanel.innerHTML="",this.context.loadQueryList({success:function(e){var n=(0,ut.domel)("ul",t.queryListPanel).addClass("list-group list-group-flush");e.map((function(e){n.addChild("li",(function(n){n.addClass("list-group-item").setStyle("cursor","pointer").data("id",e.id).text(e.name).on("click",(function(){t.checkIfQueryModified((function(){return t.loadQuery(e.id)}))}))}))}))}}))},e.prototype.initOptions=function(e){return void 0===(e=t.prototype.initOptions.call(this,e)).syncQueryOnChange&&(e.syncQueryOnChange=!0),e},e.prototype.initWidgets=function(e){var n=this;t.prototype.initWidgets.call(this,e);var o="eqjs-export",i="QueryContentJson",r="ClearQueryButton",s="NewQueryButton",a="LoadQueryButton",l="SaveQueryButton",u="CopyQueryButton",c="RemoveQueryButton",d="StorageDropButton",h="FetchDataButton",p="LoadQueryFromFileButton",f="SaveQueryToFileButton",g="QueryListPanel";e.slots&&(i=e.slots.queryContentInput||i,h=e.slots.fetchDataButton||h,r=e.slots.clearQueryButton||r,s=e.slots.newQueryButton||s,a=e.slots.loadQueryButton||a,l=e.slots.saveQueryButton||l,u=e.slots.copyQueryButton||u,c=e.slots.removeQueryButton||c,d=e.slots.storageButton||d,o=e.slots.exportClass||o,p=e.slots.loadQueryFromFileButton||p,f=e.slots.saveQueryToFileButton||f,g=e.slots.queryListPanel||g),this.exportButtons=this.domRoots.reduce((function(t,e){return t.concat(Array.from(e.querySelectorAll(".".concat(o))))}),[]),e.enableExport||this.hideExportButtons(),this.disableExportButtons();this.exportButtons.forEach((function(t){t.addEventListener("click",n.exportButtonClickHandler)})),this.fetchDataButton||(this.fetchDataButton=this.resolveElement(h),this.fetchDataButton||(this.fetchDataButton=this.resolveElement("ExecuteQueryButton")),this.fetchDataButton&&this.fetchDataButton.addEventListener("click",this.fetchDataButtonClickHandler)),this.clearQueryButton||(this.clearQueryButton=this.resolveElement(r),this.clearQueryButton&&this.clearQueryButton.addEventListener("click",this.clearQueryButtonClickHandler)),this.newQueryButton||(this.newQueryButton=this.resolveElement(s),this.newQueryButton&&this.newQueryButton.addEventListener("click",this.newQueryButtonClickHandler)),this.loadQueryButton||(this.loadQueryButton=this.resolveElement(a),this.loadQueryButton&&this.loadQueryButton.addEventListener("click",this.loadQueryButtonClickHandler)),this.saveQueryButton||(this.saveQueryButton=this.resolveElement(l),this.saveQueryButton&&this.saveQueryButton.addEventListener("click",this.saveQueryButtonClickHandler)),this.copyQueryButton||(this.copyQueryButton=this.resolveElement(u),this.copyQueryButton&&this.copyQueryButton.addEventListener("click",this.copyQueryButtonClickHandler)),this.removeQueryButton||(this.removeQueryButton=this.resolveElement(c),this.removeQueryButton&&this.removeQueryButton.addEventListener("click",this.removeQueryButtonClickHandler)),this.storageDropButton||(this.storageDropButton=this.resolveElement(d),this.storageDropButton&&this.storageDropButton.addEventListener("click",this.storageButtonClickHandler)),this.saveQueryToFileButton||(this.saveQueryToFileButton=this.resolveElement(f),this.saveQueryToFileButton&&this.saveQueryToFileButton.addEventListener("click",this.saveQueryToFileButtonClickHandler)),this.queryListPanel||(this.queryListPanel=this.resolveElement(g),this.queryListPanel||(this.queryListPanel=this.resolveElement("QueryListSlot")),this.queryListPanel&&this.context.addEventListener("ready",(function(){n.refreshQueryList()}))),this.loadQueryFromFileButton||(this.loadQueryFromFileButton=this.resolveElement(p),this.loadQueryFromFileButton&&(this.loadQueryFromFileInput=document.createElement("input"),this.loadQueryFromFileInput.type="file",this.loadQueryFromFileInput.accept=e.queryFileExtensions,this.loadQueryFromFileInput.style.display="none",document.body.appendChild(this.loadQueryFromFileInput),this.loadQueryFromFileInput.addEventListener("change",this.loadQueryFromFileInputSelect.bind(this)),this.loadQueryFromFileButton.addEventListener("click",this.loadQueryFromFileButtonClickHandler))),window.addEventListener("click",this.outsideClickHandler)},e.prototype.initDone=function(){t.prototype.initDone.call(this),this.context.getQuery().addChangedCallback(this.queryChangedHandler)},e.prototype.syncQuery=function(){var t=this;this.context.syncQuery({success:function(e){e.statement&&t.context.refreshWidgets(A.Statement)}})},e.prototype.disableExportButtons=function(){var t=this;this.exportButtons.forEach((function(e){e.disabled=!0,e.classList.contains(t.disabledClass)||e.classList.add(t.disabledClass)}))},e.prototype.enableExportButtons=function(){var t=this;this.exportButtons.forEach((function(e){e.disabled=!1,e.classList.contains(t.disabledClass)&&e.classList.remove(t.disabledClass)}))},e.prototype.hideExportButtons=function(){this.exportButtons.forEach((function(t){t.style.display="none"}))},e.prototype.clearQueryButtonClick=function(){this.context.clearQuery(),this.context.refreshWidgets(A.Statement)},e.prototype.createNewQuery=function(t){return this.context.newQuery(t)},e.prototype.loadQuery=function(t){t&&this.context.loadQuery({queryId:t,silent:!1})},e.prototype.saveQuery=function(t,e){var n=this;this.context.saveQuery({success:function(){t&&t(),n.context.getQuery().fireChangedEvent({part:x.Properties,wasModified:!1}),n.refreshQueryList()},error:e})},e.prototype.saveCurrentQuery=function(t,e){var n=this;void 0===t&&(t=!1);var o=this.context.getQuery();o.isNewbie||t?this.showSaveQueryDialog((function(t){return new En((function(e){t&&(o.regenerateId(),o.setName(t),o.fireChangedEvent({part:x.Properties,wasModified:!0}),n.saveQuery((function(){e({success:!0})}),(function(t){return e({success:!1,message:t})})))}))})):this.saveQuery(e)},e.prototype.checkIfQueryModified=function(t){var e=this;this.context.getQuery().isModified()&&!this.viewOptions.disableConfirmationOnQueryChange?this.showQueryChangedDialog((function(n){n?e.saveCurrentQuery(!1,t):t()})):t()},e.prototype.removeCurrentQuery=function(){var t=this;this.context.removeQuery({success:function(){t.createNewQuery({useStorage:!1}),t.resultCountSlot&&(t.resultCountSlot.style.display="none"),t.context.clearResult(),t.refreshQueryList()}})},e.prototype.showNewQueryDialog=function(t){var e=this.context.getServices().getDialogService(),n=r.i18n.getText("NewQueryDefName"),o=e.open({title:r.i18n.getText("NewQueryTitle"),body:this._querySaveTemplate,submitable:!0,closable:!0,cancelable:!0,submitOnEnter:!0,arrangeParents:!1,beforeOpen:function(){var t=document.getElementById("kdlg-dialog-form-input");n&&(t.value=n),document.getElementById("kdlg-dialog-form-content").innerHTML=r.i18n.getText("NewQueryContent"),t.focus()},onSubmit:function(){var e=document.getElementById("kdlg-dialog-form-input").value;if(e&&e.replace(/\s/g,"").length>0){if(!t)return!0;o.disableButtons();var n=o.getRootElement().querySelector("header"),i=(0,ut.domel)("div",n).addClass("eqjs-process-bar local").toDOM();t(e).then((function(t){n.removeChild(i),o.enableButtons(),t.success?o.close():o.showAlert(t.message,"error")}))}return!1}})},e.prototype.showQueryChangedDialog=function(t){this.context.getServices().getDialogService().openConfirm(r.i18n.getText("QueryChangedTitle"),r.i18n.getText("QueryChangedContent"),t)},e.prototype.showSaveQueryDialog=function(t){var e=this.context.getServices().getDialogService(),n=this.context.getQuery(),o=n.isNewbie?n.getName():r.i18n.getText("SaveQueryDefName").replace("{queryName}",n.getName()),i=e.open({title:r.i18n.getText("SaveQueryTitle"),body:this._querySaveTemplate,submitable:!0,closable:!0,cancelable:!0,submitOnEnter:!0,arrangeParents:!1,beforeOpen:function(){var t=document.getElementById("kdlg-dialog-form-input");t.value=o,document.getElementById("kdlg-dialog-form-content").innerHTML=r.i18n.getText("SaveQueryContent"),t.focus()},onSubmit:function(){var e=document.getElementById("kdlg-dialog-form-input").value;if(e&&e.replace(/\s/g,"").length>0){if(!t)return!0;i.disableButtons();var n=i.getRootElement().querySelector("header"),o=(0,ut.domel)("div",n).addClass("eqjs-process-bar local").toDOM();t(e).then((function(t){i.enableButtons(),n.removeChild(o),t.success?i.close():i.showAlert(t.message,"error")}))}return!1}})},e.prototype.showRemoveQueryDialog=function(t){var e=this.context.getServices().getDialogService(),n=this.context.getQuery();e.openConfirm(r.i18n.getText("RemoveQueryTitle"),r.i18n.getText("RemoveQueryContent").replace("{queryName}",n.getName()),t)},e.prototype.showSaveQueryToFileDialog=function(t){var e=this.getContext().getServices().getDialogService(),n=this.context.getQuery(),o=this.renderSaveToFileDialogBody(n.getName()),i=e.open({title:r.i18n.getText("SaveQueryToFileDlgTitle"),body:o,onSubmit:function(){var e=o.querySelector("#kdlgFileNameInput"),n=e?e.value:"Query",r=o.querySelector("#kdlgFileFormatSelector"),s=r?r.value:"json";if(t){i.disableButtons();var a=i.getRootElement().querySelector("header"),l=(0,ut.domel)("div",a).addClass("eqjs-process-bar local").toDOM();return t(n,s).then((function(t){i.enableButtons(),a.removeChild(l),t.success?i.close():i.showAlert(t.message,"error")})),!1}return!0}})},e.prototype.renderSaveToFileDialogBody=function(t,e){void 0===e&&(e="json");var n=dt.z.isIE(),o=n?"kfrm-fields-ie col-ie-1-4 label-align-right":"kfrm-fields col-a-1 label-align-right",i=n?"kfrm-fields-ie is-horizontal":"kfrm-fields is-horizontal";return(0,ut.domel)("div").addClass("kfrm-form").addChild("div",(function(n){n.addClass(o).addChild("label",(function(t){return t.attr("for","file_name").addText(r.i18n.getText("FileNameLabel"))})).addChild("div",(function(n){return n.addClass(i).addChild("input",(function(e){return e.id("kdlgFileNameInput").name("file_name").type("text").attr("value",t)})).addChild("label",(function(t){return t.addText(".")})).addChild("div",(function(t){return t.addClass("kfrm-select").addChild("select",(function(t){return t.id("kdlgFileFormatSelector").addClass("kdlg-form-control").addOption({value:"xml",selected:"xml"===e}).addOption({value:"json",selected:"json"===e})}))}))}))})).toDOM()},e.prototype.newQueryButtonClick=function(){var t=this;this.checkIfQueryModified((function(){t.createNewQuery()}))},e.prototype.saveQueryToFileButtonClick=function(){var t=this;this.showSaveQueryToFileDialog((function(e,n){return new En((function(o){t.context.getQueryFile({fileName:e,format:n,success:function(){return o({success:!0})},error:function(t){return o({success:!1,message:t})}})}))}))},e.prototype.loadQueryFromFileButtonClick=function(){var t=this;this.checkIfQueryModified((function(){t.showLoadQueryFromFileDialog()}))},e.prototype.showLoadQueryFromFileDialog=function(){this.loadQueryFromFileInput.click()},e.prototype.loadQueryFromFileInputSelect=function(){var t=this,e=this.loadQueryFromFileInput.files.item(0),n=new FormData;n.append(e.name,e),this.loadQueryFromFileInput.value="",this.context.uploadQueryFile({data:n,success:function(){t.syncQuery(),t.refreshQueryList()}})},e.prototype.loadQueryButtonClick=function(){var t=this;this.context.loadQueryList({success:function(e){t.fillLoadQueryButtonMenu(e),t.queryListMenu.showMenu({anchor:t.loadQueryButton,adjustHeight:!1,itemSelectedCallback:function(e){t.checkIfQueryModified((function(){return t.loadQuery(e.id)}))}})}})},e.prototype.fillLoadQueryButtonMenu=function(t){var e=this.getContext().getQuery();this.queryListMenu=new gt({items:t.map((function(t){return{id:t.id,text:t.name}})),selectedIds:e.getId()})},e.prototype.saveQueryButtonClick=function(){this.saveCurrentQuery()},e.prototype.copyQueryButtonClick=function(){this.saveCurrentQuery(!0)},e.prototype.removeQueryButtonClick=function(){var t=this;this.showRemoveQueryDialog((function(e){e&&t.removeCurrentQuery()}))},e.prototype.storageDropButtonClick=function(){var t=this,e=this.storageDropButton.parentElement.querySelector(".".concat(this.dropdownContentClass));e&&window.setTimeout((function(){return e.classList.toggle(t.dropdownShowClass)}),100)},e.prototype.fetchDataButtonClick=function(){this.fetchData()},e.prototype.detach=function(){var e=this;this.enableExportButtons(),this.exportButtons.forEach((function(t){t.removeEventListener("click",e.exportButtonClickHandler)})),this.exportButtons=[],this.fetchDataButton&&(this.fetchDataButton.removeEventListener("click",this.fetchDataButtonClickHandler),this.fetchDataButton=null),this.clearQueryButton&&(this.clearQueryButton.removeEventListener("click",this.clearQueryButtonClickHandler),this.clearQueryButton=null),this.newQueryButton&&(this.newQueryButton.removeEventListener("click",this.newQueryButtonClickHandler),this.newQueryButton=null),this.loadQueryButton&&(this.loadQueryButton.removeEventListener("click",this.loadQueryButtonClickHandler),this.loadQueryButton=null),this.saveQueryButton&&(this.saveQueryButton.removeEventListener("click",this.saveQueryButtonClickHandler),this.saveQueryButton=null),this.copyQueryButton&&(this.copyQueryButton.removeEventListener("click",this.copyQueryButtonClickHandler),this.copyQueryButton=null),this.removeQueryButton&&(this.removeQueryButton.removeEventListener("click",this.removeQueryButtonClickHandler),this.removeQueryButton=null),this.storageDropButton&&(this.storageDropButton.removeEventListener("click",this.storageButtonClickHandler),this.storageDropButton=null),this.saveQueryToFileButton&&(this.saveQueryToFileButton.removeEventListener("click",this.saveQueryToFileButtonClickHandler),this.saveQueryToFileButton=null),this.queryListPanel&&(this.queryListPanel=null),this.loadQueryFromFileButton&&(this.loadQueryFromFileInput&&document.body.removeChild(this.loadQueryFromFileInput),this.loadQueryFromFileButton.removeEventListener("click",this.loadQueryFromFileButtonClickHandler),this.loadQueryFromFileButton=null),t.prototype.detach.call(this)},e}(wn),Sn=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),kn=function(t){function e(){return t.call(this)||this}return Sn(e,t),e.prototype.initOptions=function(e){var n=this;return(e=t.prototype.initOptions.call(this,e)).result.fetchEmptyQueries=!0,this.context.getQuery().addChangedCallback((function(){n.resultOptions.clearResultOnQueryChange&&n.context.clearResult(),e.syncQueryOnChange&&n.context.syncQuery()})),this.context.addEventListener("ready",this.fetchData.bind(this)),e},e.prototype.initWidgets=function(e){var n=this;if(t.prototype.initWidgets.call(this,e),this.sortingBarWidget&&this.context.getQuery().addChangedCallback((function(t){var e=t.data;!e||e.part!=x.SortingColumns&&e.part!=x.Columns&&e.part!=x.All||n.fetchData()})),this.filterBarWidget){var o=this.filterBarWidget.getWidgetType();e.widgets[o]=e.widgets[o]||{},e.widgets[o].applyFilterCallback||(e.widgets[o].applyFilterCallback=function(){n.fetchData()})}},e.prototype.applyQueryFilter=function(){console.warn("applyQueryFilter is obsolete. Use fetchData instead"),this.fetchData()},e.prototype.fetchData=function(){t.prototype.fetchData.call(this,{refresh:!0})},e}(wn),Mn=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),In=function(t){function e(){return t.call(this)||this}return Mn(e,t),e.prototype.createResultGridWidget=function(t){return new Se(t)},e.prototype.applyQueryFilter=function(){console.warn("applyQueryFilter is obsolete. Use fetchData instead"),this.fetchData()},e}(kn),Bn=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),An=function(t){function e(){var e=t.call(this)||this;return e.reports=[],e.reportCache=[],e.exportButtons=[],e.exportClass="eqjs-export",e.disabledClass="eqjs-disabled",e.enableExport=!1,e.useReportCache=!0,e.syncReportOnChange=!0,e._reportSaveTemplate='<div id="kdlg-dialog-form" class="kfrm-form">\n <div class="kfrm-fields label-above">\n <label for="kdlg-dialog-form-input" id="kdlg-dialog-form-content"></label>\n <input type="text" name="kdlg-dialog-form-input" id="kdlg-dialog-form-input" />\n <label for="kdlg-dialog-form-textarea" id="kdlg-dialog-form-desc-label"></label>\n <textarea type="text" name="kdlg-dialog-form-textarea" id="kdlg-dialog-form-textarea"></textarea>\n </div>\n </div>',e.context.useStoredQueryOnFetch=!0,e.exportButtonClickHandler=function(t,n){if(!t.classList.contains(e.disabledClass)){var o=t.getAttribute("data-format");e.context.exportResult({format:o})}},e.clearReportButtonClickHandler=e.clearReportButtonClick.bind(e),e.newReportButtonClickHandler=e.newReportButtonClick.bind(e),e.loadReportButtonClickHandler=e.loadReportButtonClick.bind(e),e.saveReportButtonClickHandler=e.saveReportButtonClick.bind(e),e.removeReportButtonClickHandler=e.removeReportButtonClick.bind(e),e.reloadReportDataButtonClickHandler=e.reloadReportDataButtonClick.bind(e),dt.z.onMobileModeChanged((function(t){document.location.reload()})),e}return Bn(e,t),e.prototype.initOptions=function(e){return void 0!==(e=t.prototype.initOptions.call(this,e)).syncQueryOnChange&&(this.syncReportOnChange=e.syncQueryOnChange),void 0!==e.syncReportOnChange&&(this.syncReportOnChange=e.syncReportOnChange),e.syncQueryOnChange=this.syncReportOnChange,void 0!==e.useReportCache&&(this.useReportCache=e.useReportCache),this.defaultReportId=e.defaultReportId,e},e.prototype.initDone=function(){var e=this;t.prototype.initDone.call(this),this.context.getQuery().addChangedCallback((function(t){var n=t.data;n&&("query.switched"==n.changeType?(e.context.clearResult(),e.context.refreshWidgets(A.Result),e.context.refreshWidgets(A.Query)):(e.disableExportButtons(),e.resultCountSlot&&(e.resultCountSlot.style.display="none")));var o=!n||"query.switched"==n.changeType||n.part==x.ExtraData||n.part==x.Facets,i=!1;e.syncReportOnChange&&(n&&"query.switched"!=n.changeType&&!n.noSync&&(i=!0,e.syncReport({success:function(){!o&&e.viewOptions.fetchDataOnChange&&e.fetchData()}})));!o&&e.resultOptions.clearResultOnQueryChange&&(e.context.clearResult(),e.context.refreshWidgets(A.Result)),o||i||!e.viewOptions.fetchDataOnChange||e.fetchData()})),window.setTimeout((function(){e.context.loadQueryList({success:function(t){Array.isArray(t)&&(e.reports=t,e.reports.filter((function(t){return t.id==e.defaultReportId})).length>0?e.renderReportList({reportId:e.defaultReportId}):e.renderReportList())}})}),100)},e.prototype.initWidgets=function(e){var n=this;t.prototype.initWidgets.call(this,e);var o="ClearReportButton",i="NewReportButton",r="LoadReportButton",s="SaveReportButton",a="RemoveReportButton",l="ReloadReportDataButton",u="ResultCount",c="ResultExportButtons",d=this.exportClass;e.slots&&(u=e.slots.resultCountSpan||u,c=e.slots.exportButtons||c,o=e.slots.clearReportButton||o,i=e.slots.newReportButton||i,r=e.slots.loadReportButton||r,s=e.slots.saveReportButton||s,a=e.slots.removeReportButton||a,l=e.slots.reloadReportDataButton||l,d=e.slots.exportClass||d),this.exportButtons=this.domRoots.reduce((function(t,e){return t.concat(Array.from(e.querySelectorAll(".".concat(d))))}),[]),this.enableExport=e.enableExport,this.enableExport?this.exportButtons.forEach((function(t){t.addEventListener("click",n.exportButtonClickHandler)})):this.hideExportButtons(),this.exportButtonsContainer=this.resolveElement(c),this.clearReportButton||(this.clearReportButton=this.resolveElement(o),this.clearReportButton&&this.clearReportButton.addEventListener("click",this.clearReportButtonClickHandler)),this.newReportButton||(this.newReportButton=this.resolveElement(i),this.newReportButton&&this.newReportButton.addEventListener("click",this.newReportButtonClickHandler)),this.loadReportButton||(this.loadReportButton=this.resolveElement(r),this.loadReportButton&&this.loadReportButton.addEventListener("click",this.loadReportButtonClickHandler)),this.saveReportButton||(this.saveReportButton=this.resolveElement(s),this.saveReportButton&&this.saveReportButton.addEventListener("click",this.saveReportButtonClickHandler)),this.removeReportButton||(this.removeReportButton=this.resolveElement(a),this.removeReportButton&&this.removeReportButton.addEventListener("click",this.removeReportButtonClickHandler)),this.reloadReportDataButton||(this.reloadReportDataButton=this.resolveElement(l),this.reloadReportDataButton||(this.reloadReportDataButton=this.resolveElement("UpdateReportButton")),this.reloadReportDataButton&&this.reloadReportDataButton.addEventListener("click",this.reloadReportDataButtonClickHandler)),this.reportListSlot=document.getElementById("ReportList"),this.resultCountSlot=this.resolveElement(u)},e.prototype.newReport=function(){var t=this,e=this.context.getServices().getDialogService().open({title:r.i18n.getText("NewReportDlgTitle"),body:this._reportSaveTemplate,submitable:!0,closable:!0,cancelable:!0,submitOnEnter:!0,arrangeParents:!1,beforeOpen:function(){var t=document.getElementById("kdlg-dialog-form-input");t.value=r.i18n.getText("NewReportDefName"),document.getElementById("kdlg-dialog-form-content").innerHTML=r.i18n.getText("SaveReportDlgLabel"),document.getElementById("kdlg-dialog-form-desc-label").innerHTML=r.i18n.getText("ReportDescLabel"),t.focus()},onSubmit:function(){var n=document.getElementById("kdlg-dialog-form-input").value;if(n&&n.replace(/\s/g,"").length>0){e.clearAlert(),e.disableButtons();var o=e.getRootElement().querySelector("header"),i=(0,ut.domel)("div",o).addClass("eqjs-process-bar local").toDOM(),r=document.getElementById("kdlg-dialog-form-textarea").value;t.context.newQuery({name:n,description:r,success:function(){e.close();var n=t.context.getQuery(),o=n.getId();t.insertIntoReportList({id:o,name:n.getName(),description:n.getDescription()}),t.renderReportList({reportId:o})},error:function(t){o.removeChild(i),e.enableButtons(),e.showAlert(t,"error")}})}return!1}})},e.prototype.loadReport=function(t){var e=this;if(!t)throw"Empty report ID!";var n=this.findReportById(t);if(n){var o=this.context.getQuery(),i=function(){e.renderReportProps(),e.context.resultTable.clear(),o.fireChangedEvent({part:x.All,noSync:!0,changeType:"query.switched"}),e.fetchData()},r=this.useReportCache?this.getReportContentFromCache(n):null;r?(o.clear(),o.loadFromJson(r,{validate:!1}),i()):this.context.loadQuery({queryId:t,silent:!0,success:function(){e.saveReportContentInCache(n,o.toJSON()),i()}}),this.setActiveReport(t)}},e.prototype.saveCurrentReportAs=function(){var t=this,e=this.context.getQuery(),n=this.context.getServices().getDialogService().open({title:r.i18n.getText("SaveReportDlgTitle"),body:this._reportSaveTemplate,submitable:!0,closable:!0,cancelable:!0,submitOnEnter:!0,arrangeParents:!1,beforeOpen:function(){var t=document.getElementById("kdlg-dialog-form-input");t.value=e.getName(),document.getElementById("kdlg-dialog-form-content").innerHTML=r.i18n.getText("SaveReportDlgLabel"),document.getElementById("kdlg-dialog-form-desc-label").innerHTML=r.i18n.getText("ReportDescLabel"),document.getElementById("kdlg-dialog-form-textarea").value=e.getDescription(),t.focus()},onSubmit:function(){var o=document.getElementById("kdlg-dialog-form-input").value;if(o&&o.replace(/\s/g,"").length>0){e.setId(r.utils.generateId(o.replace(/\s/g,""))),n.clearAlert(),n.disableButtons();var i=n.getRootElement().querySelector("header"),s=(0,ut.domel)("div",i).addClass("eqjs-process-bar local").toDOM(),a=document.getElementById("kdlg-dialog-form-textarea").value;e.setDescription(a),t.context.newQuery({clearQuery:!1,name:o,success:function(){n.close(),t.context.refreshWidgets(A.Query);var o=t.context.getQuery().getId();t.fetchData(),t.insertIntoReportList({id:o,name:e.getName(),description:e.getDescription()}),t.renderReportList({reportId:o}),t.setActiveReport(o),t.renderReportProps()},error:function(t){i.removeChild(s),n.enableButtons(),n.showAlert(t,"error")}})}return!1}})},e.prototype.removeCurrentReport=function(){var t=this,e=this.context.getQuery();this.context.getServices().getDialogService().openConfirm(r.i18n.getText("RemoveReportDlgTitle"),r.i18n.getText("RemoveReportContent").replace("{reportName}",e.getName())).then((function(n){if(n){var o=e.getId();t.context.removeQuery({queryId:o,success:function(){var e=t.removeFromReportList(o);t.renderReportList({reportIndex:e})}})}}))},e.prototype.syncReport=function(t){var e=this;if(this.useReportCache){var n=this.context.getQuery(),o=this.findReportById(n.getId());o&&(o.lastUpdated=Date.now(),this.saveReportContentInCache(o,n.toJSON()))}this.context.syncQuery({success:function(n){n.query&&e.context.refreshWidgets(A.Query),n.statement&&e.context.refreshWidgets(A.Statement),t&&t.success&&t.success(n)}})},e.prototype.setActiveReport=function(t){for(var e=this.reportListSlot.querySelectorAll("li"),n=0;n<e.length;n++){var o=e[n];o.classList.remove("active"),o.getAttribute("data-rid")===t&&o.classList.add("active")}},e.prototype.renderReportProps=function(){var t=this.context.getQuery();document.getElementById("ReportTitle").innerHTML=t.getName();var e=document.querySelector(".columns-bar");if(e){e.innerHTML="<strong>Columns:</strong>";for(var n=0,o=t.getColumns();n<o.length;n++){var i=o[n];e.innerHTML+='<span class="label label-default">'+i.caption+"</span> "}}},e.prototype.renderReportList=function(t){if(this.renderReportPanels(),!this.reportListSlot.matches("li")){this.reportListSlot.innerHTML="",t=t||{reportId:this.reports.length>0?this.reports[0].id:null};var e=document.createElement("ul");e.className="list-group list-group-flush",this.reportListSlot.appendChild(e);for(var n=0,o=this.reports;n<o.length;n++){var i=o[n];this.renderReportItemInList(i,e)}if(t.reportId&&this.loadReport(t.reportId),void 0!==t.reportIndex){var r=t.reportIndex;r>=this.reports.length&&(r=this.reports.length-1),r<0&&this.reports.length>0&&(r=0),r>=0&&this.loadReport(this.reports[r].id)}}},e.prototype.detach=function(){var e=this;this.exportButtonsContainer&&(this.showExportButtons(),this.exportButtons.forEach((function(t){t.removeEventListener("click",e.exportButtonClickHandler)})),this.exportButtons=[],this.exportButtonsContainer=null),this.clearReportButton&&(this.clearReportButton.removeEventListener("click",this.clearReportButtonClickHandler),this.clearReportButton=null),this.newReportButton&&(this.newReportButton.removeEventListener("click",this.newReportButtonClickHandler),this.newReportButton=null),this.loadReportButton&&(this.loadReportButton.removeEventListener("click",this.loadReportButtonClickHandler),this.loadReportButton=null),this.saveReportButton&&(this.saveReportButton.addEventListener("click",this.saveReportButtonClickHandler),this.saveReportButton=null),this.removeReportButton&&(this.removeReportButton.removeEventListener("click",this.removeReportButtonClickHandler),this.removeReportButton=null),this.reloadReportDataButton&&(this.reloadReportDataButton.removeEventListener("click",this.reloadReportDataButtonClickHandler),this.removeReportButton=null),this.reportListSlot&&(this.reportListSlot.innerHTML="",this.reportListSlot=null),this.resultCountSlot&&(this.resultCountSlot.innerHTML="",this.resultCountSlot=null),t.prototype.detach.call(this)},e.prototype.renderReportItemInList=function(t,e){var n=this;e||(e=this.reportListSlot.querySelector("ul"));var o=t.name||t.description||"",i=document.createElement("li");i.className="list-group-item",i.style.cursor="pointer",i.setAttribute("data-rid",t.id),i.innerText=o,t.description&&(i.title=t.description),i.addEventListener("click",(function(t){var e=t.target.getAttribute("data-rid");n.loadReport(e),n.setActiveReport(e)})),e.appendChild(i)},e.prototype.renderReportPanels=function(){var t=document.getElementById("ReportsContainer"),e=document.getElementById("NoReportPanel");this.reports.length>0?(this.hideElement(e),this.showElement(t)):(this.hideElement(t),this.showElement(e))},e.prototype.hideElement=function(t){t&&(t.style.visibility="hidden")},e.prototype.showElement=function(t){t&&t.style.removeProperty("visibility")},e.prototype.insertIntoReportList=function(t){this.reports.push(t)},e.prototype.removeFromReportList=function(t){var e=this.indexOfReportById(t);return e>=0&&this.reports.splice(e,1),e},e.prototype.indexOfReportById=function(t){for(var e=0;e<this.reports.length;e++)if(this.reports[e].id===t)return e;return-1},e.prototype.clearReportButtonClick=function(){this.clearErrors(),this.context.clearQuery()},e.prototype.reloadReportDataButtonClick=function(){this.fetchData()},e.prototype.saveReportButtonClick=function(){this.saveCurrentReportAs()},e.prototype.loadReportButtonClick=function(){this.loadReport("LastQuery")},e.prototype.removeReportButtonClick=function(){this.removeCurrentReport()},e.prototype.newReportButtonClick=function(){this.newReport()},e.prototype.errorHandler=function(t){},e.prototype.clearErrors=function(){},e.prototype.disableExportButtons=function(){this.hideExportButtons()},e.prototype.enableExportButtons=function(){this.showExportButtons()},e.prototype.hideExportButtons=function(){this.exportButtonsContainer&&(this.exportButtonsContainer.style.display="none")},e.prototype.showExportButtons=function(){this.exportButtonsContainer&&(this.exportButtonsContainer.style.display="initial")},e.prototype.saveReportContentInCache=function(t,e){var n=this.findReportCacheItem(t.id);n||(n={id:t.id},this.reportCache.push(n)),n.lastUpdated=t.lastUpdated,n.content=e},e.prototype.getReportContentFromCache=function(t){var e=this.findReportCacheItem(t.id);return e&&e.lastUpdated===t.lastUpdated?e.content:null},e.prototype.findReportById=function(t){for(var e=0,n=this.reports;e<n.length;e++){var o=n[e];if(o.id===t)return o}return null},e.prototype.findReportCacheItem=function(t){for(var e=0,n=this.reportCache;e<n.length;e++){var o=n[e];if(o.id===t)return o}return null},e}(wn);r.i18n.addMapper((function(t){if(t||t.texts)for(var e in t.texts)switch(e){case"PredicateTitle":t.texts.ConditionGroupTitle=t.texts[e];break;case"RootPredicateTitle":t.texts.RootConditionGroupTitle=t.texts[e];break;case"ErrIncorrectPredicateTitleFormat":t.texts.ErrIncorrectGroupTitleFormat=t.texts[e];break;case"ButtonAddPredicate":t.texts.ButtonAddGroup=t.texts[e];break;case"ButtonDelete":t.texts.CmdDelete=t.texts[e];break;case"ButtonClear":t.texts.CmdClear=t.texts[e];break;case"ButtonEnable":t.texts.CmdToggleEnable=t.texts[e];break;case"ButtonAddCondition":t.texts.CmdAddCondition=t.texts[e];break;case"ButtonAddGroup":t.texts.CmdAddCondGroup=t.texts[e]}})),r.i18n.updateDefaultTexts({AltMenuAttribute:"Attribute",AltMenuConstantExpression:"Constant expression",ButtonApply:"Apply",ButtonCancel:"Cancel",ButtonClose:"Close",ButtonNext:"Next",ButtonPrev:"Prev",ButtonNow:"Now",ButtonOK:"OK",MenuEnable:"Enabled",MenuParameterization:"Parameterized",MenuJoinCond:"Use in JOIN",CmdClear:"Clear",CmdDelete:"Delete",CmdToggleEnable:"Toggle enable",CmdToggleEnableCustom:"Custom Expression columns are not supported",CmdAddCondition:"Add condition",CmdAddCondGroup:"Add group of conditions",ButtonSelectAll:"Select all",ButtonDeselectAll:"Clear selection",ButtonAddColumns:"Add column(s)",ButtonAddConditions:"Add condition(s)",CmdClickToAddCondition:"[Add new condition]",CmdDeleteRow:"Delete this row",ErrIncorrectGroupTitleFormat:"Incorrect condition group title format",ErrNotNumber:" is not a number",ErrIncorrectInteger:"Incorrect integer value",ErrIncorrectNumberList:"Incorrect list format",False:"False",LinkTypeAll:"all",LinkTypeAny:"any",LinkTypeNone:"none",LinkTypeNotAll:"not all",ConjAll:"and",ConjAny:"or",ConjNotAll:"and",ConjNone:"or",MsgApplySelection:"[Apply selection]",MsgAs:"as",MsgEmptyList:"(empty list)",MsgEmptyListValue:"[select value]",MsgEmptyScalarValue:"[enter value]",MsgSubQueryValue:"[edit sub-query]",MsgEmptyAttrValue:"[select attribute]",MsgEmptyOperator:"[Unrecognized operator]",MsgEmptyCustomSql:"[enter SQL expression]",MsgCustomSql:"[Custom SQL]",MsgNoResult:"No result",MsgResultCount:"{0} records found",MsgOf:"of",ConditionGroupTitle:"{lt} of the following apply",RootConditionGroupTitle:"Select records where {lt} of the following apply",StrAddConditions:"Add conditions",SubQueryDialogTitle:"Edit sub-query",SubQueryColumnTitle:"Column:",SubQueryEmptyColumn:"[select column]",SubQueryQueryPanelCaption:"Conditions",True:"True",ButtonSorting:"Sorting",ButtonToAggr:"Change to aggregate column",ButtonToSimple:"Change to simple column",ButtonFormat:"Display format",CmdAscending:"Ascending",CmdClickToAddColumn:"[Add new column]",CmdDeleteColumn:"Delete column",CmdDeleteSorting:"Delete sorting",CmdDescending:"Descending",CmdGroupSort:"Sorting",CmdGroupFormat:"Display format",CmdNotSorted:"Not sorted",ColTypeAggrFunc:"Aggregate function",ColTypeCompound:"Calculated",ColTypeGroup:"Column type",ColTypeSimple:"Simple column",HeaderExpression:"Expression",HeaderSorting:"Sorting",HeaderTitle:"Title",SortHeaderColumn:"Column",SortHeaderSorting:"Sorting",StrAddColumns:"Add columns",CustomExpression:"Custom Expression",AddAllForEntityText:"[Add all attributes]",CmdMoveToStart:"Move to start",CmdMoveRight:"Move right",CmdMoveLeft:"Move left",CmdMoveToEnd:"Move to the end",CmdMoveUp:"Move up",CmdMoveDown:"Move down",ButtonMenu:"Show menu",CmdToSimple:"Not aggregated",CmdMoveToFirst:"Move to the first",CmdMoveToPrev:"Move to the previous",CmdMoveToNext:"Move to the next",CmdMoveToLast:"Move to the last",CmdHiddenColumn:"Hidden",RowButtonTitle:"Click to see the available options",EntityToggle:"Toggle entity",StrNoFilterDefined:"No filter defined",StrNoFilterClickToAdd:"No filter defined. Click to add a new condition",HintHours:"Hours",HintMinutes:"Minutes",RemoveQueryTitle:"Confirmation",RemoveQueryContent:"Remove query [{queryName}]?",NewQueryTitle:"New query",NewQueryContent:"New query name: ",NewQueryDefName:"New query",SaveQueryTitle:"Save query",SaveQueryContent:"Query name: ",SaveQueryDefName:"{queryName} copy",QueryChangedTitle:"Confirmation",QueryChangedContent:"The query was changed. Do you want to save it first?",UpdateQuerySelector:"[click here to load the query]",FileNameLabel:"File name: ",SaveQueryToFileDlgTitle:"Save query to file",NewReportDefName:"New report",NewReportDlgTitle:"New report",SaveReportDlgTitle:"Save report",SaveReportDlgLabel:"Report name:",ReportDescLabel:"Description: ",RemoveReportDlgTitle:"Remove report",RemoveReportContent:"Are you sure you want to remove '{reportName}'?",Facets:{TotalRecordsLabel:"Total records:",AddMenuItems:{Chart:"Chart",Pivot:"Pivot table",DataTable:"Data table"},LoadDataDlgTitle:"Downloading data",LoadDataDlgContent:"Records loaded: {loadedRecs}/{totalRecs}",RefreshBtnTitle:"Refresh",ExportBtnTitle:"Export",MaximizeBtnTitle:"Maximize",RestoreBtnTitle:"Restore Down",RemoveFacetDlgTitle:"Remove facet",RemoveFacetDlgContent:"Are you sure, that you want to delete {facetTitle} tab?",DefaultDlgTitle:"Setup facet",DefaultFacetTitle:"",NewFacetTitle:"New Facet",TabNameLabel:"Tab name",ErrQueryChanged:"FAILED TO DISPLAY. QUERY WAS CHANGED",ErrNotEnoughData:"We can't display the graph because not all data for this query is loaded. \n The total number of records: {totalRecs}, currently loaded: {cachedRecs}. \n You can [download the result]. Please note: this may take some time and consume a lot of memory.",ErrTooMuchData:"Too much data. The grid is not able to display it",Chart:{FacetTitle:"Chart",DlgTitle:"Chart settings",DataColumnSelectorLabel:"Data column",LabelColumnSelectorLabel:"Label column",ChartTypeSelectorLabel:"Chart type",ShowLegendLabel:"Show legend (if available)"},Pivot:{FacetTitle:"Pivot table",DlgTitle:"Pivot settings",SwapBtnTitle:"Swap column and row fields",ColumnFieldSelectorLabel:"Column field",RowFieldSelectorLabel:"Row field",CellDataSelectorLabel:"Cell data",TotalsRowLabel:"Totals row",TotalsColLabel:"Totals column",TotalGridLabel:"Total"},DataTable:{FacetTitle:"Result table",DlgTitle:"Table facet settings"}},TotalsDlgLabel:"Totals",GrandTotalsLabel:"Grand totals",TotalsDlgTitle:"Select totals",ExportDlgTitle:"Export result",ExportDlgFmtLabel:"Format",csv:"CSV",excel:"Excel",pdf:"PDF","excel-html":"HTML (Excel-compatible)",AggrSettings:{GroupBtn:"Group selected column(s)",UngroupBtn:"Ungroup columns",AggrBtn:"Aggregate selected column",UnaggrBtn:"Remove column aggregation",GrandTotalsLabel:"Show grand totals",GroupCountsLabel:"Show record count for groups",AggrDialogTitle:"Aggregation/grouping",EnableAggrLabel:"Enable aggregation",SelectedError:"Complete the action with selected column(s)",NoGroupsOrAggrError:"Add at least one group or aggregation",NoGroupsOrGrandError:"Add at least one group, or enable grand totals",NoAggrOrCountError:"Add at least one aggregation, or enable records count",NoGroupsLabel:"No groups",NoAggrsLabel:"No aggregations",EmptySettingsLabel:"[ Click to setup ]"},ChartType:{Area:"Area chart",Bar:"Bar chart",Column:"Column chart",Combo:"Combo chart",Doughnut:"Doughnut chart",Polar:"Polar chart",Radar:"Radar chart",Histogram:"Histogram chart",Line:"Line chart",SteppedLine:"Stepped line chart",Pie:"Pie chart"}}),K.prototype.registerDialogServiceResolver=function(t){this.dialogServiceResolver=t},K.prototype.getDialogService=function(){if(!this.dialogService){if(!this.dialogServiceResolver)throw"DialogServiceResolver is not defined";this.dialogService=this.dialogServiceResolver()}return this.dialogService},Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector),window.NodeList&&!window.NodeList.prototype.forEach&&(window.NodeList.prototype.forEach=Array.prototype.forEach),Array.prototype.findIndex||(Array.prototype.findIndex=function(t){if(null==this)throw new TypeError("Array.prototype.findIndex called on null or undefined");if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var e,n=Object(this),o=n.length>>>0,i=arguments[1],r=0;r<o;r++)if(e=n[r],t.call(i,e,r,n))return r;return-1});var _n={core:r,ui:ut};window.easyqueryCore=t,window.easydata=_n}(),window.easyquery=__webpack_exports__})();
1
+ (function(){var __webpack_modules__={305:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.d(__webpack_exports__,{z:function(){return browserUtils}});var _utils__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(464),browserUtils;(function(browserUtils){var _isFirefox=null,_isIE=null;function isIE(){return eval("/*@cc_on!@*/false || !!document.documentMode")}function isFirefox(){if(null===_isFirefox){var t=navigator.userAgent;_isFirefox=t.toLowerCase().indexOf("firefox")>-1}return _isFirefox}browserUtils.isIE=isIE,browserUtils.isFirefox=isFirefox;var _detectedIsMobileMode=!1,_isMobileMode=void 0,detectIsMobileMode=function(){var t=isMobileMode();_detectedIsMobileMode=window.matchMedia("only screen and (max-width: 840px)").matches||window.matchMedia("only screen and (max-height: 420px)").matches;var e=isMobileMode();e!==t&&mobileModeChangeHandler&&mobileModeChangeHandler(e)},mobileModeChangeHandler;function isMobileMode(){return void 0!==_isMobileMode?_isMobileMode:_detectedIsMobileMode}function setIsMobileMode(t){var e=isMobileMode();_isMobileMode=t;var n=isMobileMode();n!==e&&mobileModeChangeHandler&&mobileModeChangeHandler(n)}function onMobileModeChanged(t){mobileModeChangeHandler=t}function getMobileCssClass(){return isMobileMode()?_utils__WEBPACK_IMPORTED_MODULE_0__.XD:null}detectIsMobileMode(),window.addEventListener("resize",(function(){return detectIsMobileMode()})),browserUtils.isMobileMode=isMobileMode,browserUtils.setIsMobileMode=setIsMobileMode,browserUtils.onMobileModeChanged=onMobileModeChanged,browserUtils.getMobileCssClass=getMobileCssClass})(browserUtils||(browserUtils={}))},464:function(t,e,n){"use strict";n.d(e,{X1:function(){return o},XD:function(){return s},YR:function(){return r},n6:function(){return i}});n(514);function o(t){for(var e=0;null!==t;){var n=document.defaultView.getComputedStyle(t,null).getPropertyValue("z-index");if("auto"!=n){var o=parseInt(n);o>e&&(e=o)}t=t.parentElement}return e}function i(t){setTimeout((function(e){t&&t.focus()}),100)}var r="eqjs",s="eqjs-mobile"},702:function(t,e,n){t.exports=function(){"use strict";function t(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}function e(t){return"function"==typeof t}var o=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},i=0,r=void 0,s=void 0,a=function(t,e){b[i]=t,b[i+1]=e,2===(i+=2)&&(s?s(x):E())};function l(t){s=t}function u(t){a=t}var c="undefined"!=typeof window?window:void 0,d=c||{},h=d.MutationObserver||d.WebKitMutationObserver,p="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),f="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function g(){return function(){return process.nextTick(x)}}function y(){return void 0!==r?function(){r(x)}:C()}function m(){var t=0,e=new h(x),n=document.createTextNode("");return e.observe(n,{characterData:!0}),function(){n.data=t=++t%2}}function v(){var t=new MessageChannel;return t.port1.onmessage=x,function(){return t.port2.postMessage(0)}}function C(){var t=setTimeout;return function(){return t(x,1)}}var b=new Array(1e3);function x(){for(var t=0;t<i;t+=2)(0,b[t])(b[t+1]),b[t]=void 0,b[t+1]=void 0;i=0}function w(){try{var t=Function("return this")().require("vertx");return r=t.runOnLoop||t.runOnContext,y()}catch(t){return C()}}var E=void 0;function T(t,e){var n=this,o=new this.constructor(k);void 0===o[S]&&U(o);var i=n._state;if(i){var r=arguments[i-1];a((function(){return W(i,o,r,n._result)}))}else j(n,o,t,e);return o}function D(t){var e=this;if(t&&"object"==typeof t&&t.constructor===e)return t;var n=new e(k);return F(n,t),n}E=p?g():h?m():f?v():void 0===c?w():C();var S=Math.random().toString(36).substring(2);function k(){}var M=void 0,I=1,B=2;function A(){return new TypeError("You cannot resolve a promise with itself")}function _(){return new TypeError("A promises callback cannot return that same promise.")}function P(t,e,n,o){try{t.call(e,n,o)}catch(t){return t}}function O(t,e,n){a((function(t){var o=!1,i=P(n,e,(function(n){o||(o=!0,e!==n?F(t,n):Q(t,n))}),(function(e){o||(o=!0,N(t,e))}),"Settle: "+(t._label||" unknown promise"));!o&&i&&(o=!0,N(t,i))}),t)}function L(t,e){e._state===I?Q(t,e._result):e._state===B?N(t,e._result):j(e,void 0,(function(e){return F(t,e)}),(function(e){return N(t,e)}))}function R(t,n,o){n.constructor===t.constructor&&o===T&&n.constructor.resolve===D?L(t,n):void 0===o?Q(t,n):e(o)?O(t,n,o):Q(t,n)}function F(e,n){if(e===n)N(e,A());else if(t(n)){var o=void 0;try{o=n.then}catch(t){return void N(e,t)}R(e,n,o)}else Q(e,n)}function q(t){t._onerror&&t._onerror(t._result),H(t)}function Q(t,e){t._state===M&&(t._result=e,t._state=I,0!==t._subscribers.length&&a(H,t))}function N(t,e){t._state===M&&(t._state=B,t._result=e,a(q,t))}function j(t,e,n,o){var i=t._subscribers,r=i.length;t._onerror=null,i[r]=e,i[r+I]=n,i[r+B]=o,0===r&&t._state&&a(H,t)}function H(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var o=void 0,i=void 0,r=t._result,s=0;s<e.length;s+=3)o=e[s],i=e[s+n],o?W(n,o,i,r):i(r);t._subscribers.length=0}}function W(t,n,o,i){var r=e(o),s=void 0,a=void 0,l=!0;if(r){try{s=o(i)}catch(t){l=!1,a=t}if(n===s)return void N(n,_())}else s=i;n._state!==M||(r&&l?F(n,s):!1===l?N(n,a):t===I?Q(n,s):t===B&&N(n,s))}function G(t,e){try{e((function(e){F(t,e)}),(function(e){N(t,e)}))}catch(e){N(t,e)}}var z=0;function V(){return z++}function U(t){t[S]=z++,t._state=void 0,t._result=void 0,t._subscribers=[]}function Y(){return new Error("Array Methods must be provided an Array")}var J=function(){function t(t,e){this._instanceConstructor=t,this.promise=new t(k),this.promise[S]||U(this.promise),o(e)?(this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?Q(this.promise,this._result):(this.length=this.length||0,this._enumerate(e),0===this._remaining&&Q(this.promise,this._result))):N(this.promise,Y())}return t.prototype._enumerate=function(t){for(var e=0;this._state===M&&e<t.length;e++)this._eachEntry(t[e],e)},t.prototype._eachEntry=function(t,e){var n=this._instanceConstructor,o=n.resolve;if(o===D){var i=void 0,r=void 0,s=!1;try{i=t.then}catch(t){s=!0,r=t}if(i===T&&t._state!==M)this._settledAt(t._state,e,t._result);else if("function"!=typeof i)this._remaining--,this._result[e]=t;else if(n===et){var a=new n(k);s?N(a,r):R(a,t,i),this._willSettleAt(a,e)}else this._willSettleAt(new n((function(e){return e(t)})),e)}else this._willSettleAt(o(t),e)},t.prototype._settledAt=function(t,e,n){var o=this.promise;o._state===M&&(this._remaining--,t===B?N(o,n):this._result[e]=n),0===this._remaining&&Q(o,this._result)},t.prototype._willSettleAt=function(t,e){var n=this;j(t,void 0,(function(t){return n._settledAt(I,e,t)}),(function(t){return n._settledAt(B,e,t)}))},t}();function K(t){return new J(this,t).promise}function X(t){var e=this;return o(t)?new e((function(n,o){for(var i=t.length,r=0;r<i;r++)e.resolve(t[r]).then(n,o)})):new e((function(t,e){return e(new TypeError("You must pass an array to race."))}))}function $(t){var e=new this(k);return N(e,t),e}function Z(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function tt(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}var et=function(){function t(e){this[S]=V(),this._result=this._state=void 0,this._subscribers=[],k!==e&&("function"!=typeof e&&Z(),this instanceof t?G(this,e):tt())}return t.prototype.catch=function(t){return this.then(null,t)},t.prototype.finally=function(t){var n=this,o=n.constructor;return e(t)?n.then((function(e){return o.resolve(t()).then((function(){return e}))}),(function(e){return o.resolve(t()).then((function(){throw e}))})):n.then(t,t)},t}();function nt(){var t=void 0;if(void 0!==n.g)t=n.g;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var e=t.Promise;if(e){var o=null;try{o=Object.prototype.toString.call(e.resolve())}catch(t){}if("[object Promise]"===o&&!e.cast)return}t.Promise=et}return et.prototype.then=T,et.all=K,et.race=X,et.resolve=D,et.reject=$,et._setScheduler=l,et._setAsap=u,et._asap=a,et.polyfill=nt,et.Promise=et,et}()},235:function(t,e,n){"use strict";n.r(e)},85:function(t,e,n){"use strict";n.r(e)},817:function(t,e,n){"use strict";n.r(e)},57:function(t,e,n){"use strict";n.r(e)},527:function(t,e,n){"use strict";n.r(e)},311:function(t,e,n){"use strict";n.r(e)},610:function(t,e,n){"use strict";n.r(e)},546:function(t,e,n){"use strict";n.r(e)},292:function(t,e,n){"use strict";n.r(e)},907:function(t,e,n){"use strict";var o,i;n.r(e),n.d(e,{AggregationSettings:function(){return E},ColumnAlignment:function(){return d},DataColumn:function(){return D},DataColumnList:function(){return S},DataRow:function(){return k},DataType:function(){return o},EasyDataTable:function(){return I},EasyGuid:function(){return B},EditorTag:function(){return s},EntityAttrKind:function(){return i},EventEmitter:function(){return A},HttpClient:function(){return m},HttpMethod:function(){return r},HttpRequest:function(){return u},HttpResponseError:function(){return y},MetaData:function(){return x},MetaEntity:function(){return v},MetaEntityAttr:function(){return C},ValueEditor:function(){return b},combinePath:function(){return L},i18n:function(){return a},liquid:function(){return T},repeatString:function(){return _},reverseString:function(){return P},strEndsWith:function(){return O},utils:function(){return l}}),function(t){t[t.Unknown=0]="Unknown",t[t.String=1]="String",t[t.Byte=2]="Byte",t[t.Word=3]="Word",t[t.Int32=4]="Int32",t[t.Int64=5]="Int64",t[t.Bool=6]="Bool",t[t.Float=7]="Float",t[t.Currency=8]="Currency",t[t.BCD=9]="BCD",t[t.Date=10]="Date",t[t.Time=11]="Time",t[t.DateTime=12]="DateTime",t[t.Autoinc=13]="Autoinc",t[t.Memo=14]="Memo",t[t.Blob=15]="Blob",t[t.FixedChar=16]="FixedChar",t[t.Guid=17]="Guid",t[t.Geometry=18]="Geometry",t[t.Geography=19]="Geography"}(o||(o={})),function(t){t[t.Data=0]="Data",t[t.Virtual=1]="Virtual",t[t.Lookup=2]="Lookup"}(i||(i={}));var r,s={Unknown:"Unknown",Edit:"EDIT",DateTime:"DATETIME",List:"LIST",CustomList:"CUSTOMLIST",File:"FILE"};!function(t){t.Trace="TRACE",t.Options="OPTIONS",t.Get="GET",t.Put="PUT",t.Post="POST",t.Delete="DELETE"}(r||(r={}));var a,l,u=function(){function t(t,e){this.xhr=t,this.method=e.method,this.url=e.url,this.headers=e.headers,this.queryParams=e.queryParams,this.data=e.data}return t.prototype.setHeader=function(t,e){this.headers[t]=e},t.prototype.setQueryParam=function(t,e){this.queryParams[t]=e},t.prototype.getXMLHttpRequest=function(){return this.xhr},t.prototype.getResponseHeaders=function(){if(this.xhr.readyState==this.xhr.HEADERS_RECEIVED){for(var t={},e=0,n=this.xhr.getAllResponseHeaders().trim().split(/[\r\n]+/);e<n.length;e++){var o=n[e].split(": "),i=o.shift(),r=o.join(": ");t[i]=r}return t}return{}},t.prototype.open=function(){var t=this;if(this.xhr.readyState===this.xhr.UNSENT){var e=this.url;for(var n in this.queryParams&&Object.keys(this.queryParams).length>0&&(e+=encodeURI("?"+Object.keys(this.queryParams).map((function(e){return e+"="+t.queryParams[e]})).join("&"))),this.xhr.open(this.method,e,!0),this.xhr.setRequestHeader("X-Requested-With","XMLHttpRequest"),this.headers)this.xhr.setRequestHeader(n,this.headers[n])}},t.prototype.abort=function(){this.xhr.abort()},t}();!function(t){var e,n={shortDateFormat:"MM/dd/yyyy",longDateFormat:"dd MMM, yyyy",editDateFormat:"MM/dd/yyyy",shortTimeFormat:"HH:mm",editTimeFormat:"HH:mm",longTimeFormat:"HH:mm:ss",shortMonthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],longMonthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],shortWeekDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],longWeekDayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],decimalSeparator:".",currency:"USD"},i={localeId:"en-US",englishName:"English",displayName:"English",texts:{ButtonOK:"OK",ButtonCancel:"Cancel",Yes:"Yes",No:"No",True:"True",False:"False"},settings:n},r={"en-US":i},s=[];function a(t){for(var e=0,n=s;e<n.length;e++){(0,n[e])(t)}}function u(){return e.localeId}function c(t){var n=r[t];n?l.assignDeep(e,n):(e.englishName=t,e.displayName=t,e.texts=l.assignDeep({},i.texts)),e.localeId=t}function d(){return e.settings}function h(t){e.settings||(e.settings=l.assignDeep({},n)),e.settings=l.assignDeep(e.settings,t)}function p(t,n){a(n);var o=e;t&&(n.localeId||(n.localeId=t),(o=r[t])||(o=l.assignDeep({},i),r[t]=o)),l.assignDeep(o,n)}function f(){var t,n,o,i,r,s,a="object"==typeof navigator?navigator.language:void 0;t=a,n=new Date(2020,5,7,19,34,56,88),o=n.toLocaleDateString(t,{year:"numeric",month:"numeric",day:"numeric"}),i=n.toLocaleTimeString(t,{hour:"numeric",minute:"numeric",second:"numeric"}),r=o.replace("07","dd").replace("7","d").replace("06","MM").replace("6","M").replace("2020","yyyy").replace("20","yy"),s=i.replace("19","HH").replace("07","hh").replace("7","h").replace("34","mm").replace("56","ss").replace("PM","tt"),e.settings||(e.settings={}),h({shortDateFormat:r,shortTimeFormat:s})}function g(t){var e,n=d();switch(t){case o.Date:e=n.shortDateFormat;break;case o.Time:e=n.shortTimeFormat;break;default:e=n.shortDateFormat+" "+n.shortTimeFormat}return e}function y(t){var e,n=d();switch(t){case o.Date:e=n.longDateFormat;break;case o.Time:e=n.longTimeFormat;break;default:e=n.longDateFormat+" "+n.longTimeFormat}return e}t.addMapper=function(t){s.push(t)},t.getLocales=function(){var t=[];for(var e in r)t.push({locale:e,englishName:r[e].englishName,displayName:r[e].displayName});return t.sort((function(t,e){return t.englishName>e.englishName?1:t.englishName===e.englishName?0:-1}))},t.getCurrentLocale=u,t.setLocale=function(t){console.warn("This method is deprecated. Use setCurrentLocale instead"),c(t)},t.setCurrentLocale=c,t.getText=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var o=e.texts,i="";if(t&&t.length)for(var r=t.length,s=0;s<r&&"object"==typeof(i=o[t[s]]);s++)o=i;return i},t.getLocaleSettings=d,t.getOneLocaleSetting=function(t){return e.settings[t]},t.getShortMonthName=function(t){var e=d();if(t>0&&t<13)return e.shortMonthNames[t-1];throw"Wrong month number: "+t},t.getLongMonthName=function(t){var e=d();if(t>0&&t<13)return e.longMonthNames[t-1];throw"Wrong month number: "+t},t.getShortWeekDayName=function(t){var e=d();if(t>0&&t<8)return e.shortWeekDayNames.length>=t?e.shortWeekDayNames[t-1]:t.toString();throw"Wrong month number: "+t},t.getLongWeekDayName=function(t){var e=d();if(t>0&&t<8)return e.longWeekDayNames.length>=t?e.longWeekDayNames[t-1]:t.toString();throw"Wrong month number: "+t},t.updateLocaleSettings=h,t.updateLocaleTexts=function(t){"object"==typeof t?(a({localeId:e.localeId,texts:t}),l.assignDeep(e.texts,t)):console.error("Wrong parameter type in updateLocaleTexts function call.The first parameter (localeId) is not necessary. Use updateLocaleTexts(texts) instead")},t.updateDefaultTexts=function(t){for(var n in r){var o=r[n];o.texts=l.assignDeep({},t,o.texts)}e.texts=l.assignDeep({},t,e.texts)},t.updateLocaleInfo=p,t.addLocale=function(t,e){p(t,e)},t.resetLocales=function(){e||(e=l.assignDeep({},i),f())},t.dateTimeToStr=function(t,e,n){return n?"d"==n?n=g(o.Date):"D"==n?n=y(o.Date):"f"==n?n=g(o.DateTime):"F"==n&&(n=y(o.DateTime)):n=g(e),l.dateTimeToStr(t,n)},t.numberToStr=function(e,n){if(n&&n.length>0){var o=n.charAt(0).toUpperCase();if("S"===o)return function(e,n){if(!m[n]){var o=n.split("|").filter((function(t){return t.length>0})).map((function(t){return t.split("=")}));if(m[n]={},o.length>0)if(o[0].length>1)for(var i=0,r=o;i<r.length;i++){var s=r[i];m[n][Number.parseInt(s[1])]=s[0]}else o.forEach((function(t,e){m[n][e]=t[0]}))}var a=m[n];if(void 0!==a[e]){s=a[e];return t.getText(s)||s}return e.toString()}(e,n.slice(1));if(["D","F","C"].indexOf(o)>=0){var i=u();return e.toLocaleString(i,function(t){var e=d(),n=t[0].toUpperCase(),o=t.length>1?Number.parseInt(t.slice(1)):"D"==n?1:2;switch(n){case"D":return{style:"decimal",useGrouping:!1,minimumIntegerDigits:o};case"C":return{style:"currency",currency:e.currency,minimumFractionDigits:o};default:return{style:"decimal",minimumFractionDigits:o,maximumFractionDigits:o}}}(n))}return function(t,e){for(var n=t.toString(),o="",i=n.length-1,r=e.length-1;r>=0;r--){var s=e.charAt(r);"#"===s||"0"===s?i>=0?(o+=n.charAt(i),i--):"0"===s&&(o+=0):o+=s}return o.split("").reverse().join("")}(Math.trunc(e),n)}var r=d();return l.numberToStr(e,r.decimalSeparator)},t.booleanToStr=function(e,n){if(n&&n.length>0&&"S"===n.charAt(0).toUpperCase()){var o=n.slice(1).split("|");if(o.length>1){var i=o[e?1:0];return t.getText(i)||i}}return"".concat(e)};var m={}}(a||(a={})),function(t){t.getAllDataTypes=function(){return Object.values(o).filter((function(t){return"number"==typeof t}))},t.getDateDataTypes=function(){return[o.Time,o.Date,o.DateTime]},t.getStringDataTypes=function(){return[o.String,o.Memo,o.FixedChar]};var e=[o.Byte,o.Word,o.Int32,o.Int64,o.Float,o.Currency,o.Autoinc];t.getNumericDataTypes=function(){return e};var n=[o.Byte,o.Word,o.Int32,o.Int64,o.Autoinc];function i(t,e,n){e||(e={});for(var o=0,s=n;o<s.length;o++){var a=s[o];if(a)for(var l in a)if(a.hasOwnProperty(l)){var u=a[l];null!==u&&"object"==typeof u?t.has(u)?e[l]=t.get(u):Array.isArray(u)?(e[l]=r(u),t.set(u,e[l])):(void 0!==e[l]&&null!=e[l]||(e[l]=Object.create(Object.getPrototypeOf(u))),t.set(u,e[l]),i(t,e[l],[u])):e[l]=u}}return e}function r(t){for(var e=[],n=0,o=t;n<o.length;n++){var i=o[n];e.push(i)}return e}t.assign=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var o=0;o<e.length;o++){var i=e[o];if(i)for(var r in i)i.hasOwnProperty(r)&&(t[r]=i[r])}return t},t.assignDeep=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return i(new WeakMap,t,e)},t.getIfDefined=function(t,e){return void 0!==t?t:e},t.IsDefinedAndNotNull=function(t){return null!=t},t.copyArrayTo=function(t,e){for(var n=t.length,o=e.length,i=0;i<n&&i<o;i++)e[i]=t[i]},t.createArrayFrom=r,t.findItemById=function(t,e){for(var n=t.length,o=0;o<n;o++)if(t[o].id===e)return t[o];return null},t.findItemIndexById=function(t,e){for(var n=t.length,o=0;o<n;o++)if(t[o].id===e)return o;return-1},t.indexOfArrayItem=function(t,e){if(t.indexOf)return t.indexOf(e);for(var n=t.length,o=0;o<n;o++)if(e==t[o])return o;return-1},t.moveArrayItem=function(t,e,n){if(e>=t.length)throw"Index out of bounds: "+e;n>=t.length&&(n=t.length-1);var o=t.splice(e,1)[0];t.splice(n,0,o)},t.removeArrayItem=function(t,e){var n=t.indexOf(e);if(-1!=n)return t.splice(n,1)[0]},t.insertArrayItem=function(t,e,n){t.splice(e,0,n)},t.fillArray=function(t,e,n,o){void 0===n&&(n=0);for(var i=t.length>>>0,r=n>>0,s=r<0?Math.max(i+r,0):Math.min(r,i),a=void 0===o?i:o>>0,l=a<0?Math.max(i+a,0):Math.min(a,i);s<l;)t[s]=e,s++;return t},t.shiftToFitWindow=function(t,e){var n=document.getElementsByTagName("body")[0],o=window.innerWidth||document.documentElement.clientWidth||n.clientWidth,i=t+e,r=0;return i>o&&t+(r=o-i-10)<0&&(r=10-t),r},t.isObject=function(t){return null!==t&&("function"==typeof t||"object"==typeof t)},t.isNumericType=function(t){return e.indexOf(t)>=0},t.isIntType=function(t){return n.indexOf(t)>=0},t.isNumeric=function(t){return!isNaN(parseFloat(t))&&isFinite(t)},t.areCompatibleDataTypes=function(t,e){return void 0===t||void 0===e||t==o.Unknown||e==o.Unknown||t==e||t==o.Date&&e==o.DateTime||t==o.DateTime&&e==o.Date},t.isPropSet=function(t,e){return t[e]||t[e.toLowerCase()]||t[e.toUpperCase()]};var s="0123456789abcdefghijklmnopqrstuvwxyz";function l(t,e){var n=t.length;if(n>e){var o=n/e,i="";i+=t[0];for(var r=o,s=void 0,a=1;a<n;a++)s=t[a],a+1>r&&(i+=s,r+=o);return i}return t}function u(t,e){return Math.floor(Math.random()*(e-t))+t}function c(t){var e=parseInt(t);if(isNaN(e))throw'"'.concat(t,'" is not a valid number');return e}t.generateId=function(t){t||(t="easy");var e=t.length>4?function(t,e){var n=t.split("-"),o=1,i=e;n.length<e&&(o=e/n.length,i=n.length);for(var r="",s=0;s<i;s++)r+=l(n[s],o);return r}(t,4):t;e&&e.length>0&&(e+="-");var n=s[u(0,s.length)]+s[u(0,s.length)]+s[u(0,s.length)],o=u(0,1e4);return e+n+function(t,e){void 0===e&&(e=36);var n="",o=t;do{n=s[o%e]+n,o=Math.floor(o/=e)}while(o>0);return n}(621355968e9+1e4*(new Date).getTime()-0x8d60e562e627800-o)},t.strToDateTime=function(t,e){if(!t||0==t.length)return new Date;var n=t.replace(/[^a-zA-Z0-9_]/g,"-"),o=e.replace(/[^a-zA-Z0-9_]/g,"-").split("-"),i=n.split("-"),r=o.indexOf("MM"),s=o.indexOf("dd"),a=o.indexOf("yyyy"),l=o.indexOf("HH"),u=o.indexOf("mm"),d=o.indexOf("ss"),h=new Date;try{var p=a>-1&&a<i.length?c(i[a]):h.getFullYear(),f=r>-1&&r<i.length?c(i[r])-1:h.getMonth()-1;if(f>11)throw"";var g=s>-1&&s<i.length?c(i[s]):h.getDate();if(g>function(t,e){return new Date(e,t+1,0).getDate()}(f,p))throw"";var y=l>-1&&l<i.length?c(i[l]):0;if(y>23)throw"";var m=u>-1&&u<i.length?c(i[u]):0;if(m>59)throw"";var v=d>-1&&d<i.length?c(i[d]):0;if(v>59)throw"";return new Date(p,f,g,y,m,v)}catch(e){throw"".concat(t," is not a valid date.")}},t.strToTime=function(t){var e=t.split(":");try{var n=e.length>0?c(e[0]):0;if(n>23)throw"";var o=e.length>1?c(e[1]):0;if(o>59)throw"";var i=e.length>1?c(e[1]):0;if(i>59)throw"";return new Date(0,0,0,n,o,i)}catch(e){throw"".concat(t," is not a valid time.")}};var d=/\[([^\]]+)]|y{2,4}|M{1,4}|d{1,2}|H{1,2}|h{1,2}|m{2}|s{2}|t{2}/g;t.dateTimeToStr=function(t,e){var n=t.getFullYear().toString(),o=t.getMonth()+1,i=t.getDate(),r=t.getHours(),s=t.getMinutes(),l=t.getSeconds(),u=r%12||12,c=r>11,h={yyyy:n,yy:n.substring(n.length-2),MMMM:a.getLongMonthName(o),MMM:a.getShortMonthName(o),MM:o<10?"0"+o:o.toString(),M:o.toString(),dd:i<10?"0"+i:i.toString(),d:i.toString(),HH:r<10?"0"+r:r.toString(),H:r.toString(),hh:u<10?"0"+u:u.toString(),h:u.toString(),tt:c?"PM":"AM",mm:s<10?"0"+s:s.toString(),ss:l<10?"0"+l:l.toString()};return e.replace(d,(function(t,e){return e||h[t]}))},t.numberToStr=function(t,e){return e=e||a.getLocaleSettings().decimalSeparator,t.toString().replace(".",e)}}(l||(l={}));var c,d,h=function(){function t(t,e){this.request=t,this.promise=e}return t.prototype.getPromise=function(){return this.promise},t.prototype.getRequest=function(){return this.request},t.prototype.then=function(t,e){return this.promise.then(t,e)},t.prototype.catch=function(t){return this.promise.catch(t)},t.prototype.finally=function(t){return this.promise.finally(t)},t}(),p=n(895),f=(c=function(t,e){return c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},c(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}c(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),g=function(){return g=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},g.apply(this,arguments)},y=function(t){function e(e,n){var o=t.call(this,n)||this;return o.status=e,o}return f(e,t),e}(Error),m=function(){function t(){this.defaultHeaders={},this.customPayload=void 0}return Object.defineProperty(t.prototype,"responseBody",{get:function(){return this._responseBody},enumerable:!1,configurable:!0}),t.prototype.get=function(t,e){return this.send(r.Get,t,null,e)},t.prototype.post=function(t,e,n){return this.send(r.Post,t,e,n)},t.prototype.put=function(t,e,n){return this.send(r.Put,t,e,n)},t.prototype.delete=function(t,e,n){return this.send(r.Delete,t,e,n)},t.prototype.send=function(e,n,o,i){var r=this,s=(i=i||{}).dataType||"json",a=i.contentType||"form-data"!==s?"application/json":null;o&&"form-data"!=s&&this.customPayload&&(o.data=l.assignDeep(o.data||{},this.customPayload));var c=new("onload"in new XMLHttpRequest?XMLHttpRequest:window.XDomainRequest),d={method:e,url:n,headers:g(g({},this.defaultHeaders),i.headers||{}),queryParams:i.queryParams||{},data:o};a&&(d.headers["Content-Type"]=a);var f=new u(c,d);this.beforeEachRequest&&(console.warn("HttpClient: 'beforeEachRequest' is deprecated and will be removed in future updates.\n Use 'onRequest' instead"),this.beforeEachRequest(f)),this.onRequest&&this.onRequest(f);var m=f.data&&"string"!=typeof f.data&&"json"==s?JSON.stringify(f.data):f.data;return f.open(),new h(f,new p((function(e,o){i.responseType&&(c.responseType=i.responseType),c.onerror=function(t){o(new y(c.status,c.responseText))},c.onreadystatechange=function(){if(4==c.readyState){var i=c.getResponseHeader("Content-Type")||"",s=c.status;if(0===s)o(new y(s,"Network error or the request was aborted"));else if(s>=200&&s<400){var a="arraybuffer"===c.responseType||"blob"===c.responseType?c.response:0==i.indexOf("application/json")?JSON.parse(c.responseText):c.responseText;r._responseBody=a,r.onResponse&&r.onResponse(c),e(a)}else{("arraybuffer"===c.responseType||"blob"===c.responseType?t.decodeArrayBuffer(c.response):p.resolve(c.responseText)).then((function(t){var e=0==i.indexOf("application/json")?JSON.parse(t):t;r._responseBody=e;var a=e.message||(404==s?"No such endpoint: ".concat(n):e);o(new y(s,a))}))}}},c.send(m)})))},t.decodeArrayBuffer=function(t){var e=new FileReader;return new p((function(n){e.onloadend=function(){e.readyState==FileReader.DONE&&n(e.result)},e.readAsText(new Blob([t]))}))},t}(),v=function(){function t(t){this.isEditable=!0,this.name="",this.caption="",this.description="",this.parent=t,this.attributes=new Array,this.subEntities=new Array}return t.prototype.loadFromData=function(t,e){if(e){if(this.id=e.id,this.name=e.name,this.captionPlural=e.namePlur,this.caption=e.name,this.description=e.desc,void 0!==e.ied&&(this.isEditable=e.ied),this.subEntities=new Array,e.ents)for(var n=0;n<e.ents.length;n++){var o=t.createEntity(this);o.loadFromData(t,e.ents[n]),this.subEntities.push(o)}if(this.attributes=new Array,e.attrs)for(n=0;n<e.attrs.length;n++){var i=t.createEntityAttr(this);i.loadFromData(t,e.attrs[n]),this.attributes.push(i)}}},t.prototype.scan=function(t,e){var n={stop:!1},o=function(i){if(e&&e(i,n),i.attributes)for(var r=i.attributes.length,s=0;s<r&&!n.stop;s++){var a=i.attributes[s];if(t&&t(a,n),n.stop)return}if(i.subEntities){var l=i.subEntities.length;for(s=0;s<l&&!n.stop;s++)o(i.subEntities[s])}};o(this)},t.prototype.getFirstPrimaryAttr=function(){return this.getPrimaryAttrs()[0]},t.prototype.getPrimaryAttrs=function(){return this.attributes.filter((function(t){return t.isPrimaryKey}))},t}(),C=function(){function t(t){this.id="",this.caption="{Unrecognized attribute}",this.dataType=o.String,this.size=0,this.isPrimaryKey=!1,this.isForeignKey=!1,this.isNullable=!0,this.showOnView=!0,this.isEditable=!0,this.showOnCreate=!0,this.showOnEdit=!0,this.showInLookup=!1,this.lookupAttr="",this.expr="",this.entity=t,this.kind=i.Data}return t.prototype.loadFromData=function(t,e){if(e){this.id=e.id,this.description=e.desc,this.caption=e.cptn,this.dataType=e.dtype,this.isPrimaryKey=e.ipk,this.isForeignKey=e.ifk,this.size=e.size,this.lookupAttr=e.lattr,this.lookupEntity=e.lent,this.dataAttr=e.dattr,this.lookupDataAttr=e.ldattr;var n=l.getDateDataTypes().indexOf(this.dataType);this.defaultValue=e.defVal&&n?new Date(e.defVal):e.defVal,this.isNullable=l.getIfDefined(e.nul,this.isNullable),this.isEditable=l.getIfDefined(e.ied,this.isEditable),this.showOnView=l.getIfDefined(e.ivis||e.sov,this.showOnView),this.showOnCreate=l.getIfDefined(e.soc,this.showOnCreate),this.showOnEdit=l.getIfDefined(e.soe,this.showOnEdit),this.showInLookup=l.getIfDefined(e.sil,this.showInLookup),this.kind=e.kind,this.displayFormat=e.dfmt,e.udata&&(this.userData=e.udata),e.edtr&&(this.defaultEditor=t.getEditorById(e.edtr)||t.createValueEditor())}},t}(),b=function(){function t(){this.id="",this.tag=s.Unknown,this.resType=o.Unknown,this.defValue=""}return t.prototype.loadFromData=function(t){t&&(this.id=t.id,this.tag=t.tag,this.defValue=t.defval,this.resType=t.rtype,this.accept=t.accept,this.multiline=t.multiline,t.subType&&(this.resType=t.subType),t.name&&(this.name=t.name),t.values&&(this.values=t.values))},t.prototype.getValueText=function(t){var e="";if(!this.values)return e;if(Array.isArray(t))for(var n=0,o=this.values;n<o.length;n++){var i=o[n];t.indexOf(i.id)>=0&&(e+=i.text+",")}else for(var r=0,s=this.values;r<s.length;r++){(i=s[r]).id===t&&(e+=i.text+",")}return e&&(e=e.substring(0,e.length-1)),e},t}(),x=function(){function t(){this.mainEntity=null,this.id="__none",this.name="Empty model",this.rootEntity=this.createEntity(),this.displayFormats=new Map}return t.prototype.getMainEntity=function(){return this.mainEntity},t.prototype.createEntity=function(t){return new v(t)},t.prototype.createEntityAttr=function(t){return new C(t)},t.prototype.createValueEditor=function(){return new b},t.prototype.loadFromJSON=function(t){var e=JSON.parse(t);this.loadFromData(e)},t.prototype.loadFromData=function(t){if(this.id=t.id,this.name=t.name,this.version=t.vers,this.editors=new Array,t.editors)for(var e=0;e<t.editors.length;e++){var n=this.createValueEditor();n.loadFromData(t.editors[e]),this.editors.push(n)}if(this.rootEntity.loadFromData(this,t.entroot),this.displayFormats=new Map,t.displayFormats)for(var i in t.displayFormats){var r=o[i],s=t.displayFormats[i]||new Array;this.displayFormats.set(r,s)}},t.prototype.getDisplayFormats=function(){return this.displayFormats},t.prototype.getDisplayFormatsForType=function(t){return this.displayFormats.has(t)?this.displayFormats.get(t):[]},t.prototype.getDefaultFormat=function(t){return this.displayFormats.has(t)?this.displayFormats.get(t).filter((function(t){return t.isdef}))[0]:null},t.prototype.setData=function(t){"string"==typeof t?this.loadFromJSON(t):this.loadFromData(t)},t.prototype.isEmpty=function(){return 0===this.rootEntity.subEntities.length&&0===this.rootEntity.attributes.length},t.prototype.getId=function(){return this.id},t.prototype.getName=function(){return this.name},t.prototype.getRootEntity=function(){return this.rootEntity},t.prototype.getEditorById=function(t){for(var e=0,n=this.editors;e<n.length;e++){var o=n[e];if(o.id===t)return o}return null},t.prototype.getAttributeById=function(t){var e=this.getEntityAttrById(this.getRootEntity(),t);return e||null},t.prototype.checkAttrProperty=function(t,e){var n=this.getAttributeById(t);if(n){if(void 0===n[e])throw"No such property: "+e;return!!n[e]||!!n.lookupAttr&&(t=n.lookupAttr,(n=this.getAttributeById(t))&&n[e])}return!1},t.prototype.getEntityAttrById=function(t,e){var n,o;if(t.attributes){var i=t.attributes.length;for(n=0;n<i;n++)if(t.attributes[n].id==e)return t.attributes[n]}if(t.subEntities){var r=t.subEntities.length;for(n=0;n<r;n++)if(o=this.getEntityAttrById(t.subEntities[n],e))return o}return null},t.prototype.listByEntityWithFilter=function(t,e){var n,o=new Array,i=null;if(t.subEntities)for(var r=t.subEntities.length,s=0;s<r;s++){if(i=t.subEntities[s],!e||e(i,null))(n=a.getText("Entities",i.name))||(n=i.caption),(h=l.assign(this.createEntity(),{id:i.name,text:n,items:[],isEntity:!0})).items=this.listByEntityWithFilter(i,e),h.items.length>0&&o.push(h)}var u=null;if(t.attributes)for(var c=t.attributes.length,d=0;d<c;d++)if(u=t.attributes[d],!e||e(t,u)){(n=a.getText("Attributes",u.id))||(n=u.caption);var h=l.assign(this.createEntity(),{id:u.id,text:n,dataType:u.dataType});o.push(h)}return o},t.prototype.listByEntity=function(t,e,n){e=e||{};var o,i=[],r=[],s=null;if(t.subEntities)for(var u=t.subEntities.length,c=0;c<u;c++)if(s=t.subEntities[c],!n||n(s,null)){o=a.getText("Entities",s.name)||s.caption;var d=l.assign(this.createEntity(),{id:s.name,text:o,items:[],isEntity:!0,description:s.description}),h=l.assign({},e);h.includeRootData=!1,d.items=this.listByEntity(s,h,n),d.items.length>0&&i.push(d)}var p=null;if(t.attributes)for(var f=t.attributes.length,g=0;g<f;g++)p=t.attributes[g],n&&!n(t,p)||(o=a.getText("Attributes",p.id)||p.caption,r.push(l.assign(this.createEntityAttr(t),{id:p.id,text:o,dataType:p.dataType,lookupAttr:p.lookupAttr,description:p.description})));var y,m=function(t,e){return t.text.toLowerCase()==e.text.toLowerCase()?0:t.text.toLowerCase()>e.text.toLowerCase()?1:-1};return e.sortEntities&&(i.sort(m),r.sort(m)),y=e.attrPlacement&&0!=e.attrPlacement?r.concat(i):i.concat(r),2==e.attrPlacement&&y.sort(m),e.includeRootData?((o=a.getText("Entities",t.name))||(o=t.caption),{id:t.name,text:o,items:y}):y},t.prototype.clear=function(){this.rootEntity=this.createEntity(),this.editors=[],this.version=""},t.prototype.addDefaultValueEditors=function(){this.addOrUpdateValueEditor("_DTE",s.Edit,o.String).defValue="",this.addOrUpdateValueEditor("_DPDE",s.DateTime,o.DateTime),this.addOrUpdateValueEditor("_DPTE",s.DateTime,o.DateTime)},t.prototype.addOrUpdateValueEditor=function(t,e,n){var o=l.findItemById(this.editors,t);return o||((o=this.createValueEditor()).id=t,this.editors.push(o)),o.tag=e,o.resType=n,o},t.prototype.getEntitiesTree=function(t,e){return this.listByEntity(this.getRootEntity(),t,e)},t.prototype.getEntitiesTreeWithFilter=function(t){return this.listByEntityWithFilter(this.getRootEntity(),t)},t.prototype.getFullEntityPathByAttr=function(t,e){return e=e||" ",this.getEntityPathByAttr(this.getRootEntity(),t,e,!0)},t.prototype.getEntityPathByAttr=function(t,e,n,o){if(!t)return"";n=n||" ";var i="";if(t.caption&&!o){var r=a.getText("Entities",t.caption);i=r||t.caption}if(t.attributes)for(var s=t.attributes.length,l=0;l<s;l++)if(t.attributes[l].id==e)return i;if(t.subEntities){var u=t.subEntities.length;for(l=0;l<u;l++){var c=t.subEntities[l],d=this.getEntityPathByAttr(c,e,n,!1);if(""!==d)return""!==i&&(d=i+n+d),d}}return""},t.prototype.getAttributeText=function(t,e){var n=a.getText("Attributes",t.id);if(n||(n=t.caption),!e)return n;var o=this.getFullEntityPathByAttr(t.id," ");return(o?e.replace(new RegExp("{attr}","g"),n).replace(new RegExp("{entity}","g"),o):n).trim()},t.prototype.runThroughEntities=function(t,e){this.getRootEntity().scan(t,e)},t.prototype.getFirstAttributeByFilter=function(t){var e=null;return this.runThroughEntities((function(n,o){t(n)&&(o.stop=!0,e=n)}),null),e},t}(),w=function(){return w=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},w.apply(this,arguments)},E=function(){function t(t){this.colStore=t,this.aggregates=[],this.groups=[],this.useGrandTotals=!1,this.useRecordCount=!1,this._caseSensitiveGroups=!1,this.COUNT_FIELD_NAME="GRPRECCNT"}return Object.defineProperty(t.prototype,"caseSensitiveGroups",{get:function(){return this._caseSensitiveGroups},set:function(t){this._caseSensitiveGroups=t,this.updateCompareProc()},enumerable:!1,configurable:!0}),t.prototype.updateCompareProc=function(){this.compareValues=this._caseSensitiveGroups?this.strictCompare:this.caseInsensitiveCompare},t.prototype.addGroup=function(t){var e=t.columns||this.colStore.getColumnIds(t.from,t.to);if(!this.colStore.validateColumns(e))throw"Invalid columns: "+e;if(this.hasColumnsInUse(e))throw"Can't add same columns to different groups/aggregates";return this.groups.push(w({columns:e},t)),this},t.prototype.addAggregateColumn=function(t,e){var n="string"==typeof t?t:this.colStore.getColumnIds(t,t)[0];if(this.hasColumnsInUse([n])||!this.colStore.validateAggregate(n,e))throw"Invalid aggregation function for the column: "+n;return this.aggregates.push({colId:n,funcId:e}),this},t.prototype.addGrandTotals=function(){return this.useGrandTotals=!0,this},t.prototype.addCounts=function(){return this.useRecordCount=!0,this},t.prototype.getGroups=function(){var t=this,e=[];return this.groups.map((function(n){return e=e.concat(n.columns),w(w({},n),{columns:Array.from(e),aggregates:Array.from(t.aggregates)})}))},t.prototype.getInternalGroups=function(){return this.groups},t.prototype.lastGroup=function(){var t=this.getGroups();return t[t.length-1]},t.prototype.getAggregates=function(){return this.aggregates},t.prototype.hasAggregates=function(){return this.aggregates.length>0},t.prototype.hasGroups=function(){return this.groups.length>0},t.prototype.hasGrandTotals=function(){return this.useGrandTotals},t.prototype.hasRecordCount=function(){return this.useRecordCount},t.prototype.isEmpty=function(){return!(this.hasAggregates()||this.hasGroups()||this.hasAggregates()||this.hasRecordCount())},t.prototype.drop=function(){console.warn('"drop()" method is obsolete. Use "clear()" instead'),this.clear()},t.prototype.clear=function(){return this.groups=[],this.aggregates=[],this.useGrandTotals=!1,this.useRecordCount=!1,this.caseSensitiveGroups=!1,this},t.prototype.hasColumnsInUse=function(t){for(var e=0,n=this.groups;e<n.length;e++){if(n[e].columns.filter((function(e){return t.indexOf(e)>=0})).length>0)return!0}for(var o=0,i=this.aggregates;o<i.length;o++){var r=i[o];if(t.indexOf(r.colId)>=0)return!0}return!1},t.prototype.needAggrCalculation=function(){return(this.hasAggregates()||this.hasRecordCount())&&(this.hasGrandTotals()||this.hasGroups())},t.prototype.saveToData=function(){return{groups:Array.from(this.groups),ugt:this.useGrandTotals,urc:this.useRecordCount,csg:this.caseSensitiveGroups,aggregates:Array.from(this.aggregates)}},t.prototype.loadFromData=function(t){t&&(void 0!==t.ugt&&(this.useGrandTotals=t.ugt),void 0!==t.urc&&(this.useRecordCount=t.urc),void 0!==t.csg&&(this.caseSensitiveGroups=t.csg),t.groups&&(this.groups=Array.from(t.groups)),t.aggregates&&(this.aggregates=Array.from(t.aggregates)))},t.prototype.buildGroupKey=function(t,e){var n=!this.caseSensitiveGroups,o={};if(t)for(var i=0,r=t.columns;i<r.length;i++){var s=r[i],a=e.getValue(s);n&&"string"==typeof a&&(a=a.toLowerCase()),o[s]=a}return o},t.prototype.strictCompare=function(t,e){return t instanceof Date?t.getTime()===e.getTime():t===e},t.prototype.caseInsensitiveCompare=function(t,e){return t instanceof Date?t.getTime()===e.getTime():("string"==typeof t?t.toLowerCase():t)===("string"==typeof e?e.toLowerCase():e)},t}();!function(t){t[t.None=0]="None",t[t.Left=1]="Left",t[t.Center=2]="Center",t[t.Right=3]="Right"}(d||(d={}));var T,D=function(t){if(!t)throw Error("Options are required");if(!t.id)throw Error("Field Id is required");if(!t.label)throw Error("Label is required");this.id=t.id,this.type=l.getIfDefined(t.type,o.String),this.label=t.label,this.originAttrId=t.originAttrId,this.isAggr=t.isAggr||!1,this.displayFormat=t.dfmt,this.groupFooterColumnTemplate=t.gfct,this.style=t.style||{},this.description=t.description,this.calculatedWidth=0},S=function(){function t(){this.items=[],this.mapper={},this._dateColumnIdx=[]}return Object.defineProperty(t.prototype,"count",{get:function(){return this.items.length},enumerable:!1,configurable:!0}),t.prototype.add=function(t){var e;e=t instanceof D?t:new D(t);var n=this.items.length;return this.items.push(e),this.mapper[e.id]=n,[o.Date,o.DateTime,o.Time].indexOf(e.type)>=0&&this._dateColumnIdx.push(n),n},t.prototype.updateDateColumnIdx=function(){this._dateColumnIdx=this.getItems().filter((function(t){return[o.Date,o.DateTime,o.Time].indexOf(t.type)>=0})).map((function(t,e){return e}))},t.prototype.put=function(t,e){t>=0&&t<this.count&&(this.items[t]=e,this.updateDateColumnIdx())},t.prototype.move=function(t,e){var n=this.items.indexOf(t);n>=0&&n!=e&&(l.moveArrayItem(this.items,n,e),this.updateDateColumnIdx())},t.prototype.get=function(t){return t>=0&&t<this.count?this.items[t]:null},t.prototype.getIndex=function(t){return this.mapper[t]},t.prototype.getItems=function(){return this.items},t.prototype.getDateColumnIndexes=function(){return this._dateColumnIdx},t.prototype.removeAt=function(t){var e=this.get(t);this.items.splice(t,1);var n=this._dateColumnIdx.indexOf(t);n>=0&&this._dateColumnIdx.splice(n,1),delete this.mapper[e.id]},t.prototype.clear=function(){this.items=[],this._dateColumnIdx=[],this.mapper={}},t}(),k=function(){function t(t,e){this.columns=t,this.values=e}return t.prototype.toArray=function(){return Array.from(this.values)},t.prototype.size=function(){return this.values.length},t.prototype.getValue=function(t){var e;if("string"==typeof t){if(void 0===(e=this.columns.getIndex(t)))throw new RangeError("No column with id '".concat(t,"'"))}else e=t;if(e>=this.values.length)throw new RangeError("Out of range: "+e);return this.values[e]},t.prototype.setValue=function(t,e){var n;if("string"==typeof t){if(void 0===(n=this.columns.getIndex(t)))throw new RangeError("No column with id '".concat(t,"'"))}else n=t;if(n>=this.values.length)throw new RangeError("Out of range: "+n);this.values[n]=e},t}(),M=n(895),I=function(){function t(t){if(this._chunkSize=1e3,this._elasticChunks=!1,this.cachedRows=[],this.total=0,this.loader=null,this.needTotal=!0,this.isInMemory=!1,t=t||{},this._chunkSize=t.chunkSize||this._chunkSize,this._elasticChunks=t.elasticChunks||this._elasticChunks,this.loader=t.loader,void 0!==t.inMemory&&(this.isInMemory=t.inMemory),this.isInMemory&&(this.needTotal=!1),this._columns=new S,this.onUpdate=t.onUpdate,t.columns)for(var e=0,n=t.columns;e<n.length;e++){var o=n[e];this._columns.add(o)}if(t.rows)for(var i=0,r=t.rows;i<r.length;i++){var s=r[i],a=this.createRow(s);this.addRow(a)}this.needTotal=!this._elasticChunks}return Object.defineProperty(t.prototype,"columns",{get:function(){return this._columns},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"chunkSize",{get:function(){return this._chunkSize},set:function(t){this._chunkSize=t,this.total=0,this.needTotal=!this.elasticChunks,this.cachedRows=[]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"elasticChunks",{get:function(){return this._elasticChunks},set:function(t){this._elasticChunks=t,this.total=0,this.needTotal=!this.elasticChunks,this.cachedRows=[]},enumerable:!1,configurable:!0}),t.prototype.getRows=function(t){var e=this,n=0,o=this._chunkSize;t&&("page"in t?(n=t.pageSize*(t.page-1),o=t.pageSize):(n=t.offset,o=t.limit));var i=n+o;if(!this.needTotal&&!this.elasticChunks){if(n>=this.total)return M.resolve([]);i>this.total&&(i=this.total)}if(this.isInMemory&&i>this.cachedRows.length&&(i=this.cachedRows.length),i<=this.cachedRows.length)return M.resolve(this.cachedRows.slice(n,i));if(!this.loader)throw"Loader is not defined. Can't get the rows from ".concat(n," to ").concat(i);var r=this.needTotal;this.needTotal&&(this.needTotal=!1);var s=this.cachedRows.length,a=i-s;return a<this._chunkSize&&(a=this._chunkSize),this.loader.loadChunk({offset:s,limit:a,needTotal:r}).then((function(t){(r&&(e.total=t.total),Array.prototype.push.apply(e.cachedRows,t.table.getCachedRows()),i>e.cachedRows.length&&(i=e.cachedRows.length),e.elasticChunks)&&(t.table.getCachedCount()<a&&(e.total=e.cachedRows.length));return e.fireUpdated(),e.cachedRows.slice(n,i)}))},t.prototype.getRow=function(t){return this.getRows({offset:t,limit:1}).then((function(t){return t.length>0?t[0]:null}))},t.prototype.getTotal=function(){return this.total},t.prototype.setTotal=function(t){this.total=t,this.needTotal=!1},t.prototype.getCachedCount=function(){return this.cachedRows.length},t.prototype.clear=function(){this.columns.clear(),this.cachedRows=[],this.total=0,this.needTotal=!this._elasticChunks,this.fireUpdated()},t.prototype.createRow=function(t){var e=this,n=this._columns.getDateColumnIndexes(),o=new Array(this._columns.count),i=t instanceof k?function(e){return t.getValue(e)}:function(e){return t[e]};return t&&this.columns.getItems().forEach((function(t){var r=i(t.id),s=e.columns.getIndex(t.id);o[s]=n.indexOf(s)>=0?e.mapDate(r,t.type):r})),new k(this._columns,o)},t.prototype.mapDate=function(t,e){if(t){var n=new Date(t);return isNaN(n.getTime())&&e==o.Time&&(n=l.strToTime(t)),n}return null},t.prototype.addRow=function(t){var e;if(Array.isArray(t)){var n=t,o=this._columns.getDateColumnIndexes();if(o.length>0)for(var i=0,r=o;i<r.length;i++){var s=r[i];n[s]&&(n[s]=this.mapDate(n[s],this._columns.get(s).type))}e=new k(this._columns,n)}else e=this.createRow(t);this.cachedRows.push(e);var a=this.getCachedCount();return a>this.total&&(this.total=a),e},t.prototype.getCachedRows=function(){return this.cachedRows},t.prototype.totalIsKnown=function(){return this.elasticChunks?this.getCachedCount()===this.total:!this.needTotal},t.prototype.fireUpdated=function(){this.onUpdate&&this.onUpdate(this)},t}(),B=function(){function t(){}return t.newGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)}))},t}(),A=function(){function t(t){this.silentMode=0,this.events=new Array,this.source=t}return t.prototype.subscribe=function(t,e){var n=this.getEventRecByType(t),o={id:B.newGuid(),callback:e};return n?n.eventCallbacks.push(o):(n={type:t,eventCallbacks:new Array(o)},this.events.push(n)),o.id},t.prototype.unsubscribe=function(t,e){var n=this.getEventRecByType(t);if(n){var o=-1;for(o=0;o<n.eventCallbacks.length&&n.eventCallbacks[o].id!==e;o++);o>=0&&n.eventCallbacks.splice(o,1)}},t.prototype.fire=function(t,e,n,o){if(void 0===n&&(n=0),void 0===o&&(o=!1),!this.silentMode||o){var i=this.getEventRecByType(t);if(i){var r={type:t,source:this.source,data:e},s=function(){for(var t=0,e=i.eventCallbacks;t<e.length;t++){e[t].callback(r)}};n>0?setTimeout(s,n):s()}}},t.prototype.enterSilentMode=function(){this.silentMode++},t.prototype.exitSilentMode=function(){this.silentMode&&this.silentMode--},t.prototype.isSilent=function(){return this.silentMode>0},t.prototype.getEventRecByType=function(t){for(var e=0,n=this.events;e<n.length;e++){var o=n[e];if(o.type==t)return o}return null},t}();function _(t,e){return t.repeat(e)}function P(t){return t.split("").reverse().join("")}function O(t,e){return t&&t.lastIndexOf(e)==t.length-e.length}function L(t,e){var n=t;return null!=n&&n.length>0?("/"!=n.charAt(n.length-1)&&(n+="/"),n+=e):n=e,n}!function(t){t.renderLiquidTemplate=function(t,e){var n=t;if(e)for(var o in e){var i=new RegExp("{{"+o+"}}","g");n=n.replace(i,e[o])}return n}}(T||(T={})),a.resetLocales(),"function"!=typeof Object.values&&(Object.values=function(t){return Object.keys(t).map((function(e){return t[e]}))}),"function"!=typeof Math.trunc&&(Math.trunc=function(t){return isNaN(t)?NaN:t>0?Math.floor(t):Math.ceil(t)})},895:function(t,e,n){t.exports=function(){"use strict";function t(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}function e(t){return"function"==typeof t}var o=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},i=0,r=void 0,s=void 0,a=function(t,e){b[i]=t,b[i+1]=e,2===(i+=2)&&(s?s(x):E())};function l(t){s=t}function u(t){a=t}var c="undefined"!=typeof window?window:void 0,d=c||{},h=d.MutationObserver||d.WebKitMutationObserver,p="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),f="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function g(){return function(){return process.nextTick(x)}}function y(){return void 0!==r?function(){r(x)}:C()}function m(){var t=0,e=new h(x),n=document.createTextNode("");return e.observe(n,{characterData:!0}),function(){n.data=t=++t%2}}function v(){var t=new MessageChannel;return t.port1.onmessage=x,function(){return t.port2.postMessage(0)}}function C(){var t=setTimeout;return function(){return t(x,1)}}var b=new Array(1e3);function x(){for(var t=0;t<i;t+=2)(0,b[t])(b[t+1]),b[t]=void 0,b[t+1]=void 0;i=0}function w(){try{var t=Function("return this")().require("vertx");return r=t.runOnLoop||t.runOnContext,y()}catch(t){return C()}}var E=void 0;function T(t,e){var n=this,o=new this.constructor(k);void 0===o[S]&&U(o);var i=n._state;if(i){var r=arguments[i-1];a((function(){return W(i,o,r,n._result)}))}else j(n,o,t,e);return o}function D(t){var e=this;if(t&&"object"==typeof t&&t.constructor===e)return t;var n=new e(k);return F(n,t),n}E=p?g():h?m():f?v():void 0===c?w():C();var S=Math.random().toString(36).substring(2);function k(){}var M=void 0,I=1,B=2;function A(){return new TypeError("You cannot resolve a promise with itself")}function _(){return new TypeError("A promises callback cannot return that same promise.")}function P(t,e,n,o){try{t.call(e,n,o)}catch(t){return t}}function O(t,e,n){a((function(t){var o=!1,i=P(n,e,(function(n){o||(o=!0,e!==n?F(t,n):Q(t,n))}),(function(e){o||(o=!0,N(t,e))}),"Settle: "+(t._label||" unknown promise"));!o&&i&&(o=!0,N(t,i))}),t)}function L(t,e){e._state===I?Q(t,e._result):e._state===B?N(t,e._result):j(e,void 0,(function(e){return F(t,e)}),(function(e){return N(t,e)}))}function R(t,n,o){n.constructor===t.constructor&&o===T&&n.constructor.resolve===D?L(t,n):void 0===o?Q(t,n):e(o)?O(t,n,o):Q(t,n)}function F(e,n){if(e===n)N(e,A());else if(t(n)){var o=void 0;try{o=n.then}catch(t){return void N(e,t)}R(e,n,o)}else Q(e,n)}function q(t){t._onerror&&t._onerror(t._result),H(t)}function Q(t,e){t._state===M&&(t._result=e,t._state=I,0!==t._subscribers.length&&a(H,t))}function N(t,e){t._state===M&&(t._state=B,t._result=e,a(q,t))}function j(t,e,n,o){var i=t._subscribers,r=i.length;t._onerror=null,i[r]=e,i[r+I]=n,i[r+B]=o,0===r&&t._state&&a(H,t)}function H(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var o=void 0,i=void 0,r=t._result,s=0;s<e.length;s+=3)o=e[s],i=e[s+n],o?W(n,o,i,r):i(r);t._subscribers.length=0}}function W(t,n,o,i){var r=e(o),s=void 0,a=void 0,l=!0;if(r){try{s=o(i)}catch(t){l=!1,a=t}if(n===s)return void N(n,_())}else s=i;n._state!==M||(r&&l?F(n,s):!1===l?N(n,a):t===I?Q(n,s):t===B&&N(n,s))}function G(t,e){try{e((function(e){F(t,e)}),(function(e){N(t,e)}))}catch(e){N(t,e)}}var z=0;function V(){return z++}function U(t){t[S]=z++,t._state=void 0,t._result=void 0,t._subscribers=[]}function Y(){return new Error("Array Methods must be provided an Array")}var J=function(){function t(t,e){this._instanceConstructor=t,this.promise=new t(k),this.promise[S]||U(this.promise),o(e)?(this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?Q(this.promise,this._result):(this.length=this.length||0,this._enumerate(e),0===this._remaining&&Q(this.promise,this._result))):N(this.promise,Y())}return t.prototype._enumerate=function(t){for(var e=0;this._state===M&&e<t.length;e++)this._eachEntry(t[e],e)},t.prototype._eachEntry=function(t,e){var n=this._instanceConstructor,o=n.resolve;if(o===D){var i=void 0,r=void 0,s=!1;try{i=t.then}catch(t){s=!0,r=t}if(i===T&&t._state!==M)this._settledAt(t._state,e,t._result);else if("function"!=typeof i)this._remaining--,this._result[e]=t;else if(n===et){var a=new n(k);s?N(a,r):R(a,t,i),this._willSettleAt(a,e)}else this._willSettleAt(new n((function(e){return e(t)})),e)}else this._willSettleAt(o(t),e)},t.prototype._settledAt=function(t,e,n){var o=this.promise;o._state===M&&(this._remaining--,t===B?N(o,n):this._result[e]=n),0===this._remaining&&Q(o,this._result)},t.prototype._willSettleAt=function(t,e){var n=this;j(t,void 0,(function(t){return n._settledAt(I,e,t)}),(function(t){return n._settledAt(B,e,t)}))},t}();function K(t){return new J(this,t).promise}function X(t){var e=this;return o(t)?new e((function(n,o){for(var i=t.length,r=0;r<i;r++)e.resolve(t[r]).then(n,o)})):new e((function(t,e){return e(new TypeError("You must pass an array to race."))}))}function $(t){var e=new this(k);return N(e,t),e}function Z(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function tt(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}var et=function(){function t(e){this[S]=V(),this._result=this._state=void 0,this._subscribers=[],k!==e&&("function"!=typeof e&&Z(),this instanceof t?G(this,e):tt())}return t.prototype.catch=function(t){return this.then(null,t)},t.prototype.finally=function(t){var n=this,o=n.constructor;return e(t)?n.then((function(e){return o.resolve(t()).then((function(){return e}))}),(function(e){return o.resolve(t()).then((function(){throw e}))})):n.then(t,t)},t}();function nt(){var t=void 0;if(void 0!==n.g)t=n.g;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var e=t.Promise;if(e){var o=null;try{o=Object.prototype.toString.call(e.resolve())}catch(t){}if("[object Promise]"===o&&!e.cast)return}t.Promise=et}return et.prototype.then=T,et.all=K,et.race=X,et.resolve=D,et.reject=$,et._setScheduler=l,et._setAsap=u,et._asap=a,et.polyfill=nt,et.Promise=et,et}()},514:function(t,e,n){"use strict";n.r(e),n.d(e,{AutoResizeColumns:function(){return P},Calendar:function(){return tt},CellRendererType:function(){return q},DFMT_REGEX:function(){return N},DateTimePicker:function(){return et},DefaultCalendar:function(){return ot},DefaultDateTimePicker:function(){return lt},DefaultDialog:function(){return pt},DefaultDialogService:function(){return ht},DefaultDialogSet:function(){return gt},DefaultProgressDialog:function(){return ft},DefaultTimePicker:function(){return st},DialogFooterAlignment:function(){return U},DomElementBuilder:function(){return S},DomInputElementBuilder:function(){return M},DomSelectElementBuilder:function(){return I},DomTextAreaElementBuilder:function(){return k},DragManager:function(){return R},DropEffect:function(){return A},EasyGrid:function(){return Z},EqDragEvent:function(){return O},GridCellRendererStore:function(){return V},GridColumn:function(){return Y},GridColumnAlign:function(){return j},GridColumnList:function(){return J},TimePicker:function(){return it},addCssClass:function(){return a},addElement:function(){return s},browserUtils:function(){return i.z},createBrowserEvent:function(){return h},dialogs:function(){return yt},domel:function(){return B},eqCssMobile:function(){return x},eqCssPrefix:function(){return b},eqDragManager:function(){return F},getDocSize:function(){return f},getElementAbsolutePos:function(){return y},getScrollPos:function(){return g},getViewportSize:function(){return p},getWinSize:function(){return m},hideElement:function(){return l},isVisible:function(){return d},mask:function(){return w},showElement:function(){return u},slideDown:function(){return v},slideUp:function(){return C},toggleVisibility:function(){return c},wrapInner:function(){return r}});var o=n(907),i=n(789);function r(t,e){for(t.appendChild(e);t.firstChild!==e;)e.appendChild(t.firstChild)}function s(t,e,n){var o=document.createElement(e),i=n||{};return i.cssClass&&(o.className=i.cssClass),t.appendChild(o),o}function a(t,e){t.className=t.className?t.className+" "+e:e}function l(t){t.style.display="none"}function u(t,e){e||(e=""),t.style.display=e}function c(t,e,n){n||(n={}),n.display||(n.display=""),n.duration||(n.duration=200),l(t),u(e,n.display),n.complete&&n.complete()}function d(t){return"none"!=t.style.display&&0!=t.offsetWidth&&0!=t.offsetHeight}function h(t){var e;return"function"==typeof Event?e=new Event(t):(e=document.createEvent("Event")).initEvent(t,!0,!0),e}function p(){return{width:Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),height:Math.max(document.documentElement.clientHeight||0,window.innerHeight||0)}}function f(){return i.z.IsIE()?m():{width:Math.max(document.documentElement.clientWidth,document.body.clientWidth||0),height:Math.max(document.documentElement.clientHeight,document.body.clientHeight||0)}}function g(){var t=document.body,e=document.documentElement;return{top:window.pageYOffset||e.scrollTop||t.scrollTop,left:window.pageXOffset||e.scrollLeft||t.scrollLeft}}function y(t){var e={x:0,y:0};if(null!==t){var n=function(t){var e,n={top:0,right:0,bottom:0,left:0,width:0,height:0};try{e=t.getBoundingClientRect()}catch(t){e=n}var o=document.body,i=document.documentElement,r=g(),s=r.top,a=r.left,l=i.clientTop||o.clientTop||0,u=i.clientLeft||o.clientLeft||0,c=e.top+s-l,d=e.left+a-u;return{top:Math.round(c),left:Math.round(d)}}(t);e={x:n.left,y:n.top}}return e}function m(){return{width:window.innerWidth,height:window.innerHeight}}function v(t,e,n){t.style.removeProperty("display");var o=window.getComputedStyle(t).display;"none"===o&&(o="block"),t.style.display=o;var i=t.offsetHeight;t.style.overflow="hidden",t.style.height="0px",t.style.paddingTop="0px",t.style.paddingBottom="0px",t.style.marginTop="0px",t.style.marginBottom="0px",t.offsetHeight,t.style.boxSizing="border-box",t.style.transitionProperty="height, margin, padding",t.style.transitionDuration=e+"ms",t.style.height=i+"px",t.style.removeProperty("padding-top"),t.style.removeProperty("padding-bottom"),t.style.removeProperty("margin-top"),t.style.removeProperty("margin-bottom"),window.setTimeout((function(){t.style.removeProperty("height"),t.style.removeProperty("overflow"),t.style.removeProperty("transition-duration"),t.style.removeProperty("transition-property"),t.style.removeProperty("box-sizing"),n&&n()}),e)}function C(t,e,n){t.style.transitionProperty="height, margin, padding",t.style.transitionDuration=e+"ms",t.style.boxSizing="border-box",t.style.height=t.offsetHeight+"px",t.offsetHeight,t.style.overflow="hidden",t.style.height="0px",t.style.paddingTop="0px",t.style.paddingBottom="0px",t.style.marginTop="0px",t.style.marginBottom="0px",window.setTimeout((function(){t.style.display="none",t.style.removeProperty("height"),t.style.removeProperty("padding-top"),t.style.removeProperty("padding-bottom"),t.style.removeProperty("margin-top"),t.style.removeProperty("margin-bottom"),t.style.removeProperty("overflow"),t.style.removeProperty("transition-duration"),t.style.removeProperty("transition-property"),t.style.removeProperty("box-sizing"),n&&n()}),e)}var b="eqjs",x="eqjs-mobile";function w(t,e){var n={9:"[0-9]",a:"[a-z]"},o=e.split(""),i=function(e){if("focus"!==e.type||""===t.value){var i=[],r=t.selectionStart;o.forEach((function(e,o){if(n[e]){var r=new RegExp(n[e],"i").test(t.value.charAt(o));i.push(r?t.value.charAt(o):"_")}else i.push(e)})),t.value=i.join(""),t.selectionStart=t.selectionEnd=r}};t.addEventListener("keydown",(function(e){if(8===e.keyCode||46===e.keyCode){e.preventDefault();var i=[],r=t.selectionStart;if(0==r)return;for(var s=r,a=!0,l=o.length-1;l>=0;l--){var u=o[l];if(n[u]){var c=new RegExp(n[u],"i").test(t.value.charAt(l));c&&l!=r-1&&(a=!1),l===r-1&&s--,i.push(c&&l!=r-1?t.value.charAt(l):"_")}else l===s-1&&s--,r-1===l&&r--,i.push(u)}t.value=a?"":i.reverse().join(""),t.selectionStart=t.selectionEnd=s<0?0:s;var d=document.createEvent("Event");d.initEvent("input",!0,!0),t.dispatchEvent(d)}})),t.addEventListener("keypress",(function(e){var i=String.fromCharCode(e.charCode);if(i){e.preventDefault();var r=[],s=t.selectionStart,a=s;o.forEach((function(e,o){if(n[e]){var l=o!=s?t.value.charAt(o):i,u=new RegExp(n[e],"i").test(l);r.push(u?l:"_"),u&&s===o&&a++}else r.push(e),a===o&&a++,s===o&&s++})),t.value=r.join(""),t.selectionStart=t.selectionEnd=a;var l=document.createEvent("Event");l.initEvent("input",!0,!0),t.dispatchEvent(l)}})),t.addEventListener("input",i),t.addEventListener("focus",i)}var E,T=(E=function(t,e){return E=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},E(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}E(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),D=function(t,e,n){if(n||2===arguments.length)for(var o,i=0,r=e.length;i<r;i++)!o&&i in e||(o||(o=Array.prototype.slice.call(e,0,i)),o[i]=e[i]);return t.concat(o||Array.prototype.slice.call(e))},S=function(){function t(t,e){this.element="string"==typeof t?document.createElement(t):t,e&&this.element.parentElement!==e&&e.appendChild(this.element)}return t.prototype.addChild=function(t,e){var n=B(t,this.element);return e&&e(n),this},t.prototype.addChildElement=function(t){return t&&this.element.appendChild(t),this},t.prototype.attr=function(t,e){return this.element.setAttribute(t,e),this},t.prototype.id=function(t){return this.attr("id",t)},t.prototype.focus=function(){return this.element.focus(),this},t.prototype.title=function(t){return this.attr("title",t)},t.prototype.data=function(t,e){return void 0===e&&(e=null),null===e?(this.element.removeAttribute("data-"+t),this):this.attr("data-"+t,e)},t.prototype.show=function(){return this.removeStyle("display")},t.prototype.hide=function(t){return void 0===t&&(t=!0),t?this.setStyle("display","none"):this},t.prototype.visible=function(t){return void 0===t&&(t=!0),t?this.setStyle("visibility","visible"):this.setStyle("visibility","hidden")},t.prototype.isVisible=function(){return!!(this.element.offsetWidth||this.element.offsetHeight||this.element.getClientRects().length)},t.prototype.addClass=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(t)for(var o=D(D([],t.trim().split(" "),!0),e,!0),i=0;i<o.length;i++)this.element.classList.add(o[i]);return this},t.prototype.removeClass=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(t)for(var o=D(D([],t.trim().split(" "),!0),e,!0),i=0;i<o.length;i++)this.element.classList.remove(o[i]);return this},t.prototype.toggleClass=function(t,e){return void 0===e&&(e=void 0),t&&this.element.classList.toggle(t,e),this},t.prototype.on=function(t,e){for(var n=t.split(" "),o=0;o<n.length;o++)this.element.addEventListener(n[o],e);return this},t.prototype.off=function(t,e){for(var n=t.split(" "),o=0;o<n.length;o++)this.element.removeEventListener(n[o],e);return this},t.prototype.setStyle=function(t,e){return this.element.style.setProperty(t,e),this},t.prototype.removeStyle=function(t){return this.element.style.removeProperty(t),this},t.prototype.text=function(t){return this.element.innerText=t,this},t.prototype.html=function(t){return this.element.innerHTML=t,this},t.prototype.clear=function(){var t=this.element;this.element=document.createElement(this.element.tagName),t.replaceWith(this.element)},t.prototype.addText=function(t){var e=document.createTextNode(t);return this.element.appendChild(e),this},t.prototype.addHtml=function(t){return this.element.innerHTML+=t,this},t.prototype.toDOM=function(){return this.element},t.prototype.appendTo=function(t){return t&&t.appendChild(this.element),this},t}(),k=function(t){function e(e,n){return e?t.call(this,e,n)||this:t.call(this,"textarea",n)||this}return T(e,t),e.prototype.name=function(t){return this.element.name=t,this},e.prototype.rows=function(t){return this.element.rows=t,this},e.prototype.cols=function(t){return this.element.cols=t,this},e.prototype.value=function(t){return this.element.value=t,this},e}(S),M=function(t){function e(e,n){return e?t.call(this,e,n)||this:t.call(this,"input",n)||this}return T(e,t),e.prototype.name=function(t){return this.element.name=t,this},e.prototype.type=function(t){return this.element.type=t,this},e.prototype.size=function(t){return this.element.size=t,this},e.prototype.value=function(t){return t instanceof Date?this.element.valueAsDate=t:"number"==typeof t?this.element.valueAsNumber=t:this.element.value=t,this},e.prototype.mask=function(t){return w(this.element,t),this},e}(S),I=function(t){function e(e,n){return e?t.call(this,e,n)||this:t.call(this,"select",n)||this}return T(e,t),e.prototype.addOption=function(t){var e=document.createElement("option");return"string"==typeof t?(e.value=t,e.innerHTML=t):(e.value=t.value,e.innerHTML=t.title||t.value,e.selected=t.selected||!1),this.element.appendChild(e),this},e.prototype.value=function(t){return this.element.value=t,this},e}(S);function B(t,e){return"div"===t||t instanceof HTMLDivElement||"span"===t||t instanceof HTMLSpanElement||"a"===t||t instanceof HTMLAnchorElement||"button"===t||t instanceof HTMLButtonElement||"img"===t||t instanceof HTMLImageElement?new S(t,e):"input"===t||t instanceof HTMLInputElement?new M(t instanceof HTMLInputElement?t:null,e):"textarea"===t||t instanceof HTMLTextAreaElement?new k(t instanceof HTMLTextAreaElement?t:null,e):"select"===t||t instanceof HTMLSelectElement?new I(t instanceof HTMLSelectElement?t:null,e):new S(t,e)}var A,_="undefined"!=typeof TouchEvent;!function(t){t.None="none",t.Allow="allow",t.Forbid="forbid"}(A||(A={}));var P,O=function(t,e,n){this.dropEffect=A.Allow,this.pageX=0,this.pageY=0,this.item=t,this.dragImage=e,this.data=t.data,this.sourceEvent=n,n&&n instanceof MouseEvent&&(this.pageX=n.pageX,this.pageY=n.pageY),n&&_&&n instanceof TouchEvent&&n.touches[0]&&(this.pageX=n.touches[0].pageX,this.pageY=n.touches[0].pageY)},L=function(t){t&&t instanceof MouseEvent&&(this.x=t.pageX,this.y=t.pageY),t&&_&&t instanceof TouchEvent&&t.touches[0]&&(this.x=t.touches[0].pageX,this.y=t.touches[0].pageY)},R=function(){function t(){this.delta=5,this.draggableItem=null,this.dragImage=null,this.finishedSuccessfully=!1,this.mouseDownPosition=null,this.containerDescriptors=[],this.containerDescriptorIndex=-1,this.dropEffect=A.None,this.classPrefix="eqjs-drop",this.DRAG_DISABLED_ATTR="drag-disabled"}return t.prototype.registerDraggableItem=function(t){var e=this,n=t.element;if(!n)throw Error("Element in draggle item is null or undefined");n.ondragstart=function(){return!1};var o=function(t){if(!n.hasAttribute(e.DRAG_DISABLED_ATTR)){t.preventDefault(),t instanceof MouseEvent&&t.stopPropagation();var o=new L(t);(Math.abs(o.x-e.mouseDownPosition.x)>e.delta||Math.abs(o.y-e.mouseDownPosition.y)>e.delta)&&r(t)}},i=function(t){e.mouseMoveDragListener(t)},r=function(r){r.preventDefault(),r.stopPropagation(),n.removeEventListener("mousemove",o),n.removeEventListener("touchmove",o),e.finishedSuccessfully=!1,t.beforeDragStart&&t.beforeDragStart(),e.dragImage=B("div").setStyle("position","absolute").setStyle("z-index","65530").toDOM(),document.body.appendChild(e.dragImage),e.dragImage.appendChild(n.cloneNode(!0)),t.renderer&&t.renderer(e.dragImage),e.dropEffect=A.None,e.updateCusror(e.dropEffect),e.updateImageClass(e.dropEffect),e.draggableItem={element:n,scope:t.scope,data:t.data},e.updateDragItemPosition(r);var s=new O(e.draggableItem,e.dragImage,r);s.dropEffect=e.dropEffect,t.onDragStart&&t.onDragStart(s),e.dropEffect!==s.dropEffect&&(e.dropEffect=s.dropEffect,e.updateImageClass(e.dropEffect)),document.addEventListener("mousemove",i,!0),document.addEventListener("touchmove",i,!0)},s=function(t){_&&t instanceof TouchEvent&&t.preventDefault(),e.mouseDownPosition=new L(t),n.addEventListener("mousemove",o),n.addEventListener("touchmove",o),document.addEventListener("mouseup",a),document.addEventListener("touchend",a)};n.addEventListener("mousedown",s),n.addEventListener("touchstart",s);var a=function(t){e.mouseDownPosition=null,n.removeEventListener("mousemove",o),n.removeEventListener("touchmove",o),document.removeEventListener("mousemove",i,!0),document.removeEventListener("touchmove",i,!0),e.draggableItem&&l(t)},l=function(n){try{if(e.containerDescriptorIndex>=0){var o=e.containerDescriptors[e.containerDescriptorIndex],i={element:o.element,scopes:o.scopes,data:o.data},r=new O(e.draggableItem,e.dragImage,n);try{i.scopes.indexOf(e.draggableItem.scope)>=0&&e.dropEffect===A.Allow&&(e.finishedSuccessfully=!0,o.onDrop&&o.onDrop(i,r))}finally{o.onDragLeave&&o.onDragLeave(i,r)}}}finally{try{var s=new O(e.draggableItem,e.dragImage,n);s.data.finishedSuccessfully=e.finishedSuccessfully,t.onDragEnd&&t.onDragEnd(s)}finally{e.draggableItem=null,e.dragImage&&e.dragImage.parentElement&&e.dragImage.parentElement.removeChild(e.dragImage),e.dragImage=null,e.finishedSuccessfully=!1,document.removeEventListener("mouseup",a),document.removeEventListener("touchend",a)}}}},t.prototype.registerDropContainer=function(t){if(!t.element)throw Error("Element in drop container is null or undefined");this.containerDescriptors.push(t)},t.prototype.removeDropContainer=function(t){var e=this.containerDescriptors.filter((function(e){return e===t||e.element==t}));if(e)for(var n=0,i=e;n<i.length;n++){var r=i[n];o.utils.removeArrayItem(this.containerDescriptors,r)}},t.prototype.mouseMoveDragListener=function(t){if(t instanceof MouseEvent&&t.preventDefault(),t.stopPropagation(),this.updateDragItemPosition(t),-1==this.containerDescriptorIndex){for(var e=0;e<this.containerDescriptors.length;e++){var n=this.containerDescriptors[e];if(this.detectDragEnterEvent(n.element,t)){this.containerDescriptorIndex=e;break}}this.containerDescriptorIndex>=0&&this.dragEnterEvent(t)}else{n=this.containerDescriptors[this.containerDescriptorIndex];this.detectDragLeaveEvent(n.element,t)&&(this.dragLeaveEvent(t),this.containerDescriptorIndex=-1)}if(this.containerDescriptorIndex>=0){var o={element:(n=this.containerDescriptors[this.containerDescriptorIndex]).element,scopes:n.scopes,data:n.data};if(o.scopes.indexOf(this.draggableItem.scope)>=0){var i=new O(this.draggableItem,this.dragImage,t);i.dropEffect=this.dropEffect,n.onDragOver&&n.onDragOver(o,i)}}},t.prototype.updateCusror=function(t){switch(t){case A.Allow:this.setCursorStyle(this.dragImage,"grabbing");break;case A.Forbid:this.setCursorStyle(this.dragImage,"no-drop");break;default:this.setCursorStyle(this.dragImage,"grabbing")}},t.prototype.updateImageClass=function(t){switch(this.dragImage.classList.remove("".concat(this.classPrefix,"-allow")),this.dragImage.classList.remove("".concat(this.classPrefix,"-forbid")),this.dragImage.classList.remove("".concat(this.classPrefix,"-none")),t){case A.Allow:this.dragImage.classList.add("".concat(this.classPrefix,"-allow"));break;case A.None:this.dragImage.classList.add("".concat(this.classPrefix,"-none"));break;case A.Forbid:this.dragImage.classList.add("".concat(this.classPrefix,"-forbid"));break;default:this.dragImage.classList.add("".concat(this.classPrefix,"-none"))}},t.prototype.setCursorStyle=function(t,e){if(t){t.style.cursor=e;for(var n=0;n<t.children.length;n++)this.setCursorStyle(t.children[n],e)}},t.prototype.updateDragItemPosition=function(t){if(this.dragImage){var e=new L(t);this.dragImage.style.top=e.y-this.dragImage.offsetHeight/2+"px",this.dragImage.style.left=e.x-this.dragImage.offsetWidth/2+"px"}},t.prototype.dragEnterEvent=function(t){var e=this.containerDescriptors[this.containerDescriptorIndex],n={element:e.element,scopes:e.scopes,data:e.data};if(n.scopes.indexOf(this.draggableItem.scope)>=0){var o=new O(this.draggableItem,this.dragImage,t);o.dropEffect=A.Allow,e.onDragEnter&&e.onDragEnter(n,o),this.dropEffect=o.dropEffect,this.updateCusror(this.dropEffect),this.updateImageClass(this.dropEffect)}else this.dropEffect!==A.Forbid&&(this.dropEffect=A.None,this.updateCusror(this.dropEffect),this.updateImageClass(this.dropEffect))},t.prototype.dragLeaveEvent=function(t){var e=this.containerDescriptors[this.containerDescriptorIndex],n={element:e.element,scopes:e.scopes,data:e.data};if(n.scopes.indexOf(this.draggableItem.scope)>=0){var o=new O(this.draggableItem,this.dragImage,t);o.dropEffect=A.None,e.onDragLeave&&e.onDragLeave(n,o),this.dropEffect=o.dropEffect,this.updateCusror(this.dropEffect),this.updateImageClass(this.dropEffect)}},t.prototype.detectDragEnterEvent=function(t,e){var n=y(t),o=new L(e);return!(o.y<n.y||o.y>n.y+t.offsetHeight)&&!(o.x<n.x||o.x>n.x+t.offsetWidth)},t.prototype.detectDragLeaveEvent=function(t,e){var n=y(t),o=new L(e);return!(o.y>n.y&&o.y<n.y+t.offsetHeight&&o.x>n.x&&o.x<n.x+t.offsetWidth)},t}(),F=new R;!function(t){t[t.Always=0]="Always",t[t.Once=1]="Once",t[t.Never=2]="Never"}(P||(P={}));var q,Q="keg",N=/{0:(.*?)}/g;!function(t){t[t.STRING=1]="STRING",t[t.NUMBER=2]="NUMBER",t[t.DATETIME=3]="DATETIME",t[t.BOOL=4]="BOOL"}(q||(q={}));var j,H=function(t,e,n,o){var i=t?t.toString().replace(/\n/g,"↵ "):"";n.innerText=i,n.title=i,e.align==j.NONE&&n.classList.add("".concat(Q,"-cell-value-align-left"))},W=function(t,e,n,i){var r=(t||"").toString();"number"==typeof t&&(r=e.dataColumn&&e.dataColumn.displayFormat&&N.test(e.dataColumn.displayFormat)?e.dataColumn.displayFormat.replace(N,(function(e,n){return o.i18n.numberToStr(t,n)})):t.toLocaleString()),n.innerText=r,n.title=r,e.align==j.NONE&&n.classList.add("".concat(Q,"-cell-value-align-right"))},G=function(t,e,n,i){var r="[object Date]"===Object.prototype.toString.call(t),s=(t||"").toString();if(r)if(e.dataColumn&&e.dataColumn.displayFormat&&N.test(e.dataColumn.displayFormat))s=e.dataColumn.displayFormat.replace(N,(function(n,i){return o.i18n.dateTimeToStr(t,e.type,i)}));else{var a=o.i18n.getCurrentLocale(),l={hour:"numeric",minute:"numeric",second:"numeric"};switch(e.type){case o.DataType.Date:s=t.toLocaleDateString(a);break;case o.DataType.Time:s=t.toLocaleTimeString(a,l);break;case o.DataType.DateTime:s="".concat(t.toLocaleDateString(a)," ").concat(t.toLocaleTimeString(a,l))}}n.innerText=s,n.title=s,e.align==j.NONE&&n.classList.add("".concat(Q,"-cell-value-align-right"))},z=function(t,e,n,i){if(e.dataColumn&&e.dataColumn.displayFormat&&N.test(e.dataColumn.displayFormat)){var r=e.dataColumn.displayFormat.replace(N,(function(e,n){return o.i18n.booleanToStr(t,n)}));return H(r,e,n)}n.classList.add("".concat(Q,"-cell-value-bool")),n.classList.add("".concat(Q,"-").concat(t?"cell-value-true":"cell-value-false"))},V=function(){function t(t){this.renderers={},this.defaultRenderers={},this.registerRenderer("StringDefault",H),this.setDefaultRenderer(q.STRING,H),this.registerRenderer("NumberDefault",W),this.setDefaultRenderer(q.NUMBER,W),this.registerRenderer("DateTimeDefault",G),this.setDefaultRenderer(q.DATETIME,G),this.registerRenderer("BoolDefault",z),this.setDefaultRenderer(q.BOOL,z)}return t.prototype.getDefaultRenderer=function(t){var e=this.getCellType(t);return this.defaultRenderers[q[e]]},t.prototype.getDefaultRendererByType=function(t){return this.defaultRenderers[q[t]]},t.prototype.setDefaultRenderer=function(t,e){e&&(this.defaultRenderers[q[t]]=e)},t.prototype.getRenderer=function(t){return this.renderers[t]},t.prototype.registerRenderer=function(t,e){this.renderers[t]=e},t.prototype.getCellType=function(t){switch(t){case o.DataType.Autoinc:case o.DataType.Byte:case o.DataType.Word:case o.DataType.Currency:case o.DataType.Float:case o.DataType.Int32:case o.DataType.Int64:return q.NUMBER;case o.DataType.Date:case o.DataType.DateTime:case o.DataType.Time:return q.DATETIME;case o.DataType.Bool:return q.BOOL;default:return q.STRING}},t}();!function(t){t[t.NONE=1]="NONE",t[t.LEFT=2]="LEFT",t[t.CENTER=3]="CENTER",t[t.RIGHT=4]="RIGHT"}(j||(j={}));var U,Y=function(){function t(t,e,n){void 0===n&&(n=!1),this._label=null,this._description=null,this.align=j.NONE,this.isVisible=!0,this.isRowNum=!1,this.dataColumn=t,this.grid=e;var i=e.options.columnWidths||{};t?(t.style.alignment&&(this.align=function(t){switch(t){case o.ColumnAlignment.Left:return j.LEFT;case o.ColumnAlignment.Center:return j.CENTER;case o.ColumnAlignment.Right:return j.RIGHT;default:return j.NONE}}(t.style.alignment)),this.width=i&&i[this.type]?i[this.type].default:250,this.cellRenderer=this.grid.cellRendererStore.getDefaultRenderer(t.type),this._description=t.description):n&&(this.isRowNum=!0,this.width=i&&i.rowNumColumn?i.rowNumColumn.default:60,this._label="",this.cellRenderer=this.grid.cellRendererStore.getDefaultRendererByType(q.NUMBER)),e&&e.options&&e.options.onGetCellRenderer&&(this.cellRenderer=e.options.onGetCellRenderer(this,this.cellRenderer)||this.cellRenderer)}return Object.defineProperty(t.prototype,"label",{get:function(){return this._label?this._label:this.isRowNum?"":this.dataColumn.label},set:function(t){this._label=this.label},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"description",{get:function(){return this._description},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"type",{get:function(){return this.dataColumn?this.dataColumn.type:null},enumerable:!1,configurable:!0}),t}(),J=function(){function t(t,e){this.items=[],this.grid=e,this.sync(t)}return t.prototype.sync=function(t,e){void 0===e&&(e=!0),this.clear();var n=new Y(null,this.grid,!0);if(this.add(n),e||(n.isVisible=!1),t)for(var o=0,i=t.getItems();o<i.length;o++){var r=i[o],s=new Y(r,this.grid);this.grid.options.onSyncGridColumn&&this.grid.options.onSyncGridColumn(s),this.add(s)}},Object.defineProperty(t.prototype,"count",{get:function(){return this.items.length},enumerable:!1,configurable:!0}),t.prototype.add=function(t){var e=this.items.length;return this.items.push(t),e},t.prototype.put=function(t,e){t>=0&&t<this.items.length&&(this.items[t]=e)},t.prototype.move=function(t,e){var n=this.items.indexOf(t);n>=0&&n!=e&&o.utils.moveArrayItem(this.items,n,e)},t.prototype.get=function(t){return t>=0&&t<this.items.length?this.items[t]:null},t.prototype.getItems=function(){return this.items},t.prototype.removeAt=function(t){this.get(t);this.items.splice(t,1)},t.prototype.clear=function(){this.items=[]},t}(),K=n(946),X=function(){return X=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},X.apply(this,arguments)},$=function(t,e,n){if(n||2===arguments.length)for(var o,i=0,r=e.length;i<r;i++)!o&&i in e||(o||(o=Array.prototype.slice.call(e,0,i)),o[i]=e[i]);return t.concat(o||Array.prototype.slice.call(e))},Z=function(){function t(t){if(this.cssPrefix="keg",this.pagination={page:1,pageSize:30,total:0},this.paginationOptions={maxButtonCount:10,useBootstrap:!1},this.defaultDataGridOptions={slot:null,dataTable:null,fixHeightOnFirstRender:!1,syncGridColumns:!0,useRowNumeration:!0,allowDragDrop:!1,aggregates:{settings:null,calculator:null},paging:{enabled:!0,pageSize:30,pageSizeItems:[20,30,50,100,200]},columnWidths:{autoResize:P.Always,stringColumns:{min:100,max:500,default:250},numberColumns:{min:60,default:120},boolColumns:{min:50,default:80},dateColumns:{min:80,default:200},otherColumns:{min:100,max:500,default:250},rowNumColumn:{min:40,default:60}},showPlusButton:!1,viewportRowsCount:null,showActiveRow:!0},this.rowsOnPagePromise=null,this.containerInitialHeight=0,this.firstRender=!0,this.prevRowTotals=null,this.landingIndex=-1,this.landingSlot=B("div").addClass("".concat(this.cssPrefix,"-col-landing-slot")).addChildElement(B("div").toDOM()).toDOM(),this._activeRowIndex=-1,t&&t.paging&&(t.paging=o.utils.assign(this.defaultDataGridOptions.paging,t.paging)),this.options=this.mergeOptions(t),this.processColumnWidthsOptions(),!this.options.slot)throw Error('"slot" parameter is required to initialize EasyDataGrid');if(!this.options.dataTable)throw Error('"dataTable" parameter is required to initialize EasyDataGrid');this.dataTable=t.dataTable,this.eventEmitter=new o.EventEmitter(this),this.cellRendererStore=new V(t),this.columns=new J(this.dataTable.columns,this),this.setSlot(this.options.slot),this.init(this.options)}return t.prototype.mergeOptions=function(t){var e=o.utils.assignDeep({},this.defaultDataGridOptions.columnWidths,t.columnWidths),n=o.utils.assignDeep({},this.defaultDataGridOptions.paging,t.paging),i=o.utils.assign({},this.defaultDataGridOptions,t);return i.columnWidths=e,i.paging=n,i},t.prototype.processColumnWidthsOptions=function(){var t=this.options.columnWidths;if(t){o.utils.getStringDataTypes().forEach((function(e){t[e]=X(X({},t.stringColumns),t[e])})),o.utils.getNumericDataTypes().forEach((function(e){t[e]=X(X({},t.numberColumns),t[e])})),t[o.DataType.Bool]=X(X({},t.boolColumns),t[o.DataType.Bool]),o.utils.getDateDataTypes().forEach((function(e){t[e]=X(X({},t.dateColumns),t[e])}));var e=$($($($([],o.utils.getStringDataTypes(),!0),o.utils.getNumericDataTypes(),!0),o.utils.getDateDataTypes(),!0),[o.DataType.Bool],!1);o.utils.getAllDataTypes().forEach((function(n){n in e||(t[n]=X(X({},t.otherColumns),t[n]))})),t[o.DataType.Unknown]=t.otherColumns}},t.prototype.setSlot=function(t){if("string"==typeof t){if(t.length)if("#"===t[0])this.slot=document.getElementById(t.substring(1));else{if("."!==t[0])throw Error("Unrecognized slot parameter (Must be id, class or HTMLElement): "+t);var e=document.getElementsByClassName(t.substring(1));e.length&&(this.slot=e[0])}}else this.slot=t},t.prototype.init=function(t){var e=this;t.onInit&&this.addEventListener("init",t.onInit),t.onRowClick&&this.addEventListener("rowClick",t.onRowClick),t.onRowDbClick&&this.addEventListener("rowDbClick",t.onRowDbClick),t.onPlusButtonClick&&this.addEventListener("plusButtonClick",t.onPlusButtonClick),t.onColumnChanged&&this.addEventListener("columnChanged",t.onColumnChanged),t.onColumnDeleted&&this.addEventListener("columnDeleted",t.onColumnDeleted),t.onColumnMoved&&this.addEventListener("columnMoved",t.onColumnMoved),t.onPageChanged&&this.addEventListener("pageChanged",t.onPageChanged),t.onActiveRowChanged&&this.addEventListener("activeRowChanged",t.onActiveRowChanged),this.addEventListener("pageChanged",(function(t){return e.activeRowIndex=-1})),o.utils.assignDeep(this.paginationOptions,t.pagination),this.pagination.pageSize=this.options.paging.pageSize||this.pagination.pageSize,this.options.allowDragDrop&&F.registerDropContainer({element:this.slot,scopes:["gridColumnMove"],onDragEnter:function(t,n){e.slot.classList.add("".concat(b,"-drophover")),e.showLandingSlot(n.pageX,n.pageY)},onDragOver:function(t,n){e.showLandingSlot(n.pageX,n.pageY)},onDragLeave:function(t,n){n.dropEffect=A.Forbid,e.slot.classList.remove("".concat(b,"-drophover")),e.hideLandingSlot()},onDrop:function(t,n){e.dataTable.columns.move(n.data.column,e.landingIndex),e.refresh(),e.fireEvent({type:"columnMoved",columnId:n.data.column.id,newIndex:e.landingIndex})}}),this.refresh(),this.fireEvent("init")},t.prototype.fireEvent=function(t){"string"==typeof t?this.eventEmitter.fire(t):this.eventEmitter.fire(t.type,t)},t.prototype.setData=function(t){this.dataTable=t,this.clear(),this.refresh()},t.prototype.getData=function(){return this.dataTable},t.prototype.getColumns=function(){return this.columns},t.prototype.destroy=function(){this.slot.innerHTML=""},t.prototype.refresh=function(){this.clearDOM(),this.render()},t.prototype.clearDOM=function(){this.slot.innerHTML=""},t.prototype.clear=function(){this.pagination.page=1,this.clearDOM()},t.prototype.render=function(){var t=this;if(this.hasData()||this.options.showPlusButton){this.containerInitialHeight=this.slot.clientHeight,this.rootDiv=document.createElement("div"),this.rootDiv.style.width="100%",this.rootDiv.classList.add("".concat(this.cssPrefix,"-root")),this.columns.sync(this.dataTable.columns,this.options.useRowNumeration),this.renderHeader(),this.rootDiv.appendChild(this.headerDiv),this.renderBody(),this.rootDiv.appendChild(this.bodyDiv),this.renderFooter(),this.rootDiv.appendChild(this.footerDiv);var e=document.createElement("div");e.classList.add("".concat(this.cssPrefix,"-container")),e.appendChild(this.rootDiv),this.slot.appendChild(e);var n=this.options.columnWidths.autoResize!==P.Never;this.rowsOnPagePromise?this.rowsOnPagePromise.then((function(){return t.updateHeight()})).then((function(){t.firstRender=!1,t.rowsOnPagePromise=null})):setTimeout((function(){t.updateHeight().then((function(){t.firstRender=!1,n&&t.resizeColumns()}))}),100)}},t.prototype.updateHeight=function(){var t=this;return new K((function(e){if(t.options.viewportRowsCount){var n=t.bodyCellContainerDiv.firstElementChild,o=(n?n.offsetHeight:36)*t.options.viewportRowsCount;return B(t.bodyViewportDiv).setStyle("height","".concat(o,"px")),void setTimeout((function(){var n=t.bodyViewportDiv.offsetHeight-t.bodyViewportDiv.clientHeight;o+=n,B(t.bodyViewportDiv).setStyle("height","".concat(o,"px")),e()}),100)}t.containerInitialHeight,e()})).then((function(){t.options.fixHeightOnFirstRender&&t.firstRender&&(t.slot.style.height="".concat(t.slot.offsetHeight,"px"))}))},t.prototype.getContainerWidth=function(){return this.columns.getItems().filter((function(t){return t.isVisible})).map((function(t){return t.width})).reduce((function(t,e){return t+e}))},t.prototype.renderHeader=function(){var t=this;this.headerDiv=B("div").addClass("".concat(this.cssPrefix,"-header")).toDOM(),this.headerViewportDiv=B("div",this.headerDiv).addClass("".concat(this.cssPrefix,"-header-viewport")).toDOM(),this.headerCellContainerDiv=B("div",this.headerViewportDiv).addClass("".concat(this.cssPrefix,"-header-cell-container")).toDOM(),this.headerRowDiv=B("div",this.headerCellContainerDiv).addClass("".concat(this.cssPrefix,"-header-row")).toDOM(),this.columns.getItems().forEach((function(e,n){if(e.isVisible){var o=t.renderColumnHeader(e,n);t.headerRowDiv.appendChild(o),e.isRowNum&&B(o).addChildElement(t.renderHeaderButtons())}}));var e=this.getContainerWidth();B(this.headerCellContainerDiv).setStyle("width","".concat(e,"px"))},t.prototype.hasData=function(){return this.dataTable.columns.count>0},t.prototype.renderColumnHeader=function(t,e){var n=this,o=B("div").addClass("".concat(this.cssPrefix,"-header-cell")).data("col-idx","".concat(e)).setStyle("width","".concat(t.width,"px"));t.dataColumn&&o.data("col-id","".concat(t.dataColumn.id));var i=o.toDOM();return B("div",i).addClass("".concat(this.cssPrefix,"-header-cell-resize")),t.isRowNum||B("div",i).addClass("".concat(this.cssPrefix,"-header-cell-label")).text(t.label),t.description&&B("div",i).addClass("question-mark").title(t.description),this.options.allowDragDrop&&F.registerDraggableItem({element:i,scope:"gridColumnMove",data:{column:t},renderer:function(e){e.innerHTML="";var o=document.createElement("div");o.innerText=t.label,e.classList.add("".concat(n.cssPrefix,"-sortable-helper")),e.appendChild(o)},onDragStart:function(t){t.dropEffect=A.Allow}}),i},t.prototype.renderBody=function(){var t=this;this.bodyDiv=B("div").addClass("".concat(this.cssPrefix,"-body")).toDOM(),this.bodyViewportDiv=B("div",this.bodyDiv).addClass("".concat(this.cssPrefix,"-body-viewport")).attr("tabIndex","0").toDOM(),this.bodyCellContainerDiv=B("div",this.bodyViewportDiv).addClass("".concat(this.cssPrefix,"-cell-container")).toDOM();var e=this.canShowAggregates();this.dataTable&&(this.showProgress(),this.rowsOnPagePromise=this.getRowsToRender().then((function(n){t.pagination.total=t.dataTable.getTotal(),t.hideProgress(),t.bodyCellContainerDiv.innerHTML="",t.prevRowTotals=null;var i=0;if(n.length){var r=e?t.options.aggregates.settings.getGroups():[];i=n.length<t.pagination.pageSize?n.length:t.pagination.pageSize,n.forEach((function(n,o){if(e&&t.updateTotalsState(r,n),o<i){var s=t.renderRow(n,o);t.bodyCellContainerDiv.appendChild(s)}}));var s=t.options.aggregates&&t.options.aggregates.showGrandTotalsOnEachPage;if(e&&(t.isLastPage()||s)){var a=new o.DataRow(t.dataTable.columns,new Array(t.dataTable.columns.count));t.updateTotalsState(r,a,!0)}}if(t.options.columnWidths.autoResize!==P.Never)t.resizeColumns();else{var l=t.getContainerWidth();B(t.bodyCellContainerDiv).setStyle("width","".concat(l,"px"))}return i})).catch((function(t){return console.error(t),0}))),this.bodyViewportDiv.addEventListener("scroll",(function(e){B(t.headerViewportDiv).setStyle("margin-left","-".concat(t.bodyViewportDiv.scrollLeft,"px"))})),this.bodyViewportDiv.addEventListener("keydown",this.onViewportKeydown.bind(this))},t.prototype.isLastPage=function(){return this.dataTable.elasticChunks?this.dataTable.totalIsKnown()&&this.pagination.page*this.pagination.pageSize>=this.pagination.total:this.pagination.page*this.pagination.pageSize>=this.pagination.total},t.prototype.canShowAggregates=function(){if(!this.options||!this.options.aggregates||!this.options.aggregates.settings)return!1;var t=this.options.aggregates.settings;return(t.hasAggregates()||t.hasRecordCount())&&(t.hasGroups()||t.hasGrandTotals())},t.prototype.updateTotalsState=function(t,e,n){void 0===n&&(n=!1);var i=this.options.aggregates.settings;if(this.prevRowTotals&&i.hasGroups()){for(var r=-1,s=1;s<=t.length;s++){for(var a=0,l=t[s-1].columns;a<l.length;a++){var u=l[a];if(!i.compareValues(this.prevRowTotals.getValue(u),e.getValue(u))){r=s;break}}if(-1!==r)break}if(-1!==r)for(s=t.length;s>=r;s--){var c=new o.DataRow(this.dataTable.columns,this.prevRowTotals.toArray()),d=this.renderTotalsRow(s,c);this.bodyCellContainerDiv.appendChild(d)}}if(n&&i.hasGrandTotals()&&i.hasAggregates()){d=this.renderTotalsRow(0,e);this.bodyCellContainerDiv.appendChild(d)}this.prevRowTotals=e},t.prototype.applyGroupColumnTemplate=function(t,e,n){var o=t.replace(/{{\s*GroupValue\s*}}/g,e?"".concat(e):"-");return o=o.replace(/{{\s*GroupCount\s*}}/g,n?"".concat(n):"-")},t.prototype.renderTotalsRow=function(t,e){var n=this,o=this.options.aggregates.settings,i=t>0?o.getGroups()[t-1]:{columns:[],aggregates:o.getAggregates()},r=B("div").addClass("".concat(this.cssPrefix,"-row")).addClass("".concat(this.cssPrefix,"-row-totals")).addClass("".concat(this.cssPrefix,"-totals-lv").concat(t)).data("totals-level","".concat(t)).attr("tabindex","-1").toDOM();this.columns.getItems().forEach((function(t,o){if(t.isVisible){var s="",a=t.isRowNum?-1:n.dataTable.columns.getIndex(t.dataColumn.id);!t.isRowNum&&t.dataColumn&&i.columns.indexOf(t.dataColumn.id)>=0&&(s=e.getValue(a)),a==n.dataTable.columns.count-1&&(s=". . . . . ."),r.appendChild(n.renderCell(t,o,s,r))}}));var s=this.options.aggregates.calculator.getAggrContainer(),a=o.getAggregates().map((function(t){return t.colId})),l=o.buildGroupKey(i,e);return s.getAggregateData(t,l).then((function(s){for(var l=0,u=a;l<u.length;l++){var c=u[l];e.setValue(c,s[c])}r.innerHTML="",n.columns.getItems().forEach((function(l,u){if(l.isVisible){var c="",d=l.isRowNum?-1:n.dataTable.columns.getIndex(l.dataColumn.id);if(!l.isRowNum){var h=!1;if(l.dataColumn){var p=i.columns.indexOf(l.dataColumn.id),f=a.indexOf(l.dataColumn.id);h=t>0?p==i.columns.length-1:0==d,(p>=0||f>=0)&&(c=e.getValue(d))}var g="";if(t>0&&!(g=l.dataColumn.groupFooterColumnTemplate)&&o.hasRecordCount()&&h&&(g="{{GroupValue}} ({{GroupCount}})"),g)c=n.renderCell(l,u,c,r).firstChild.innerHTML,c=n.applyGroupColumnTemplate(g,c,s[o.COUNT_FIELD_NAME])}var y=n.renderCell(l,u,c,r);r.appendChild(y)}}))})).catch((function(t){return console.error(t)})),r},t.prototype.onViewportKeydown=function(t){if(this.options.showActiveRow){var e=this.bodyCellContainerDiv.querySelectorAll(".".concat(this.cssPrefix,"-row")).length,n=void 0;switch(t.key){case"ArrowLeft":case"ArrowRight":break;case"ArrowUp":t.preventDefault(),n=this.activeRowIndex<0||this.activeRowIndex>=e?e-1:this.activeRowIndex-1,this.activeRowIndex=n>=0?n:0;break;case"ArrowDown":t.preventDefault(),n=this.activeRowIndex<0||this.activeRowIndex>=e?0:this.activeRowIndex+1,this.activeRowIndex=n<e?n:e-1}}},t.prototype.ensureRowVisibility=function(t){var e="number"==typeof t?this.getDataRow(t):t;if(e){var n=e.getBoundingClientRect(),o=this.bodyViewportDiv.getBoundingClientRect(),i=n.top-o.top,r=n.bottom-o.top,s=this.bodyViewportDiv.clientHeight,a=window.innerHeight||document.documentElement.clientHeight;if(i>0&&r<=s&&n.top>0&&n.bottom<a)return;i<0?this.bodyViewportDiv.scrollTop=this.bodyViewportDiv.scrollTop+i:r>s&&(this.bodyViewportDiv.scrollTop=this.bodyViewportDiv.scrollTop+r-s),(n=e.getBoundingClientRect()).top<0?document.documentElement.scrollTop=document.documentElement.scrollTop+n.top:n.bottom>a&&(document.documentElement.scrollTop=document.documentElement.scrollTop+n.bottom-a)}},t.prototype.getRowsToRender=function(){return!1===this.options.paging.enabled?K.resolve(this.dataTable.getCachedRows()):this.dataTable.getRows({offset:(this.pagination.page-1)*this.pagination.pageSize,limit:this.pagination.pageSize+1}).catch((function(t){return console.error(t),[]}))},t.prototype.renderFooter=function(){var t=this;this.footerDiv=B("div").addClass("".concat(this.cssPrefix,"-footer")).toDOM(),this.rowsOnPagePromise&&this.rowsOnPagePromise.then((function(e){t.footerDiv.innerHTML="",t.footerPaginateDiv=t.renderPageNavigator(),t.footerDiv.appendChild(t.footerPaginateDiv);var n=t.renderPageInfoBlock(e);t.footerDiv.appendChild(n)}))},t.prototype.renderPageInfoBlock=function(t){var e=B("div").addClass("".concat(this.cssPrefix,"-page-info")).toDOM();if(this.dataTable.getTotal()>0){var n=t?(this.pagination.page-1)*this.pagination.pageSize+1:0,i=t?n+t-1:0,r=this.dataTable.getTotal().toString();if(this.dataTable.elasticChunks)this.dataTable.getCachedCount()!==this.dataTable.getTotal()&&(r="?");e.innerHTML=o.i18n.getText("GridPageInfo").replace("{FirstPageRecordNum}","<span>".concat(n.toString(),"</span>")).replace("{LastPageRecordNum}","<span>".concat(i.toString(),"</span>")).replace("{Total}","<span>".concat(r,"</span>"))}return e},t.prototype.showProgress=function(){},t.prototype.hideProgress=function(){},t.prototype.getLocalIndexByGlobal=function(t){return this.pagination?t%this.pagination.pageSize:t},t.prototype.getGlobalIndexByLocal=function(t){return this.pagination?(this.pagination.page-1)*this.pagination.pageSize+t:t},t.prototype.renderRow=function(t,e){var n=this,o=this.getGlobalIndexByLocal(e),i=B("div").addClass("".concat(this.cssPrefix,"-row")).addClass("".concat(this.cssPrefix,"-row-").concat(e%2==1?"odd":"even")).data("row-idx","".concat(o)).attr("tabindex","-1").on("click",(function(o){n.activeRowIndex=e,n.fireEvent({type:"rowClick",row:t,rowIndex:e,sourceEvent:o})})).on("dblclick",(function(o){n.fireEvent({type:"rowDbClick",row:t,rowIndex:e,sourceEvent:o})}));0==e&&i.addClass("".concat(this.cssPrefix,"-row-first"));var r=i.toDOM();return this.options.showActiveRow&&e==this.activeRowIndex&&i.addClass("".concat(this.cssPrefix,"-row-active")),this.columns.getItems().forEach((function(e,i){if(e.isVisible){var s=e.isRowNum?-1:n.dataTable.columns.getIndex(e.dataColumn.id),a=e.isRowNum?o+1:t.getValue(s);r.appendChild(n.renderCell(e,i,a,r))}})),r},t.prototype.renderCell=function(t,e,n,o){var i=B("div").addClass("".concat(this.cssPrefix,"-cell")).data("col-idx","".concat(e)).attr("tabindex","-1").setStyle("width","".concat(t.width,"px"));t.align==j.LEFT?i.addClass("".concat(this.cssPrefix,"-cell-align-left")):t.align==j.RIGHT?i.addClass("".concat(this.cssPrefix,"-cell-align-right")):t.align==j.CENTER&&i.addClass("".concat(this.cssPrefix,"-cell-align-center"));var r=i.toDOM(),s=r.appendChild(B("div").addClass("".concat(this.cssPrefix,"-cell-value")).toDOM());return t.cellRenderer&&t.cellRenderer(n,t,s,o),r},t.prototype.setPage=function(t){this.pagination.page=t,this.fireEvent({type:"pageChanged",page:t}),this.refresh(),this.bodyViewportDiv.focus()},t.prototype.renderPageNavigator=function(){var t=this,e=document.createElement("div");e.className="".concat(this.cssPrefix,"-pagination-wrapper");var n=this.dataTable.getTotal();if(this.options.paging&&this.options.paging.enabled&&n>0){var i=this.paginationOptions.useBootstrap?"":"".concat(this.cssPrefix,"-"),r=function(e){var n=e.target;if(n.hasAttribute("data-page")){var o=parseInt(n.getAttribute("data-page"));t.setPage(o)}},s=function(e,n,o,s,a){var l=document.createElement("li");if(l.className="".concat(i,"page-item"),!s){a&&(l.className+=" active");var u=document.createElement("a");return u.setAttribute("href","javascript:void(0)"),u.innerHTML=n||e.toString(),u.setAttribute("data-page","".concat(e)),u.className="".concat(i,"page-link"),u.addEventListener("click",r),l.appendChild(u),l}var c=document.createElement("span");if(c.setAttribute("aria-hidden","true"),c.className="".concat(i,"page-link"),o)l.className+=" disabled";else{if(t.paginationOptions.useBootstrap)(c=document.createElement("a")).setAttribute("href","javascript:void(0)"),c.setAttribute("data-page","".concat(e));else{var d=document.createElement("a");d.setAttribute("href","javascript:void(0)"),d.setAttribute("data-page","".concat(e)),c=d}c.className="".concat(i,"page-link"),c.addEventListener("click",r)}return c.innerHTML=n,l.appendChild(c),l};if(this.dataTable.elasticChunks){var a=this.pagination.page||1;(u=document.createElement("ul")).className="".concat(i,"pagination");var l=s(a-1,"&laquo;",1==a,!0,!1);u.appendChild(l),l=s(a+1,"&raquo;",this.isLastPage(),!0,!1),u.appendChild(l),e.appendChild(u)}else if(this.pagination.total>this.pagination.pageSize){a=this.pagination.page||1;var u,c=Math.ceil(this.pagination.total/this.pagination.pageSize)||1,d=this.paginationOptions.maxButtonCount||10,h=a-1,p=h-h%d+1,f=p+d-1;f>c&&(f=c),(u=document.createElement("ul")).className="".concat(i,"pagination");l=s(p-1,"&laquo;",1==p,!0,!1);u.appendChild(l);for(var g=p;g<=f;g++)l=s(g,g.toString(),!1,!1,g==a),u.appendChild(l);l=s(f+1,"&raquo;",f==c,!0,!1),u.appendChild(l),e.appendChild(u)}if(this.options.paging.allowPageSizeChange){var y=document.createElement("div");y.className="".concat(this.cssPrefix,"-page-sizes");var m=document.createElement("div");m.className="kfrm-select ".concat(this.cssPrefix,"-page-sizes-select"),y.appendChild(m);var v=document.createElement("select"),C=this.options.paging.pageSizeItems||[],b=new Set(C);b.add(this.options.paging.pageSize||20),Array.from(b).forEach((function(t){var e=document.createElement("option");e.value=t.toString(),e.text=t.toString(),v.appendChild(e)})),v.value=(this.pagination.pageSize||20).toString(),m.appendChild(v),v.addEventListener("change",(function(e){var n=parseInt(e.target.value);t.pagination.pageSize=n,t.pagination.page=1,t.refresh()}));var x=document.createElement("div");x.className="".concat(this.cssPrefix,"-page-sizes-label"),y.appendChild(x);var w=document.createElement("span");w.innerText=o.i18n.getText("GridItemsPerPage"),x.appendChild(w),e.appendChild(y)}}return e},t.prototype.addEventListener=function(t,e){return this.eventEmitter.subscribe(t,(function(t){return e(t.data)}))},t.prototype.removeEventListener=function(t,e){this.eventEmitter.unsubscribe(t,e)},t.prototype.renderHeaderButtons=function(){var t=this;return this.options.showPlusButton?B("div").addClass("".concat(this.cssPrefix,"-header-btn-plus")).title(this.options.plusButtonTitle||"Add").addChild("a",(function(e){return e.attr("href","javascript:void(0)").on("click",(function(e){e.preventDefault(),t.fireEvent({type:"plusButtonClick",sourceEvent:e})}))})).toDOM():B("span").addText("#").toDOM()},t.prototype.showLandingSlot=function(t,e){for(var n=this.headerRowDiv.querySelectorAll("[class*=".concat(this.cssPrefix,"-table-col]")),o=[],i=1;i<n.length;i++){var r=n[i];"none"!==r.style.display&&o.push(r)}if(0===o.length)return this.landingIndex=0,void this.headerRowDiv.appendChild(this.landingSlot);var s=y(this.landingSlot);if(!(t>=s.x&&t<=s.x+this.landingSlot.offsetWidth)){for(var a=this.landingIndex,l=0,u=o;l<u.length;l++){var c=u[l],d=y(c),h=c.offsetWidth;t>d.x&&t<d.x+h&&(a=parseInt(c.getAttribute("data-col-idx"))-1)}a!=this.landingIndex&&(this.landingIndex=a,this.landingIndex<o.length?this.headerRowDiv.insertBefore(this.landingSlot,o[this.landingIndex]):this.headerRowDiv.appendChild(this.landingSlot))}},t.prototype.hideLandingSlot=function(){var t=this;this.landingIndex=-1,setTimeout((function(){t.landingSlot.parentElement&&t.landingSlot.parentElement.removeChild(t.landingSlot)}),10)},Object.defineProperty(t.prototype,"activeRowIndex",{get:function(){return this._activeRowIndex},set:function(t){if(t!==this._activeRowIndex){var e=this._activeRowIndex;this._activeRowIndex=t,this.updateActiveRow(),this.fireEvent({type:"activeRowChanged",oldValue:e,newValue:this.activeRowIndex,rowIndex:this.getGlobalIndexByLocal(this.activeRowIndex)})}},enumerable:!1,configurable:!0}),t.prototype.updateActiveRow=function(){var t=this;if(this.options.showActiveRow){this.bodyCellContainerDiv.querySelectorAll("[class*=".concat(this.cssPrefix,"-row-active]")).forEach((function(e){e.classList.remove("".concat(t.cssPrefix,"-row-active"))}));var e=this.getActiveRow();e&&(e.classList.add("".concat(this.cssPrefix,"-row-active")),this.ensureRowVisibility(this.activeRowIndex))}},t.prototype.getActiveRow=function(){return this.getDataRow(this.activeRowIndex)},t.prototype.getDataRow=function(t){var e=Array.from(this.bodyCellContainerDiv.querySelectorAll(".".concat(this.cssPrefix,"-row:not(.").concat(this.cssPrefix,"-row-totals)")));return t>=0&&t<e.length?e[t]:null},t.prototype.focus=function(){this.bodyViewportDiv.focus()},t.prototype.resizeColumns=function(){if(this.options.columnWidths.autoResize!==P.Never){var t=this.bodyCellContainerDiv.style.width;this.bodyCellContainerDiv.style.visibility="hidden",this.bodyCellContainerDiv.style.width="1px",this.headerRowDiv.style.width="1px";for(var e=0,n=this.columns.getItems(),i=this.headerCellContainerDiv.querySelectorAll(".".concat(this.cssPrefix,"-header-cell")),r=0,s=function(t){var s=n[t];if(!s.isVisible)return"continue";var l=a.options.columnWidths.autoResize!==P.Always&&s.dataColumn?s.dataColumn.calculatedWidth:0,u=a.bodyCellContainerDiv.querySelectorAll(".".concat(a.cssPrefix,'-cell[data-col-idx="').concat(t,'"] > .').concat(a.cssPrefix,"-cell-value")),c=0;if(l>0)e+=l,s.width=l,u.forEach((function(t){t.parentElement.style.width="".concat(l,"px")})),i[r].style.width="".concat(l,"px");else if(0==u.length&&(i[r].style.width=null,i[r].style.whiteSpace="nowrap"),c=i[r].offsetWidth,u.length>0){u.forEach((function(t){t.parentElement.style.width=null;var e=t.parentElement.offsetWidth;e>c&&(c=e)})),c+=3;var d=s.isRowNum?a.options.columnWidths.rowNumColumn.max||500:a.options.columnWidths[s.dataColumn.type].max||2e3,h=s.isRowNum?a.options.columnWidths.rowNumColumn.min||0:a.options.columnWidths[s.dataColumn.type].min||20;c>d&&(c=d),c<h&&(c=h),o.utils.isNumericType(s.type)&&(c=Math.round(1.3*c)),e+=c,s.width=c,u.forEach((function(t){t.parentElement.style.width="".concat(c,"px")})),i[r].style.width="".concat(c,"px"),s.dataColumn&&(s.dataColumn.calculatedWidth=c)}else e+=c;r++},a=this,l=0;l<this.columns.count;l++)s(l);e>0?(this.bodyCellContainerDiv.style.width="".concat(e,"px"),this.headerCellContainerDiv.style.width="".concat(e,"px")):(this.bodyCellContainerDiv.style.width=t,this.headerCellContainerDiv.style.width=t),this.bodyCellContainerDiv.style.visibility=null,this.headerRowDiv.removeAttribute("style")}},t}(),tt=function(){function t(t,e){this.slot=t,this.options=e||{},this.options.yearRange||(this.options.yearRange="c-10:c+10")}return Object.defineProperty(t.prototype,"cssPrefix",{get:function(){return"kdtp-cal"},enumerable:!1,configurable:!0}),t.prototype.setDate=function(t){this.currentDate=new Date(t)},t.prototype.getDate=function(){return new Date(this.currentDate)},t.prototype.dateChanged=function(t){this.options.onDateChanged&&this.options.onDateChanged(this.currentDate,t)},t}(),et=function(){function t(t){this.calendar=null,this.timePicker=null,this.options=t,this.render()}return Object.defineProperty(t.prototype,"cssPrefix",{get:function(){return"kdtp"},enumerable:!1,configurable:!0}),t.prototype.setDateTime=function(t){this.currentDateTime=new Date(t),this.calendar&&this.calendar.setDate(this.currentDateTime),this.timePicker&&this.timePicker.setTime(this.currentDateTime)},t.prototype.getDateTime=function(){return new Date(this.currentDateTime)},t.prototype.render=function(){var t=this;this.options.showCalendar&&(this.calendar=this.createCalendar({yearRange:this.options.yearRange,showDateTimeInput:this.options.showDateTimeInput,timePickerIsUsed:this.options.showTimePicker,oneClickDateSelection:this.options.oneClickDateSelection,onDateChanged:function(e,n){t.currentDateTime=e,t.timePicker&&t.timePicker.setTime(t.currentDateTime),t.options.showTimePicker&&t.dateTimeChanged(),n&&t.apply(t.currentDateTime)}}),this.calendar&&this.calendar.render()),this.options.showTimePicker&&(this.timePicker=this.createTimePicker({onTimeChanged:function(e){t.currentDateTime.setHours(e.getHours()),t.currentDateTime.setMinutes(e.getMinutes()),t.calendar&&t.calendar.setDate(t.currentDateTime),t.dateTimeChanged()}}),this.timePicker&&this.timePicker.render()),this.setDateTime(new Date)},t.prototype.createCalendar=function(t){return null},t.prototype.createTimePicker=function(t){return null},t.prototype.show=function(t){this.options.beforeShow&&this.options.beforeShow();var e=y(t||document.body);this.slot.style.top=e.y+t.clientHeight+"px",this.slot.style.left=e.x+"px"},t.prototype.apply=function(t){this.options.onApply&&this.options.onApply(t),this.destroy()},t.prototype.cancel=function(){this.options.onCancel&&this.options.onCancel(),this.destroy()},t.prototype.destroy=function(){this.slot&&this.slot.parentElement&&this.slot.parentElement.removeChild(this.slot)},t.prototype.dateTimeChanged=function(){this.options.onDateTimeChanged&&this.options.onDateTimeChanged(this.currentDateTime)},t}(),nt=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),ot=function(t){function e(e,n){var i=t.call(this,e,n)||this;i.daysOfWeek=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],i.months=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],i.calendarBody=null,i.isManualInputChanging=!1;for(var r=0;r<i.daysOfWeek.length;r++)i.daysOfWeek[r]=o.i18n.getShortWeekDayName(r+1);for(r=0;r<i.months.length;r++)i.months[r]=o.i18n.getLongMonthName(r+1);return i}return nt(e,t),e.prototype.setDate=function(e){t.prototype.setDate.call(this,e),this.selectedMonth=this.currentDate.getMonth(),this.selectedYear=this.currentDate.getFullYear(),this.rerenderMonth()},e.prototype.render=function(){var t=this,e=B("div",this.slot).addClass("".concat(this.cssPrefix,"-header"));this.options.showDateTimeInput?e.addChildElement(this.renderManualDateInput()):e.addChild("span",(function(e){return t.headerTextElem=e.toDOM()})),B(this.slot).addChildElement(this.renderCalendarButtons()),this.calendarBody=B("div",this.slot).addClass("".concat(this.cssPrefix,"-body")).toDOM()},e.prototype.getInputDateFormat=function(){var t=o.i18n.getLocaleSettings();return this.options.timePickerIsUsed?"".concat(t.editDateFormat," ").concat(t.editTimeFormat):t.editDateFormat},e.prototype.renderManualDateInput=function(){var t=this,e=this.getInputDateFormat(),n=B("input").attr("placeholder",e).addClass("".concat(this.cssPrefix,"-header-input"));return n.mask(e.replace("yyyy","9999").replace("MM","99").replace("dd","99").replace("HH","99").replace("mm","99").replace("ss","99")).on("input",(function(i){n.removeClass("error");try{t.isManualInputChanging=!0;var r=o.utils.strToDateTime(t.manualInputElem.value,e);t.currentDate=r,t.jump(t.currentDate.getFullYear(),t.currentDate.getMonth()),t.dateChanged(!1)}catch(t){n.addClass("error")}finally{t.isManualInputChanging=!1}})).on("keydown",(function(e){13===e.keyCode&&(e.preventDefault(),e.stopPropagation(),t.manualInputElem.className.indexOf("error")<0&&!t.isManualInputChanging&&t.dateChanged(!0))})).on("focus",(function(){setTimeout((function(){t.manualInputElem.selectionStart=0,t.manualInputElem.selectionEnd=0}),50)})),this.manualInputElem=n.toDOM(),this.manualInputElem},e.prototype.updateDisplayedDateValue=function(){if(this.manualInputElem){if(!this.isManualInputChanging){var t=this.getInputDateFormat();this.manualInputElem.value=o.utils.dateTimeToStr(this.currentDate,t),this.manualInputElem.focus()}}else if(this.headerTextElem){var e=o.i18n.getCurrentLocale();this.headerTextElem.innerText=this.currentDate.toLocaleString("en"==e?void 0:e,{year:"numeric",month:"long",day:"numeric"})}},e.prototype.renderCalendarButtons=function(){var t=this;return B("nav").addClass("".concat(this.cssPrefix,"-nav")).addChild("div",(function(e){return e.addClass("".concat(t.cssPrefix,"-nav-prev")).on("click",(function(){t.prev()})).addChild("span",(function(t){return t.html("&lsaquo;")}))})).addChild("div",(function(e){return e.addClass("".concat(t.cssPrefix,"-nav-selectors")).addChild("div",(function(e){return e.addClass("".concat(t.cssPrefix,"-nav-month")).addChild("select",(function(e){e.on("change",(function(){t.jump(t.selectedYear,parseInt(t.selectMonthElem.value))}));for(var n=function(n){e.addChild("option",(function(e){return e.attr("value",n.toString()).text(t.months[n])}))},o=0;o<t.months.length;o++)n(o);t.selectMonthElem=e.toDOM()}))})).addChild("div",(function(e){return e.addClass("".concat(t.cssPrefix,"-nav-year")).addChild("select",(function(e){return t.selectYearElem=e.on("change",(function(){t.jump(parseInt(t.selectYearElem.value),t.selectedMonth)})).toDOM()}))}))})).addChild("div",(function(e){return e.addClass("".concat(t.cssPrefix,"-nav-next")).on("click",(function(){t.next()})).addChild("span",(function(t){return t.html("&rsaquo;")}))})).toDOM()},e.prototype.prev=function(){this.selectedYear=0===this.selectedMonth?this.selectedYear-1:this.selectedYear,this.selectedMonth=0===this.selectedMonth?11:this.selectedMonth-1,this.rerenderMonth()},e.prototype.next=function(){this.selectedYear=11===this.selectedMonth?this.selectedYear+1:this.selectedYear,this.selectedMonth=(this.selectedMonth+1)%12,this.rerenderMonth()},e.prototype.rerenderSelectYear=function(){var t=/c-(\d*):c\+(\d*)/g.exec(this.options.yearRange),e=0,n=1;null!==t&&(e=parseInt(t[1]),n=parseInt(t[2])),this.selectYearElem.innerHTML="";for(var o=0;o<=e+n;o++){var i=document.createElement("option"),r=this.selectedYear-e+o;i.value=r.toString(),i.innerText=r.toString(),this.selectYearElem.appendChild(i)}},e.prototype.jump=function(t,e){this.selectedYear=t,this.selectedMonth=e,this.rerenderMonth()},e.prototype.rerenderMonth=function(){var t=this;this.updateDisplayedDateValue(),this.rerenderSelectYear();var e=new Date(this.selectedYear,this.selectedMonth).getDay(),n=new Date(this.selectedYear,this.selectedMonth+1,0).getDate();this.calendarBody.innerHTML="",this.selectYearElem.value=this.selectedYear.toString(),this.selectMonthElem.value=this.selectedMonth.toString(),this.daysOfWeek.forEach((function(e,n){B("div",t.calendarBody).addClass("".concat(t.cssPrefix,"-weekday")).addClass(0==n||6==n?"".concat(t.cssPrefix,"-weekend"):"").text(e)}));for(var o=0;o<e;o++)B("div",this.calendarBody).addClass("".concat(this.cssPrefix,"-day-empty"));for(var i=new Date,r=1;r<=n;r++){var s=B("div",this.calendarBody).addClass("".concat(this.cssPrefix,"-day")).attr("data-date",r.toString()).text(r.toString()).on("click",(function(e){t.currentDate.setFullYear(t.selectedYear),t.currentDate.setMonth(t.selectedMonth),t.currentDate.setDate(parseInt(e.target.getAttribute("data-date"))),t.dateChanged(t.options.oneClickDateSelection)}));r===i.getDate()&&this.selectedYear===i.getFullYear()&&this.selectedMonth===i.getMonth()&&s.addClass("".concat(this.cssPrefix,"-day-current")),r===this.currentDate.getDate()&&this.selectedYear===this.currentDate.getFullYear()&&this.selectedMonth===this.currentDate.getMonth()&&s.addClass("".concat(this.cssPrefix,"-day-selected"));var a=(e+r-1)%7;0!=a&&6!=a||s.addClass("".concat(this.cssPrefix,"-weekend"))}var l=(e+n)%7,u=0==l?0:7-l;for(o=0;o<u;o++)B("div",this.calendarBody).addClass("".concat(this.cssPrefix,"-day-empty"))},e.prototype.dateChanged=function(e){t.prototype.dateChanged.call(this,e),this.rerenderMonth()},e}(tt),it=function(){function t(t,e){this.slot=t,this.options=e||{}}return Object.defineProperty(t.prototype,"cssPrefix",{get:function(){return"kdtp-tp"},enumerable:!1,configurable:!0}),t.prototype.setTime=function(t){this.currentTime=new Date(t)},t.prototype.getTime=function(){return new Date(this.currentTime)},t.prototype.timeChanged=function(){this.options.onTimeChanged&&this.options.onTimeChanged(this.currentTime)},t}(),rt=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),st=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return rt(e,t),e.prototype.setTime=function(e){t.prototype.setTime.call(this,e),this.updateDisplayedTime(),this.hoursInput.valueAsNumber=e.getHours(),this.minutesInput.valueAsNumber=e.getMinutes()},e.prototype.render=function(){var t=this;B("div",this.slot).addClass("".concat(this.cssPrefix,"-time")).addChild("span",(function(e){return t.timeText=e.toDOM()})).toDOM();var e=B("div",this.slot).addClass("".concat(this.cssPrefix,"-sliders"));return e.addChild("div",(function(e){return e.addClass("".concat(t.cssPrefix,"-time-row")).title("Hours").addChild("input",(function(e){return t.hoursInput=e.addClass("".concat(t.cssPrefix,"-input-hours")).type("range").attr("min","0").attr("max","23").attr("step","1").on("input",(function(e){t.currentTime.setHours(t.hoursInput.valueAsNumber),t.updateDisplayedTime(),t.timeChanged()})).toDOM()}))})),e.addChild("div",(function(e){return e.addClass("".concat(t.cssPrefix,"-time-row")).title("Minutes").addChild("input",(function(e){return t.minutesInput=e.addClass("".concat(t.cssPrefix,"-input-minutes")).type("range").attr("min","0").attr("max","59").attr("step","1").on("input",(function(e){t.currentTime.setMinutes(t.minutesInput.valueAsNumber),t.updateDisplayedTime(),t.timeChanged()})).toDOM()}))})),this.slot},e.prototype.updateDisplayedTime=function(){var t=o.i18n.getCurrentLocale(),e=this.currentTime.toLocaleString("en"==t?void 0:t,{hour:"numeric",minute:"numeric"});this.timeText.innerText=e},e}(it),at=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),lt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return at(e,t),e.prototype.render=function(){var e=this,n=B("div",document.body).addClass("".concat(this.cssPrefix)).attr("tabIndex","0").setStyle("position","absolute").setStyle("top","-1000px").setStyle("left","-1000px").on("keydown",(function(t){return 27===t.keyCode?e.cancel():13===t.keyCode&&e.apply(e.getDateTime()),!1}));this.options.zIndex&&n.setStyle("z-index","".concat(this.options.zIndex)),this.slot=n.toDOM(),t.prototype.render.call(this),this.renderButtons(),this.globalMouseDownHandler=function(t){var n=window.event||t;n.srcElement||n.target;return!e.slot.contains(n.target)&&(document.removeEventListener("mousedown",e.globalMouseDownHandler,!0),e.cancel()),!0}},e.prototype.renderButtons=function(){var t=this,e=B("div",this.slot).addClass("".concat(this.cssPrefix,"-buttons")).addChild("button",(function(e){return t.nowButton=e.addClass("".concat(t.cssPrefix,"-button ").concat(t.cssPrefix,"-button-now")).text(o.i18n.getText("ButtonNow")).on("click",(function(){return t.setDateTime(new Date),t.dateTimeChanged(),!1})).toDOM()}));!this.options.showTimePicker&&this.options.oneClickDateSelection||e.addChild("button",(function(e){return t.submitButton=e.addClass("".concat(t.cssPrefix,"-button ").concat(t.cssPrefix,"-button-apply")).text(o.i18n.getText("ButtonApply")).on("click",(function(){return t.apply(t.getDateTime()),!1})).toDOM()})),e.addChild("button",(function(e){return t.submitButton=e.addClass("".concat(t.cssPrefix,"-button ").concat(t.cssPrefix,"-button-cancel")).text(o.i18n.getText("ButtonCancel")).on("click",(function(){return t.cancel(),!1})).toDOM()}))},e.prototype.createCalendar=function(t){return this.calendarSlot=B("div",this.slot).addClass("".concat(this.cssPrefix,"-cal")).toDOM(),new ot(this.calendarSlot,t)},e.prototype.createTimePicker=function(t){return this.timePickerSlot=B("div",this.slot).addClass("".concat(this.cssPrefix,"-tp")).toDOM(),new st(this.timePickerSlot,t)},e.prototype.show=function(e){var n=this;if(this.options.showDateTimeInput){this.options.beforeShow&&this.options.beforeShow();var o=y(e||document.body),i=y(e?e.parentElement||e:document.body);this.slot.style.top=i.y+"px",this.slot.style.left=o.x+"px"}else t.prototype.show.call(this,e),this.slot.focus();setTimeout((function(){document.addEventListener("mousedown",n.globalMouseDownHandler,!0)}),1)},e}(et);!function(t){t[t.Left=1]="Left",t[t.Center=2]="Center",t[t.Right=3]="Right"}(U||(U={}));var ut=n(946),ct=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),dt="kdlg",ht=function(){function t(){}return t.prototype.openConfirm=function(t,e,n){var o=this,i={title:t,closable:!1,submitable:!0,cancelable:!0,body:'<div id="'.concat(dt,'-dialog-confirm">').concat(e,"</div>")};return n?(i.onSubmit=function(){n(!0)},i.onCancel=function(){n(!1)},void this.open(i)):new ut((function(t){i.onSubmit=function(){t(!0)},i.onCancel=function(){t(!1)},o.open(i)}))},t.prototype.openPrompt=function(t,e,n,o){var i=this,r={title:t,submitable:!0,closable:!0,cancelable:!0,submitOnEnter:!0,body:'<div id="'.concat(dt,'-dialog-form" class="kfrm-form">\n <div class="kfrm-fields label-above">\n <label for="').concat(dt,'-dialog-form-input" id="').concat(dt,'-dialog-form-content">').concat(e,'</label>\n <input type="text" name="').concat(dt,'-dialog-form-input" id="').concat(dt,'-dialog-form-input" />\n </div>\n </div>'),arrangeParents:!1,beforeOpen:function(){var t=document.getElementById("".concat(dt,"-dialog-form-input"));n&&(t.value=n),t.focus()}},s=function(t){var e=document.getElementById("".concat(dt,"-dialog-form-input")),n=e.value;return n&&n.replace(/\s/g,"").length>0?(t(n),!0):(e.classList.add("eqjs-invalid"),!1)};return o?(r.onSubmit=function(){return s(o)},r.onCancel=function(){o("")},void this.open(r)):new ut((function(t){r.onSubmit=function(){return s(t)},r.onCancel=function(){t("")},i.open(r)}))},t.prototype.open=function(t,e){var n=this,o=new pt(t,e),i=t.onDestroy;return t.onDestroy=function(t){n.untrack(t),i&&i(t)},o.open(),this.track(o),o},t.prototype.createSet=function(t){return new gt(t,this)},t.prototype.untrack=function(e){var n=t.openDialogs.indexOf(e);n>=0&&t.openDialogs.splice(n,1)},t.prototype.track=function(e){t.openDialogs.push(e)},t.prototype.openProgress=function(t){var e=this,n=new ft(t),o=t.onDestroy;return t.onDestroy=function(t){e.untrack(t),o&&o(t)},n.open(),this.track(n),n},t.prototype.getAllDialogs=function(){return Array.from(t.openDialogs)},t.prototype.closeAllDialogs=function(){for(var e=0,n=Array.from(t.openDialogs);e<n.length;e++){n[e].close()}},t.openDialogs=[],t}(),pt=function(){function t(t,e){var n=this;this.options=t,this.submitHandler=function(t){return(!n.options.onSubmit||!1!==n.options.onSubmit(n,t))&&(n.destroy(),!0)},this.cancelHandler=function(){n.options.onCancel&&n.options.onCancel(n),n.destroy()},this.keydownHandler=function(t){return 13!=t.keyCode||!n.isActiveDialog()||(t.preventDefault(),t.stopPropagation(),!n.submitHandler())||(window.removeEventListener("keydown",n.keydownHandler,!1),!1)},this.dialogId=o.utils.generateId("dlg"),this.data=e,this.slot=B("div",document.body).attr("tab-index","-1").data("dialog-id",this.dialogId).addClass("".concat(dt,"-modal"),"is-active").focus().addChild("div",(function(t){return t.addClass("kdlg-modal-background")})).addChild("div",(function(i){return n.windowElement=i.addClass("".concat(dt,"-modal-window")).addChild("header",(function(e){n.headerElement=e.addClass("".concat(dt,"-header")).addChild("p",(function(e){return e.addClass("".concat(dt,"-header-title")).addText(t.title)})).toDOM(),!1!==t.closable&&e.addChild("button",(function(t){return t.addClass("".concat(dt,"-modal-close")).on("click",(function(){n.cancelHandler()})).focus()}))})).addChild("div",(function(t){t.addClass("".concat(dt,"-alert-container")),n.alertElement=t.toDOM()})).addChild("section",(function(i){if(n.bodyElement=i.addClass("".concat(dt,"-body")).toDOM(),"string"==typeof t.body){var r=o.liquid.renderLiquidTemplate(t.body,e);i.addHtml(r)}else i.addChildElement(t.body)})).addChild("footer",(function(e){var i=null;i=t.footerAlignment&&t.footerAlignment==U.Center?"align-center":"align-right",n.footerElement=e.addClass("".concat(dt,"-footer")).toDOM(),e.addClass(i),!1!==t.submitable&&(e.addChild("button",(function(e){e.id(n.dialogId+"-btn-submit").addClass("kfrm-button","is-info").addText(t.submitButtonText||o.i18n.getText("ButtonOK")),t.recaptchaSiteKey?(e.data("sitekey",t.recaptchaSiteKey),e.addClass("g-recaptcha"),e.on("click",(function(e){grecaptcha?grecaptcha.ready((function(){grecaptcha.execute(t.recaptchaSiteKey,{action:"submit"}).then((function(t){n.submitHandler(t)}))})):n.submitHandler()}))):e.on("click",(function(t){n.submitHandler()})),e.focus()})),!1!==t.cancelable&&e.addChild("button",(function(e){return e.id(n.dialogId+"-btn-cancel").addClass("kfrm-button").addText(t.cancelButtonText||o.i18n.getText("ButtonCancel")).on("click",(function(t){n.cancelHandler()}))})))})).toDOM()})).toDOM()}return t.prototype.getData=function(){return this.data},t.prototype.getRootElement=function(){return this.slot},t.prototype.getSubmitButtonElement=function(){return document.getElementById(this.dialogId+"-btn-submit")},t.prototype.getCancelButtonElement=function(){return document.getElementById(this.dialogId+"-btn-cancel")},t.prototype.open=function(){var t=this;this.options.beforeOpen&&this.options.beforeOpen(this),B(this.slot).show(),this.options.arrangeParents&&this.arrangeParents(!0);var e=this.slot.querySelector(".".concat(dt,"-modal-window"));this.options.height&&(e.style.height="string"==typeof this.options.height?this.options.height:"".concat(this.options.height,"px")),this.options.width&&(e.style.width="string"==typeof this.options.width?this.options.width:"".concat(this.options.width,"px")),this.options.submitOnEnter&&window.addEventListener("keydown",this.keydownHandler,!1),this.slot.querySelectorAll("input").forEach((function(e){return e.addEventListener("input",(function(){t.clearAlert(),t.options.onInput&&t.options.onInput(t)}))})),this.options.onShow&&this.options.onShow(this)},t.prototype.submit=function(){this.submitHandler()},t.prototype.cancel=function(){this.cancelHandler()},t.prototype.close=function(){this.destroy()},t.prototype.disableButtons=function(){this.slot.querySelectorAll("button").forEach((function(t){return t.disabled=!0}))},t.prototype.enableButtons=function(){this.slot.querySelectorAll("button").forEach((function(t){return t.disabled=!1}))},t.prototype.showAlert=function(t,e,n){var o=B("div").addClass("".concat(dt,"-alert ").concat(e||"")).addChild("span",(function(t){return t.addClass("".concat(dt,"-alert-closebtn")).text("×").on("click",(function(t){var e=t.target.parentElement;e.parentElement.removeChild(e)}))})).addText(t).toDOM();!0===n&&this.clearAlert(),this.alertElement.appendChild(o)},t.prototype.clearAlert=function(){this.alertElement.innerHTML=""},t.prototype.destroy=function(){document.querySelectorAll('[data-dialog-id="'.concat(this.dialogId,'"]')).length<=0||(this.options.arrangeParents&&this.arrangeParents(!1),document.body.removeChild(this.slot),this.options.submitOnEnter&&window.removeEventListener("keydown",this.keydownHandler,!1),this.options.onDestroy&&this.options.onDestroy(this))},t.prototype.isActiveDialog=function(){var t=document.documentElement.querySelectorAll(".kdlg-modal");return t[t.length-1]===this.slot},t.prototype.arrangeParents=function(t){for(var e=document.documentElement.querySelectorAll(".kdlg-modal-window"),n=0;n<e.length-1;n++)if(t){var o=0==n?20:40*n+20;B(e[n]).setStyle("margin-top","".concat(o,"px")).setStyle("margin-left","".concat(o,"px"))}else B(e[n]).removeStyle("margin-top").removeStyle("margin-left")},t}(),ft=function(t){function e(e,n){var o,i,r=this,s=B("div").addChild("div",(function(t){return o=t.text(e.content||"").toDOM()})).addChild("div",(function(t){t.addClass("".concat(dt,"-progress-line")).addChild("div",(function(t){i=t.addClass("fill").toDOM(),e.determinated?t.setStyle("width","0%"):t.addClass("indeterminate")}))})).toDOM();return(r=t.call(this,{title:e.title,body:s,beforeOpen:e.beforeOpen,onSubmit:e.onSubmit,width:e.width,height:e.height,submitable:!1,cancelable:!1,closable:!1,onDestroy:e.onDestroy},n)||this).contentElement=o,r.progressElement=i,r}return ct(e,t),e.prototype.updateContent=function(t){this.contentElement.innerText=t},e.prototype.updateProgress=function(t){var e=this;t=this.in01(t),this.progressElement.style.width="".concat(100*t,"%"),1===t&&setTimeout((function(){e.submit()}),500)},e.prototype.in01=function(t){return t>1?1:t<0?0:t},e}(pt),gt=function(){function t(t,e){this.options=t,this.dialogService=e,this.currentDialog=null,this.currentIndex=0,this.options=t,this.dialogService=e}return t.prototype.getCurrent=function(){return this.currentDialog},t.prototype.openNext=function(t){return this.open(this.currentIndex+1,t)},t.prototype.openPrev=function(t){return this.open(this.currentIndex-1,t)},t.prototype.open=function(t,e){if(t<0?this.currentIndex=0:t>=this.options.length?this.currentIndex=this.options.length-1:this.currentIndex=t,this.currentDialog)try{this.currentDialog.close()}catch(t){}var n=this.options[this.currentIndex];return this.currentDialog=this.dialogService.open(n,e),this.currentDialog},t.prototype.close=function(){this.currentDialog&&(this.currentDialog.close(),this.currentDialog=null)},t}();o.i18n.updateDefaultTexts({GridPageInfo:"{FirstPageRecordNum} - {LastPageRecordNum} of {Total} records",GridItemsPerPage:"items per page",ButtonOK:"OK",ButtonCancel:"Cancel",ButtonApply:"Apply",ButtonNow:"Now",LblTotal:"Total"});var yt=new ht},789:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){"use strict";var browserUtils;__webpack_require__.d(__webpack_exports__,{z:function(){return browserUtils}}),function(browserUtils){var _isFirefox=null,_isIE=null;function IsIE(){if(null===_isIE){var t=navigator.userAgent;_isIE=t.indexOf("MSIE ")>-1||t.indexOf("Trident/")>-1}return _isIE}function IsEdge(){return!IsIE()&&eval("!!window.StyleMedia")}function IsFirefox(){if(null===_isFirefox){var t=navigator.userAgent;_isFirefox=t.toLowerCase().indexOf("firefox")>-1}return _isFirefox}browserUtils.IsIE=IsIE,browserUtils.IsEdge=IsEdge,browserUtils.IsFirefox=IsFirefox;var _detectedIsMobileMode=!1,_isMobileMode=void 0,detectIsMobileMode=function(){var t=isMobileMode();_detectedIsMobileMode=window.matchMedia("only screen and (max-width: 840px)").matches||window.matchMedia("only screen and (max-height: 420px)").matches;var e=isMobileMode();e!==t&&mobileModeChangeHandler&&mobileModeChangeHandler(e)},mobileModeChangeHandler;function isMobileMode(){return void 0!==_isMobileMode?_isMobileMode:_detectedIsMobileMode}function setIsMobileMode(t){var e=isMobileMode();_isMobileMode=t;var n=isMobileMode();n!==e&&mobileModeChangeHandler&&mobileModeChangeHandler(n)}function onMobileModeChanged(t){mobileModeChangeHandler=t}function getMobileCssClass(){return isMobileMode()?"k-mobile":null}detectIsMobileMode(),window.addEventListener("resize",(function(){return detectIsMobileMode()})),browserUtils.isMobileMode=isMobileMode,browserUtils.setIsMobileMode=setIsMobileMode,browserUtils.onMobileModeChanged=onMobileModeChanged,browserUtils.getMobileCssClass=getMobileCssClass}(browserUtils||(browserUtils={}))},946:function(t,e,n){t.exports=function(){"use strict";function t(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}function e(t){return"function"==typeof t}var o=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},i=0,r=void 0,s=void 0,a=function(t,e){b[i]=t,b[i+1]=e,2===(i+=2)&&(s?s(x):E())};function l(t){s=t}function u(t){a=t}var c="undefined"!=typeof window?window:void 0,d=c||{},h=d.MutationObserver||d.WebKitMutationObserver,p="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),f="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function g(){return function(){return process.nextTick(x)}}function y(){return void 0!==r?function(){r(x)}:C()}function m(){var t=0,e=new h(x),n=document.createTextNode("");return e.observe(n,{characterData:!0}),function(){n.data=t=++t%2}}function v(){var t=new MessageChannel;return t.port1.onmessage=x,function(){return t.port2.postMessage(0)}}function C(){var t=setTimeout;return function(){return t(x,1)}}var b=new Array(1e3);function x(){for(var t=0;t<i;t+=2)(0,b[t])(b[t+1]),b[t]=void 0,b[t+1]=void 0;i=0}function w(){try{var t=Function("return this")().require("vertx");return r=t.runOnLoop||t.runOnContext,y()}catch(t){return C()}}var E=void 0;function T(t,e){var n=this,o=new this.constructor(k);void 0===o[S]&&U(o);var i=n._state;if(i){var r=arguments[i-1];a((function(){return W(i,o,r,n._result)}))}else j(n,o,t,e);return o}function D(t){var e=this;if(t&&"object"==typeof t&&t.constructor===e)return t;var n=new e(k);return F(n,t),n}E=p?g():h?m():f?v():void 0===c?w():C();var S=Math.random().toString(36).substring(2);function k(){}var M=void 0,I=1,B=2;function A(){return new TypeError("You cannot resolve a promise with itself")}function _(){return new TypeError("A promises callback cannot return that same promise.")}function P(t,e,n,o){try{t.call(e,n,o)}catch(t){return t}}function O(t,e,n){a((function(t){var o=!1,i=P(n,e,(function(n){o||(o=!0,e!==n?F(t,n):Q(t,n))}),(function(e){o||(o=!0,N(t,e))}),"Settle: "+(t._label||" unknown promise"));!o&&i&&(o=!0,N(t,i))}),t)}function L(t,e){e._state===I?Q(t,e._result):e._state===B?N(t,e._result):j(e,void 0,(function(e){return F(t,e)}),(function(e){return N(t,e)}))}function R(t,n,o){n.constructor===t.constructor&&o===T&&n.constructor.resolve===D?L(t,n):void 0===o?Q(t,n):e(o)?O(t,n,o):Q(t,n)}function F(e,n){if(e===n)N(e,A());else if(t(n)){var o=void 0;try{o=n.then}catch(t){return void N(e,t)}R(e,n,o)}else Q(e,n)}function q(t){t._onerror&&t._onerror(t._result),H(t)}function Q(t,e){t._state===M&&(t._result=e,t._state=I,0!==t._subscribers.length&&a(H,t))}function N(t,e){t._state===M&&(t._state=B,t._result=e,a(q,t))}function j(t,e,n,o){var i=t._subscribers,r=i.length;t._onerror=null,i[r]=e,i[r+I]=n,i[r+B]=o,0===r&&t._state&&a(H,t)}function H(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var o=void 0,i=void 0,r=t._result,s=0;s<e.length;s+=3)o=e[s],i=e[s+n],o?W(n,o,i,r):i(r);t._subscribers.length=0}}function W(t,n,o,i){var r=e(o),s=void 0,a=void 0,l=!0;if(r){try{s=o(i)}catch(t){l=!1,a=t}if(n===s)return void N(n,_())}else s=i;n._state!==M||(r&&l?F(n,s):!1===l?N(n,a):t===I?Q(n,s):t===B&&N(n,s))}function G(t,e){try{e((function(e){F(t,e)}),(function(e){N(t,e)}))}catch(e){N(t,e)}}var z=0;function V(){return z++}function U(t){t[S]=z++,t._state=void 0,t._result=void 0,t._subscribers=[]}function Y(){return new Error("Array Methods must be provided an Array")}var J=function(){function t(t,e){this._instanceConstructor=t,this.promise=new t(k),this.promise[S]||U(this.promise),o(e)?(this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?Q(this.promise,this._result):(this.length=this.length||0,this._enumerate(e),0===this._remaining&&Q(this.promise,this._result))):N(this.promise,Y())}return t.prototype._enumerate=function(t){for(var e=0;this._state===M&&e<t.length;e++)this._eachEntry(t[e],e)},t.prototype._eachEntry=function(t,e){var n=this._instanceConstructor,o=n.resolve;if(o===D){var i=void 0,r=void 0,s=!1;try{i=t.then}catch(t){s=!0,r=t}if(i===T&&t._state!==M)this._settledAt(t._state,e,t._result);else if("function"!=typeof i)this._remaining--,this._result[e]=t;else if(n===et){var a=new n(k);s?N(a,r):R(a,t,i),this._willSettleAt(a,e)}else this._willSettleAt(new n((function(e){return e(t)})),e)}else this._willSettleAt(o(t),e)},t.prototype._settledAt=function(t,e,n){var o=this.promise;o._state===M&&(this._remaining--,t===B?N(o,n):this._result[e]=n),0===this._remaining&&Q(o,this._result)},t.prototype._willSettleAt=function(t,e){var n=this;j(t,void 0,(function(t){return n._settledAt(I,e,t)}),(function(t){return n._settledAt(B,e,t)}))},t}();function K(t){return new J(this,t).promise}function X(t){var e=this;return o(t)?new e((function(n,o){for(var i=t.length,r=0;r<i;r++)e.resolve(t[r]).then(n,o)})):new e((function(t,e){return e(new TypeError("You must pass an array to race."))}))}function $(t){var e=new this(k);return N(e,t),e}function Z(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function tt(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}var et=function(){function t(e){this[S]=V(),this._result=this._state=void 0,this._subscribers=[],k!==e&&("function"!=typeof e&&Z(),this instanceof t?G(this,e):tt())}return t.prototype.catch=function(t){return this.then(null,t)},t.prototype.finally=function(t){var n=this,o=n.constructor;return e(t)?n.then((function(e){return o.resolve(t()).then((function(){return e}))}),(function(e){return o.resolve(t()).then((function(){throw e}))})):n.then(t,t)},t}();function nt(){var t=void 0;if(void 0!==n.g)t=n.g;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var e=t.Promise;if(e){var o=null;try{o=Object.prototype.toString.call(e.resolve())}catch(t){}if("[object Promise]"===o&&!e.cast)return}t.Promise=et}return et.prototype.then=T,et.all=K,et.race=X,et.resolve=D,et.reject=$,et._setScheduler=l,et._setAsap=u,et._asap=a,et.polyfill=nt,et.Promise=et,et}()},18:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.d(__webpack_exports__,{e:function(){return GoogleDataConverter}});var _easydata_core__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(907),GoogleDataConverter=function(){function GoogleDataConverter(t){t||(t={cols:[],rows:[]}),"string"==typeof t?this.loadFromJSON(t):this.tableObj=t}return GoogleDataConverter.prototype.loadFromJSON=function(t){this.tableObj=JSON.parse(t)},GoogleDataConverter.prototype.toJSON=function(){return JSON.stringify(this.tableObj)},GoogleDataConverter.prototype.getObject=function(){return this.tableObj},GoogleDataConverter.prototype.isEmpty=function(){return 0==this.getNumberOfColumns()||0==this.getNumberOfRows()},GoogleDataConverter.prototype.getNumberOfColumns=function(){return this.tableObj.cols.length},GoogleDataConverter.prototype.getColumnObject=function(t){return t<this.tableObj.cols.length?this.tableObj.cols[t]:null},GoogleDataConverter.prototype.getColumnId=function(t){var e=this.getColumnObject(t);return e?e.id:null},GoogleDataConverter.prototype.getColumnLabel=function(t){var e=this.getColumnObject(t);return e?e.label:null},GoogleDataConverter.prototype.getColumnType=function(t){var e=this.getColumnObject(t);return e?e.type:null},GoogleDataConverter.prototype.getColumnProperties=function(t){var e=this.getColumnObject(t);return e?e.p:null},GoogleDataConverter.prototype.getNumberOfRows=function(){return this.tableObj.rows.length},GoogleDataConverter.prototype.convertValue=function(value,colIndex){var colType=this.googleDataTypeToDataType(this.getColumnType(colIndex));return[_easydata_core__WEBPACK_IMPORTED_MODULE_0__.DataType.Date,_easydata_core__WEBPACK_IMPORTED_MODULE_0__.DataType.DateTime,_easydata_core__WEBPACK_IMPORTED_MODULE_0__.DataType.Time].includes(colType)?eval("new ".concat(value)):value},GoogleDataConverter.prototype.getValue=function(t,e){var n=t<this.tableObj.rows.length?this.tableObj.rows[t]:null;if(n){var o=e<this.tableObj.cols.length?n.c[e]:null;if(o)return this.convertValue(o.v,e)}return null},GoogleDataConverter.prototype.getRow=function(t){var e=this;return(t<this.tableObj.rows.length?this.tableObj.rows[t]:null).c.map((function(t,n){return e.convertValue(t.v,n)}),this)},GoogleDataConverter.prototype.convertTo=function(t){for(var e=this.getNumberOfColumns(),n=0;n<e;n++)t.columns.add({id:this.getColumnId(n),label:this.getColumnLabel(n),type:this.googleDataTypeToDataType(this.getColumnType(n))});var o=this.getNumberOfRows();for(n=0;n<o;n++)t.addRow(this.getRow(n))},GoogleDataConverter.prototype.googleDataTypeToDataType=function(t){switch(t){case"string":default:return _easydata_core__WEBPACK_IMPORTED_MODULE_0__.DataType.String;case"number":return _easydata_core__WEBPACK_IMPORTED_MODULE_0__.DataType.Float;case"boolean":return _easydata_core__WEBPACK_IMPORTED_MODULE_0__.DataType.Bool;case"date":return _easydata_core__WEBPACK_IMPORTED_MODULE_0__.DataType.Date;case"datetime":return _easydata_core__WEBPACK_IMPORTED_MODULE_0__.DataType.DateTime;case"timeofday":return _easydata_core__WEBPACK_IMPORTED_MODULE_0__.DataType.Time}},GoogleDataConverter}()},567:function(t,e,n){t.exports=function(){"use strict";function t(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}function e(t){return"function"==typeof t}var o=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},i=0,r=void 0,s=void 0,a=function(t,e){b[i]=t,b[i+1]=e,2===(i+=2)&&(s?s(x):E())};function l(t){s=t}function u(t){a=t}var c="undefined"!=typeof window?window:void 0,d=c||{},h=d.MutationObserver||d.WebKitMutationObserver,p="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),f="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function g(){return function(){return process.nextTick(x)}}function y(){return void 0!==r?function(){r(x)}:C()}function m(){var t=0,e=new h(x),n=document.createTextNode("");return e.observe(n,{characterData:!0}),function(){n.data=t=++t%2}}function v(){var t=new MessageChannel;return t.port1.onmessage=x,function(){return t.port2.postMessage(0)}}function C(){var t=setTimeout;return function(){return t(x,1)}}var b=new Array(1e3);function x(){for(var t=0;t<i;t+=2)(0,b[t])(b[t+1]),b[t]=void 0,b[t+1]=void 0;i=0}function w(){try{var t=Function("return this")().require("vertx");return r=t.runOnLoop||t.runOnContext,y()}catch(t){return C()}}var E=void 0;function T(t,e){var n=this,o=new this.constructor(k);void 0===o[S]&&U(o);var i=n._state;if(i){var r=arguments[i-1];a((function(){return W(i,o,r,n._result)}))}else j(n,o,t,e);return o}function D(t){var e=this;if(t&&"object"==typeof t&&t.constructor===e)return t;var n=new e(k);return F(n,t),n}E=p?g():h?m():f?v():void 0===c?w():C();var S=Math.random().toString(36).substring(2);function k(){}var M=void 0,I=1,B=2;function A(){return new TypeError("You cannot resolve a promise with itself")}function _(){return new TypeError("A promises callback cannot return that same promise.")}function P(t,e,n,o){try{t.call(e,n,o)}catch(t){return t}}function O(t,e,n){a((function(t){var o=!1,i=P(n,e,(function(n){o||(o=!0,e!==n?F(t,n):Q(t,n))}),(function(e){o||(o=!0,N(t,e))}),"Settle: "+(t._label||" unknown promise"));!o&&i&&(o=!0,N(t,i))}),t)}function L(t,e){e._state===I?Q(t,e._result):e._state===B?N(t,e._result):j(e,void 0,(function(e){return F(t,e)}),(function(e){return N(t,e)}))}function R(t,n,o){n.constructor===t.constructor&&o===T&&n.constructor.resolve===D?L(t,n):void 0===o?Q(t,n):e(o)?O(t,n,o):Q(t,n)}function F(e,n){if(e===n)N(e,A());else if(t(n)){var o=void 0;try{o=n.then}catch(t){return void N(e,t)}R(e,n,o)}else Q(e,n)}function q(t){t._onerror&&t._onerror(t._result),H(t)}function Q(t,e){t._state===M&&(t._result=e,t._state=I,0!==t._subscribers.length&&a(H,t))}function N(t,e){t._state===M&&(t._state=B,t._result=e,a(q,t))}function j(t,e,n,o){var i=t._subscribers,r=i.length;t._onerror=null,i[r]=e,i[r+I]=n,i[r+B]=o,0===r&&t._state&&a(H,t)}function H(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var o=void 0,i=void 0,r=t._result,s=0;s<e.length;s+=3)o=e[s],i=e[s+n],o?W(n,o,i,r):i(r);t._subscribers.length=0}}function W(t,n,o,i){var r=e(o),s=void 0,a=void 0,l=!0;if(r){try{s=o(i)}catch(t){l=!1,a=t}if(n===s)return void N(n,_())}else s=i;n._state!==M||(r&&l?F(n,s):!1===l?N(n,a):t===I?Q(n,s):t===B&&N(n,s))}function G(t,e){try{e((function(e){F(t,e)}),(function(e){N(t,e)}))}catch(e){N(t,e)}}var z=0;function V(){return z++}function U(t){t[S]=z++,t._state=void 0,t._result=void 0,t._subscribers=[]}function Y(){return new Error("Array Methods must be provided an Array")}var J=function(){function t(t,e){this._instanceConstructor=t,this.promise=new t(k),this.promise[S]||U(this.promise),o(e)?(this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?Q(this.promise,this._result):(this.length=this.length||0,this._enumerate(e),0===this._remaining&&Q(this.promise,this._result))):N(this.promise,Y())}return t.prototype._enumerate=function(t){for(var e=0;this._state===M&&e<t.length;e++)this._eachEntry(t[e],e)},t.prototype._eachEntry=function(t,e){var n=this._instanceConstructor,o=n.resolve;if(o===D){var i=void 0,r=void 0,s=!1;try{i=t.then}catch(t){s=!0,r=t}if(i===T&&t._state!==M)this._settledAt(t._state,e,t._result);else if("function"!=typeof i)this._remaining--,this._result[e]=t;else if(n===et){var a=new n(k);s?N(a,r):R(a,t,i),this._willSettleAt(a,e)}else this._willSettleAt(new n((function(e){return e(t)})),e)}else this._willSettleAt(o(t),e)},t.prototype._settledAt=function(t,e,n){var o=this.promise;o._state===M&&(this._remaining--,t===B?N(o,n):this._result[e]=n),0===this._remaining&&Q(o,this._result)},t.prototype._willSettleAt=function(t,e){var n=this;j(t,void 0,(function(t){return n._settledAt(I,e,t)}),(function(t){return n._settledAt(B,e,t)}))},t}();function K(t){return new J(this,t).promise}function X(t){var e=this;return o(t)?new e((function(n,o){for(var i=t.length,r=0;r<i;r++)e.resolve(t[r]).then(n,o)})):new e((function(t,e){return e(new TypeError("You must pass an array to race."))}))}function $(t){var e=new this(k);return N(e,t),e}function Z(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function tt(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}var et=function(){function t(e){this[S]=V(),this._result=this._state=void 0,this._subscribers=[],k!==e&&("function"!=typeof e&&Z(),this instanceof t?G(this,e):tt())}return t.prototype.catch=function(t){return this.then(null,t)},t.prototype.finally=function(t){var n=this,o=n.constructor;return e(t)?n.then((function(e){return o.resolve(t()).then((function(){return e}))}),(function(e){return o.resolve(t()).then((function(){throw e}))})):n.then(t,t)},t}();function nt(){var t=void 0;if(void 0!==n.g)t=n.g;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var e=t.Promise;if(e){var o=null;try{o=Object.prototype.toString.call(e.resolve())}catch(t){}if("[object Promise]"===o&&!e.cast)return}t.Promise=et}return et.prototype.then=T,et.all=K,et.race=X,et.resolve=D,et.reject=$,et._setScheduler=l,et._setAsap=u,et._asap=a,et.polyfill=nt,et.Promise=et,et}()}},__webpack_module_cache__={};function __webpack_require__(t){var e=__webpack_module_cache__[t];if(void 0!==e)return e.exports;var n=__webpack_module_cache__[t]={exports:{}};return __webpack_modules__[t].call(n.exports,n,n.exports,__webpack_require__),n.exports}__webpack_require__.d=function(t,e){for(var n in e)__webpack_require__.o(e,n)&&!__webpack_require__.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),__webpack_require__.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},__webpack_require__.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var __webpack_exports__={};__webpack_require__(292),__webpack_require__(610),__webpack_require__(546),__webpack_require__(527),__webpack_require__(311),__webpack_require__(57),__webpack_require__(85),__webpack_require__(817),__webpack_require__(235),function(){"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{core:function(){return t},ui:function(){return e}});var t={};__webpack_require__.r(t),__webpack_require__.d(t,{AggrFunction:function(){return c},BrowserQueryStorage:function(){return q},CondTag:function(){return M},Condition:function(){return P},ConditionPart:function(){return I},DataKind:function(){return l},DataModel:function(){return S},DefaultAggregatesCalculator:function(){return J},EasyQueryDataLoader:function(){return $},EmptyChunk:function(){return u},Entity:function(){return m},EntityAttr:function(){return v},EqAction:function(){return _},EqActionResult:function(){return tt},EqAggregatesContainer:function(){return Y},EqContext:function(){return rt},EqEditorTag:function(){return b},EqModelLoader:function(){return N},EqQueryFileLoader:function(){return V},EqServerDataFetcher:function(){return W},EqServerExporter:function(){return ot},EqServerModelLoader:function(){return H},EqServerQuerySynchronizer:function(){return G},EqServerValueListResolver:function(){return z},EqServiceProvider:function(){return K},EqValueEditor:function(){return h},ExprTag:function(){return p},Expression:function(){return k},FormatParser:function(){return s},GoogleDataConverter:function(){return Z.e},InMemoryModelStorage:function(){return nt},InvalidQueryError:function(){return L},LinkType:function(){return n},Operand:function(){return g},Operator:function(){return f},Query:function(){return R},QueryChangeAction:function(){return w},QueryChangePart:function(){return x},QueryColumn:function(){return B},SortDirection:function(){return E},Tree:function(){return T},Widget:function(){return st},WidgetGroup:function(){return A},eqconsts:function(){return i},equtils:function(){return o},i18n:function(){return r.i18n},versionInfo:function(){return at}});var e={};__webpack_require__.r(e),__webpack_require__.d(e,{AddRowRenderer:function(){return ce},AdvancedSearchView:function(){return Dn},AggrFuncColumnRendererCB:function(){return _t},AggrFuncColumnRendererCP:function(){return Et},AggrSettingsDialog:function(){return gn},AggrSettingsRenderer:function(){return pn},AggregationBar:function(){return mn},AttributeExpressionRenderer:function(){return se},BaseElementRenderer:function(){return Kt},ChartFacet:function(){return tn},ChartJsWidget:function(){return Ke},ChartType:function(){return qe},ChartWidget:function(){return Ye},ColumnAction:function(){return lt},ColumnRendererCB:function(){return Mt},ColumnRendererCP:function(){return Ct},ColumnsBar:function(){return Ot},ColumnsPanel:function(){return kt},ConditionAction:function(){return qt},ConditionGroupRenderer:function(){return Yt},ConditionGroupRowRenderer:function(){return Jt},ConditionRenderer:function(){return jt},CustomListExpressionRenderer:function(){return oe},CustomSqlColumnRendererCP:function(){return Dt},DataFilterView:function(){return kn},DataTableFacet:function(){return sn},DateTimeExpressionRenderer:function(){return fe},DomDropDownElementBuilder:function(){return Gt},DropDownRenderer:function(){return le},EasyGridWidget:function(){return Ae},EntitiesPanel:function(){return pt},EqHtmlGrid:function(){return Se},ExportDialog:function(){return Ne},ExportWidget:function(){return hn},ExpressionRenderer:function(){return $t},FacetType:function(){return Vt},FilterBar:function(){return we},GoogleChartWidget:function(){return $e},Grid:function(){return Me},HtmlContentWidget:function(){return Te},HtmlDataFilterView:function(){return In},InputExpressionRenderer:function(){return te},ListExpressionRenderer:function(){return ne},ManageDrillDownWidget:function(){return Fe},OperatorRenderer:function(){return he},PivotTableFacet:function(){return on},PopupMenu:function(){return gt},ProcessWidget:function(){return Le},QPEditablePart:function(){return vt},QueryPanel:function(){return be},ReportView:function(){return An},ResultFacet:function(){return Ge},ResultFacetsPanel:function(){return cn},SimpleColumnRendererCB:function(){return Bt},SimpleColumnRendererCP:function(){return xt},SimpleConditionRenderer:function(){return Ht},SortingBar:function(){return Ft},SqlListExpressionRenderer:function(){return ie},StatementPanel:function(){return Pe},SubQueryExpressionRenderer:function(){return ye},TextRenderer:function(){return Qt},View:function(){return wn},browserUtils:function(){return dt.z},dropdown:function(){return zt}});var n,o,i,r=__webpack_require__(907),s=function(){function t(t){this.start(t)}return t.prototype.start=function(t){this.formatStr=t,this.pos=0,this.exprNum=0,this.tokenText=""},t.prototype.skipSpaces=function(){for(;this.pos<this.formatStr.length&&" "===this.formatStr.charAt(this.pos);)this.pos++},t.prototype.next=function(){if(this.skipSpaces(),this.pos>=this.formatStr.length)return!1;var t=0;if("{"===this.formatStr.charAt(this.pos)){if((t=this.formatStr.indexOf("}",this.pos))<0)return!1;this.tokenText=this.formatStr.substring(this.pos,t+1),0===this.tokenText.indexOf("{expr")&&(this.token="expression",this.exprNum=parseInt(this.tokenText.substring(5,this.tokenText.length))),this.pos=t+1}else if("["===this.formatStr.charAt(this.pos)&&this.pos<this.formatStr.length-1&&"["===this.formatStr.charAt(this.pos+1))this.pos+=2,t=this.formatStr.indexOf("]]",this.pos),this.token="operator",this.tokenText=this.formatStr.substring(this.pos,t),this.pos=t+2;else{this.token="text";var e=this.formatStr.indexOf("{",this.pos);e<0&&(e=this.formatStr.length);var n=this.formatStr.indexOf("[[",this.pos);n<0&&(n=this.formatStr.length),t=Math.min(e,n),this.tokenText=this.formatStr.substring(this.pos,t).trim(),this.pos=t}return!0},t.prototype.getToken=function(){return{type:this.token,text:this.tokenText,index:this.exprNum-1}},t.prototype.parse=function(){for(var t=[];this.next();)t.push(this.getToken());return t},t}();!function(t){t[t.None=0]="None",t[t.Any=1]="Any",t[t.NotAll=2]="NotAll",t[t.All=3]="All"}(n||(n={})),function(t){t.combinePath=function(t,e){var n=t;return null!=n&&n.length>0?("/"!=n.charAt(n.length-1)&&(n+="/"),n+=e):n=e,n},t.strToLinkType=function(t){return"All"==t?n.All:"NotAll"==t?n.NotAll:"Any"==t?n.Any:n.None},t.linkTypeToStr=function(t){return t===n.All?"All":t===n.NotAll?"NotAll":t==n.Any?"Any":"None"},t.parseOperatorFormat=function(t){var e=r.i18n.getText("Operators",t.id,"format");return e||(e=r.i18n.getText("Operators",t.id,"displayFormat")),e||(e=t.displayFormat),new s(e).parse()},t.convertValue=function(t,e,n){switch(n){case r.DataType.String:return t;case r.DataType.Autoinc,r.DataType.Byte,r.DataType.Int32,r.DataType.Int64,r.DataType.Word:var o=parseInt(t);return isNaN(o)?"":o.toString();case r.DataType.Currency,r.DataType.Float:var i=parseFloat(t);return isNaN(i)?"":i.toString();default:return""}}}(o||(o={})),function(t){var e=function(){this.SpecDateValues=[{id:"${Today}",key:"Today",isDefault:!0},{id:"${Yesterday}",key:"Yesterday"},{id:"${Tomorrow}",key:"Tomorrow"},{id:"${FirstDayOfMonth}",key:"FirstDayOfMonth"},{id:"${FirstDayOfYear}",key:"FirstDayOfYear"}],this.SpecTimeValues=[{id:"${Now}",key:"Now",isDefault:!0},{id:"${HourStart}",key:"HourStart"},{id:"${Midnight}",key:"Midnight"},{id:"${Noon}",key:"Noon"}],this.BooleanValues=[{id:"${false}",key:"False"},{id:"${true}",key:"True",isDefault:!0}]};t.constLists=new e,t.predicateLinkTypeList=[{id:"All",key:"LinkTypeAll"},{id:"Any",key:"LinkTypeAny"},{id:"None",key:"LinkTypeNone"},{id:"NotAll",key:"LinkTypeNotAll"}]}(i||(i={}));var a,l,u={offset:0,limit:0,needTotal:!1},c=function(){function t(){this.id="",this.caption="",this.sqlExpr="",this.displayFormat="",this.appliedTypes=[]}return t.prototype.loadFromData=function(t){t&&(this.id=t.id,this.caption=t.cptn,this.displayFormat=t.fmt,this.sqlExpr=t.expr,this.appliedTypes=t.dtypes||this.appliedTypes)},t.prototype.getAppliedTypesOrDefault=function(){return this.appliedTypes.length>0?this.appliedTypes:"SUM"===this.id||"AVG"===this.id?[r.DataType.Autoinc,r.DataType.Byte,r.DataType.Currency,r.DataType.Float,r.DataType.Int32,r.DataType.Int64,r.DataType.Word]:"MIN"===this.id||"MAX"===this.id?[r.DataType.Autoinc,r.DataType.BCD,r.DataType.Byte,r.DataType.Currency,r.DataType.Date,r.DataType.DateTime,r.DataType.Time,r.DataType.Float,r.DataType.Int32,r.DataType.Int64,r.DataType.Word]:r.utils.getAllDataTypes()},t}(),d=(a=function(t,e){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},a(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}a(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),h=function(t){function e(){return t.call(this)||this}return d(e,t),e.prototype.loadFromData=function(e){t.prototype.loadFromData.call(this,e),e&&(e.sql&&(this.statement=e.sql),e.extraParams&&(this.extraParams=e.extraParams))},e}(r.ValueEditor);!function(t){t[t.Scalar=0]="Scalar",t[t.Const=1]="Const",t[t.Attribute=2]="Attribute",t[t.List=4]="List",t[t.Query=5]="Query",t[t.ParentColumn=6]="ParentColumn"}(l||(l={}));var p,f=function(){function t(){this.id="",this.expr="",this.constValueFormat="{const}",this.caption="{Unrecognized operator}",this.displayFormat="{expr1} [[{unrecognized operator}]] {expr2}",this.isRange=!1,this.caseIns=!1,this.paramCount=2,this.defaultOperand=new g,this.appliedTypes=[],this.operands=new Array}return t.prototype.loadFromData=function(t,e){if(e&&(this.id=e.id,this.caption=e.cptn,this.caseIns=e.caseIns,this.isRange=e.isRange,this.displayFormat=e.fmt,this.paramCount=e.pcnt,this.expr=e.expr,this.appliedTypes=e.dtypes||this.appliedTypes,e.defOperand&&this.defaultOperand.loadFromData(t,e.defOperand),e.editor&&(this.defaultOperand.editor=t.getEditorById(e.editor)||new h),e.operands))for(var n=0;n<e.operands.length;n++){var o=new g;o.loadFromData(t,e.operands[n]),e.editor&&(o.editor=t.getEditorById(e.editor)||new h),this.operands.push(o)}},t}(),g=function(){function t(){this.kind=l.Scalar,this.dataType=r.DataType.Unknown,this.editor=new h,this.defValue=""}return t.prototype.loadFromData=function(t,e){this.kind=e.kind,this.dataType=e.dtype,this.defValue=e.val,this.defText=e.txt,e.editor&&(this.editor=t.getEditorById(e.editor)||new h)},t.prototype.copyFrom=function(t){r.utils.assign(this,t)},t}(),y=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),m=function(t){function e(e){var n=t.call(this,e)||this;return n.useInConditions=!1,n.useInResult=!1,n.useInSorting=!1,n}return y(e,t),e.prototype.loadFromData=function(e,n){t.prototype.loadFromData.call(this,e,n),n&&(this.useInConditions=n.uic,this.useInResult=n.uir,this.useInSorting=n.uis)},e.prototype.scan=function(e,n){t.prototype.scan.call(this,(function(t,n){return e&&e(t,n)}),(function(t,e){return n&&n(t,e)}))},e}(r.MetaEntity),v=function(t){function e(e){var n=t.call(this,e)||this;return n.params=[],n.useInConditions=!0,n.useInResult=!0,n.useInSorting=!0,n.defaultOperator="",n.operators=new Array,n.lookupAttr="",n.expr="",n}return y(e,t),e.prototype.loadFromData=function(e,n){t.prototype.loadFromData.call(this,e,n),n&&(this.useInConditions=n.uic,this.useInResult=n.uir,this.useInSorting=n.uis,this.expr=n.sql,this.defaultOperator=n.defOperator,this.operators=n.ops,n.udata&&(this.userData=n.udata))},e}(r.MetaEntityAttr),C=function(){return C=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},C.apply(this,arguments)},b=C(C({},r.EditorTag),{SqlList:"SQLLIST",SubQuery:"SUBQUERY",BindToParentColumn:"BINDTOPARENTCOLUMN"});!function(t){t[t.Unknown=0]="Unknown",t[t.Constant=1]="Constant",t[t.EntityAttribute=2]="EntityAttribute",t[t.ParentEntityAttribute=3]="ParentEntityAttribute",t[t.AggregateFunction=4]="AggregateFunction",t[t.ParentColumn=5]="ParentColumn",t[t.Query=11]="Query",t[t.CustomSql=21]="CustomSql"}(p||(p={}));var x,w,E,T=function(){function t(e){void 0===e&&(e=null),this.childs=[],this.value=null,this.parent=null,e&&(Array.isArray(e)?(this.value=e[0],e.length>1&&this.addChild(new t(e.slice(1)))):e instanceof t?(this.value=e.value,this.childs=e.childs):this.value=e)}return t.prototype.contains=function(t){if(this.value===t)return!0;for(var e=0,n=this.childs;e<n.length;e++){if(n[e].contains(t))return!0}return!1},t.prototype.findNode=function(t){if(this.value===t)return this;for(var e=0,n=this.childs;e<n.length;e++){var o=n[e].findNode(t);if(o)return o}return null},t.prototype.addChild=function(t){t.parent=this,this.childs.push(t)},t.prototype.setParents=function(){for(var t=0,e=this.childs;t<e.length;t++){var n=e[t];n.parent=this,n.setParents()}},t}(),D=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),S=function(t){function e(){var e=t.call(this)||this;return e.mainEntity=null,e.nullAttribute=new v(null),e.nullOperator=new f,e.operators=new Array,e.rootEntity=new m,e.aggrFunctions=new Array,e.dateMacros=["Today","Yesterday","Tomorrow","FirstDayOfMonth","LastDayOfMonth","FirstDayOfWeek","FirstDayOfYear","FirstDayOfNextWeek","FirstDayOfPrevMonth","FirstDayOfNextMonth","FirstDayOfNextYear","FirstDayOfPrevYear","FirstDayOfPrevWeek"],e.timeMacros=["Now","HourStart","Midnight","Noon"],e.links=[],e}return D(e,t),e.prototype.getMainEntity=function(){return this.mainEntity},e.prototype.loadFromJSON=function(t){var e=JSON.parse(t);this.loadFromData(e)},e.prototype.loadFromData=function(e){if(t.prototype.loadFromData.call(this,e),this.operators=new Array,e.operators)for(var n=0;n<e.operators.length;n++){var o=new f;o.loadFromData(this,e.operators[n]),this.operators.push(o)}if(this.rootEntity.loadFromData(this,e.entroot),this.aggrFunctions=new Array,e.aggrfuncs)for(n=0;n<e.aggrfuncs.length;n++){var i=new c;i.loadFromData(e.aggrfuncs[n]),this.aggrFunctions.push(i)}},e.prototype.getObject=function(){return this},e.prototype.setData=function(t){"string"==typeof t?this.loadFromJSON(t):this.loadFromData(t)},e.prototype.createEntity=function(t){return new m(t)},e.prototype.createEntityAttr=function(t){return new v(t)},e.prototype.createValueEditor=function(){return new h},e.prototype.createQuery=function(){return new R(this)},e.prototype.getRootEntity=function(){return this.rootEntity},e.prototype.getEditorById=function(e){return t.prototype.getEditorById.call(this,e)},e.prototype.getAttributeById=function(t){var e=this.getEntityAttrById(this.getRootEntity(),t);return e||null},e.prototype.getAttributeByIdSafe=function(t){var e=this.getAttributeById(t);return e||this.nullAttribute},e.prototype.checkAttrProperty=function(t,e){var n=this.getAttributeById(t);if(n){if(void 0===n[e])throw"No such property: "+e;return!!n[e]||!!n.lookupAttr&&(t=n.lookupAttr,(n=this.getAttributeById(t))&&n[e])}return!1},e.prototype.getEntityAttrById=function(e,n){return t.prototype.getEntityAttrById.call(this,e,n)},e.prototype._listByEntityWithFilter=function(t,e){var n,o=new Array,i=null;if(t.subEntities)for(var s=t.subEntities.length,a=0;a<s;a++){if(i=t.subEntities[a],!e||e(i,null))(n=r.i18n.getText("Entities",i.name))||(n=i.caption),(d=r.utils.assign(new m,{id:i.name,text:n,items:[],isEntity:!0})).items=this._listByEntityWithFilter(i,e),d.items.length>0&&o.push(d)}var l=null;if(t.attributes)for(var u=t.attributes.length,c=0;c<u;c++)if(l=t.attributes[c],!e||e(t,l)){(n=r.i18n.getText("Attributes",l.id))||(n=l.caption);var d=r.utils.assign(new m,{id:l.id,text:n,dataType:l.dataType});o.push(d)}return o},e.prototype._listByEntity=function(t,e,n){e=e||{};var o,i=[],s=[],a=null;if(t.subEntities)for(var l=t.subEntities.length,u=0;u<l;u++)if(a=t.subEntities[u],(!n||n(a,null))&&(!1!==e.addUIC&&!1!==a.useInConditions||!1!==e.addUIR&&!1!==a.useInResult||!1!==e.addUIS&&!1!==a.useInSorting)){o=r.i18n.getText("Entities",a.name)||a.caption;var c=r.utils.assign(new m,{id:a.name,text:o,items:[],isEntity:!0,description:a.description}),d=r.utils.assign({},e);d.includeRootData=!1,c.items=this._listByEntity(a,d,n),c.items.length>0&&i.push(c)}var h=null;if(t.attributes)for(var p=t.attributes.length,f=0;f<p;f++)h=t.attributes[f],n&&!n(t,h)||(!1!==e.addUIC&&!1!==h.useInConditions||!1!==e.addUIR&&!1!==h.useInResult||!1!==e.addUIS&&!1!==h.useInSorting)&&(o=r.i18n.getText("Attributes",h.id)||h.caption,s.push(r.utils.assign(new v(t),{id:h.id,text:o,dataType:h.dataType,lookupAttr:h.lookupAttr,description:h.description})));var g,y=function(t,e){return t.text.toLowerCase()==e.text.toLowerCase()?0:t.text.toLowerCase()>e.text.toLowerCase()?1:-1};return e.sortEntities&&(i.sort(y),s.sort(y)),g=e.attrPlacement&&0!=e.attrPlacement?s.concat(i):i.concat(s),2==e.attrPlacement&&g.sort(y),e.includeRootData?((o=r.i18n.getText("Entities",t.name))||(o=t.caption),{id:t.name,text:o,items:g}):g},e.prototype.clear=function(){t.prototype.clear.call(this),this.operators=[],this.aggrFunctions=[]},e.prototype.addOrUpdateOperator=function(t){var e=r.utils.findItemById(this.operators,t.id);return e||((e=new f).id=t.id,this.operators.push(e)),e.caption=t.caption,e.expr=t.expr||"",e.displayFormat=t.format,e.defaultOperand=new g,e.defaultOperand.kind=t.kind||l.Scalar,t.appliedTypes&&(e.appliedTypes=t.appliedTypes),t.paramCount>0&&(e.paramCount=t.paramCount),this.runThroughEntities((function(t,n){t.operators.indexOf(e.id)<0&&e.appliedTypes.indexOf(t.dataType)>=0&&t.operators.push(e.id)})),e},e.prototype.removeOperator=function(t,e){void 0===e&&(e=!1);var n=r.utils.findItemById(this.operators,t);n&&(e||r.utils.removeArrayItem(this.operators,n),this.runThroughEntities((function(t,e){r.utils.removeArrayItem(t.operators,n.id)})))},e.prototype.getOperatorIdsByDataType=function(t){switch(t){case r.DataType.String:case r.DataType.Memo:return"StartsWith,EndsWith,Contains,Equal,InList,NotStartsWith,NotEndsWith,NotContains,NotEqual,NotInList,IsNull,IsNotNull".split(",");case r.DataType.Guid:return"Equal,NotEqual".split(",");case r.DataType.Date:case r.DataType.DateTime:return"DateWithinToday,DateWithinThisWeek,DateWithinPrevWeek,DateWithinThisMonth,DateWithinPrevMonth,DateWithinThisYear,DateWithinPrevYear,DateBeforePrecise,DateAfterPrecise,DatePeriodPrecise,IsNull,IsNotNull".split(",");case r.DataType.Time:return"TimeBeforePrecise,TimeAfterPrecise,TimePeriodPrecise,IsNull,IsNotNull".split(",");case r.DataType.Byte:case r.DataType.Word:case r.DataType.Int32:case r.DataType.Int64:case r.DataType.Float:case r.DataType.Currency:case r.DataType.BCD:case r.DataType.Autoinc:case r.DataType.Unknown:return"Equal,Between,LessThan,LessOrEqual,GreaterThan,GreaterOrEqual,InList,NotEqual,NotBetween,NotInList,IsNull,IsNotNull".split(",");case r.DataType.Bool:return"IsTrue,NotTrue".split(",");default:for(var e=[],n=0,o=this.operators;n<o.length;n++){var i=o[n];i.appliedTypes.indexOf(t)>=0&&e.push(i.id)}return e}},e.prototype.buildQueryPath=function(t){var e=this.mainEntity||this.rootEntity,n=this.createTreeNodeFromEntity(e);return n.setParents(),n},e.prototype.createTreeNodeFromEntity=function(t){for(var e=new T(t),n=0,o=t.subEntities;n<o.length;n++){var i=o[n];e.addChild(this.createTreeNodeFromEntity(i))}return e},e.prototype.getEntitiesInQuery=function(t){if(t.model.id!==this.id)throw Error("Model mithmatch");for(var e=[],n=0,o=t.getColumns();n<o.length;n++){var i=o[n];i.enabled&&this.addEntityByExpression(e,i.expr)}var r=t.getRootCondition();return this.fillEntitiesByCondtionGroup(e,r),e},e.prototype.findAggrFunctionById=function(t){for(var e=0,n=this.aggrFunctions;e<n.length;e++){var o=n[e];if(o.id===t)return o}return null},e.prototype.fillEntitiesByCondtionGroup=function(t,e){for(var n=0,o=e.getConditions();n<o.length;n++){var i=o[n];if(i.isGroup())this.fillEntitiesByCondtionGroup(t,i);else for(var r=0,s=i.expressions;r<s.length;r++){var a=s[r];if(this.addEntityByExpression(t,a),a.args)for(var l=0,u=a.args;l<u.length;l++){var c=u[l];this.addEntityByExpression(t,c)}}}},e.prototype.addEntityByExpression=function(t,e){if(e.tag===p.EntityAttribute){var n=e.baseAttrId||e.value;if(n){var o=this.getAttributeById(n);o&&o.entity&&r.utils.indexOfArrayItem(t,o.entity)<0&&t.push(o.entity)}}},e.prototype.findLink=function(t,e){for(var n=0,o=this.links;n<o.length;n++){var i=o[n];if(i.entityFrom==t&&i.entityTo==e)return i}return null},e.prototype.getLinksByEntity=function(t){for(var e=[],n=0,o=this.links;n<o.length;n++){var i=o[n];i.entityFrom!=t&&i.entityTo!=t||e.push(i)}return e},e.prototype.getEntitiesTree=function(t,e){return this._listByEntity(this.getRootEntity(),t,e)},e.prototype.getEntitiesTreeWithFilter=function(t){return this._listByEntityWithFilter(this.getRootEntity(),t)},e.prototype.getFullEntityPathByAttr=function(t,e){return e=e||" ",this.getEntityPathByAttr(this.getRootEntity(),t,e,!0)},e.prototype.getEntityPathByAttr=function(e,n,o,i){return t.prototype.getEntityPathByAttr.call(this,e,n,o,i)},e.prototype.getAttributeText=function(e,n){return t.prototype.getAttributeText.call(this,e,n)},e.prototype.getFirstUICAttr=function(){return this.getFirstUICAttrInEntity(this.getRootEntity())},e.prototype.getFirstUICAttrInEntity=function(t){if(!1!==t.useInConditions){if(t.attributes)for(var e=t.attributes.length,n=0;n<e;n++)if(t.attributes[n].useInConditions)return t.attributes[n];if(t.subEntities){var o=t.subEntities.length;for(n=0;n<o;n++){var i=this.getFirstUICAttrInEntity(t.subEntities[n]);if(i)return i}}}return null},e.prototype.runThroughEntities=function(t,e){this.getRootEntity().scan(t,e)},e.prototype.getFirstAttributeByFilter=function(t){var e=null;return this.runThroughEntities((function(n,o){t(n)&&(o.stop=!0,e=n)}),null),e},e.prototype.findOperatorById=function(t){if(this.operators.length>0)for(var e=this.operators.length,n=0;n<e;n++)if(this.operators[n].id==t)return this.operators[n];return null},e.prototype.getOperatorById=function(t){var e=this.findOperatorById(t);return e||this.nullOperator},e.prototype.getDefaultOperatorIdForAttr=function(t){return t.defaultOperator?t.defaultOperator:t.operators.length>0?t.operators[0]:this.nullOperator.id},e.prototype.getAggrFunctionCaption=function(t){var e=r.i18n.getText("AggregateFunctions",t),n=e?e.caption:r.i18n.getText("Aggr"+t.replace(" ","")+"_Caption");if(n)return n;var o=r.utils.findItemById(this.aggrFunctions,t);return o&&o.caption?o.caption:t},e.prototype.getAggrFunctionFormat=function(t){var e=r.i18n.getText("AggregateFunctions",t),n=e?e.displayFormat:r.i18n.getText("Aggr"+t.replace(" ","")+"_Format");if(n)return n;var o=r.utils.findItemById(this.aggrFunctions,t);return o&&o.displayFormat?o.displayFormat:""},e.prototype.getDefaultOperatorForAttr=function(t){var e=this.getDefaultOperatorIdForAttr(t);return this.getOperatorById(e)},e.prototype.getOperand=function(t,e,n){var o=new g;e&&e.defaultOperand?(o.copyFrom(e.defaultOperand),o.defValue||(o.defValue=""),o.defText||(o.defText="")):(o.kind=l.Scalar,o.dataType=t.dataType,o.defValue="",o.defText="",o.editor=null);var i=o;return i.dataType===r.DataType.Unknown&&t&&(i.dataType=t.dataType),e&&n>=0&&e.operands&&e.operands[n-1]&&(i=r.utils.assign(i,e.operands[n-1])),i.editor||(o.editor?i.editor=o.editor:o.kind===l.Query?i.editor.tag=b.SubQuery:t&&t.defaultEditor?i.editor=t.defaultEditor:i.dataType===r.DataType.Date||i.dataType===r.DataType.DateTime||i.dataType===r.DataType.Time?i.editor.tag=b.DateTime:i.editor.tag=b.Edit),i},e.prototype.getAggrFunctions=function(){return this.aggrFunctions},e.prototype.isDateMacro=function(t,e){var n=t.match(/\${{?(.*?)}?}/);if(null!=n){var o=n[1];if(r.utils.indexOfArrayItem(this.dateMacros,o)>=0)return e&&e(o),!0}return!1},e.prototype.isTimeMacro=function(t,e){var n=t.match(/\${{?(.*?)}?}/);if(null!=n){var o=n[1];if(r.utils.indexOfArrayItem(this.timeMacros,o)>=0)return e&&e(o),!0}return!1},e.prototype.getDateMacroValue=function(t){var e=new Date;return this.isDateMacro(t,(function(t){switch(t){case"Today":break;case"Yesterday":e.setDate(e.getDate()-1);break;case"Tomorrow":e.setDate(e.getDate()+1);break;case"FirstDayOfMonth":e.setDate(1);break;case"LastDayOfMonth":e.setMonth(e.getMonth()+1,0);break;case"FirstDayOfPrevWeek":n=0==(n=e.getDay())?1:8-n,e.setDate(e.getDate()-n);break;case"FirstDayOfWeek":n=0==(n=e.getDay())?6:n-1,e.setDate(e.getDate()-n);break;case"FirstDayOfYear":e.setMonth(0,1);break;case"FirstDayOfNextWeek":var n;n=0==(n=e.getDay())?1:8-n,e.setDate(e.getDate()+n);break;case"FirstDayOfNextMonth":e.setMonth(e.getMonth()+1,1);break;case"FirstDayOfPrevMonth":e.setMonth(e.getMonth()-1,1);break;case"FirstDayOfPrevYear":e.setFullYear(e.getFullYear()-1,0,1);break;case"FirstDayOfNextYear":e.setFullYear(e.getFullYear()+1,0,1)}}))?e:null},e.prototype.getDateOrMacroValue=function(t){var e=this.getDateMacroValue(t);return e||t},e.prototype.getTimeMacroValue=function(t){var e=new Date;return this.isDateMacro(t,(function(t){switch(t){case"Now":break;case"HourStart":e.setMinutes(0,0,0);break;case"Midnight":e.setHours(0,0,0,0);break;case"Noon":e.setHours(12,0,0,0)}}))?e:null},e.prototype.getTimeOrMacroValue=function(t){var e=this.getTimeMacroValue(t);return e||t},e.prototype.getAllDateMacros=function(){return this.dateMacros},e.prototype.getAllTimeMacros=function(){return this.timeMacros},e}(r.MetaData),k=function(){function t(t){var e=this;this.parent=t,this.tag=p.Constant,this.kind=l.Scalar,this.dataType=r.DataType.Unknown,this._value="",this.distinct=!1,this._isDefaultValue=!1,this.getText=function(){return e.text||e._value},this.args=new Array}return t.prototype.getParent=function(){return this.parent},t.prototype.getModel=function(){return this.parent.getQuery().getModel()},t.prototype.loadFromData=function(e,n){if(n)if(this.tag=n.tag,n.val?(this._value=n.val,this.text=n.txt):n.id&&(this.kind=l.Attribute,this._value=n.id,this.text=n.txt),void 0!==n.dtype&&(this.dataType=n.dtype),this.tag==p.EntityAttribute||this.tag==p.ParentEntityAttribute)this.kind=l.Attribute;else{if(void 0!==n.kind&&(this.kind=n.kind),n.query&&(this.subQuery=this.parent.getQuery().createSubQuery(),this.subQuery.loadFromDataOrJson(n.query)),void 0!==n.distinct&&(this.distinct=n.distinct),n.func&&(this.func=n.func,n.args))for(var o=0;o<n.args.length;o++){var i=new t(this.parent);i.loadFromData(e,n.args[o]),this.args.push(i)}n.sql&&(this.sql=n.sql,this.baseAttrId=n.baseAttrId)}},t.prototype.saveToData=function(){var t={tag:this.tag};if(t.dtype=this.dataType,this.tag==p.EntityAttribute||this.tag==p.ParentEntityAttribute)this._value&&(t.id=this._value,t.val=this._value),this.text&&(t.txt=this.text);else{if(this.subQuery&&(t.query=this.subQuery.toJSONData()),void 0!==this.kind&&(t.kind=this.kind),this._value&&(t.val=this._value),this.text&&(t.txt=this.text),this.distinct&&(t.distinct=this.distinct),this.func){t.func=this.func,t.args=[];for(var e=0;e<this.args.length;e++)t.args.push(this.args[e].saveToData())}this.sql&&(t.sql=this.sql,t.baseAttrId=this.baseAttrId)}return t},t.prototype.getIndex=function(){return this.parent.getExpressionIndex(this)},Object.defineProperty(t.prototype,"value",{get:function(){return this._value},enumerable:!1,configurable:!0}),t.prototype.setValue=function(t,e){void 0===e&&(e=!1),this.setContent(t,void 0,e)},t.prototype.setContent=function(t,e,n){void 0===n&&(n=!1);var o=this.value;if(this.kind==l.Attribute&&t){var i=this.getModel().getAttributeById(t);if(!i)throw"No such entity attribute:"+t;this.dataType=i.dataType}this._value=t,void 0!==e?this.text=e:void 0!==this.text&&(this.text=t),this._isDefaultValue=!1,n||this.parent.expressionChanged(this,o)},t.prototype.isEmpty=function(){return!(this.text||this._value)},t.prototype.hasText=function(){return this.text&&this.text.length>0},t.prototype.tryCopyValueFrom=function(t){if(this.kind==t.kind){if(this.dataType==t.dataType)this.setContent(t.value.length?t.value:this._value,t.text&&t.text.length?t.text:this.text,!0);else{var e=o.convertValue(t.value,t.dataType,this.dataType);this.setContent(e.length?e:this._value,t.text&&t.text.length?t.text:this.text,!0)}this.subQuery=t.subQuery,this.sql=t.sql,this.baseAttrId=t.baseAttrId}else this._isDefaultValue||(this.setContent("","",!0),this.subQuery=null,this.sql=null,this.baseAttrId=null)},t}();!function(t){t[t.Conditions=1]="Conditions",t[t.Columns=2]="Columns",t[t.SortingColumns=4]="SortingColumns",t[t.Properties=32]="Properties",t[t.ExtraData=64]="ExtraData",t[t.Facets=128]="Facets",t[t.Aggregation=256]="Aggregation",t[t.All=511]="All"}(x||(x={})),function(t){t[t.Add=1]="Add",t[t.Modify=2]="Modify",t[t.Delete=4]="Delete",t[t.Activate=8]="Activate",t[t.All=127]="All"}(w||(w={})),function(t){t[t.None=0]="None",t[t.Ascending=1]="Ascending",t[t.Descending=2]="Descending"}(E||(E={}));var M,I,B=function(){function t(t,e){void 0===e&&(e=!1),this.query=t,this.justsorted=e,this.enabled=!0,this.params=[],this._isHidden=!1,this.query=t,this._id=r.utils.generateId("col"),this.caption="",this._sorting=E.None,this._sortIndex=-1,this.expr=new k(this),this.blockId="",this.justsorted=e}return Object.defineProperty(t.prototype,"id",{get:function(){return this._id},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sorting",{get:function(){return this.query?this.query.getColumnSorting(this):this._sorting},set:function(t){this.query?this.query.setColumnSorting(this,t):this._sorting=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sortIndex",{get:function(){return this.query?this.query.getColumnSortIndex(this):this._sortIndex},set:function(t){this.query?this.query.setColumnSortIndex(this,t):this._sortIndex=t},enumerable:!1,configurable:!0}),t.prototype.getModel=function(){return this.query.getModel()},t.prototype.getQuery=function(){return this.query},t.prototype.isReadOnly=function(){return!1},t.prototype.isJustSorted=function(){return this.justsorted},t.prototype.setReadOnly=function(t){},t.prototype.isHidden=function(){return this._isHidden},t.prototype.setHidden=function(t){this._isHidden=t},t.prototype.getDataType=function(){if(this.expr.dataType===r.DataType.Unknown){var t=null;if(this.expr.func){if("COUNT"==this.expr.func||"CNTDST"==this.expr.func)return r.DataType.Int64;t=this.expr.args[0].value}else t=this.expr.value;var e=this.query.getModel().getAttributeById(t);if(e)return e.dataType}return this.expr.dataType},t.prototype.loadFromData=function(t,e){e&&(e.id&&(this._id=e.id),this.caption=e.cptn,void 0!==e.srt&&(this._sorting=e.srt,this._sortIndex=void 0!==e.srtidx?e.srtidx:-1),!1===e.enabled&&(this.enabled=e.enabled),this.expr.loadFromData(t,e.expr),this.blockId=e.blockId,this.displayFormat=e.dfmt,this.groupFooterColumnTemlate=e.gfct,e.hidden&&this.setHidden(!0))},t.prototype.saveToData=function(){var t={};return t.id=this._id,void 0!==this.caption&&(t.cptn=this.caption),this.sorting!=E.None&&(t.srt=this.sorting,t.srtidx=this.sortIndex),t.expr=this.expr.saveToData(),this.blockId&&(t.blockId=this.blockId),!1===this.enabled&&(t.enabled=this.enabled),t.dfmt=this.displayFormat,t.gfct=this.groupFooterColumnTemlate,this.isHidden()&&(t.hidden=!0),t},t.prototype.fireChangedEvent=function(){this.query.fireChangedEvent({part:this.justsorted?x.SortingColumns:x.Columns,action:w.Modify,changee:this})},t.prototype.getExpressionIndex=function(t){return 0},t.prototype.expressionChanged=function(t,e){},t}();!function(t){t[t.Unknown=0]="Unknown",t[t.Simple=1]="Simple",t[t.Group=51]="Group"}(M||(M={})),function(t){t[t.EntityAttr=2]="EntityAttr",t[t.Operator=4]="Operator",t[t.Value=8]="Value",t[t.All=14]="All"}(I||(I={}));var A,_,P=function(){function t(t,e){this.query=t,this.linkType=n.All,this.parent=null,this._id=r.utils.generateId("cond"),this.justAdded=!1,this.tag=e||M.Unknown,this.enabled=!0,this.operatorId="",this.blockId="",this.expressions=new Array,this.conditions=new Array}return Object.defineProperty(t.prototype,"id",{get:function(){return this._id},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enabled",{get:function(){return this._enabled&&(!this.getParent()||this.getParent().enabled)},set:function(t){this._enabled=t&&(!this.getParent()||this.getParent().enabled),this.conditions&&this.conditions.forEach((function(e){e.enabled=t}))},enumerable:!1,configurable:!0}),t.prototype.getQuery=function(){return this.query},t.prototype.getModel=function(){return this.query.getModel()},t.prototype.getParent=function(){return this.parent},t.prototype.setParent=function(t){this.parent=t},t.prototype.getConditions=function(){return this.conditions},t.prototype.isEmpty=function(){return 0===this.conditions.length},t.prototype.isGroup=function(){return this.tag==M.Group||null==this.parent},t.prototype.getLevel=function(){var t=this.getParent();return t?t.getLevel()+1:0},t.prototype.isReadOnly=function(){return!1},t.prototype.setReadOnly=function(t){},t.prototype.isParameterized=function(){return!1},t.prototype.setParameterized=function(t){},t.prototype.isInJoin=function(){return!1},t.prototype.setInJoin=function(t){},t.prototype.clearConditions=function(){this.conditions=[]},t.prototype.addCondition=function(t){return t.setParent(this),this.conditions.push(t)},t.prototype.removeConditionAt=function(t){this.conditions.splice(t,1)},t.prototype.loadFromData=function(t,e){if(e){if(this.tag=e.tag,this.tag||(this.tag=!this.parent||this.conditions.length>0?M.Group:M.Simple),void 0!==e.enabled&&(this.enabled=e.enabled),void 0!==e.disabled&&(this.enabled=!e.disabled),this.tag==M.Simple&&(this.operatorId=e.op,e.exprs))for(var n=0;n<e.exprs.length;n++){var o=new k(this);o.loadFromData(t,e.exprs[n]),this.expressions.push(o)}this.linkType=e.linking}},t.prototype.saveToData=function(){var t={};if(t.tag=this.tag,this.enabled||(t.enabled=this.enabled),this.tag==M.Simple){t.op=this.operatorId,t.exprs=[];for(var e=0;e<this.expressions.length;e++)t.exprs.push(this.expressions[e].saveToData())}return this.tag==M.Group&&(t.linking=this.linkType),t},t.prototype.fireChangedEvent=function(t){void 0===t&&(t=I.All),this.query.fireChangedEvent({part:x.Conditions,action:w.Modify,changee:this,condPart:t})},t.prototype.getExpressionIndex=function(t){return this.expressions.indexOf(t,0)},t.prototype.expressionChanged=function(t,e){0==t.getIndex()&&t.tag==p.EntityAttribute&&this.tuneOperatorForAttr(t.value)},t.prototype.getOperatorId=function(){return this.operatorId},t.prototype.setOperatorId=function(t,e){void 0===e&&(e=!1);var n=this.operatorId;if(this.operatorId=t,!e){var o=this.getModel(),i=o.getOperatorById(t),r=this.expressions[0].value,s=o.getAttributeById(r);this.tuneValueExpressions(s,i,s.id,n)}},t.prototype.tuneOperatorForAttr=function(t){var e=this.getModel(),n=this.expressions[0].value,o=e.getAttributeById(n);if(null!=o){var i=this.getModel().getDefaultOperatorForAttr(o),r=this.operatorId;this.operatorId=i.id,this.tuneValueExpressions(o,i,t,r)}},t.prototype.tuneValueExpressions=function(t,e,n,o){var i=this.getModel();if(e){var s=this.expressions.length,a=(n&&i.getAttributeById(n),null);if(o&&(a=i.getOperatorById(o)),a&&a.paramCount==e.paramCount){for(var l=1;l<e.paramCount;){var u=i.getOperand(t,a,l);(g=i.getOperand(t,e,l)).dataType==r.DataType.Unknown&&(g.dataType=t.dataType);var c=g.editor&&g.editor.tag!==r.EditorTag.Unknown?g.editor:t.defaultEditor&&t.defaultEditor.tag!==r.EditorTag.Unknown?t.defaultEditor:new h;if(l>=s){var d=this.createValueExpr(g);this.expressions.push(d)}else{var p=this.expressions[l],f=this.createValueExpr(g);this.areCompitableEditors(u.editor,c)&&f.tryCopyValueFrom(p),this.expressions[l]=f}l++}s>l&&this.expressions.splice(l,s-l)}else{this.expressions.splice(1,this.expressions.length-1);for(l=1;l<e.paramCount;l++){var g;(g=i.getOperand(t,e,l)).dataType==r.DataType.Unknown&&(g.dataType=t.dataType);d=this.createValueExpr(g);this.expressions.push(d)}}}},t.prototype.areCompitableEditors=function(t,e){return e.tag!=b.CustomList&&e.tag!=b.List&&e.tag!=b.SqlList&&e.tag!=r.EditorTag.Unknown},t.prototype.addExpressionByOperand=function(t,e){void 0===e&&(e=null);var n=this.createValueExpr(t,e);return this.expressions.push(n),n},t.prototype.createValueExpr=function(t,e){void 0===e&&(e=null);var n=null==e,o=e||t.defValue,i=e||t.defText,r=new k(this);if(t.kind===l.Query)r.tag=p.Query,r.dataType=t.dataType,r.kind=t.kind,r.setContent(o,i,!0);else if(t.kind===l.Attribute){if(!n){var s=this.getModel().getFirstAttributeByFilter((function(e){return 1==e.useInConditions&&(!t.dataType||e.dataType==t.dataType)}));o=s?s.id:null}r.tag=p.EntityAttribute,r.kind=t.kind,r.dataType=t.dataType,r.setContent(o,i,!0)}else n&&(o=t.defValue&&""!=t.defValue?t.defValue:t.editor&&t.editor.defValue?t.editor.defValue:"",t.editor&&(i=t.editor.getValueText(o))),r.tag=p.Constant,r.dataType=t.dataType,r.kind=t.kind,r.setContent(o,i,!0),r._isDefaultValue=n;return r},t}(),O=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),L=function(t){function e(n){var o=t.call(this,n)||this;return Error.captureStackTrace&&Error.captureStackTrace(o,e),o.name="InvalidQueryError",o}return O(e,t),e}(Error),R=function(){function t(t,e,n){var o=this;this.extraData={},this.innerData={},this.isNewbie=!0,this._isModified=!1,this._enableAggregation=!1,this.parentQuery=null,this.drillDowns=[],this.syncSortOrderWithColumnsOrder=!0,n&&(this.context=n.context,this.context&&(this.syncSortOrderWithColumnsOrder=this.context.options.syncSortOrderWithColumnsOrder)),this.eventEmitter=new r.EventEmitter(this),this.root=new P(this,M.Group),this.extraConditions=new P(this,M.Group),this.columns=new Array,this.sortedColumns=new Array,this.id||this.regenerateId(),this.setDefaultName(),this.description="",this.model=t||new S,e&&this.loadFromData(e),this.attributeExprTag=n&&n.attrTag||p.EntityAttribute,this.clientListRequestHandler=n?n.clientListRequestHandler:new Array,this.serverListRequestHandler=n?n.serverListRequestHandler:new Array,this.timezoneOffset=(new Date).getTimezoneOffset(),this.aggrSettings=new r.AggregationSettings(this),n&&(this.parentQuery=n.parent),this.addChangedCallback((function(t){t.data&&(t.data.part&x.Columns)>0&&!t.data.aggregation&&o._enableAggregation&&o.updateAggregationSettings()&&o.fireChangedEvent({part:x.Aggregation})}))}return t.prototype.isModified=function(){return this._isModified},t.prototype.resetModified=function(){this._isModified=!1},Object.defineProperty(t.prototype,"enableAggregation",{get:function(){return this._enableAggregation},set:function(t){var e=this._enableAggregation;if(this._enableAggregation=t,!e&&t){this.processQueryForAggregation();this.columns.filter((function(t){return t.enabled&&t.expr.tag==p.AggregateFunction}))}this._enableAggregation||this.aggrSettings.clear()},enumerable:!1,configurable:!0}),t.prototype.updateAggregationSettings=function(){for(var t=!1,e=this.getAggregationSettings(),n=e.groups.length-1;n>=0;n--){for(var o=e.groups[n],i=function(e){var n=o.columns[e];r.columns.find((function(t){return t.id===n}))||(o.columns.splice(e,1),t=!0)},r=this,s=o.columns.length-1;s>=0;s--)i(s);0==o.columns.length&&e.groups.slice(n,1)}var a=e.getAggregates(),l=function(e){var n=a[e];u.columns.find((function(t){return t.id===n.colId}))||(a.splice(e,1),t=!0)},u=this;for(n=a.length-1;n>=0;n--)l(n);return t},t.prototype.createSubQuery=function(){return new t(this.model,null,{context:this.context})},t.prototype.useAggregation=function(t,e){if(void 0===e&&(e=!1),this.aggrSettings.clear(),t(this.aggrSettings),this.enableAggregation)this.processQueryForAggregation(e);else if(!e)return void console.warn("Aggregation is turned off. Turn it on with query.enableAggregation = true")},t.prototype.useDefaultAggregation=function(){var t=this;this._enableAggregation=!0,this.useAggregation((function(e){var n=t.columns.filter((function(t){return t.enabled&&t.expr.tag==p.AggregateFunction}));if(n.length){for(var o=t.columns.filter((function(t){return t.enabled&&t.expr.tag==p.EntityAttribute})),i=[],s=0,a=n;s<a.length;s++){var l=a[s];i.push({id:l.id,func:l.expr.func}),t.changeColumnType(l,p.EntityAttribute)}for(var u=0,c=i;u<c.length;u++){var d=c[u];e.addAggregateColumn(d.id,d.func)}for(var h=0,f=o;h<f.length;h++){l=f[h];e.addGroup({columns:[l.id],name:l.caption})}e.addGrandTotals(),t.fireChangedEvent({part:x.Columns,wasModified:!1})}else{var g=t.getColumns().filter((function(e){return e.enabled&&e.expr.tag==p.EntityAttribute&&t.model.getAttributeById(e.expr.value).dataType===r.DataType.Currency}))[0],y=t.getColumns().filter((function(e){return e.enabled&&e.expr.tag==p.EntityAttribute&&t.model.getAttributeById(e.expr.value).dataType===r.DataType.String}))[0];if(!g&&!e.hasAggregates()||!y)return;e.addGrandTotals().addAggregateColumn(g.id,"SUM").addGroup({columns:[y.id],name:"Default"})}}))},t.prototype.processQueryForAggregation=function(t){var e=this;void 0===t&&(t=!1);var n=this.getAggregationSettings().getGroups();if(n.length>0){for(var o=n[n.length-1].columns,i=[],r=[],s=0,a=this.getColumns();s<a.length;s++){var l=a[s];o.indexOf(l.id)>=0?i.push(l):this.getColumnSorting(l)!=E.None&&r.push(l)}var u=0;i.forEach((function(t){e.getColumnSorting(t)==E.None&&e.setColumnSorting(t,E.Ascending),e.setColumnSortIndex(t,u++)})),r.forEach((function(t){e.setColumnSortIndex(t,u++)})),t||this.fireChangedEvent({part:x.Columns,aggregation:!0,wasModified:!1})}},t.prototype.getAggregationSettings=function(){return this.aggrSettings},t.prototype.getColumnIds=function(t,e){return e=e||t,this.columns.slice(t,e-t+1).map((function(t){return t.id}))},t.prototype.validateColumns=function(t){for(var e=this.columns.filter((function(t){return t.enabled})).map((function(t){return t.id})),n=-1,o=0,i=t;o<i.length;o++){var r=i[o],s=e.indexOf(r);if(s<0)return!1;if(n>s)return!1;n=s}return!0},t.prototype.validateAggregate=function(t,e){var n=this.columns.filter((function(e){return e.enabled&&e.id===t}))[0],o=this.model.findAggrFunctionById(e);return!(!o||!n||o.appliedTypes.indexOf(n.expr.dataType)<0)},t.prototype.isEx=function(){return!1},t.prototype.reset=function(t){void 0===t&&(t=!0),t&&this.clear(),this.regenerateId(),this.setDefaultName(),this._isModified=!1,this.isNewbie=!0},t.prototype.hasEnabledAggrColumns=function(){return this.columns.filter((function(t){return t.enabled&&t.expr.tag===p.AggregateFunction})).length>0},t.prototype.setDefaultName=function(){return this.setName(r.i18n.getText("NewQueryName")),this.getName()},t.prototype.validate=function(t){t=t||{};var e="EntityAttribute isn't declared in the model: ";if(!this.model)throw new L("Model is not declared");if(this.columns)for(var n=0,o=this.columns;n<o.length;n++){var i=o[n];if(i.expr.tag==p.EntityAttribute||i.expr.tag===p.ParentEntityAttribute){if(!this.model.getAttributeById(i.expr.value))throw new L(e+i.expr.value)}else if(i.expr.tag===p.AggregateFunction){if(!this.model.getAttributeById(i.expr.args[0].value))throw new L(e+i.expr.args[0].value)}else if(i.expr.tag===p.Unknown)throw new L("The expression has wrond tag: "+i.expr.tag)}this.root&&this.root.getConditions()&&this.validateConditionGroup(this.root,t)},t.prototype.getAggregatedColumns=function(){return this.getColumns().filter((function(t){return t.enabled&&t.expr.tag===p.AggregateFunction}))},t.prototype.tryValidate=function(t){try{return this.validate(t),!0}catch(t){if(t instanceof L)return!1;throw t}},t.prototype.validateConditionGroup=function(t,e){if(t.isGroup())for(var n=0,o=t.getConditions();n<o.length;n++){var i=o[n];i.enabled&&this.validateConditionGroup(i,e)}else if(t.expressions[0].tag===p.EntityAttribute){var s=t.expressions[0].value;if(!this.model.getAttributeById(s))throw new L("EntityAttribute isn't declared in the model: "+s);if(!e.checkExpressions)return;for(var a=1;a<t.expressions.length;a++){var u=t.expressions[a];if(u.tag===p.Constant&&r.utils.isNumericType(u.dataType)){if(!u.value)continue;for(var c=0,d=u.kind===l.List?u.value.split(/\s*,\s*/):[u.value];c<d.length;c++){var h=d[c],f=+h;if(isNaN(f))throw new L("Expression constant is NaN in condition:"+t.id);if(r.utils.isIntType(u.dataType)&&f!=parseInt(h,10))throw new L("Expression constant is wrong interger in condition: "+t.id)}}}}},t.prototype.loadFromDataOrJson=function(t,e){t&&("string"==typeof t?this.loadFromJson(t,e):this.loadFromData(t,e))},t.prototype.loadFromJson=function(t,e){var n=JSON.parse(t);this.loadFromData(n,e)},t.prototype.loadFromData=function(t,e){var n=this;e=r.utils.assign({changeStatus:!0,validate:!0},e||{});if(this.clear(),this.clearDrillDowns(),t){if(this.id=t.id,this.root.loadFromData(this.model,t.root),t.root&&t.root.conds)for(var o=0;o<t.root.conds.length;o++){var i=t.root.conds[o];if(!i.conds||this.isEx()){var s=this.createCondition();s.loadFromData(this.model,i),this.root.addCondition(s)}else console.error("Community version doesn't support working with groups.")}if(this.name=t.name,this.description=t.desc,this.sortedColumns=[],t.justsortcols)for(o=0;o<t.justsortcols.length;o++){(a=this.createColumn(!0)).loadFromData(this.model,t.justsortcols[o]),this.addColumnToSorted(a)}if(t.cols)for(o=0;o<t.cols.length;o++){var a;(a=this.createColumn()).loadFromData(this.model,t.cols[o]),this.columns.push(a),a._sorting!=E.None&&this.addColumnToSorted(a)}if(this.sortedColumns.sort((function(t,e){return t._sortIndex-e._sortIndex})),this.fixupSortingIndices(),t.extraData&&(this.extraData=t.extraData),this.innerData=t.innerData||this.innerData,this.innerData&&this.innerData.aggr&&(this._enableAggregation=this.innerData.aggr.enabled||!1,this.useAggregation((function(t){t.loadFromData(n.innerData.aggr)}),!0)),t.dds&&t.dds.length)for(var l=0,u=t.dds;l<u.length;l++){var c=u[l];this.addDrillDown().loadFromData(c)}}e.changeStatus&&(this.isNewbie=!1,this._isModified=!1),e.validate&&this.validate()},t.prototype.addDrillDown=function(){var t=this.model.createQuery();return t.parentQuery=this,this.drillDowns.push(t),t},t.prototype.getDrillDowns=function(){return this.drillDowns},t.prototype.getParentQuery=function(){return this.parentQuery},t.prototype.findColumnById=function(t){for(var e=0,n=this.columns;e<n.length;e++){var o=n[e];if(o.id===t)return o}return null},t.prototype.getModel=function(){return this.model},t.prototype.setModel=function(t){this.model=t},t.prototype.loadModelData=function(t){this.model.setData(t)},t.prototype.toJSON=function(){return JSON.stringify(this.toJSONData())},t.prototype.toJSONData=function(){var t=this;this.fixupSortingIndices();var e={modelId:this.model?this.model.getId():null,modelName:this.model?this.model.getName():null};e.id=this.id,e.name=this.name,this.description&&(e.desc=this.description),e.cols=[];for(var n=0;n<this.columns.length;n++)e.cols.push(this.columns[n].saveToData());e.justsortcols=[],this.sortedColumns.forEach((function(t){t.isJustSorted()&&e.justsortcols.push(t.saveToData())})),this.extraData&&(e.extraData=this.extraData),this.innerData&&(e.innerData=this.innerData,e.innerData.aggr=this.aggrSettings.saveToData(),e.innerData.aggr.enabled=this._enableAggregation);var o=function(e){var n=e.saveToData();n.conds=[];for(var o=e.getConditions(),i=0;i<o.length;i++)!o[i].isGroup()||t.isEx()?n.conds.push(o[i].saveToData()):console.error("Community version doesn't support working with groups.");return n};if(e.root=o(this.root),e.extraConds=o(this.extraConditions),this.drillDowns.length>0){e.dds=[];for(var i=0,s=this.drillDowns;i<s.length;i++){var a=s[i];e.dds.push(a.toJSONData())}}return e.timezoneOffset=this.timezoneOffset,e.locale=r.i18n.getCurrentLocale(),e},t.prototype.isEmptyConditions=function(){return this.root.isEmpty()},t.prototype.isEmptyColumns=function(){return!this.columns||0===this.columns.length},t.prototype.isEmpty=function(){return this.isEmptyColumns()&&this.isEmptyConditions()},t.prototype.clear=function(){this._enableAggregation=!1,this.aggrSettings.clear(),this.clearColumns(),this.clearConditions(),this.clearExtraConditions(),this.innerData={},this.extraData={}},t.prototype.clearColumns=function(){this.columns=[],this.sortedColumns=[]},t.prototype.clearConditions=function(){this.root.clearConditions(),this.root.linkType=n.All,this.root.enabled=!0},t.prototype.clearExtraConditions=function(){this.extraConditions.clearConditions()},t.prototype.clearDrillDowns=function(){this.drillDowns=[]},t.prototype.getId=function(){return this.id},t.prototype.setId=function(t){this.id=t},t.prototype.regenerateId=function(){this.id=r.utils.generateId("quer")},t.prototype.getName=function(){return this.name},t.prototype.setName=function(t){this.name=t},t.prototype.getDescription=function(){return this.description},t.prototype.setDescription=function(t){this.description=t},t.prototype.getColumns=function(){return this.columns},t.prototype.getUsedInTotalsColumns=function(){if(0===this.getAggregatedColumns().length)return[];var t=this.getColumns().filter((function(t){return t.enabled&&t.expr.tag===p.EntityAttribute}));return t.length&&t.pop(),t},t.prototype.addColumnToSorted=function(t){var e=JSON.stringify(t.expr.saveToData()),n=!0;this.sortedColumns.forEach((function(t){JSON.stringify(t.expr.saveToData())===e&&(n=!1)})),n&&this.sortedColumns.push(t)},t.prototype.getJustSortedColumns=function(){return this.sortedColumns.filter((function(t){return t.isJustSorted()}))},t.prototype.getSortedColumns=function(){return this.sortedColumns},t.prototype.getColumnSortIndex=function(t){return this.sortedColumns.indexOf(t)},t.prototype.setColumnSortIndex=function(t,e){if(!(e<0)){var n=this.getColumnSortIndex(t);n<0&&(this.addColumnToSorted(t),n=this.sortedColumns.length-1),r.utils.moveArrayItem(this.sortedColumns,n,e),this.fixupSortingIndices(),this.fireColumnsChangedEvent(w.All)}},t.prototype.getColumnSorting=function(t){return this.getColumnSortIndex(t)>=0?t._sorting!=E.None?t._sorting:E.Ascending:E.None},t.prototype.setColumnSorting=function(t,e){var n=this.getColumnSortIndex(t);t._sorting=e,n>=0?e==E.None&&(r.utils.removeArrayItem(this.sortedColumns,t),this.fixupSortingIndices()):e!=E.None&&(this.addColumnToSorted(t),this.fixupSortingIndices()),this.adjustColumnsSorting(),this.fireColumnsChangedEvent(w.Modify,t,t.isJustSorted())},t.prototype.fixupSortingIndices=function(){this.sortedColumns.forEach((function(t,e){t._sortIndex=e}))},t.prototype.adjustColumnsSorting=function(){var t=this;if(this.syncSortOrderWithColumnsOrder&&!(this.getJustSortedColumns().length>0)){var e=0;this.columns.forEach((function(n){if(n.sorting!=E.None){var o=t.getColumnSortIndex(n);o>=0&&(r.utils.moveArrayItem(t.sortedColumns,o,e),e++)}})),this.fixupSortingIndices()}},t.prototype.createColumn=function(t){return void 0===t&&(t=!1),new B(this,t)},t.prototype.getColumnById=function(t){return r.utils.findItemById(this.columns,t)},t.prototype.addColumn=function(t,e){var n;if(t.column)n=t.column;else{n=this.createColumn(t.justsorted);var o=void 0;if(t.attribute)o=t.attribute;else{if(!t.attributeId)throw new Error("Not enought data for addColumn operation. Need attribute or attributeId");if(!(o=this.model.getAttributeById(t.attributeId)))throw new Error("Incorrect attribute id (".concat(t.attributeId,"): addColumn"))}if(!o.useInResult&&(o.lookupAttr&&(o=this.model.getAttributeById(o.lookupAttr)),!o||!o.useInResult))throw new Error("Can't use this attribute for a column");if(t.aggrFuncId&&t.cusomtSql&&console.warn("Column cannot be created using aggrFuncId and customSql at the same time. cusomSql will be used."),t.cusomtSql)n.caption="Custom SQL Column",n.expr.tag=p.CustomSql,n.expr.baseAttrId=o.id,n.expr.sql=t.cusomtSql,n.expr.kind=l.Query,n.expr.dataType=r.DataType.Unknown;else if(t.aggrFuncId){var i=t.aggrFuncId;n.caption=o.caption+" "+this.model.getAggrFunctionCaption(t.aggrFuncId),n.expr.tag=p.AggregateFunction,n.expr.func=t.aggrFuncId,n.expr.kind=l.Scalar,n.expr.dataType="COUNT"==i||"CNTDST"==i?4:o.dataType,n.expr.distinct=!1;var s=new k(n);s.setValue(o.id,!0),s.tag=p.EntityAttribute,s.dataType=o.dataType,n.expr.args.push(s)}else n.caption=o.caption,n.expr.setValue(o.id,!0),n.expr.tag=p.EntityAttribute,n.expr.dataType=o.dataType;n.caption=t.caption||n.caption,n._sorting=t.sorting||E.None,n._sortIndex=t.sortIndex||-1,n.enabled=r.utils.getIfDefined(t.enabled,!0),n.setReadOnly(r.utils.getIfDefined(t.readonly,!1))}var a=t.justsorted||t.column&&t.column.isJustSorted();return a||(t.index&&t.index>=0&&t.index<this.columns.length?this.columns.splice(t.index,0,n):this.columns.push(n)),this.setColumnSorting(n,n._sorting),this.fireColumnsChangedEvent(w.Add,n,a),n},t.prototype.addColumnObj=function(t,e,n){var o=this,i=this.columns;void 0===t.length?("number"==typeof e?i.splice(e,0,t):i.push(t),t.sorting!=E.None&&this.addColumnToSorted(t),this.fixupSortingIndices()):("number"==typeof e?i.push.apply(i,[e,0].concat(t)):i.push.apply(i,[].concat(t)),t.forEach((function(t){t.sorting!=E.None&&o.addColumnToSorted(t)})),this.fixupSortingIndices())},t.prototype.changeColumnType=function(t,e,n){if(!t.isJustSorted())if(n=n||{},t.caption=void 0!==n.caption?n.caption:"",e===p.AggregateFunction){if(!n.funcId)throw Error('"funcId" argument is not defined');if(t.expr.tag==p.AggregateFunction)return void(t.expr.func=n.funcId);(l=new k(t)).tag=p.AggregateFunction,l.func=n.funcId,l.distinct=!1,l.dataType="COUNT"==n.funcId||"CNTDST"==n.funcId?4:t.expr.dataType;var o=new k(t);o.loadFromData(this.model,t.expr.saveToData()),l.args.push(o),t.expr=l}else if(e===p.CustomSql){var i=t.expr.tag==p.AggregateFunction?t.expr.args[0].value:t.expr.value,s="";this.model&&(s=this.model.getAttributeById(i).expr);var a=new k(t);a.tag=p.CustomSql,a.dataType=r.DataType.String,a.sql=s,a.baseAttrId=i,t.expr=a}else if(e===p.EntityAttribute){if(t.expr.tag===p.EntityAttribute||t.expr.tag===p.ParentEntityAttribute)return;var l,u=t.expr.tag===p.CustomSql?t.expr.baseAttrId:t.expr.args[0].value,c=this.model.getAttributeById(u);(l=new k(t)).tag=p.EntityAttribute,l.dataType=null!=c?c.dataType:r.DataType.Unknown,l.setValue(u,!0),t.expr=l}},t.prototype.moveColumn=function(t,e){var n=this.getColumns();r.utils.moveArrayItem(n,t,e),this.adjustColumnsSorting()},t.prototype.removeColumn=function(t,e){r.utils.removeArrayItem(this.columns,t),r.utils.removeArrayItem(this.sortedColumns,t)},t.prototype.addConditionGroup=function(t,e){return void 0===e&&(e=!0),console.error("Community version doesn't support working with groups."),null},t.prototype.addExtraConditionGroup=function(t,e){return void 0===e&&(e=!0),console.error("Community version doesn't support working with groups."),null},t.prototype.createCondition=function(t){return void 0===t&&(t=M.Simple),new P(this,t)},t.prototype.addSimpleCondition=function(t){var e=t.parent||this.getRootCondition(),n=this.getModel();if(!n)return null;if(!t.attribute&&!t.attributeId)throw new Error("Either `attribute` or `attributeId` parameter must have a value");if(!t.attribute&&(t.attribute=n.getAttributeById(t.attributeId),!t.attribute))throw new Error("Could not find this attribute: "+t.attributeId);!t.operator&&t.operatorId&&(t.operator=n.getOperatorById(t.operatorId)),t.operator||(t.operator=n.getDefaultOperatorForAttr(t.attribute));var o=this.createSimpleConditionObject(t.attribute,t.operator,t.value);return e.addCondition(o),o.enabled=r.utils.getIfDefined(t.enabled,!0),o.setReadOnly(r.utils.getIfDefined(t.readonly,!1)),o},t.prototype.addSimpleExtraCondition=function(t){return t.parent=t.parent||this.extraConditions,this.addSimpleCondition(t)},t.prototype.createSimpleConditionObject=function(t,e,n){if(!t||!t.useInConditions)throw"Can't add a condition with such attribute: "+(t?t.caption:"NULL");var o=this.createCondition(M.Simple);o.setOperatorId(e.id,!0);var i=new k(o);i.setValue(t.id,!0),i.tag=this.attributeExprTag,i.kind=l.Attribute,i.dataType=t.dataType,o.expressions.push(i);var s=this.getModel(),a=e.paramCount,u=r.utils.fillArray(new Array(a-1),null);null!=n&&(Array.isArray(n)?r.utils.copyArrayTo(n,u):a>0&&(u[0]=n));for(var c=u.length,d=0;d<c;d++){var h=s.getOperand(t,e,d+1);o.addExpressionByOperand(h,u[d])}return o},t.prototype.removeColumns=function(t,e){var n=t.filter((function(t){return t.isJustSorted()})),o=t.filter((function(t){return!t.isJustSorted()}));function i(t,e){for(var n=e.length,o=0;o<n;o++){var i=t.indexOf(e[o]);i>=0&&t.splice(i,1)}}o.length>0&&(i(this.getColumns(),o),i(this.sortedColumns,o)),n.length>0&&i(this.sortedColumns,n),this.fixupSortingIndices()},t.prototype.fireProcessEvent=function(t){this.eventEmitter.fire("query.process",t)},t.prototype.fireChangedEvent=function(t,e,n){t=t||{part:x.All},void 0===e&&void 0===n||(t.postpone=e||0,t.wasModified=n,console.warn("Method with 'postpone' and 'wasModified' args is deprecated. Pass params in data object")),this._isModified=void 0===t.wasModified||t.wasModified;var o=t||{part:x.All};this.eventEmitter.fire("query.change",o,t.postpone||0)},t.prototype.fireColumnsChangedEvent=function(t,e,n){void 0===n&&(n=!1),this.fireChangedEvent({part:n?x.SortingColumns:x.Columns,action:t,changee:e})},t.prototype.fireConditionsChangedEvent=function(t,e){this.fireChangedEvent({part:x.Conditions,action:t,changee:e})},t.prototype.runThroughConditions=function(t){var e=function(n){for(var o=0;o<n.getConditions().length;o++){var i=n.getConditions()[o];i.isGroup()?e(i):t&&t(i)}};e(this.getRootCondition())},t.prototype.getOneValueForAttr=function(t){var e=null;return this.runThroughConditions((function(n){if(n.enabled){var o=n.expressions[0],i=n.getOperatorId();o.value!=t||!n.expressions[1]||"Equal"!=i&&"InList"!=i&&"StartsWith"!=i||(e=n.expressions[1].value)}})),e},t.prototype.getRootCondition=function(){return this.root},t.prototype.addProcessCallback=function(t){return this.eventEmitter.subscribe("query.process",t)},t.prototype.removeProcessCallback=function(t){this.eventEmitter.unsubscribe("query.process",t)},t.prototype.addChangedCallback=function(t){return this.eventEmitter.subscribe("query.change",t)},t.prototype.removeChangedCallback=function(t){this.eventEmitter.unsubscribe("query.change",t)},t.prototype.getConditionsText=function(){var t=this,e=this.getModel();if(!e)return"";var i=function(s){var a,u,c="",d="Conj"+o.linkTypeToStr(s.linkType),h=r.i18n.getText(d);for(u=0;u<s.getConditions().length;u++){a="";var f=s.getConditions()[u];if(f.enabled||void 0===f.enabled)if(f.isGroup())(a=i(f))&&(a="("+a+")");else for(var g=f.getOperatorId(),y=e.getOperatorById(g),m=o.parseOperatorFormat(y),v=m.length,C=0;C<v;C++){var b=m[C],x=b.text;if("expression"==b.type){var w=f.expressions[b.index];if(w.kind==l.Attribute||w.tag==p.EntityAttribute){var E=e.getAttributeById(w.value);null!=E&&(x=e.getAttributeText(E,"{entity} {attr}"))}else if(x=w.getText(),t.model.isDateMacro(x)||t.model.isTimeMacro(x)){var T=x.substring(3,x.length-2);x=r.i18n.getText(T)||x}}C>0&&(a+=" "),a+=x}a&&(u>0&&c&&(c+=" "+h+" "),c+=a)}return s.linkType!=n.None&&s.linkType!=n.NotAll||(c="not ( "+c+" )"),c};return i(this.getRootCondition())},t.prototype.getConditionsTextAsHtml=function(){var t=this,e=this.getModel();if(!e)return'<div class="eqjs-query-text"></div>';var i=function(e){if(e.kind==l.Query)return"&lt;".concat(e.getText(),"&gt;");if(e.kind==l.List)return"[".concat(e.getText(),"]");if(e.dataType==r.DataType.String||e.dataType==r.DataType.Memo||e.dataType==r.DataType.FixedChar)return"&quot;".concat(e.getText(),"&quot;");var n=e.getText();if(t.model.isDateMacro(n)||t.model.isTimeMacro(n)){var o=n.substring(3,n.length-2);n=r.i18n.getText(o)||n}return n},s=function(t){var a,u,c="",d="Conj"+o.linkTypeToStr(t.linkType),h='<span class="eqjs-query-text-conj">'.concat(r.i18n.getText(d),"</span>");for(u=0;u<t.getConditions().length;u++){a="";var f=t.getConditions()[u];if(f.enabled||void 0===f.enabled)if(f.isGroup())(a=s(f))&&(a="("+a+")");else for(var g=f.getOperatorId(),y=e.getOperatorById(g),m=o.parseOperatorFormat(y),v=m.length,C=0;C<v;C++){var b=m[C],x=b.text;if("expression"==b.type){var w=f.expressions[b.index];if(w.kind==l.Attribute||w.tag==p.EntityAttribute){var E=e.getAttributeById(w.value);x='<span class="eqjs-query-text-attr">'.concat(e.getAttributeText(E,"{entity} {attr}"),"</span>")}else x='<span class="eqjs-query-text-expr">'.concat(i(w),"</span>")}else"operator"==b.type&&(x='<span class="eqjs-query-text-op">'.concat(x,"</span>"));C>0&&(a+=" "),a+=x}a&&(u>0&&c&&(c+=" "+h+" "),c+=a)}return t.linkType!=n.None&&t.linkType!=n.NotAll||(c='<span class="eqjs-query-text-conj">not</span> ( '+c+" )"),c};return'<div class="eqjs-query-text">'.concat(s(this.getRootCondition()),"</div>")},t}(),F=__webpack_require__(567),q=function(){function t(t){this.context=t,console.warn("BrowserQueryStorage is used for managing queries")}return t.prototype.init=function(t){var e="eq";t&&t.keyPrefix&&(e=t.keyPrefix),this.queryListKey=e+"-querylist",this.queryKeyPrefix=e},t.prototype.getQueryList=function(t){var e=this;return new F((function(t,n){try{var o=localStorage.getItem(e.queryListKey);o&&t(JSON.parse(o)),t([])}catch(t){n(t)}}))},t.prototype.newQuery=function(t){var e=this;return new F((function(n,o){var i=new R(e.context.getModel(),null,{context:e.context});i.reset(),i.setDefaultName(),t&&(t.query&&i.loadFromData(t.query.toJSONData()),t.queryId&&i.setId(t.queryId),t.name&&i.setName(t.name),t.description&&i.setDescription(t.description)),e._saveQuery(i),n(i.toJSONData())}))},t.prototype.loadQuery=function(t){var e=this;return new F((function(n,o){try{var i=localStorage.getItem(e.queryKeyPrefix+"-"+t.queryId);throw i&&n(JSON.parse(i)),new Error("Query is not found: "+t.queryId)}catch(t){o(t)}}))},t.prototype.saveQuery=function(t){var e=this;return new F((function(n,o){try{t.modelId||e.context.getModel().getId();var i=t.query||e.context.getQuery();e._saveQuery(i),n(null)}catch(t){o(t)}}))},t.prototype._saveQuery=function(t){var e=[],n=localStorage.getItem(this.queryListKey);n&&(e=JSON.parse(n));var o=r.utils.findItemById(e,t.getId());o||(o={id:t.getId(),name:t.getName(),text:t.getDescription()},e.push(o)),o.name=t.getName(),o.text=t.getDescription(),localStorage.setItem(this.queryListKey,JSON.stringify(e)),localStorage.setItem(this.queryKeyPrefix+"-"+t.getId(),t.toJSON())},t.prototype.removeQuery=function(t){var e=this;return new F((function(n,o){try{t.modelId||e.context.getModel().getId();var i=t.queryId||e.context.getQuery().getId(),r=[],s=localStorage.getItem(e.queryListKey);s&&(r=JSON.parse(s)),r=r.filter((function(t){return t.id!=i})),localStorage.setItem(e.queryListKey,JSON.stringify(r)),localStorage.removeItem(e.queryKeyPrefix+"-"+i),n()}catch(t){o(t)}}))},t}(),Q=__webpack_require__(567),N=function(){function t(t){this.context=t,this.modelPromise=null}return t.prototype.init=function(t){},t.prototype.getContext=function(){return this.context},t.prototype.createModelLoadingPromise=function(){var t=this;this.modelPromise=new Q((function(e,n){t.modelLoadingResolveFunc=e,t.modelLoadingRejectFunc=n}))},t.prototype.getModelPromise=function(){return this.modelPromise||Q.reject(new Error("Model has been never loaded."))},t.prototype.startModelLoading=function(t){return this.createModelLoadingPromise(),this.sendLoadModelRequest(t),this.modelPromise},t}(),j=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),H=function(t){function e(e){return t.call(this,e)||this}return j(e,t),e.prototype.init=function(){},e.prototype.sendLoadModelRequest=function(t){var e=this,n=this.getContext(),o=n.getServices().getHttpClient(),i=n.resolveEndpoint("GetModel",{modelId:t.modelId});o.get(i).then((function(t){t.model||e.modelLoadingRejectFunc(new Error('Wrong response format for "GetModel" request')),e.modelLoadingResolveFunc(t.model)})).catch((function(t){e.modelLoadingRejectFunc(t)}))},e}(N),W=function(){function t(t){this.context=t}return t.prototype.fetchData=function(t){var e=t.query||this.context.getQuery(),n=e.getId(),o={options:t.options};void 0!==t.queryId?o.queryId=t.queryId:o.query=e.toJSONData(),t.debug&&(o.debug=t.debug),t.chunk&&(o.chunk=t.chunk),t.data&&(o.data=t.data),void 0!==t.aux&&(o.aux=t.aux);var i=this.context.resolveEndpoint("FetchData",{modelId:e.getModel().getId(),queryId:n});return this.context.getServices().getHttpClient().post(i,o).then((function(t){return t}))},t}(),G=function(){function t(t){this.context=t}return t.prototype.syncQuery=function(t){var e=(t=t||{}).query||this.context.getQuery(),n=t.options||{},o={query:e.toJSONData(),options:n};t.data&&(o.data=t.data);var i=this.context.resolveEndpoint("SyncQuery",{modelId:e.getModel().getId(),queryId:e.getId()});return this.context.getServices().getHttpClient().post(i,o).then((function(t){return t}))},t}(),z=function(){function t(t){this.context=t}return t.prototype.loadValueList=function(t){var e=t.modelId||this.context.getModel().getId(),n=r.utils.assign({modelId:e},t.params).editorId,o=this.context.getServices().getHttpClient(),i=this.context.resolveEndpoint("GetValueList",{modelId:e,listId:n}),s={};return t&&t.params&&t.params.queryParams&&(s=t.params.queryParams),o.get(i,{queryParams:s}).then((function(t){if(t&&t.values)return t.values;throw new Error('Wrong response format. No "values" property')}))},t}(),V=function(){function t(t){this.context=t}return t.prototype.getQueryFile=function(t){var e=t.query||this.context.getQuery(),n=this.context.resolveEndpoint("GetQueryFile",{modelId:e.getModel().getId(),format:t.format||"xml"}),o=this.context.getServices().getHttpClient().post(n,{query:e.toJSONData()}),i=o.getRequest();return o.then((function(e){var n=new Blob([e]),o=i.getXMLHttpRequest().getResponseHeader("Content-Disposition"),r=o?o.match(/filename="(.*)"/)[1]:"query.json";if(t.fileName&&(r=t.fileName+r.substring(r.lastIndexOf("."))),window.navigator.msSaveOrOpenBlob)window.navigator.msSaveOrOpenBlob(n,r);else{var s=document.createElement("a");document.body.appendChild(s),s.style.display="none",s.href=window.URL.createObjectURL(n),s.download=r,s.click(),window.URL.revokeObjectURL(s.href),document.body.removeChild(s)}}))},t.prototype.uploadQueryFile=function(t){var e=(t=t||{}).query||this.context.getQuery(),n=this.context.resolveEndpoint("UploadQueryFile",{modelId:e.getModel().getId()});return this.context.getServices().getHttpClient().post(n,t.data,{dataType:"form-data"}).then((function(t){return t.query}))},t}(),U=__webpack_require__(567),Y=function(){function t(t){this.context=t,this.levels={}}return t.prototype.getAggregateData=function(t,e){var n=this;return new U((function(o,i){var r=function(t){var r=n.groupKeyToStr(e),s=t.get(r);s?o(s):i("Can't find data for ".concat(r))},s=n.getLevelDesc(t,!1);s&&s.data?r(s.data):s.receivedCallbacks.push(r)}))},t.prototype.setAggregateData=function(t,e){var n=this.getLevelDesc(t,!0);if(n.data=e,n.receivedCallbacks)for(var o=0,i=n.receivedCallbacks;o<i.length;o++){(0,i[o])(n.data)}n.receivedCallbacks=[]},t.prototype.updateAggregateData=function(t,e,n){var o=this.getLevelDesc(t,!0),i=this.groupKeyToStr(e);o.data.set(i,n)},t.prototype.groupKeyToStr=function(t){return JSON.stringify(t)},t.prototype.getLevelDesc=function(t,e){var n=this.levels[t];return!n&&e&&(n={receivedCallbacks:[],data:new Map},this.levels[t]=n),n},t.prototype.clear=function(){this.levels=[]},t}(),J=function(){function t(t){this.context=t,this.aggrs=null}return t.prototype.getAggrContainer=function(){return this.aggrs},t.prototype.calculate=function(t){console.warn("Grand totals and sub totals aggregation calculation can be used in Enterprise version only"),(t=t||{}).maxLevel=t.maxLevel>=0?t.maxLevel:0,this.aggrs=new Y(this.context);var e=this.context.createQuery();e.loadFromData(this.context.getQuery().toJSONData());for(var n=this.context.getQuery().getAggregationSettings(),o=n.getAggregates().map((function(t){return t.colId})),i=e.getColumns().filter((function(t){return o.indexOf(t.id)<0})),r=0;r<i.length;r++)i[r].enabled=!1;n.hasGrandTotals()&&(this.aggrs.setAggregateData(0,new Map),t.resultObtained&&t.resultObtained({},0));for(var s=n.getGroups(),a=1;a<=s.length&&a<=t.maxLevel;a++)this.aggrs.setAggregateData(a,new Map),t.resultObtained&&t.resultObtained({},a);return U.resolve()},t.prototype.needRecalculation=function(){return!0},t.prototype.reset=function(){},t}(),K=function(){function t(t){this.context=t,this.modelLoader=null,this.queryStorage=null,this.querySynchronizer=null,this.dataFetcher=null,this.valueListResolver=null,this.queryFileLoader=null,this.aggrCalculator=null,this.httpClient=new r.HttpClient,this.httpClient.defaultHeaders["x-eqjs-version"]="7.2.0",this.modelResolver=function(t){return new S},this.modelStorageResolver=null,this.queryResolver=function(t){return new R(t.getModel(),null,{context:t})},this.modelLoaderResolver=function(t){return new H(t)},this.queryStorageResolver=function(t){return new q(t)},this.querySynchronizerResolver=function(t){return new G(t)},this.vlrResolver=function(t){return new z(t)},this.dataFetcherResolver=function(t){return new W(t)},this.queryFileLoaderResolver=function(t){return new V(t)},this.aggrCalculatoResolver=function(t){return new J(t)}}return t.prototype.reset=function(){this.modelStorage=null,this.modelLoader=null,this.queryStorage=null,this.querySynchronizer=null},t.prototype.getHttpClient=function(){return this.httpClient},t.prototype.createDataModel=function(){if(!this.modelResolver)throw"Model resolver is not defined";return this.modelResolver(this.context)},t.prototype.createQuery=function(){if(!this.queryResolver)throw"Query resolver is not defined";return this.queryResolver(this.context)},t.prototype.getModelLoader=function(){if(!this.modelLoader){if(!this.modelLoaderResolver)throw"ModelLoaderResolver is not defined";this.modelLoader=this.modelLoaderResolver(this.context)}return this.modelLoader},t.prototype.getModelStorage=function(){if(!this.modelStorage){if(!this.modelStorageResolver)throw"ModelStorageResolver is not defined";this.modelStorage=this.modelStorageResolver(this.context)}return this.modelStorage},t.prototype.getQueryStorage=function(){if(!this.queryStorage){if(!this.queryStorageResolver)throw"QueryStorageResolver is not defined";this.queryStorage=this.queryStorageResolver(this.context)}return this.queryStorage},t.prototype.getQuerySynchronizer=function(){if(!this.querySynchronizer){if(!this.querySynchronizerResolver)throw"QuerySynchronizerResolver is not defined";this.querySynchronizer=this.querySynchronizerResolver(this.context)}return this.querySynchronizer},t.prototype.getDataFetcher=function(){if(!this.dataFetcher){if(!this.dataFetcherResolver)throw"DataFetcherResolver is not defined";this.dataFetcher=this.dataFetcherResolver(this.context)}return this.dataFetcher},t.prototype.getValueListResolver=function(){if(!this.valueListResolver){if(!this.vlrResolver)throw"Resolver for ValueListResolver is not defined";this.valueListResolver=this.vlrResolver(this.context)}return this.valueListResolver},t.prototype.getQueryFileLoader=function(){if(!this.queryFileLoader){if(!this.queryFileLoaderResolver)throw"Resolver for QueryFileLoader is not defined";this.queryFileLoader=this.queryFileLoaderResolver(this.context)}return this.queryFileLoader},t.prototype.getAggregatesCalculator=function(){if(!this.aggrCalculator){if(!this.aggrCalculatoResolver)throw"Resolver for AggregatesCalculator is not defined";this.aggrCalculator=this.aggrCalculatoResolver(this.context)}return this.aggrCalculator},t.prototype.registerDataModelResolver=function(t){this.modelResolver=t},t.prototype.registerQueryResolver=function(t){this.queryResolver=t},t.prototype.registerModelLoaderResolver=function(t){this.modelLoaderResolver=t},t.prototype.registerModelStorageResolver=function(t){this.modelStorageResolver=t},t.prototype.registerQueryStorageResolver=function(t){this.queryStorageResolver=t},t.prototype.registerDataFetcherResolver=function(t){this.dataFetcherResolver=t},t.prototype.registerQuerySyncronizerResolver=function(t){this.querySynchronizerResolver=t},t.prototype.registerValueListResolver=function(t){this.vlrResolver=t},t.prototype.registerQueryFileLoaderResolver=function(t){this.queryFileLoaderResolver=t},t.prototype.registerAggregatesCalculator=function(t){this.aggrCalculatoResolver=t},t}(),X=__webpack_require__(567),$=function(){function t(t){this.context=t}return t.prototype.loadChunk=function(t){var e=this;return this.dataLoadPromise=new X((function(n,o){var i={chunk:t,success:function(o){for(var i=new r.EasyDataTable({loader:e.context.dataLoader,chunkSize:e.context.resultTable.chunkSize}),s=o.resultSet,a=0,l=s.cols;a<l.length;a++){var u=l[a];i.columns.add(u)}i.setTotal(o.meta.totalRecords);for(var c=0,d=s.rows;c<d.length;c++){var h=d[c];i.addRow(h)}var p=0;o.meta&&o.meta.totalRecords&&(p=o.meta.totalRecords),n({table:i,total:p,hasNext:!t.needTotal||t.offset+t.limit<p})},error:function(t){return o(t)}};e.context.debugMode&&(i.debug="Data Chunk. Offset: ".concat(t.offset)),e.context.fetchDataChunk(i)})),this.dataLoadPromise},t}(),Z=__webpack_require__(18);!function(t){t[t.None=0]="None",t[t.Model=1]="Model",t[t.Query=2]="Query",t[t.Result=4]="Result",t[t.Statement=8]="Statement",t[t.QueryStatus=16]="QueryStatus",t[t.All=65535]="All"}(A||(A={})),function(t){t.LoadModel="LoadModel",t.LoadQuery="LoadQuery",t.LoadQueryList="LoadQueryList",t.NewQuery="NewQuery",t.SaveQuery="SaveQuery",t.RemoveQuery="RemoveQuery",t.SyncQuery="SyncQuery",t.FetchData="FetchData",t.GetValueList="GetValueList",t.ExportResult="ExportResult",t.GetQueryFile="GetQueryFile",t.UploadQueryFile="UploadQueryFile"}(_||(_={}));var tt,et=__webpack_require__(567),nt=function(){function t(t){this.models=[],t&&r.utils.assign(this.models,[],t)}return t.prototype.getModels=function(){var t=this;return new et((function(e,n){e(t.models)}))},t}();!function(t){t[t.Error=0]="Error",t[t.Success=1]="Success"}(tt||(tt={}));var ot=function(){function t(t){this.context=t}return t.prototype.setFormat=function(t,e){this.format=t,this.responseType=e},t.prototype.export=function(t){t=t||{};var e=this.context.getServices().getHttpClient(),n=this.format||"csv",o=t.query||this.context.getQuery(),i=o.getModel().getId(),r={settings:t.settings,chunk:u};void 0!==t.queryId?r.queryId=t.queryId:r.query=o.toJSONData(),t.data&&(r.data=t.data),t.options&&(r.options=t.options);var s=this.context.resolveEndpoint("ExportResult",{modelId:i,format:n}),a=e.post(s,r,{responseType:this.responseType}),l=a.getRequest();return a.then((function(t){var e=new Blob([t]),o=l.getXMLHttpRequest().getResponseHeader("Content-Disposition"),i=o?o.match(/filename="(.*)"/)[1]:"export-data."+n;if(window.navigator.msSaveOrOpenBlob)window.navigator.msSaveOrOpenBlob(e,i);else{var r=document.createElement("a");document.body.appendChild(r),r.style.display="none",r.href=window.URL.createObjectURL(e),r.download=i,r.click(),window.URL.revokeObjectURL(r.href),document.body.removeChild(r)}}))},t}(),it=function(){return it=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},it.apply(this,arguments)},rt=function(){function t(){var t=this;this.options={syncSortOrderWithColumnsOrder:!0},this.servicesInitialized=!1,this.internalListCache={},this.loadModelOnStart=!0,this.loadQueryOnStart=!1,this.useStoredQueryOnFetch=!1,this.debugMode=!1,this._backendInfo={type:"EQN-ANC",subType:"asp-net-core-razor"},this.endpointVarsRegex=/\{.*?\}/g,this.elasticPaging=!1,this._predefinedListRequestHandlers={_DSDE:function(e,n){return n(t.getModel().getAllDateMacros().map((function(t){return{id:"${{"+t+"}}",text:r.i18n.getText(t)}}))),!0},_DSTE:function(e,n){return n(t.getModel().getAllTimeMacros().map((function(t){return{id:"${{"+t+"}}",text:r.i18n.getText(t)}}))),!0}},this._listRequestHandler=function(e,n){if(null!=e&&e.listName){var o=t.getQuery(),i=r.utils.assign({listName:e.listName},e.editorParams),s={},a=/@{{(.+?)}}/;for(var l in i)if(i[l]){var u=i[l].match(a);if(u){var c=o.getOneValueForAttr(u[1]);c||(c=""),s[l]=i[l].replace(a,c)}}var d={listName:s.listName,editorId:e.editorId,queryParams:s},h=t.getListFromCache(e);if(h&&h.length>0)n(h);else{var p=!1,f=t._predefinedListRequestHandlers[e.editorId];f&&(p=f(e,n)),!p&&t.clientListRequestHandler&&(p=t.clientListRequestHandler(e,n)),p||t.loadValueList({params:d,success:function(o){o&&t.addListToCache(e,o),n(o)},error:function(t){n(null)}})}}},this.baseEndpoint="api/easyquery",this.eqServices=new K(this),this.widgets=new Array,this.eventEmitter=new r.EventEmitter(this),this.exporters=new Map,this.endpoints=new Map,this.dataLoader=new $(this),this.resultTable=new r.EasyDataTable({loader:this.dataLoader,onUpdate:this.onResultTableUpdate.bind(this)}),this.resultTable.id="ResultTable",this.errorHandlerId=this.addEventListener("error",(function(t,e){e.result=tt.Error;var n=e.action?e.action+" error":"Error",o=e.text?e.text:"";e.sourceError&&e.sourceError.message!==o&&(o+="\n"+e.sourceError),console.error(n+": "+o)}))}return t.prototype.getServices=function(){return this.eqServices},t.prototype.registerExporter=function(t,e){this.exporters.set(t,e)},t.prototype.registerServerExporter=function(t,e){this.registerExporter(t,(function(n){var o=new ot(n);return o.setFormat(t,e),o}))},t.prototype.getExporter=function(t){var e=this.exporters.get(t);return e?e(this):null},t.prototype.getExportFormats=function(){return Array.from(this.exporters.keys())},t.prototype.addDefaultExporters=function(){this.registerServerExporter("csv","arraybuffer"),this.registerServerExporter("excel-html","arraybuffer")},t.prototype.resolveEndpoint=function(t,e){e=e||{};var n=this.endpoints.get(t);if(!n)throw t+" endpoint is not defined";var o=n.match(this.endpointVarsRegex);if(o)for(var i=0,r=o;i<r.length;i++){var s=r[i],a=s.substring(1,s.length-1),l=e[a];if(!l)if("modelId"==a)l=this.getModel().getId();else{if("queryId"!=a)throw"Parameter [".concat(a,"] is not defined");l=this.getQuery().getId()}n=n.replace(s,l)}return n},t.prototype.setEndpoint=function(t,e){this.endpoints.set(t,e)},t.prototype.setEnpointIfNotExist=function(t,e){this.endpoints.has(t)||this.endpoints.set(t,e)},t.prototype.setDefaultEndpoints=function(t){this.setEnpointIfNotExist("GetModel",o.combinePath(t,"models/{modelId}")),this.setEnpointIfNotExist("GetQuery",o.combinePath(t,"models/{modelId}/queries/{queryId}")),this.setEnpointIfNotExist("SaveQuery",o.combinePath(t,"models/{modelId}/queries/{queryId}")),this.setEnpointIfNotExist("SyncQuery",o.combinePath(t,"models/{modelId}/queries/{queryId}/sync")),this.setEnpointIfNotExist("NewQuery",o.combinePath(t,"models/{modelId}/queries")),this.setEnpointIfNotExist("RemoveQuery",o.combinePath(t,"models/{modelId}/queries/{queryId}")),this.setEnpointIfNotExist("GetQueryList",o.combinePath(t,"models/{modelId}/queries")),this.setEnpointIfNotExist("FetchData",o.combinePath(t,"models/{modelId}/fetch")),this.setEnpointIfNotExist("GetValueList",o.combinePath(t,"models/{modelId}/valuelists/{listId}")),this.setEnpointIfNotExist("ExportResult",o.combinePath(t,"models/{modelId}/export/{format}")),this.setEnpointIfNotExist("GetQueryFile",o.combinePath(t,"models/{modelId}/getqueryfile/{format}")),this.setEnpointIfNotExist("UploadQueryFile",o.combinePath(t,"models/{modelId}/uploadqueryfile"))},t.prototype.initStart=function(){this.servicesInitialized=!0},t.prototype.init=function(t){var e=this;(this.servicesInitialized||this.initStart(),t=t||{},this.setOptions(t),void 0!==t.debugMode&&(this.debugMode=t.debugMode),void 0!==t.chunkSize&&(this.resultTable.chunkSize=t.chunkSize),void 0!==t.elasticPaging&&(this.elasticPaging=t.elasticPaging),t.listCache&&this.setExternalListCache(t.listCache),t.locale&&r.i18n.setCurrentLocale(t.locale),t.localeSettings&&r.i18n.updateLocaleSettings(t.localeSettings),t.endpoint&&(this.baseEndpoint=t.endpoint,console.warn("The `endpoint` option is deprecated.\nPlease use `context.useEndpoint(endpointURL)` function instead.")),this.setDefaultEndpoints(this.baseEndpoint),t.modelStorageResolver)&&this.getServices().registerModelStorageResolver(t.modelStorageResolver);if(this.loadQueryOnStart=!1,t.loadQueryOnStart&&(this.loadQueryOnStart=t.loadQueryOnStart),this.loadModelOnStart=!0,void 0!==t.loadModelOnStart&&(this.loadModelOnStart=t.loadModelOnStart),t.handlers&&(t.handlers.onInit&&this.addEventListener("ready",t.handlers.onInit),t.handlers.afterLoadModel&&this.addEventListener("loadModel",t.handlers.afterLoadModel),t.handlers.afterLoadQuery&&this.addEventListener("loadQuery",t.handlers.afterLoadQuery),t.handlers.afterSyncQuery&&this.addEventListener("syncQuery",t.handlers.afterSyncQuery),t.handlers.afterFetchData&&this.addEventListener("fetchData",t.handlers.afterFetchData),t.handlers.afterExportResult&&this.addEventListener("exportResult",t.handlers.afterExportResult),t.handlers.onProcessStart&&this.addEventListener("processStart",t.handlers.onProcessStart),t.handlers.onProcessEnd&&this.addEventListener("processEnd",t.handlers.onProcessEnd),t.handlers.onError&&(this.removeEventListener("error",this.errorHandlerId),this.addEventListener("error",t.handlers.onError)),t.handlers.onListRequest&&(this.clientListRequestHandler=t.handlers.onListRequest),t.handlers.beforeLoadModel&&(this.beforeLoadModel=t.handlers.beforeLoadModel),t.handlers.beforeLoadQuery&&(this.beforeLoadQuery=t.handlers.beforeLoadQuery),t.handlers.beforeSyncQuery&&(this.beforeSyncQuery=t.handlers.beforeSyncQuery),t.handlers.beforeFetchData&&(this.beforeFetchData=t.handlers.beforeFetchData),t.handlers.beforeExportResult&&(this.beforeExportResult=t.handlers.beforeExportResult)),this.initialQuery=t.initialQuery,this.defaultQueryId=t.defaultQueryId||"",this.defaultModelId=t.defaultModelId||"__default",this.eqServices.getModelLoader().init(t),this.eqServices.getQueryStorage().init(t),!1!==t.useDefaultExporters&&this.addDefaultExporters(),t.serverExporters){this.exporters.clear();for(var n=0,o=t.serverExporters;n<o.length;n++){var i=o[n];this.registerServerExporter(i,"arraybuffer")}}var s=this.getQuery();t.defaultQueryId&&s.setId(t.defaultQueryId),this.widgets.forEach((function(n){var o={};t.widgets&&t.widgets[n.getWidgetType()]&&(o=t.widgets[n.getWidgetType()]),n.init(e,o)})),this.loadModelOnStart?this.loadDefaultModel():this.fireEvent("ready")},t.prototype.setOptions=function(t){r.utils.assignDeep(this.options,t)},Object.defineProperty(t.prototype,"backendInfo",{get:function(){return this._backendInfo},enumerable:!1,configurable:!0}),t.prototype.useEndpoint=function(t){return this.baseEndpoint=t,this},t.prototype.useBackend=function(t){if(t.type&&(this._backendInfo.type=t.type),t.subType)this._backendInfo.subType=t.subType;else switch(this._backendInfo.type){case"EQN-ANC":this._backendInfo.subType="asp-net-core-razor";break;case"EQN-ASP":this._backendInfo.subType="asp-net-4-mvc";break;default:this._backendInfo.subType="other"}return this},t.prototype.addWidget=function(t){this.widgets.push(t)},t.prototype.getAllWidgetsByType=function(t){return this.widgets.filter((function(e){return e.getWidgetType()===t}))},t.prototype.getWidgetByType=function(t){var e=this.getAllWidgetsByType(t);return e.length>0?e[0]:null},t.prototype.refreshWidgets=function(t){void 0===t&&(t=A.All),this.widgets.forEach((function(e){e.belongsToGroup(t)&&e.refresh()}))},t.prototype.addQueryChangedCallback=function(t){this.getQuery().addChangedCallback(t)},t.prototype.removeQueryChangedCallback=function(t){this.getQuery().removeChangedCallback(t)},t.prototype.createQuery=function(){return this.eqServices.createQuery()},t.prototype.getQuery=function(){if(!this.query){if(!this.servicesInitialized)throw new Error("Can't create query until the context is initialized");this.query=this.createQuery()}return this.query},t.prototype.getModel=function(){return this.dataModel||(this.dataModel=this.eqServices.createDataModel()),this.dataModel},t.prototype.loadModelFromData=function(t){this.getQuery().loadModelData(t),this.dataModel=this.getQuery().getModel()},t.prototype.setDefaultModelId=function(t){this.defaultModelId=t},t.prototype.startProcess=function(t,e){this.eventEmitter.fire("processStart",t),this.widgets.forEach((function(t){t.belongsToGroup(e)&&t.onProcessStart()}))},t.prototype.endProcess=function(t,e){this.eventEmitter.fire("processEnd",t),t.result===tt.Error&&this.throwError(t),this.widgets.forEach((function(t){t.belongsToGroup(e)&&t.onProcessEnd()}))},t.prototype.throwError=function(t){t.result=tt.Error,this.eventEmitter.fire("error",t)},t.prototype.loadDefaultModel=function(){var t=this;this.loadModel({modelId:this.defaultModelId,silent:!0,success:function(){t.refreshWidgets(A.Model);var e=t.getQuery();t.fireEvent("initialModelLoad"),t.initialQuery&&e.loadFromData(t.initialQuery,{changeStatus:!1}),t.loadQueryOnStart?t.loadQuery({queryId:t.defaultQueryId,modelId:t.defaultModelId,success:function(){t.refreshWidgets(A.Query),t.fireEvent("ready")}}):(t.refreshWidgets(A.Query),t.fireEvent("ready"))}})},t.prototype.clearQuery=function(){var t=this.getQuery();t.clear(),t.fireChangedEvent({part:x.All})},t.prototype.clearResult=function(){this.resultTable.clear(),this.resultStatement=null,this.resultContent=null},t.prototype.setExternalListCache=function(t){this.externalListCache=t},t.prototype.getListFromCache=function(t){var e=this.getListCacheKey(t);return this.externalListCache?this.externalListCache.get(e):this.internalListCache[e]},t.prototype.getListCacheKey=function(t){var e="SQL"==t.listName?"SQL_"+t.editorId:t.listName;return t.queryParams&&(e+="_"+Object.keys(t.queryParams).filter((function(t){return"listName"!=t})).map((function(e){return t.queryParams[e]})).join("_")),e},t.prototype.addListToCache=function(t,e){var n=this.getListCacheKey(t);this.externalListCache?this.externalListCache.set(n,e):this.internalListCache[n]=e},t.prototype.resetListCache=function(){this.externalListCache?this.externalListCache.clear():this.internalListCache={}},t.prototype.getListRequestHandler=function(){return this._listRequestHandler},t.prototype.addLocale=function(t,e){r.i18n.addLocale(t,e)},t.prototype.addEventListener=function(t,e){var n=this;return this.eventEmitter.subscribe(t,(function(t){return e(n,t.data)}))},t.prototype.removeEventListener=function(t,e){this.eventEmitter.unsubscribe(t,e)},t.prototype.fireEvent=function(t,e){this.eventEmitter.fire(t,e)},t.prototype.getBaseEndpoint=function(){return this.baseEndpoint},t.prototype.loadValueList=function(t){var e=this;t=t||{},this.startProcess({action:_.GetValueList,text:"Loading values"},A.Result),this.eqServices.getValueListResolver().loadValueList(t).then((function(n){e.endProcess({result:tt.Success,action:_.GetValueList,text:"Values loaded"},A.Result),t.success&&t.success(n)})).catch((function(n){var o=t&&t.params?t.params.editorId:"undefined",i="Can't load the value list for editor ".concat(o,".\n ").concat(n.message);e.endProcess({result:tt.Error,action:_.GetValueList,text:i,sourceError:n},A.Result),t.error&&t.error(i,"GetValueList")}))},t.prototype.loadModel=function(t){var e=this;this.beforeLoadModel&&this.beforeLoadModel(this,t);var n=t.modelId||"__default",o=t.silent||!1;return this.startProcess({action:_.LoadModel,text:"Loading model: "+n},A.Model),this.eqServices.getModelLoader().startModelLoading(t).then((function(i){return i?(e.loadModelFromData(i),e.dataModel.isEmpty()&&console.warn("Empty model has been loaded. Model ID: ".concat(e.dataModel.getId()))):console.warn("Model has not been changed."),e.fireEvent("loadModel"),e.endProcess({result:tt.Success,action:_.LoadModel,text:"Model loaded: "+n},A.Model),o||(e.clearQuery(),e.clearResult(),e.refreshWidgets()),t.success&&t.success(e.getModel()),e.getModel()})).catch((function(o){var i="Can't load model ".concat(n,".\n ").concat(o.message);return e.endProcess({result:tt.Error,action:_.LoadModel,text:i,sourceError:o},A.Model),t.error&&t.error(i,"LoadModel"),e.getModel()}))},t.prototype.callWhenModelLoaded=function(t){this.eqServices.getModelLoader().getModelPromise().then((function(){t()}))},t.prototype.loadQuery=function(t){var e=this;t=t||{};var n=this.eqServices.getModelLoader();this.clearResult(),n.getModelPromise().then((function(){var n=(t=t||{}).queryId,o=t.silent||!1;e.beforeLoadQuery&&e.beforeLoadQuery(e,t),e.startProcess({action:_.LoadQuery,text:"Query loading: "+n},A.Query),e.eqServices.getQueryStorage().loadQuery(t).then((function(i){i&&e.query.loadFromData(i,{validate:!1}),e.limitCustomSqlColumns(),e.fireEvent("loadQuery"),e.endProcess({result:tt.Success,action:_.LoadQuery,text:"Query loaded: "+n},A.Query),e.query.resetModified(),o||(e.query.fireChangedEvent({part:x.Properties,wasModified:e.query.isModified()}),e.refreshWidgets()),t.success&&t.success(e.query)})).catch((function(n){var o=e.getQuery();n.message="Can't load query ["+o.getId()+"]\n"+(n.message||""),t.error&&t.error(n.message,_.LoadQuery),e.endProcess({result:tt.Error,action:_.LoadQuery,text:n.message,sourceError:n},A.Query)}))})).catch((function(t){console.error(t)}))},t.prototype.loadQueryList=function(t){var e=this;this.eqServices.getModelLoader().getModelPromise().then((function(){e.startQueryListLoading(t)})).catch((function(t){var n="Can't load the list of available queries.\n ".concat(t.message);e.throwError({action:_.LoadQueryList,text:n,sourceError:t})}))},t.prototype.startQueryListLoading=function(t){var e=this;t=t||{},this.eqServices.getQueryStorage().getQueryList(t).then((function(e){t.success&&t.success(e)})).catch((function(n){var o="Can't load the list of available queries.\n ".concat(n.message);t.error?t.error(o,"LoadQueryList"):e.throwError({action:_.LoadQueryList,text:o,sourceError:n})}))},t.prototype.newQuery=function(t){var e=this,n=void 0===(t=t||{}).clearQuery||t.clearQuery;this.query.reset(n),t.queryId&&this.query.setId(t.queryId),t.name&&this.query.setName(t.name),t.description&&this.query.setDescription(t.description);var o=t.silent||!1,i=!0;void 0!==t.useStorage&&(i=t.useStorage);var r=function(){var t=e.getQuery();t.isNewbie=!0,o||t.fireChangedEvent({part:x.All,wasModified:t.isModified()})};i?(this.startProcess({action:_.NewQuery,text:"New query creation..."},A.Query),this.eqServices.getQueryStorage().newQuery(t).then((function(n){n&&e.query.loadFromData(n),e.endProcess({result:tt.Success,action:_.NewQuery,text:"A new query has been created"},A.Query),r(),t.success&&t.success()})).catch((function(n){var o="Can't create a new query.\n".concat(n.message);e.endProcess({result:tt.Error,action:_.NewQuery,text:o,sourceError:n},A.Query),t.error&&t.error(o,"NewQuery")}))):r();return this.query},t.prototype.saveQuery=function(t){var e=this;t=t||{};var n=this.getQuery();this.startProcess({action:_.SaveQuery,text:"Query saving: "+n.getId()},A.Query),this.eqServices.getQueryStorage().saveQuery(t).then((function(o){e.endProcess({action:_.SaveQuery,result:tt.Success,text:"Query saved: "+n.getId()},A.Query),o&&n.loadFromData(o),n.resetModified(),n.isNewbie=!1,t.success&&t.success()})).catch((function(o){var i="Can't save query ".concat(n.getId(),".\n ").concat(o.message);e.endProcess({action:_.SaveQuery,result:tt.Error,text:i,sourceError:o},A.Query),t.error&&t.error(i,_.SaveQuery)}))},t.prototype.removeQuery=function(t){var e=this;t=t||{};var n=this.getQuery();this.startProcess({action:_.RemoveQuery,text:"Query deleting: "+n.getId()},A.Query),this.eqServices.getQueryStorage().removeQuery(t).then((function(){n.reset(),e.endProcess({action:_.RemoveQuery,result:tt.Success,text:"Query deleted: "+n.getId()},A.Query),t.success&&t.success()})).catch((function(o){var i="Can't remove query ".concat(n.getId(),".\n ").concat(o.message);e.endProcess({action:_.RemoveQuery,result:tt.Error,text:i,sourceError:o},A.Query),t.error&&t.error(i,"RemoveQuery")}))},t.prototype.syncQuery=function(t){var e=this;t=t||{};var n=this.getQuery();this.beforeSyncQuery&&this.beforeSyncQuery(this,t),this.startProcess({action:_.SyncQuery,text:"Query syncing: "+n.getId()},A.Query),this.eqServices.getQuerySynchronizer().syncQuery(t).then((function(o){if(e.resultStatement=o&&o.statement?o.statement:"",e.fireEvent("syncQuery"),e.refreshWidgets(A.Statement),e.endProcess({result:tt.Success,action:_.SyncQuery,text:"Query synced: "+n.getId()},A.Query),o){if(o.querySaved){var i=o.query;i&&(n.setId(i.id),n.setName(i.name),n.setDescription(i.desc),n.extraData=i.extraData),n.resetModified(),e.refreshWidgets(A.QueryStatus)}t.success&&t.success(o)}})).catch((function(o){var i="Can't synchronize query ".concat(n.getId(),".\n ").concat(o.message);e.endProcess({result:tt.Error,action:_.SyncQuery,text:i,sourceError:o},A.Query),t.error&&t.error(i,"SyncQuery")}))},t.prototype.fetchData=function(t){var e=this,n=void 0!==(t=t||{}).elasticPaging?t.elasticPaging:this.elasticPaging;this.resultTable.elasticChunks=n,t.chunk=t.chunk||{offset:0,limit:this.resultTable.chunkSize,needTotal:!n},this.debugMode&&(t.debug="Fetching the result set. Initial chunk"),this.query.tryValidate({checkExpressions:!0})&&(t.groupFetchSuccess&&(this.afterGroupFetch=t.groupFetchSuccess),this.resultTable.elasticChunks&&t.chunk.limit++,this.fetchDataChunk(it(it({},t),{success:function(n){if(n.statement&&(e.resultStatement=n.statement,e.refreshWidgets(A.Statement)),e.getServices().getAggregatesCalculator().reset(),e.resultContent=n,n.resultSet){e.resultTable.clear(),e.resultTable.id=e.query.getId();for(var o=n.resultSet,i=0,r=o.cols;i<r.length;i++){var s=r[i];e.resultTable.columns.add(s)}n.meta&&void 0!==n.meta.totalRecords&&e.resultTable.setTotal(n.meta.totalRecords);var a=o.rows.length;e.resultTable.elasticChunks&&a===t.chunk.limit&&o.rows.splice(o.rows.length-1,1);for(var l=0,u=o.rows;l<u.length;l++){var c=u[l];e.resultTable.addRow(c)}e.resultTable.elasticChunks&&(e.resultTable.total=a<t.chunk.limit?o.rows.length:0),e.resultTable.fireUpdated()}t.success&&t.success(n)}})))},t.prototype.getQueryFile=function(t){var e=this,n=this.getQuery();this.startProcess({action:_.GetQueryFile,text:"Getting query file: "+n.getId()},A.Query),this.getServices().getQueryFileLoader().getQueryFile(t).then((function(){e.endProcess({result:tt.Success,action:_.GetQueryFile,text:"Getting query file: "+n.getId()},A.Query),t.success&&t.success()})).catch((function(o){var i="Can't get file for query ".concat(n.getId(),".\n ").concat(o.message);e.endProcess({result:tt.Error,action:_.GetQueryFile,text:i,sourceError:o},A.Query),t.error&&t.error(i,"GetQueryFile")}))},t.prototype.uploadQueryFile=function(t){var e=this,n=this.getQuery();this.startProcess({action:_.UploadQueryFile,text:"Uploading query file: "+n.getId()},A.Query),this.getServices().getQueryFileLoader().uploadQueryFile(t).then((function(o){n.loadFromData(o),e.fireEvent("loadQuery"),e.refreshWidgets(),e.endProcess({result:tt.Success,action:_.UploadQueryFile,text:"Uploading query file: "+n.getId()},A.Query),t.success&&t.success()})).catch((function(o){var i="Can't upload a file for query ".concat(n.getId(),".\n ").concat(o.message);e.endProcess({result:tt.Error,action:_.UploadQueryFile,text:i,sourceError:o},A.Query),t.error&&t.error(i,"UploadQueryFile")}))},t.prototype.fetchDataChunk=function(t){var e=this,n=this.getQuery().getId(),o=t||{};this.useStoredQueryOnFetch&&(o.queryId=this.query.getId()),this.beforeFetchData&&this.beforeFetchData(this,o),this.startProcess({action:_.FetchData,text:"Fetching data for the query: "+n},A.Result),this.eqServices.getDataFetcher().fetchData(o).then((function(t){t.statement&&(e.resultStatement=t.statement),e.resultContent=t,o.success&&o.success(t),e.fireEvent("fetchData"),e.endProcess({result:tt.Success,action:_.FetchData,text:"Data fetching is finished for the query: "+n},A.Result)})).catch((function(t){var i="Data fetching error for the query ".concat(n,". \n").concat(t.message);e.endProcess({result:tt.Error,action:_.FetchData,text:i,sourceError:t},A.Result),o.error&&o.error(i,_.FetchData)}))},t.prototype.onResultTableUpdate=function(){var t=this,e=this.query.getAggregationSettings(),n=this.getServices().getAggregatesCalculator();e.needAggrCalculation()&&n.needRecalculation()&&n.calculate({maxLevel:e.getGroups().length+1,resultObtained:function(e,n){t.afterGroupFetch&&t.afterGroupFetch(e)},errorOccurred:function(e){var n="Data fetching error on group level ".concat(e.level," query. \n").concat(e.message);t.throwError({action:_.FetchData,text:n,sourceError:e})}})},t.prototype.fetchDrillDownData=function(t){var e=this;(t=t||{}).chunk=t.chunk||{offset:0,limit:this.resultTable.chunkSize,needTotal:!0};var n=t.query.getId();this.startProcess({action:_.FetchData,text:"DrillDown executing: "+n},A.Result),this.eqServices.getDataFetcher().fetchData(t).then((function(o){e.endProcess({result:tt.Success,action:_.FetchData,text:"DrillDown execution error: "+n},A.Result),t.success&&t.success(o)})).catch((function(o){var i="Drill-down data fetching error for query ".concat(n,". \n").concat(o.message);e.endProcess({result:tt.Error,action:_.FetchData,text:i},A.Result),t.error?t.error(i,"DrillDown"):e.throwError({action:_.FetchData,text:i})}))},t.prototype.exportResult=function(t){var e=this;(t=t||{}).chunk=t.chunk||u,this.beforeExportResult&&this.beforeExportResult(this,t);var n=t.format;if(n){var o=this.getExporter(n);if(o){var i=this.getQuery().getId();this.useStoredQueryOnFetch&&(t.queryId=i),this.startProcess({action:_.ExportResult,text:"Exporting result for query: "+i},A.Result);var s=r.i18n.getLocaleSettings();t.settings=s;var a=this.query.getAggregationSettings();a.hasAggregates()&&(a.hasGrandTotals()||a.hasGroups())&&(t.aggregates=a.saveToData()),o.export(t).then((function(n){e.fireEvent("exportResult"),e.endProcess({result:tt.Success,action:_.ExportResult,text:"The result set for query [".concat(i,"] has been successfully exported")},A.Result),t.success&&t.success()})).catch((function(n){var o="Error on exporting data for query ".concat(i,". \n").concat(n.message);e.endProcess({result:tt.Error,action:_.ExportResult,text:o,sourceError:n},A.Result),t.error&&t.error(o,"ExportResult")}))}}},t.prototype.limitCustomSqlColumns=function(){this.options.allowCustomExpressions||this.query.getColumns().forEach((function(t){t.expr.tag===p.CustomSql&&(t.enabled=!1)}))},t}(),st=function(){function t(t){this.slot=t,this._id=r.utils.generateId(this.getWidgetType())}return Object.defineProperty(t.prototype,"id",{get:function(){return this._id},enumerable:!1,configurable:!0}),t.prototype.init=function(t,e){this.context=t},t.prototype.getContext=function(){return this.context},t.prototype.refresh=function(){this.refreshCore()},t.prototype.refreshCore=function(){},t.prototype.onProcessStart=function(){this.onProcessStartCore()},t.prototype.onProcessStartCore=function(){},t.prototype.onProcessEnd=function(){this.onProcessEndCore()},t.prototype.onProcessEndCore=function(){},t.prototype.belongsToGroup=function(t){return void 0===t||null==t||0!=(t&this.group)},t.prototype.destroy=function(){this.destroyCore()},t.prototype.destroyCore=function(){},t}(),at=new(function(){function t(t,e,n){this.major=t,this.minor=e,this.update=n}return t.prototype.toString=function(){return"".concat(this.major,".").concat(this.minor,".").concat(this.update)},t}())(6,2,0);r.i18n.updateDefaultTexts({NewQueryName:"[New query]",Today:"Today",Yesterday:"Yesterday",Tomorrow:"Tomorrow",FirstDayOfMonth:"First day of the month",LastDayOfMonth:"Last day of the month",FirstDayOfWeek:"First day of the week",FirstDayOfYear:"First day of the year",FirstDayOfNextWeek:"First day of the next week",FirstDayOfNextMonth:"First day of the next month",FirstDayOfNextYear:"First day of the next year",Now:"Now",HourStart:"This hour start",Midnight:"Midnight",Noon:"Noon",Entities:{},Attributes:{},Operators:{},AggregateFunctions:{}});var lt,ut=__webpack_require__(514),ct=__webpack_require__(464),dt=__webpack_require__(305),ht=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),pt=function(t){function e(e){var n=t.call(this,e)||this;return n.queryChangedCallbackId=null,n.group=A.Model|A.Query,n.panel=e,n}return ht(e,t),Object.defineProperty(e.prototype,"cssPrefix",{get:function(){return"eqjs-ep"},enumerable:!1,configurable:!0}),e.prototype.getWidgetType=function(){return"entitiesPanel"},e.prototype.init=function(e,n){t.prototype.init.call(this,e,n),this.setOptions(n),this.renderProgressBlock()},e.prototype.refreshCore=function(){this.render(),this.options.syncWithColumns&&this.refreshCheckedStateByColumns()},e.prototype.onProcessStartCore=function(){this.options.showIndicatorOnLoad&&(this.progressBlock.parentNode||this.panel.appendChild(this.progressBlock))},e.prototype.onProcessEndCore=function(){this.options.showIndicatorOnLoad&&this.progressBlock.parentNode&&this.panel.removeChild(this.progressBlock)},e.prototype.destroyCore=function(){this.slot.innerHTML=""},e.prototype.setOptions=function(t){var e=this;(this.options={showToolbar:!0,syncWithColumns:!1,showSelectAllButton:!1,showClearSelectionButton:!0,showAddColumnButton:!0,showAddConditionButton:!0,showCheckboxes:!0,showTooltips:!0,draggableAttributes:!0,showAttributes:{useInConditions:!0,useInResult:!0,useInSorting:!1},showFilterBox:!1,filterBoxMode:0,showIndicatorOnLoad:!0,attrPlacement:0,sortEntities:!1,autoClearSelection:!0,entityRenderedCallback:null,attributeRenderedCallback:null,columnTitleFormat:"{attr}"},t&&r.utils.assignDeep(this.options,t),this.queryChangedCallbackId)&&(n=this.context.getQuery()).removeChangedCallback(this.queryChangedCallbackId);if(this.options.syncWithColumns){var n=this.context.getQuery();this.queryChangedCallbackId=n.addChangedCallback((function(t){var n=t.data;!n||n.part!=x.Columns&&n.part!=x.All||e.refreshCheckedStateByColumns()}))}},e.prototype.render=function(){var t=this.context.getModel();if(this.clear(),this.panel.classList.add("".concat(this.cssPrefix,"-panel")),this.panel.classList.add(dt.z.getMobileCssClass()),this.rootEntityBlock=document.createElement("div"),null!=t&&!t.isEmpty()){var e=t.getEntitiesTree({addUIC:this.options.showAttributes.useInConditions,addUIR:this.options.showAttributes.useInResult,addUIS:this.options.showAttributes.useInSorting,attrPlacement:this.options.attrPlacement,sortEntities:this.options.sortEntities,includeRootData:!0});this.entityTreeBlock=this.renderEntity(e,this.rootEntityBlock,0),this.panel.appendChild(this.entityTreeBlock)}this.options.showFilterBox?this.createFilterBox():this.rootEntityBlock.style.top="0",this.options.showToolbar&&!this.options.syncWithColumns?this.createToolPanel():this.rootEntityBlock.style.bottom="0"},e.prototype.renderEntity=function(t,e,n){var o,i=this,s=document.createElement("div");s.classList.add("".concat(this.cssPrefix,"-entity-node")),s.classList.add(dt.z.getMobileCssClass());var a=document.createElement("div");a.classList.add("".concat(this.cssPrefix,"-entity-children")),a.classList.add(dt.z.getMobileCssClass());var l=document.createElement("label");l.classList.add("".concat(this.cssPrefix,"-entity-node-label"));var u=document.createElement("input");u.type="checkbox",u.title=t.text;var c,d,h,f=document.createElement("a");f.href="javascript:void(0)",f.title="".concat(r.i18n.getText("EntityToggle")," ").concat(t.text),f.classList.add("".concat(this.cssPrefix,"-entity-node-button"));var g=n;if(e?(o=e).innerHTML="":o=document.createElement("div"),o.classList.add("".concat(this.cssPrefix,"-entity")),o.classList.add(dt.z.getMobileCssClass()),t.id&&""!=t.id){l.innerText=t.text,s.appendChild(l),this.options.showCheckboxes&&l.insertBefore(u,l.firstChild),s.insertBefore(f,s.firstChild),this.options.showTooltips&&t.description&&l.setAttribute("title",t.description);for(var y=0;y<g;y++){var m=document.createElement("div");m.classList.add("".concat(this.cssPrefix,"-entity-offset")),s.insertBefore(m,s.firstChild)}o.appendChild(s),a.hidden=!0,g++}var v=t.items?t.items.length:0,C=function(e){var n=t.items[e];if(n.isEntity)a.appendChild(b.renderEntity(n,null,g));else if(!n.lookupAttr||!function(t,e){return e.querySelectorAll(".".concat(i.cssPrefix,'-entity-attr[data-id="').concat(t,'"]')).length>0}(n.lookupAttr,a)){(d=document.createElement("label")).innerText=n.text,d.classList.add("".concat(b.cssPrefix,"-entity-attr-label")),b.options.showCheckboxes&&((h=document.createElement("input")).type="checkbox",h.title=n.text,d.insertBefore(h,d.firstChild),b.options.syncWithColumns&&h.addEventListener("change",(function(t){var e=i.context.getModel(),n=i.context.getQuery(),o=t.currentTarget,r=o.parentElement.parentElement.getAttribute("data-id");if(e.checkAttrProperty(r,"useInResult"))if(o.checked){var s=e.getAttributeById(r),a=e.getAttributeText(s,i.options.columnTitleFormat),l=n.addColumn({attribute:s,caption:a});n.fireColumnsChangedEvent(w.Add,l)}else{var u=n.getColumns().filter((function(t){return t.expr.tag===p.EntityAttribute&&t.expr.value===r}));u.length>0&&(n.removeColumn(u[0],null),n.fireColumnsChangedEvent(w.Delete,u[0]))}}))),b.options.showTooltips&&n.description&&d.setAttribute("title",n.description);for(var o=0;o<g+1;o++){var r=document.createElement("div");r.classList.add("".concat(b.cssPrefix,"-entity-offset")),d.insertBefore(r,d.firstChild)}(c=document.createElement("div")).classList.add("".concat(b.cssPrefix,"-entity-attr")),0==s.innerHTML.length&&c.classList.add("".concat(b.cssPrefix,"-entity-attr-root")),c.innerHTML="",c.appendChild(d),c.setAttribute("data-id",n.id),b.options.draggableAttributes&&ut.eqDragManager.registerDraggableItem({element:c,scope:"entityAttr",data:{attrId:n.id},renderer:function(t){t.innerHTML="";var e=document.createElement("span");e.innerText=n.text,t.appendChild(e)}}),b.options.attributeRenderedCallback&&b.options.attributeRenderedCallback(c),a.appendChild(c)}},b=this;for(y=0;y<v;y++)C(y);if(a.innerHTML.length&&(o.appendChild(a),f.addEventListener("click",(function(t){a.hidden=!a.hidden;var e=t.target,n="".concat(i.cssPrefix,"-entity-node-button-open");e.classList.contains(n)?e.classList.remove(n):e.classList.add(n),t.preventDefault()}))),a){var x=a.querySelectorAll(".".concat(this.cssPrefix,"-entity-attr > label > input"));for(y=0;y<x.length;y++){x[y].addEventListener("click",(function(t){t.target.checked&&!u.checked?u.checked=!0:0===a.querySelectorAll("input:checked").length&&(u.checked=!1),t.stopPropagation()}))}}return u.addEventListener("click",(function(t){for(var e=t.target,n=a.querySelectorAll("label input"),o=0;o<n.length;o++){n[o].checked=e.checked}if(i.options.syncWithColumns){for(var r=i.context.getQuery(),s=i.context.getModel(),l=[],u=0,c=Array.from(a.querySelectorAll(".".concat(i.cssPrefix,"-entity-attr")));u<c.length;u++){var d=c[u].getAttribute("data-id");s.checkAttrProperty(d,"useInResult")&&l.push(d)}if(e.checked)for(var h=0,f=l;h<f.length;h++){d=f[h];r.addColumn({attributeId:d})}else{var g=r.getColumns().filter((function(t){return t.expr.tag===p.EntityAttribute&&l.indexOf(t.expr.value)>=0}));r.removeColumns(g,null)}r.fireColumnsChangedEvent()}t.stopPropagation()})),e!=this.rootEntityBlock&&this.options.entityRenderedCallback&&this.options.entityRenderedCallback(o),o},e.prototype.createFilterBox=function(){var t=this;this.filterBoxBlock=document.createElement("div"),this.filterBoxBlock.classList.add("".concat(this.cssPrefix,"-filter-box")),this.filterBoxBlock.classList.add(dt.z.getMobileCssClass()),this.filterBoxInput=document.createElement("input"),this.filterBoxInput.classList.add("".concat(this.cssPrefix,"-filter-box-input")),this.filterBoxInput.addEventListener("input",(function(e){for(var n=t.panel.querySelectorAll(".".concat(t.cssPrefix,"-entity-attr")),o=0;o<n.length;o++){var i=n[o];i.hidden=!t.checkFilterAttribute(i)}var r=t.panel.querySelectorAll(":scope > .".concat(t.cssPrefix,"-entity"));for(o=0;o<r.length;o++){for(var s=r[o],a=s.querySelectorAll(".".concat(t.cssPrefix,"-entity-attr")),l=0,u=0;u<a.length;u++)"None"!==a[u].style.display&&l++;s.hidden=0===l}""===t.filterBoxInput.value?t.collapseAll():t.expandAll()})),this.filterBoxBlock.appendChild(this.filterBoxInput),this.panel.insertBefore(this.filterBoxBlock,this.panel.firstChild)},e.prototype.createToolPanel=function(){var t=this,e="".concat(this.cssPrefix,"-tool-panel"),n=document.createElement("div");n.classList.add(e),n.classList.add(dt.z.getMobileCssClass());var o=document.createElement("div");o.classList.add("".concat(e,"-select-all")),o.title="Select all";var i=document.createElement("div");i.classList.add("".concat(e,"-deselect-all")),i.title="Clear selection";var s=document.createElement("div");s.classList.add("".concat(e,"-add-columns")),s.title="Add column";var a=document.createElement("div");a.classList.add("".concat(e,"-add-cond")),a.title="Add condition";var l=document.createElement("div");l.classList.add("".concat(e,"-left-side"));var u=document.createElement("div");u.classList.add("".concat(e,"-right-side"));var c=this.context.getModel();this.options.showSelectAllButton&&(o.title=r.i18n.getText("ButtonSelectAll"),l.appendChild(o),o.addEventListener("click",(function(){t.selectAll()}))),this.options.showClearSelectionButton&&(i.title=r.i18n.getText("ButtonDeselectAll"),l.appendChild(i),i.addEventListener("click",(function(){t.deselectAll()}))),this.options.showAddColumnButton&&(s.title=r.i18n.getText("ButtonAddColumns"),u.appendChild(s),s.addEventListener("click",(function(){var e,n=t.panel.querySelectorAll(".".concat(t.cssPrefix,"-entity-attr")),o=[],i=t.context.getQuery();i.fireProcessEvent({source:self,status:"start"});for(var r=0;r<n.length;r++){var s=n[r];s.getElementsByTagName("input")[0].checked&&(e=s.getAttribute("data-id"),c.checkAttrProperty(e,"useInResult")&&o.push(e))}for(var a=0,l=o;a<l.length;a++){var u=l[a],d=c.getAttributeById(u),h=c.getAttributeText(d,t.options.columnTitleFormat);i.addColumn({attribute:d,caption:h})}i.fireChangedEvent(),t.options.autoClearSelection&&t.deselectAll(),i.fireProcessEvent({source:self,status:"finish"})}))),this.options.showAddConditionButton&&(a.title=r.i18n.getText("ButtonAddConditions"),u.appendChild(a),a.addEventListener("click",(function(){var e,n=t.panel.querySelectorAll(".".concat(t.cssPrefix,"-entity-attr")),o=[],i=t.context.getQuery();i.fireProcessEvent({source:self,status:"start"});for(var r=0;r<n.length;r++){var s=n[r];s.getElementsByTagName("input")[0].checked&&(e=s.getAttribute("data-id"),c.checkAttrProperty(e,"useInConditions")&&o.push(e))}for(var a=0,l=o;a<l.length;a++){var u=l[a];i.addSimpleCondition({attributeId:u})}i.fireChangedEvent(),t.options.autoClearSelection&&t.deselectAll(),i.fireProcessEvent({source:self,status:"finish"})}))),n.appendChild(l),n.appendChild(u),this.panel.appendChild(n)},e.prototype.checkFilterAttribute=function(t){if(t.querySelector("label input").checked)return!0;var e=t.querySelector("label").textContent;if(this.checkFilterText(e))return!0;var n=t.parentElement.parentElement.querySelector(".".concat(this.cssPrefix,"-entity-node")).querySelector("label").textContent;return!!this.checkFilterText(n)},e.prototype.checkFilterText=function(t){var e=this.filterBoxInput.value;return""==e||(0==this.options.filterBoxMode&&t.toLowerCase().indexOf(e.toLowerCase())>=0||1==this.options.filterBoxMode&&0==t.toLowerCase().indexOf(e.toLowerCase()))},e.prototype.refreshCheckedStateByColumns=function(){this.deselectAll();for(var t=0,e=this.context.getQuery().getColumns().filter((function(t){return t.expr.tag===p.EntityAttribute}));t<e.length;t++){var n=e[t],o=this.rootEntityBlock.querySelector(".".concat(this.cssPrefix,'-entity-attr[data-id="').concat(n.expr.value,'"]')),i=o.querySelector("label > input");i.checked=!0;for(var r=o.parentElement;r&&r.classList.contains("".concat(this.cssPrefix,"-entity-children"));){r.hidden=!1;var s=r.parentElement;if(!s||r===s.firstElementChild)break;(i=s.firstElementChild.querySelector("label > input")).checked=!0,r=s.parentElement}}},e.prototype.expandAll=function(){for(var t=0;t<this.rootEntityBlock.childNodes.length;t++)for(var e=this.rootEntityBlock.childNodes[0].querySelectorAll(".".concat(this.cssPrefix,"-entity-children")),n=0;n<e.length;n++){e[n].hidden=!1}var o=this.rootEntityBlock.querySelectorAll(".".concat(this.cssPrefix,"-entity-node-button"));for(t=0;t<o.length;t++){o[t].classList.add("".concat(this.cssPrefix,"-entity-node-button-open"))}},e.prototype.collapseAll=function(){for(var t=0;t<this.rootEntityBlock.childNodes.length;t++)for(var e=this.rootEntityBlock.childNodes[0].querySelectorAll(".".concat(this.cssPrefix,"-entity-children")),n=0;n<e.length;n++){e[n].hidden=!0}var o=this.rootEntityBlock.querySelectorAll(".".concat(this.cssPrefix,"-entity-node-button"));for(t=0;t<o.length;t++){o[t].classList.remove("".concat(this.cssPrefix,"-entity-node-button-open"))}},e.prototype.selectAll=function(){for(var t=this.entityTreeBlock.querySelectorAll("input"),e=0;e<t.length;e++){t[e].checked=!0}},e.prototype.deselectAll=function(){for(var t=this.entityTreeBlock.querySelectorAll("input"),e=0;e<t.length;e++){t[e].checked=!1}},e.prototype.renderProgressBlock=function(){this.progressBlock=document.createElement("div"),this.progressBlock.classList.add("".concat(ct.YR,"-progress-win8")),this.progressBlock.classList.add(dt.z.getMobileCssClass()),this.progressBlock.innerHTML='<div class="wBall" id="wBall_1"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_2"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_3"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_4"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_5"><div class="wInnerBall"></div></div>'},e.prototype.clear=function(){this.panel.innerHTML=""},e}(st),ft=function(){function t(t){this.isFilteringMode=!1,this.showSelected=!1,this.parentMenu=t.menu||null,this.parentLevel=t.parent||null,this.parentElement=t.container||document.body,this.levelIndex=t.levelIndex||0,this.levelDiv=null,this.domWriteItemsId=t.domWriteItemsId||!1,this.menuId=t.menuId||"",this.itemRenderedCallback=t.itemRenderedCallback||null,this._applyItem={id:null,text:null,itemDiv:null},this.items=t.items||[],this.activeItem=null,this.selectedItem=null,this.initialized=!1,this.showSelected=t.showSelected,this.updated=0,this.renderContent()}return Object.defineProperty(t.prototype,"applyItem",{get:function(){return this._applyItem},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cssPrefix",{get:function(){return"eqjs-menu"},enumerable:!1,configurable:!0}),t.prototype.getItems=function(){return this.items},t.prototype.setItems=function(t){this.items=t},t.prototype.renderContent=function(){var t=this;if(this.items){var e=this.parentMenu.style.colors.bgON||"white",n=this.parentMenu.style.colors.fgON||"black",o=(this.parentMenu.style.colors.bgOVER,this.parentMenu.style.itemStyle.fontFamily||""),i=this.parentMenu.style.itemStyle.fontSize||"14px",s=this.parentMenu.options.multiselect,a=this.parentMenu.options.isSubQuery,l=(0,ut.domel)("div").addClass(dt.z.getMobileCssClass());this.parentMenu.options.useDefaultStyles&&l.setStyle("backgroundColor",e).setStyle("border","1px solid").setStyle("borderColor",e).setStyle("backgroundColor",this.parentMenu.style.colors.border).setStyle("margin","-2px 2px 2px -2px").setStyle("width","auto").setStyle("height","auto"),l.setStyle("z-index",this.parentMenu.zIndex).setStyle("position","absolute").setStyle("display","none");var u=l.toDOM();u.menuLevel=this;var c=this._applyItem;if(s&&0===this.levelIndex&&!0!==this.parentMenu.options.hideButtons){var d=document.createElement("div");d.classList.add("".concat(this.cssPrefix,"-applyDiv")),d.menuItem=c,this.applyBtn=document.createElement("button"),this.parentMenu.options.useDefaultStyles&&(d.style.borderBottom="1px solid",d.style.padding="5px",d.style.marginBottom="5px",this.applyBtn.style.padding="0 5px",this.applyBtn.style.cursor="pointer");var h=document.createTextNode(this.parentMenu.options.buttons.submit);this.applyBtn.appendChild(h),d.appendChild(this.applyBtn);var p=document.createElement("button");p.classList.add("".concat(this.cssPrefix,"-cancel")),this.parentMenu.options.useDefaultStyles&&(p.style.padding="0 5px",p.style.cursor="pointer",p.style.marginLeft="15px");var f=document.createTextNode(this.parentMenu.options.buttons.cancel);p.appendChild(f),d.appendChild(p),u.appendChild(d),c.itemDiv=d,this.applyBtn.addEventListener("click",(function(){t.submit(t._applyItem)})),p.addEventListener("click",(function(){t.parentMenu.hideMenu()}))}if(null==this.parentLevel&&(this.parentMenu.options.searchBoxAlwaysShown||this.items.length>=this.parentMenu.options.showSearchBoxAfter)){var g=(0,ut.domel)("div").addClass("".concat(this.cssPrefix,"-searchDiv"));this.parentMenu.options.useDefaultStyles&&(g.setStyle("border-bottom","1px solid #666").setStyle("background-color",e).setStyle("border-color",this.parentMenu.style.colors.border),""!=o&&g.setStyle("font-family",o),g.setStyle("font-size",i).setStyle("color",n).setStyle("cursor","pointer").setStyle("text-align","left").setStyle("padding","5px"));var y=(0,ut.domel)("input").id("searchBox").name("searchBox").type("text").size(16).addClass("".concat(this.cssPrefix,"-searchBox")).on("input",(function(e){t.deactivateItem(t.activeItem),t.renderItems(t.searchBox.value)})).on("keydown",(function(e){switch(e.keyCode){case 13:t.activeItem&&t.activeItem.itemDiv.click();break;case 38:t.moveActiveItemUp();break;case 40:t.moveActiveItemDown();break;case 39:t.searchBox.value||t.openSubLevel(t.activeItem)}}));this.parentMenu.options.useDefaultStyles&&y.setStyle("font-family","monospace").setStyle("font-size","8pt").setStyle("width","100%"),a&&y.addClass("eqjs-dialog"),this.searchBox=y.toDOM(),this.searchDiv=g.toDOM(),this.searchDiv.appendChild(this.searchBox),u.appendChild(this.searchDiv)}var m=document.createElement("div");m.tabIndex=1,(0,ut.domel)(m).addClass("".concat(this.cssPrefix,"-scrollDiv")).addClass(dt.z.getMobileCssClass()),m.style.overflowX="hidden",m.style.overflowY="auto",m.style.position="relative",u.appendChild(m),this.levelDiv=u,this.scrollDiv=m,this.menuId&&(this.levelDiv.id=this.menuId),this.parentLevel&&(this.levelDiv.style.zIndex=this.parentLevel.levelDiv.style.zIndex),this.renderItems();m.addEventListener("keydown",(function(e){switch(e.which){case 13:t.parentMenu.options.multiselect?t.parentMenu.getRootLevel().applyBtn.click():t.activeItem&&t.activeItem.itemDiv.click();break;case 32:t.activeItem&&t.activeItem.itemDiv.click();break;case 37:t.parentLevel&&!t.isFilteringMode&&(t.deactivateItem(t.activeItem),t.parentLevel.focus());break;case 39:t.openSubLevel(t.activeItem);break;case 38:t.moveActiveItemUp();break;case 40:t.moveActiveItemDown();break;default:return}e.preventDefault()})),dt.z.isMobileMode()&&(this.closeDiv=(0,ut.domel)("div",u).addClass("eqjs-menu-close-btn").addText(r.i18n.getText("ButtonClose")).on("click",(function(){t.parentMenu.hideMenu()})).toDOM())}},t.prototype.moveActiveItemDown=function(){var t=this.isFilteringMode?this.filteredItems:this.items;if(this.activeItem){var e=t.indexOf(this.activeItem);e<t.length-1&&this.activateItem(t[e+1],!1)}else this.activateItem(t[0],!1)},t.prototype.moveActiveItemUp=function(){var t=this.isFilteringMode?this.filteredItems:this.items;if(this.activeItem){var e=t.indexOf(this.activeItem);e>0&&this.activateItem(t[e-1],!1)}else this.activateItem(t[t.length-1],!1)},t.prototype.openSubLevel=function(t){t&&t.items&&!this.isFilteringMode&&(this.showSubLevel(t),t.subLevel.activateItem(t.subLevel.items[0]))},t.prototype.focusScrollDiv=function(){this.scrollDiv.focus()},t.prototype.turnCheckboxes=function(t){for(var e=0;e<t.length;e++){var n=t[e];n.itemCheckbox&&(n.itemCheckbox.checked=this.isItemSelected(n)),n.items&&this.turnCheckboxes(n.items)}},t.prototype.isItemSelected=function(t){if(t.items){for(var e=0;e<t.items.length;e++)if(this.isItemSelected(t.items[e]))return!0;return!1}return t.selected},t.prototype.setItemSelected=function(t,e){if(t.items)for(var n=0;n<t.items.length;n++)this.setItemSelected(t.items[n],e);else t.selected=e},t.prototype.submitItems=function(t,e){for(var n=0;n<t.length;n++)t[n].items?this.submitItems(t[n].items,e):t[n].selected&&e.push(t[n])},t.prototype.allSubitemsAreFiltered=function(t,e){for(var n=0;n<t.length;n++)if(e(t[n]))return!1;return!0},t.prototype.isItemDiv=function(t){return!!t.menuItem},t.prototype.isLevelDiv=function(t){return!!t.menuLevel},t.prototype.getMenuItem=function(t){for(var e=t;!this.isItemDiv(e);){if(this.isLevelDiv(e))throw"Can't get menu item";e=e.parentElement}return e.menuItem},t.prototype.renderItemsWithoutFilter=function(){var t=this;this.isFilteringMode=!1;var e=this.scrollDiv,n=this.parentMenu.options.multiselect,o=this.parentMenu.options.activateOnMouseOver,i=this.parentMenu.style.colors.fgON||"black",r=(this.parentMenu.style.colors.bgOVER,this.parentMenu.style.itemStyle.fontSize||"14px"),s=this.parentMenu.getItemFilterCallback();e.innerHTML="";for(var a=0;a<this.items.length;a++){var l=this.items[a];if(l&&l.text){if(s){if(!s(l))continue;if(l.items&&this.allSubitemsAreFiltered(l.items,s))continue}l.data=function(e){return t[e]},void 0===l.selected&&(l.selected=!1),l.selected&&null==this.selectedItem&&(this.selectedItem=l);var u=document.createElement("div");if((0,ut.domel)(u).addClass("".concat(this.cssPrefix,"-itemDiv")).addClass(dt.z.getMobileCssClass()),l.selected&&this.showSelected&&!n&&u.classList.add("".concat(this.cssPrefix,"-selected")),this.domWriteItemsId&&this.menuId&&(u.id="item-"+this.menuId+"-"+l.id),e.appendChild(u),u.menuItem=l,u.menuLevel=this,l.itemDiv=u,this.parentMenu.options.useDefaultStyles&&(u.style.fontSize=r,u.style.color=i,u.style.paddingLeft="15px",u.style.paddingRight="6px",u.style.cursor="pointer"),"---"==l.text)u.appendChild(document.createElement("hr"));else{if(n){var c=document.createElement("input");c.type="checkbox",c.id="cb"+l.id,c.checked=this.isItemSelected(l),c.defaultChecked=this.isItemSelected(l),u.appendChild(c),l.itemCheckbox=c,this.parentMenu.options.useDefaultStyles&&(c.style.margin="4px 10px 0 0",c.style.verticalAlign="top")}var d=l.text;this.parentMenu.options.showItemIds&&(d=l.id+":"+d);var h=document.createTextNode(d);if(u.appendChild(h),l.items&&l.items.length>0){u.classList.add("".concat(this.cssPrefix,"-itemDiv-hasChildren"));var p=document.createElement("span");p.classList.add("".concat(this.cssPrefix,"-itemDiv-arrow")),u.appendChild(p);var f=document.createTextNode(">");p.appendChild(f)}var g=function(e){var o=t.getMenuItem(e.target);if(n)if(o.items&&e.target!=o.itemCheckbox)t.activateItem(o);else{var i=t.isItemSelected(o);t.setItemSelected(o,!i),o.itemCheckbox.checked=!i,t.parentMenu.refreshCheckboxes()}else t.activateItem(o),t.submit(o);return!1};u.removeEventListener("click",g),u.addEventListener("click",g),u.addEventListener("mouseenter",(function(e){var n=t.getMenuItem(e.target);t.parentMenu.isCursorInside=!0,o&&t.activateItem(n)})),u.addEventListener("mouseleave",(function(e){var n=t.getMenuItem(e.target);t.parentMenu.isCursorInside=!1,setTimeout((function(){t.parentMenu.isCursorInside||o&&n==t.activeItem&&!n.subLevel&&t.deactivateItem(n)}),200)}))}this.itemRenderedCallback&&this.itemRenderedCallback(this.menuId,u)}}},t.prototype.renderItemsWithFilter=function(t){this.isFilteringMode=!0,this.scrollDiv.innerHTML="";var e=t.split(">"),n=e.map((function(t){return t.replace(/\*/g,"")})),o=this.filterItems(this.items,e);this.filteredItems=[];for(var i=0;i<o.length;i++)this.renderItemWithFilter(o[i],n,0)},t.prototype.matchesFilter=function(t,e){return!t||!e||e.test(t)},t.prototype.filterItems=function(t,e){for(var n=[],o=e.length>0?e[0]:"",i=e.length>1?e.slice(1):e,s=o?new RegExp(o.replace(/\*/g,".+?"),"i"):null,a=0;a<t.length;a++){var l=t[a];if(l.items){var u=r.utils.assign({},l),c=this.matchesFilter(l.text,s);e.length<2?c&&e.length<2?u.items=r.utils.createArrayFrom(l.items):u.items=this.filterItems(l.items,i):u.items=c?this.filterItems(l.items,i):[],u.items.length>0&&n.push(u)}else this.matchesFilter(l.text,s)&&n.push(l)}return n},t.prototype.renderItemWithFilter=function(t,e,n){var o=this,i=this.scrollDiv,r=n<e.length?e[n]:e[e.length-1],s=this.parentMenu.options.multiselect,a=this.parentMenu.options.activateOnMouseOver,l=this.parentMenu.style.colors.fgON||"black",u=(this.parentMenu.style.colors.bgOVER,this.parentMenu.style.itemStyle.fontSize||"14px"),c=this.parentMenu.getItemFilterCallback();if(t&&t.text){if(c){if(!c(t))return;if(t.items&&this.allSubitemsAreFiltered(t.items,c))return}t.data=function(t){return this[t]},void 0===t.selected&&(t.selected=!1),t.selected&&null==this.selectedItem&&(this.selectedItem=t);var d=document.createElement("div");if((0,ut.domel)(d).addClass("".concat(this.cssPrefix,"-itemDiv")).addClass(dt.z.getMobileCssClass()),d.style.marginLeft="".concat(10*n,"px"),t.selected&&!s&&d.classList.add("".concat(this.cssPrefix,"-selected")),this.domWriteItemsId&&this.menuId&&(d.id="item-"+this.menuId+"-"+t.id),i.appendChild(d),d.menuItem=t,d.menuLevel=this,t.itemDiv=d,this.parentMenu.options.useDefaultStyles&&(d.style.fontSize=u,d.style.color=l,d.style.paddingLeft="15px",d.style.paddingRight="6px",d.style.cursor="pointer"),"---"==t.text)d.appendChild(document.createElement("hr"));else{if(s){var h=document.createElement("input");h.type="checkbox",h.id="cb"+t.id,h.checked=this.isItemSelected(t),h.defaultChecked=this.isItemSelected(t),d.appendChild(h),t.itemCheckbox=h,this.parentMenu.options.useDefaultStyles&&(h.style.margin="4px 10px 0 0",h.style.verticalAlign="top")}var p=document.createElement("span");if(p.innerHTML=this.highlightText(t.text,r),d.appendChild(p),t.items&&t.items.length>0)d.classList.add("".concat(this.cssPrefix,"-itemDiv-filter-hasChildren"));else{this.filteredItems.push(t);var f=function(e){if(s)if(t.items&&e.target!=t.itemCheckbox)o.activateItem(t);else{var n=o.isItemSelected(t);o.setItemSelected(t,!n),t.itemCheckbox.checked=!n,o.parentMenu.refreshCheckboxes()}else o.activateItem(t),o.submit(t);return!1};d.removeEventListener("click",f),d.addEventListener("click",f),d.addEventListener("mouseenter",(function(e){o.parentMenu.isCursorInside=!0,a&&o.activateItem(t)})),d.addEventListener("mouseleave",(function(e){o.parentMenu.isCursorInside=!1,setTimeout((function(){o.parentMenu.isCursorInside||a&&t==o.activeItem&&!t.subLevel&&o.deactivateItem(t)}),200)}))}}if(t.items)for(var g=0;g<t.items.length;g++)this.renderItemWithFilter(t.items[g],e,n+1);this.itemRenderedCallback&&this.itemRenderedCallback(this.menuId,d)}},t.prototype.highlightText=function(t,e){if(e&&e.length>0){var n=e.toLowerCase(),o=t.toLowerCase();if(o.indexOf(n)>=0){for(var i=0,r=t,s=[];;){var a=o.indexOf(n,i);if(a>=0?(s.push(a),i=a+e.length):i++,i>=r.length-1)break}if(s.length>0){t="";for(var l=0;l<s.length;l++)0===l&&(t+=r.substring(0,s[l])),t+="<span class='eqjs-menu-itemDiv-highlight'>"+r.substring(s[l],s[l]+e.length)+"</span>",l<s.length-1?t+=r.substring(s[l]+e.length,s[l+1]):t+=r.substring(s[l]+e.length)}}}return t},t.prototype.renderItems=function(t){t||dt.z.isMobileMode()?(t=t||"",this.renderItemsWithFilter(t.toLowerCase())):this.renderItemsWithoutFilter()},t.prototype.activateItem=function(t,e){void 0===e&&(e=!0),null!=this.activeItem&&this.deactivateItem(this.activeItem),this.activeItem=t;var n=t.itemDiv;if(n.classList.add("active"),this.parentMenu.options.useDefaultStyles){this.parentMenu.style.colors.bgON,this.parentMenu.style.colors.fgON;var o=this.parentMenu.style.colors.bgOVER,i=this.parentMenu.style.colors.fgOVER||"";this.parentMenu.style.itemClass;""!=(this.parentMenu.style.itemClassOver||"")?(n.style.backgroundColor="",n.style.color=""):(n.style.backgroundColor=o,n.style.color=i)}t.items&&!this.isFilteringMode&&e&&this.showSubLevel(t)},t.prototype.deactivateItem=function(t){if(t){var e=t.itemDiv;if(e.classList.remove("active"),this.parentMenu.options.useDefaultStyles){var n=this.parentMenu.style.colors.bgON,o=this.parentMenu.style.colors.fgON;""!=(this.parentMenu.style.itemClass||"")?(e.style.backgroundColor="",e.style.color=""):(e.style.backgroundColor=n,e.style.color=o)}t.subLevel&&t.subLevel.hide(),this.activeItem=null}},t.prototype.showSubLevel=function(e){if(!e.subLevel){var n="";this.menuId&&(n=this.menuId+"-"+e.id),e.subLevel=new t({showSelected:this.showSelected,menu:this.parentMenu,parent:this,container:this.parentElement,items:e.items,levelIndex:this.levelIndex+1,domWriteItemsId:this.domWriteItemsId,menuId:n,itemRenderedCallback:this.itemRenderedCallback})}var o=(0,ut.getElementAbsolutePos)(e.itemDiv),i=(0,ut.getScrollPos)(),r=(0,ut.getWinSize)(),s=o.x-i.left,a=r.width-s-e.itemDiv.offsetWidth;o.x+=e.itemDiv.offsetParent.offsetWidth,o.y+=1,e.subLevel.showAt(o.x,o.y,!0,!0),e.subLevel.levelDiv.style.width="",e.subLevel.levelDiv.style.right="",a>=e.subLevel.levelDiv.offsetWidth||a>=s?a<e.subLevel.levelDiv.offsetWidth&&(e.subLevel.levelDiv.style.right=-i.left+"px"):(s<e.subLevel.levelDiv.offsetWidth?e.subLevel.levelDiv.style.left=i.left+4+"px":e.subLevel.levelDiv.style.left="",e.subLevel.levelDiv.style.right=(0,ut.getViewportSize)().width-o.x+e.itemDiv.offsetWidth-6+"px"),e.subLevel.levelDiv.style.visibility="visible",e.subLevel.focus()},t.prototype.adjustTopPos=function(t){var e=(0,ut.getWinSize)(),n=t-(0,ut.getScrollPos)().top+this.levelDiv.offsetHeight,o=t;return n>e.height-5&&(o-=n-e.height+5)<(0,ut.getScrollPos)().top&&(o=(0,ut.getScrollPos)().top+10),o},t.prototype.showAt=function(t,e,n,o){if(this.items){this.initLevelDiv(),this.turnCheckboxes(this.items),this.renderItems();var i=this.levelDiv.style;o&&(this.levelDiv.style.visibility="hidden"),i.display="block",i.left=t+"px",i.top=e+"px",this.scrollDiv.style.width="auto",this.scrollDiv.style.height="auto",n&&(e=this.adjustTopPos(e),i.top=e+"px");var r=this.parentMenu.minItemWidth;if(r>0&&this.scrollDiv.offsetWidth<r)for(var s=0;s<this.items.length;s++)this.items[s].itemDiv.style.width=r+"px";var a=this.parentMenu.maxItemWidth;if(a>0&&this.scrollDiv.offsetWidth>a)for(s=0;s<this.items.length;s++)this.items[s].itemDiv.style.width=a+"px",this.items[s].itemDiv.style.overflowX="hidden";var l=(0,ut.getWinSize)().height-(e-(0,ut.getScrollPos)().top)-15;if(this.parentMenu.maxHeight>0&&l>this.parentMenu.maxHeight&&(l=this.parentMenu.maxHeight),null!=this._applyItem&&null!=this._applyItem.itemDiv&&(l-=this._applyItem.itemDiv.offsetHeight+5),null!=this.searchDiv&&(l-=this.searchDiv.offsetHeight),null!=this.closeDiv&&(l-=this.closeDiv.offsetHeight),this.levelDiv.offsetHeight>l){var u=l;u<50&&(u=50),this.scrollDiv.style.height=u+"px"}else this.scrollDiv.style.height="auto";this.activeItem=null}},t.prototype.focus=function(){var t=this;window.setTimeout((function(){t.scrollDiv.focus(),null!=t.searchBox&&(t.parentMenu.options.searchBoxAutoFocus&&t.searchBox.focus(),t.searchBox.value="")}),100)},t.prototype.hide=function(){(null!==this.activeItem&&this.activeItem.subLevel&&this.activeItem.subLevel.hide(),this.levelDiv)&&(this.levelDiv.style.display="none",this.initialized&&(this.parentElement.removeChild(this.levelDiv),this.initialized=!1))},t.prototype.initLevelDiv=function(){this.initialized||(this.parentElement.appendChild(this.levelDiv),(0,ut.domel)(this.levelDiv).addClass("".concat(this.cssPrefix,"-levelDiv")).addClass(dt.z.getMobileCssClass()),this.initialized=!0)},t.prototype.submit=function(t){if(null!=t&&!t.items){this.parentMenu.hideMenu();var e=[];t==this._applyItem&&this.submitItems(this.items,e),this.parentMenu.submitMenu(t,e)}},t.prototype.remove=function(){for(var t=0;t<this.items.length;t++){var e=this.items[t];e.subLevel&&e.subLevel.remove()}if(this.levelDiv){this.levelDiv.innerHTML="";var n=this.levelDiv.parentNode;null!=n&&n.removeChild(this.levelDiv)}this.levelDiv=null},t.prototype.update=function(t){this.remove(),this.items=t,this.activeItem=null,this.selectedItem=null,this._applyItem.itemDiv=null,this.initialized=!1,this.updated++,this.renderContent()},t.prototype.refreshCheckboxes=function(){for(var t=0;t<this.items.length;t++){var e=this.items[t];e.itemCheckbox&&(e.itemCheckbox.checked=this.isItemSelected(e)),e.subLevel&&e.subLevel.refreshCheckboxes()}},t.prototype.refreshItems=function(){for(var t=0;t<this.items.length;t++){var e=this.items[t];e.itemDiv&&(e.hidden?e.itemDiv.style.display="none":e.itemDiv.style.display="block"),e.subLevel&&e.subLevel.refreshItems()}},t.prototype.findItem=function(t){for(var e=t.toLowerCase(),n=0;n<this.items.length;n++){var o=this.items[n];if(0==o.text.toLowerCase().indexOf(e))return o}return null},t}(),gt=function(){function t(e){var n=this;this.isCursorInside=!1,this.mouseIsOverBlock=!1,this.mouseIsOverLink=!1,this.toId=null,this.active=!1,this.ancorFocused=null,this.options={items:[],buttons:{submit:r.i18n.getText("ButtonApply"),cancel:r.i18n.getText("ButtonCancel")},itemFilterCallback:null,useDefaultStyles:!1,multiselect:!1,adjustHeight:!0,showSearchBoxAfter:30,activateOnMouseOver:!0,container:document.body,domWriteItemsId:!1,itemRenderedCallback:null,showItemIds:!1},e&&r.utils.assignDeep(this.options,e),this.options.hideButtons&&(this.options.submitOnBlur=!0),this.menuId=t.lastMenuID++,this.updateProps(),this.rootLevel=new ft({menu:this,items:this.options.items,levelIndex:0,container:this.options.container,domWriteItemsId:this.options.domWriteItemsId,menuId:this.options.id,itemRenderedCallback:this.options.itemRenderedCallback,showSelected:this.options.showSelected}),this.rootLevel.levelDiv.classList.add("".concat(this.cssPrefix,"-rootLevel")),this.options.zIndex&&(this.rootLevel.levelDiv.style.zIndex="".concat(this.options.zIndex)),this.menuKeyUpHandler=function(t){27==t.which&&(n.hideMenu(),t.stopImmediatePropagation())},this.globalMouseDownHandler=function(t){if(!n.active)return!0;for(var e=window.event||t,o=e.srcElement||e.target,i=!0;o;){if(o.tagName&&"div"==o.tagName.toLowerCase()&&o.menuLevel&&o.menuLevel.parentMenu==n){i=!1;break}o=o.parentNode||o.parentElement}return i&&(n.options.submitOnBlur&&n.rootLevel.submit(n.rootLevel.applyItem),n.hideMenu()),!0},this.render()}return Object.defineProperty(t.prototype,"cssPrefix",{get:function(){return"eqjs-menu"},enumerable:!1,configurable:!0}),t.prototype.getItems=function(){return this.rootLevel.getItems()},t.prototype.updateProps=function(){this.style={},this.style.colors={border:"#666666",shadow:"#888888",bgON:"white",fgON:"black",bgOVER:"#B6BDD2",fgOVER:"black"},this.style.itemStyle={fontSize:"14px"},this.minItemWidth=0,this.maxItemWidth=0,this.maxHeight=0,this.zIndex="".concat(this.options.zIndex),this.commandTemplate="",this.args=[],this.active=!1},t.prototype.render=function(){},t.prototype.clearItemsMenuProps=function(t){if(t)for(var e=0;e<t.length;e++)this.clearItemMenuProps(t[e])},t.prototype.clearItemMenuProps=function(t){t.subLevel&&t.subLevel.parentMenu==this||(t.subLevel&&(t.subLevel.remove(),t.subLevel=null),t.itemDiv&&(t.itemDiv=null),t.items&&this.clearItemsMenuProps(t.items))},t.prototype.setSelectedItems=function(t,e){for(var n=t?t.length:0,o=0;o<n;o++){var i=t[o];i.items?this.setSelectedItems(i.items,e):i.selected=e.indexOf(i.id)>=0}},t.prototype.getRootLevel=function(){return this.rootLevel},t.prototype.getItemFilterCallback=function(){return this.itemFilterCallback},t.prototype.showMenu=function(t){this.ancorFocused=t.anchor==document.activeElement?t.anchor:null,this.clearItemsMenuProps(this.options.items),this.itemSelectedCallback=t.itemSelectedCallback||null,this.menuClosedCallback=t.menuClosedCallback||null,this.itemFilterCallback=t.itemFilterCallback||null,t.items&&(this.options.items=t.items,this.rootLevel.setItems(t.items)),t.onMenuItemSelected&&(this.options.onMenuItemSelected=t.onMenuItemSelected);var e=t.selectedIds||null;if(e?"string"==typeof e&&(e=e.split(",")):e=[],this.active=!0,this.setSelectedItems(this.options.items,e),dt.z.isMobileMode())this.rootLevel.showAt(0,0,!0,!0),this.rootLevel.levelDiv.style.top="0px",this.rootLevel.levelDiv.style.bottom="0px",this.rootLevel.levelDiv.style.right="0px",this.rootLevel.levelDiv.style.position="fixed",this.rootLevel.levelDiv.style.fontSize="20px";else{var n=t.anchor||document.documentElement,o=(0,ut.getElementAbsolutePos)(n),i=n.offsetHeight,r=n.offsetWidth,s={x:o.x,y:o.y+i+2},a=(0,ut.getScrollPos)(),l=(0,ut.getWinSize)(),u=s.x+r-a.left,c=l.width-u+r;s.x+=2,this.rootLevel.showAt(s.x,s.y,!0,!0),this.rootLevel.levelDiv.style.width="",this.rootLevel.levelDiv.style.right="",this.rootLevel.levelDiv.style.zIndex||(this.rootLevel.levelDiv.style.zIndex="".concat(Math.max(1e4,(0,ct.X1)(n)+1))),c>=this.rootLevel.levelDiv.offsetWidth||c>=u?c<this.rootLevel.levelDiv.offsetWidth&&(this.rootLevel.levelDiv.style.right=-a.left+"px"):(u<this.rootLevel.levelDiv.offsetWidth?this.rootLevel.levelDiv.style.left=a.left+4+"px":this.rootLevel.levelDiv.style.left="",this.rootLevel.levelDiv.style.right=(0,ut.getViewportSize)().width-s.x-r+"px"),this.rootLevel.levelDiv.style.fontSize="14px"}this.rootLevel.levelDiv.style.visibility="visible",this.rootLevel.focus(),document.addEventListener("keyup",this.menuKeyUpHandler),document.addEventListener("mousedown",this.globalMouseDownHandler,!0)},t.prototype.hideMenu=function(){document.removeEventListener("mousedown",this.globalMouseDownHandler,!0),document.removeEventListener("keyup",this.menuKeyUpHandler),this.rootLevel.hide(),this.ancorFocused&&this.ancorFocused.focus(),this.menuClosedCallback&&this.menuClosedCallback()},t.prototype.submitMenu=function(t,e){this.itemSelectedCallback&&this.itemSelectedCallback(t,e)},t.prototype.knockMenuStyle=function(t){t.removeAttribute("style");var e=t.querySelectorAll("ul").item(0);!1!==!(!e||!e.style)&&e.setAttribute("style","")},t.prototype.refreshItems=function(){this.rootLevel.refreshItems()},t.prototype.refreshCheckboxes=function(){this.rootLevel.refreshCheckboxes()},t.lastMenuID=0,t}(),yt=function(){function t(){this.formatStr="",this.pos=0,this.token="text",this.tokenText=""}return t.prototype.start=function(t){this.formatStr=t,this.pos=0,this.tokenText=""},t.prototype.skipSpaces=function(){for(;this.pos<this.formatStr.length&&" "===this.formatStr.charAt(this.pos);)this.pos++},t.prototype.getToken=function(){return this.token},t.prototype.getTokenText=function(){return this.tokenText},t.prototype.next=function(){if(this.skipSpaces(),this.pos>=this.formatStr.length)return!1;var t=0;if("{"===this.formatStr.charAt(this.pos)){if((t=this.formatStr.indexOf("}",this.pos))<0)return!1;this.tokenText=this.formatStr.substring(this.pos,t+1),0!==this.tokenText.indexOf("{expr")&&0!==this.tokenText.indexOf("{attr")||(this.token="expression"),this.pos=t+1}else if("["===this.formatStr.charAt(this.pos)&&this.pos<this.formatStr.length-1&&"["===this.formatStr.charAt(this.pos+1))this.pos+=2,t=this.formatStr.indexOf("]]",this.pos),this.token="function",this.tokenText=this.formatStr.substring(this.pos,t),this.pos=t+2;else{this.token="text";var e=this.formatStr.indexOf("{",this.pos);e<0&&(e=this.formatStr.length);var n=this.formatStr.indexOf("[[",this.pos);n<0&&(n=this.formatStr.length),t=Math.min(e,n),this.tokenText=this.formatStr.substring(this.pos,t).trim(),this.pos=t}return!0},t}(),mt=function(t,e,n){if(n||2===arguments.length)for(var o,i=0,r=e.length;i<r;i++)!o&&i in e||(o||(o=Array.prototype.slice.call(e,0,i)),o[i]=e[i]);return t.concat(o||Array.prototype.slice.call(e))};!function(t){t[t.Enable=0]="Enable",t[t.Delete=1]="Delete",t[t.Hidden=2]="Hidden",t[t.SortingNone=3]="SortingNone",t[t.SortingAsc=4]="SortingAsc",t[t.SortingDesc=5]="SortingDesc",t[t.MoveTop=6]="MoveTop",t[t.MoveUp=7]="MoveUp",t[t.MoveDown=8]="MoveDown",t[t.MoveBottom=9]="MoveBottom",t[t.Menu=10]="Menu",t[t.Type=11]="Type",t[t.Format=12]="Format"}(lt||(lt={}));var vt,Ct=function(){function t(t,e,n){this.functionMenu=null,this.formatsMenu=null,this.buttonMenu=null,this.isMouseOverBlock=!1,this.keepShowingButtons=!1,this.panel=t,this.column=e,this.element=n}return Object.defineProperty(t.prototype,"cssPrefix",{get:function(){return"eqjs-qc"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"columnEnabled",{get:function(){return this.column.enabled},set:function(t){this.column.enabled=t},enumerable:!1,configurable:!0}),t.prototype.render=function(){var t=this;this.baseAttr=this.getAttribute(),this.getButtonsToShow().indexOf("sorting")>=0&&this.columnEnabled&&(this.sortingButton=this.renderSoringButton(this.column.sorting),this.column.sorting!==E.None&&(this.sortingButton.style.display="block"));var e=(0,ut.domel)("div");return e.data("id",this.column.id),this.element&&this.element.parentNode.replaceChild(e.toDOM(),this.element),this.element=e.toDOM(),this.panel.options.allowDragDrop&&!dt.z.isMobileMode()&&ut.eqDragManager.registerDraggableItem({element:this.element,scope:"entityAttrSort",data:{column:this.column},beforeDragStart:function(){t.hideButtons()},renderer:function(e){e.innerHTML="";var n=document.createElement("span");n.innerText=t.column.caption,e.classList.add("eqjs-sortable-helper"),e.appendChild(n)},onDragStart:function(e){t.element.style.display="none",e.dropEffect=ut.DropEffect.Allow},onDragEnd:function(e){e.data.finishedSuccessfully||t.element.style.removeProperty("display")}}),this.isEditable()&&(this.createFunctionMenu(),this.createFormatsMenu()),this.createButtonMenu(),e.addClass(this.getClassesToAdd()).addClass(dt.z.getMobileCssClass()).addChildElement(this.renderCheckbox()).addChild("div",(function(e){return e.addClass("".concat(ct.YR,"-button-placeholder"),"".concat(t.cssPrefix,"-button-placeholder"),"".concat(t.cssPrefix,"-colelement"),"".concat(t.cssPrefix,"-sortbutton-placeholder")).addChildElement(t.sortingButton)})).addChildElement(this.renderExpressionBlock()),!1===this.panel.options.showColumnTitles||dt.z.isMobileMode()||e.addChildElement(this.renderCaptionBlock()),e.addChild("div",(function(e){e.addClass("".concat(ct.YR,"-column-buttonsBlock"),"".concat(t.cssPrefix,"-buttonsBlock")).addClass(dt.z.getMobileCssClass()),t.getButtonsToShow().indexOf("enable")>=0&&!t.column.isReadOnly()&&e.addChildElement(t.renderEnabledButton()),t.getButtonsToShow().indexOf("type")>=0&&t.columnEnabled&&e.addChildElement(t.renderColumnTypeButton()),t.getButtonsToShow().indexOf("format")>=0&&t.columnEnabled&&e.addChildElement(t.renderColumnFormatButton()),t.getButtonsToShow().indexOf("delete")>=0&&!t.column.isReadOnly()&&e.addChildElement(t.renderDeleteButton()),t.getButtonsToShow().indexOf("menu")>=0&&!t.column.isReadOnly()&&e.addChildElement(t.renderMenuButton())})),dt.z.isMobileMode()||e.on("mouseenter",this.onMouseEnter.bind(this)).on("mouseleave",this.onMouseLeave.bind(this)),(this.panel.options.accentActiveColumn||dt.z.isMobileMode())&&e.on("click",this.onMouseClick.bind(this)),this.panel.options.alwaysShowButtons&&this.showButtons(),this.element},t.prototype.onMouseClick=function(t){return t.stopPropagation(),this.panel.toggleColumnPicked(this.column),this.adjustButtonsVisibility(),dt.z.isMobileMode()||this.element.dispatchEvent((0,ut.createBrowserEvent)("mouseenter")),!1},t.prototype.fireColumnChanged=function(){this.column.fireChangedEvent()},t.prototype.refresh=function(){this.render()},t.prototype.getAttribute=function(){return this.panel.getContext().getModel().getAttributeByIdSafe(this.column.expr.value)},t.prototype.renderCaptionBlock=function(){var t=this;this.column.caption&&""!=this.column.caption||(this.column.caption=this.getDefaultColumnCaption());var e=(0,ut.domel)("div").addClass("".concat(this.cssPrefix,"-colelement"),"".concat(this.cssPrefix,"-captionelement")).addClass(dt.z.getMobileCssClass());return this.isEditable()?e.addChild("a",(function(e){return e.attr("href","javascript:void(0)").title(t.column.caption).text(t.column.caption).on("click",(function(e){e.stopPropagation();var n=e.target,o=n.parentElement.querySelector("input");return o&&(n.style.display="none",o.style.removeProperty("display"),o.style.minWidth="".concat(n.clientWidth),o.focus(),t.element.setAttribute(ut.eqDragManager.DRAG_DISABLED_ATTR,"")),!1}))})).addChild("input",(function(e){return e.hide().value(t.column.caption).on("blur keydown",(function(e){var n=!1,o=!0;if(e instanceof KeyboardEvent?13===e.keyCode?n=!0:27===e.keyCode&&(n=!0,o=!1):e instanceof FocusEvent&&(n=!0),n){var i=e.target,r=i.parentElement.querySelector("a");r&&(r.style.removeProperty("display"),i.style.display="none"),o&&t.column.caption!==i.value?(t.column.caption=i.value,t.fireColumnChanged()):(i.value=t.column.caption,(0,ct.n6)(r)),t.element.removeAttribute(ut.eqDragManager.DRAG_DISABLED_ATTR)}return!0}))})):e.addChild("span",(function(e){e.text(t.column.caption).title(t.column.caption)})),e.toDOM()},t.prototype.renderSoringButton=function(t){var e,n=this,o="".concat(ct.YR,"-column-sortbutton");switch(t){case E.Ascending:e="".concat(o,"-asc");break;case E.Descending:e="".concat(o,"-desc");break;default:e="".concat(o,"-none")}return this.isEditable()?(0,ut.domel)("div").addClass(o,"".concat(ct.YR,"-button"),e).data("btnplaceholder","").title(r.i18n.getText("ButtonSorting")).attr("tabIndex","0").on("click",(function(t){t.stopPropagation(),n.keepShowingButtons=!0,(n.getUIS()&&n.panel.sortMenu||n.panel.moveMenu).showMenu({anchor:n.sortingButton,selectedIds:n.column.isHidden()?["IsHidden"]:null,itemSelectedCallback:function(t,e){var o;switch(t.id){case"IsHidden":o=lt.Hidden;break;case"MoveTop":o=lt.MoveTop;break;case"MoveDown":o=lt.MoveDown;break;case"MoveUp":o=lt.MoveUp;break;case"MoveBottom":o=lt.MoveBottom;break;case"None":o=lt.SortingNone;break;case"Ascending":o=lt.SortingAsc;break;case"Descending":o=lt.SortingDesc}n.buttonMenuHandler(o,null)},menuClosedCallback:function(){n.keepShowingButtons=!1,n.isMouseOverBlock||n.leaveButtonBlock()}})})).on("keypress",(function(t){13==t.keyCode&&t.target.click()})).toDOM():t===E.Ascending||t===E.Descending?(0,ut.domel)("div").addClass(o,"".concat(ct.YR,"-button"),e).title(r.i18n.getText("ButtonSorting")).toDOM():null},t.prototype.renderCheckbox=function(){var t=this;return this.panel.options.showCheckboxes&&!this.column.isReadOnly()?(0,ut.domel)("div").title(r.i18n.getText("CmdToggleEnable")).attr("tabIndex","0").addClass("".concat(this.cssPrefix,"-colelement ").concat(this.cssPrefix,"-column-checkbox")).addClass("".concat(this.columnEnabled?"enabled":"")).on("click",(function(){return t.columnEnabled=!t.columnEnabled,t.column.fireChangedEvent(),!1})).on("keypress",(function(t){[13,32].includes(t.keyCode)&&t.target.click()})).toDOM():null},t.prototype.renderDeleteButton=function(){var t=this;return(0,ut.domel)("div").addClass("".concat(ct.YR,"-button-placeholder"),"".concat(this.cssPrefix,"-button-placeholder"),"".concat(this.cssPrefix,"-deletebutton-placeholder")).data("btnplaceholder","").addChild("div",(function(e){return e.addClass("".concat(ct.YR,"-button"),"".concat(ct.YR,"-column-button"),"".concat(ct.YR,"-column-button-delete")).title(r.i18n.getText("CmdDelete")).attr("tabIndex","0").on("click",(function(e){return t.buttonMenuHandler(lt.Delete,e)})).on("keypress",(function(t){13==t.keyCode&&t.target.click()}))})).toDOM()},t.prototype.renderMenuButton=function(){var t=this;return(0,ut.domel)("div").addClass("".concat(ct.YR,"-button-placeholder"),"".concat(this.cssPrefix,"-button-placeholder"),"".concat(this.cssPrefix,"-menubutton-placeholder")).data("btnplaceholder","").addChild("div",(function(e){return e.addClass("".concat(ct.YR,"-button"),"".concat(ct.YR,"-column-button"),"".concat(ct.YR,"-column-button-menu")).title(r.i18n.getText("ButtonMenu")).attr("tabIndex","0").on("click",(function(e){return t.buttonMenuHandler(lt.Menu,e)})).on("keypress",(function(t){13==t.keyCode&&t.target.click()}))})).toDOM()},t.prototype.getDefaultColumnCaption=function(){return this.getDefaultTitleText(this.baseAttr)},t.prototype.getDefaultTitleText=function(t){return this.getAttributeCaption(t,this.panel.options.titleElementFormat)},t.prototype.getAttributeCaption=function(t,e){return e=e||this.panel.options.attrElementFormat,this.panel.getContext().getModel().getAttributeText(t,e)},t.prototype.getClassesToAdd=function(){var t="";return t+=this.columnEnabled?"":" ".concat(this.cssPrefix,"-disabled"),this.columnEnabled&&(t+=this.column.isReadOnly()?" ".concat(this.cssPrefix,"-readonly"):""),t+=this.column.isHidden()?" ".concat(this.cssPrefix,"-hidden"):""},t.prototype.renderColumnTypeButton=function(){var t=this;return this.isEditable()&&!1!==this.panel.options.allowAggrColumns?(0,ut.domel)("div").addClass("".concat(ct.YR,"-button-placeholder"),"".concat(this.cssPrefix,"-button-placeholder"),"".concat(this.cssPrefix,"-typebutton-placeholder"),"".concat(this.cssPrefix,"-button-active")).data("btnplaceholder","").addChild("div",(function(e){return e.addClass("".concat(ct.YR,"-button"),"".concat(ct.YR,"-column-button"),"".concat(ct.YR,"-column-button-type")).title(r.i18n.getText("ButtonToAggr")).attr("tabIndex","0").on("click",(function(e){e.stopPropagation(),t.keepShowingButtons=!0,t.changeTypeHandler(e)})).on("keypress",(function(t){13==t.keyCode&&t.target.click()}))})).toDOM():null},t.prototype.renderColumnFormatButton=function(){var t=this,e=this.getFormatsMenuItems();return this.isEditable()&&!1!==this.panel.options.allowDisplayFormatChange&&e.length>1?(0,ut.domel)("div").addClass("".concat(ct.YR,"-button-placeholder"),"".concat(this.cssPrefix,"-button-placeholder"),"".concat(this.cssPrefix,"-formatbutton-placeholder"),"".concat(this.cssPrefix,"-button-active")).data("btnplaceholder","").addChild("div",(function(e){return e.addClass("".concat(ct.YR,"-button"),"".concat(ct.YR,"-column-button"),"".concat(ct.YR,"-column-button-format")).title(r.i18n.getText("ButtonFormat")).attr("tabIndex","0").on("click",(function(e){e.stopPropagation(),t.keepShowingButtons=!0,t.changeFormatHandler(e)})).on("keypress",(function(t){13==t.keyCode&&t.target.click()}))})).toDOM():null},t.prototype.renderEnabledButton=function(){var t=this;return(0,ut.domel)("div").addClass("".concat(ct.YR,"-button-placeholder"),"".concat(this.cssPrefix,"-button-placeholder"),"".concat(this.cssPrefix,"-enablebutton-placeholder"),"".concat(this.cssPrefix,"-button-active")).data("btnplaceholder","").addChild("div",(function(e){return e.addClass("".concat(ct.YR,"-button"),"".concat(ct.YR,"-column-button"),"".concat(ct.YR,"-column-button-enable")).title(r.i18n.getText("CmdToggleEnable")).addClass(t.columnEnabled?"enabled":"").attr("tabIndex","0").on("click",(function(e){return t.buttonMenuHandler(lt.Enable,e)})).on("keypress",(function(t){13==t.keyCode&&t.target.click()}))})).toDOM()},t.prototype.isEditable=function(){return this.columnEnabled&&!this.column.isReadOnly()},t.prototype.changeFormatHandler=function(t){var e=this,n=this.panel.getContext().getModel().getDisplayFormatsForType(this.column.getDataType()),o="{0:__default}";n.filter((function(t){return t.format==e.column.displayFormat})).length>0&&(o=this.column.displayFormat),this.formatsMenu.showMenu({anchor:t.target,selectedIds:o,itemSelectedCallback:function(t,n){return t.id!=o&&("{0:__default}"==t.id?e.column.displayFormat="":e.column.displayFormat=t.id,e.column.fireChangedEvent()),!1},menuClosedCallback:function(){e.keepShowingButtons=!1,e.isMouseOverBlock||e.element.dispatchEvent((0,ut.createBrowserEvent)("mouseleave"))}})},t.prototype.getUIS=function(){return this.panel.getContext().getModel().checkAttrProperty(this.column.expr.value,"useInSorting")},t.prototype.onMouseEnter=function(t){return this.isMouseOverBlock=!0,this.enterButtonBlock(),t.stopPropagation(),!1},t.prototype.onMouseLeave=function(t){return this.isMouseOverBlock=!1,this.leaveButtonBlock(),t.stopPropagation(),!1},t.prototype.isColumnActive=function(){return this.element.classList.contains("active")},t.prototype.hideButtons=function(){(0,ut.domel)(this.element).data("show-buttons",null)},t.prototype.showButtons=function(){(0,ut.domel)(this.element).data("show-buttons","")},t.prototype.adjustButtonsVisibility=function(){(this.panel.options.alwaysShowButtons||(this.panel.options.accentActiveColumn||dt.z.isMobileMode())&&this.isColumnActive())&&this.showButtons()},t.prototype.enterButtonBlock=function(){this.showButtons()},t.prototype.leaveButtonBlock=function(){this.keepShowingButtons||!0===this.panel.options.alwaysShowButtons||this.isColumnActive()&&1==this.panel.options.accentActiveColumn||this.hideButtons()},t.prototype.createFunctionMenu=function(){for(var t,e=[],n=this.panel.getContext().getModel().getAggrFunctions(),o=!0,i=null,s=this.column.getDataType(),a=0,l=n;a<l.length;a++){var u=l[a];if(u){var c=u.getAppliedTypesOrDefault().indexOf(s)>=0;this.column.expr.func!==u.id||c||(o=!1),c&&(t=this.panel.getContext().getModel().getAggrFunctionCaption(u.id),i={id:u.id,text:t},e.push(i))}}o||(this.column.expr.func=e[0].id),this.panel.areCustomExpressionsAllowed()&&(i={id:"CustomSqlDivider",text:"---"},e.push(i),i={id:"CUSTOMSQL",text:t=r.i18n.getText("CustomExpression")},e.push(i));var d=this.column.id;d&&(d+="-FunctionsMenu");var h={items:e,id:d,searchBoxAlwaysShown:!1,domWriteItemsId:!0};this.functionMenu=new gt(h)},t.prototype.createFormatsMenu=function(){if(0!=this.panel.options.allowDisplayFormatChange){var t=this.column.id;t&&(t+="-FormatsMenu");var e={items:this.getFormatsMenuItems(),id:t,searchBoxAlwaysShown:!1,showSelected:!0,domWriteItemsId:!0};this.formatsMenu=new gt(e)}},t.prototype.getFormatsMenuItems=function(){var t=this.panel.getContext().getModel().getDisplayFormatsForType(this.column.getDataType());return[{id:"{0:__default}",text:"Default"}].concat(t.map((function(t){return{id:t.format,text:r.i18n.getText("DisplayFormats",t.name)||t.name}})))},t.prototype.getButtonsToShow=function(){return this.panel.options.buttons&&Array.isArray(this.panel.options.buttons)?this.panel.options.buttons:["enable","delete","type","sorting","format"]},t.prototype.buttonMenuHandler=function(t,e){var n=this;switch(t){case lt.Delete:var o=this.column.getQuery();o.removeColumn(this.column,this.panel),o.fireColumnsChangedEvent(w.Delete,this.column);break;case lt.Enable:this.columnEnabled=!this.columnEnabled,this.fireColumnChanged();break;case lt.Hidden:this.column.setHidden(!this.column.isHidden()),this.fireColumnChanged();break;case lt.MoveTop:this.panel.moveColumn(this.column,"MoveTop");break;case lt.MoveBottom:this.panel.moveColumn(this.column,"MoveBottom");break;case lt.MoveUp:this.panel.moveColumn(this.column,"MoveUp");break;case lt.MoveDown:this.panel.moveColumn(this.column,"MoveDown");break;case lt.SortingAsc:this.column.sorting=E.Ascending,this.column.fireChangedEvent();break;case lt.SortingDesc:this.column.sorting=E.Descending,this.column.fireChangedEvent();break;case lt.SortingNone:this.column.sorting=E.None,this.column.fireChangedEvent();break;case lt.Menu:var i=this.buttonMenu;this.keepShowingButtons=!0,i.showMenu({anchor:e?e.target:null,selectedIds:this.getButtonMenuSelectedItems(),itemSelectedCallback:function(t){var o=t.id;switch(t.id){case"enable":o=lt.Enable;break;case"delete":o=lt.Delete;break;case"hidden":o=lt.Hidden;break;case"MoveTop":o=lt.MoveTop;break;case"MoveBottom":o=lt.MoveBottom;break;case"MoveUp":o=lt.MoveUp;break;case"MoveDown":o=lt.MoveDown;break;case"None":o=lt.SortingNone;break;case"Ascending":case"Descending":o=lt.SortingAsc}n.buttonMenuHandler(o,e)},itemFilterCallback:function(t){return n.columnEnabled||"__group"===t.id||"enable"===t.id||"delete"===t.id},menuClosedCallback:function(){n.keepShowingButtons=!1,n.isMouseOverBlock||n.leaveButtonBlock()}});break;default:this.processFormatsButtonMenuItems(t,e)||this.processExtraButtonMenuItems(t,e)}return e&&e.stopPropagation(),!1},t.prototype.createButtonMenu=function(){if(!this.buttonMenu){var t=this.column.id;t&&(t+="-ButtonMenu");var e=[];e.push({id:"enable",text:r.i18n.getText("MenuEnable")}),this.panel.options.allowHiddenColumns&&e.push({id:"hidden",text:r.i18n.getText("CmdHiddenColumn")}),e.push({id:"delete",text:r.i18n.getText("CmdDelete")});var n=[];n.push({id:"__group",text:" ",items:e});var o=this.panel.options.allowSorting?mt(mt([],this.panel.getSortMenuList(),!0),this.panel.getMoveMenuList(),!0):this.panel.getMoveMenuList();n.push({id:"__group",text:r.i18n.getText("CmdGroupSort"),items:o});var i=this.getExtraButtonMenuItems();i&&Array.isArray(i)&&(n=mt(mt([],n,!0),i,!0));var s=this.getFormatsMenuItems();s.length>1&&n.push({id:"__group",text:r.i18n.getText("CmdGroupFormat"),items:s});var a={items:n,id:t,searchBoxAlwaysShown:!1,domWriteItemsId:!0,showSelected:!0};this.buttonMenu=new gt(a)}},t.prototype.processFormatsButtonMenuItems=function(t,e){var n=this.panel.getContext().getModel().getDisplayFormatsForType(this.column.getDataType());if("{0:__default}"==t)this.column.displayFormat="";else{if(!(n.filter((function(e){return e.format==t})).length>0))return!1;this.column.displayFormat=t}return this.column.fireChangedEvent(),!0},t.prototype.getButtonMenuSelectedItems=function(){var t=this,e=[];this.columnEnabled&&e.push("enable"),this.column.isHidden()&&e.push("hidden");var n="{0:__default}";return this.panel.getContext().getModel().getDisplayFormatsForType(this.column.getDataType()).filter((function(e){return e.format==t.column.displayFormat})).length>0&&(n=this.column.displayFormat),e.push(n),e},t}(),bt=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),xt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return bt(e,t),e.prototype.getClassesToAdd=function(){return"".concat(t.prototype.getClassesToAdd.call(this)," ").concat(this.cssPrefix,"-row ").concat(this.cssPrefix,"-row-column-entattr")},e.prototype.renderExpressionBlock=function(){var t=this;return(0,ut.domel)("div").addClass("".concat(this.cssPrefix,"-expr-block")).addClass(dt.z.getMobileCssClass()).addChild("div",(function(e){return e.addClass("".concat(t.cssPrefix,"-colelement"),"".concat(t.cssPrefix,"-attrelement")).addClass(dt.z.getMobileCssClass()).addChildElement(t.renderBaseExpression())})).toDOM()},e.prototype.renderBaseExpression=function(){var t=this,e=this.getAttributeCaption(this.baseAttr);return this.isEditable()?(0,ut.domel)("a").attr("href","javascript:void(0)").title(e).text(e).on("click",(function(e){return e.stopPropagation(),t.panel.showEntitiesMenu({anchor:e.target,selectedIds:null,itemSelectedCallback:t.baseExpressionItemSelectedCallback.bind(t),itemFilterCallback:function(t){return"__AddAll__"!==t.id}}),!1})).toDOM():(0,ut.domel)("span").text(e).title(e).toDOM()},e.prototype.baseExpressionItemSelectedCallback=function(t,e){var n=t.id;return this.column.expr.setValue(n,!0),this.column.caption="",this.fireColumnChanged(),!1},e.prototype.getUIS=function(){var t=this.column.expr.args[0];return!t||this.panel.getContext().getModel().checkAttrProperty(t.value,"useInSorting")},e.prototype.changeTypeHandler=function(t){var e=this;this.keepShowingButtons=!0,this.functionMenu.showMenu({anchor:t.target,selectedIds:null,itemSelectedCallback:function(t,n){return e.processExtraButtonMenuItems(t.id,null),!1},menuClosedCallback:function(){e.keepShowingButtons=!1,e.isMouseOverBlock||e.element.dispatchEvent((0,ut.createBrowserEvent)("mouseleave"))}})},e.prototype.changeTypeToCustomSql=function(){var t=this;this.column.getQuery().changeColumnType(this.column,p.CustomSql);var e=this.element.parentElement;setTimeout((function(){var n=e.querySelector("div[data-id='".concat(t.column.id,"'] div[class*='").concat(t.cssPrefix,"-expr-block'] div[class*='").concat(t.cssPrefix,"-colelement'] a"));n&&n.click()}),500),this.fireColumnChanged()},e.prototype.changeTypeToAggr=function(t){this.column.getQuery().changeColumnType(this.column,p.AggregateFunction,{funcId:t}),this.fireColumnChanged()},e.prototype.processExtraButtonMenuItems=function(t,e){return"CUSTOMSQL"===t?this.changeTypeToCustomSql():this.changeTypeToAggr(t),!0},e.prototype.getExtraButtonMenuItems=function(){for(var t,e=[],n=this.panel.getContext().getModel().getAggrFunctions(),o=!0,i=!0,s=null,a=this.getAttribute(),l=0,u=n;l<u.length;l++){var c=u[l];o=c.getAppliedTypesOrDefault().indexOf(a.dataType)>=0,this.column.expr.func!==c.id||o||(i=!1),o&&(t=this.panel.getContext().getModel().getAggrFunctionCaption(c.id),s={id:c.id,text:t},e.push(s))}for(var d=0;d<n.length;d++)n[d];return i||(this.column.expr.func=e[0].id),this.panel.areCustomExpressionsAllowed()&&(s={id:"CustomSqlDivider",text:"---"},e.push(s),s={id:"CUSTOMSQL",text:t=r.i18n.getText("CustomExpression")},e.push(s)),[{id:"__group",text:r.i18n.getText("ColTypeGroup"),items:e}]},e}(Ct),wt=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Et=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.displayFormatParser=new yt,e}return wt(e,t),e.prototype.getClassesToAdd=function(){return"".concat(t.prototype.getClassesToAdd.call(this)," ").concat(this.cssPrefix,"-row ").concat(this.cssPrefix,"-row-column-aggr")},e.prototype.getAttribute=function(){return this.panel.getContext().getModel().getAttributeByIdSafe(this.column.expr.args[0].value)},e.prototype.getDefaultColumnCaption=function(){return this.getDefaultTitleText(this.baseAttr)+" "+this.panel.getContext().getModel().getAggrFunctionCaption(this.column.expr.func)},e.prototype.renderExpressionBlock=function(){var t=this,e=this.panel.getContext().getModel(),n=(0,ut.domel)("div").addClass("".concat(this.cssPrefix,"-expr-block"),"".concat(this.cssPrefix,"-expr-block-aggr")).addClass(dt.z.getMobileCssClass()),o=e.getAggrFunctionFormat(this.column.expr.func);if(o&&""!==o){var i=this.parseDisplayFormat(o);if(0!==i.length){for(var r=null,s=i.length,a=function(e){if(1===(r=i[e]).type)if(l.isEditable()){var o=(0,ut.domel)("a").attr("href","javascript:void(0)").text(r.text).on("click",(function(e){e.stopPropagation(),t.functionMenu.showMenu({anchor:o.toDOM(),selectedIds:null,itemSelectedCallback:function(e,n){"CUSTOMSQL"===e.id?t.changeTypeToCustomSql():(t.column.expr.func=e.id,t.column.caption="",t.fireColumnChanged())}})}));n.addChild("div",(function(e){return e.addClass("".concat(t.cssPrefix,"-colelement"),"".concat(t.cssPrefix,"-aggrfuncelement")).addClass(dt.z.getMobileCssClass()).addChildElement(o.toDOM())}))}else n.addChild("div",(function(e){return e.addClass("".concat(t.cssPrefix,"-colelement"),"".concat(t.cssPrefix,"-aggrfuncelement")).addClass(dt.z.getMobileCssClass()).addChild("span",(function(t){return t.text(r.text).title(r.text)}))}));else 2===r.type?n.addChild("div",(function(e){return e.addClass("".concat(t.cssPrefix,"-colelement"),"".concat(t.cssPrefix,"-attrelement")).addClass(dt.z.getMobileCssClass()).addChildElement(t.renderBaseExpression())})):3===r.type&&n.addChild("span",(function(e){return e.addClass("".concat(t.cssPrefix,"-colelement")).addClass(dt.z.getMobileCssClass()).text(r.text).title(r.text)}))},l=this,u=0;u<s;u++)a(u);return n.toDOM()}}},e.prototype.renderColumnTypeButton=function(){var e=t.prototype.renderColumnTypeButton.call(this);return e&&(e.firstElementChild.classList.add("aggregated"),e.firstElementChild.setAttribute("title",r.i18n.getText("ButtonToSimple"))),e},e.prototype.baseExpressionItemSelectedCallback=function(t,e){var n=t.id;return this.column.expr.args[0].setValue(n,!0),this.column.caption="",this.fireColumnChanged(),!1},e.prototype.changeTypeToSimple=function(){this.column.getQuery().changeColumnType(this.column,p.EntityAttribute),this.fireColumnChanged()},e.prototype.parseDisplayFormat=function(t){if(!t)return[];var e=[],n=this.displayFormatParser;for(n.start(t);n.next();){var o=n.getToken(),i=n.getTokenText();"function"===o?e.push({type:1,text:i}):"expression"===o?e.push({type:2}):"text"===o&&e.push({type:3,text:i})}return e},e.prototype.changeTypeHandler=function(t){this.changeTypeToSimple()},e.prototype.processExtraButtonMenuItems=function(t,e){return this.changeTypeToSimple(),!0},e.prototype.getExtraButtonMenuItems=function(){return[{id:"__group",text:r.i18n.getText("ColTypeGroup"),items:[{id:"type",text:r.i18n.getText("ColTypeSimple")}]}]},e}(xt),Tt=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Dt=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.dataTypeMenu=null,e}return Tt(e,t),e.prototype.renderEnabledButton=function(){var e=t.prototype.renderEnabledButton.call(this);return e.children[0].title=r.i18n.getText("CmdToggleEnableCustom"),e},e.prototype.getClassesToAdd=function(){return"".concat(this.cssPrefix,"-row ").concat(this.cssPrefix,"-row-column-entattr")+t.prototype.getClassesToAdd.call(this)},Object.defineProperty(e.prototype,"columnEnabled",{get:function(){return!!this.panel.areCustomExpressionsAllowed()&&this.column.enabled},set:function(t){this.panel.areCustomExpressionsAllowed()?this.column.enabled=t:this.column.enabled=!1},enumerable:!1,configurable:!0}),e.prototype.renderColumnTypeButton=function(){var e=t.prototype.renderColumnTypeButton.call(this);return e&&(e.firstElementChild.classList.add("aggregated"),e.firstElementChild.setAttribute("title",r.i18n.getText("ButtonToSimple"))),e},e.prototype.renderExpressionBlock=function(){var t=this;this.column.caption&&""!=this.column.caption||(this.column.caption=this.getDefaultColumnCaption());var e=(0,ut.domel)("div").addClass("".concat(this.cssPrefix,"-expr-block")).addClass(dt.z.getMobileCssClass()).toDOM(),n=(0,ut.domel)("div",e).addClass("".concat(this.cssPrefix,"-colelement"),"".concat(this.cssPrefix,"-attrelement")).addClass(dt.z.getMobileCssClass());return this.isEditable()?n.addChild("a",(function(e){return e.attr("href","javascript:void(0)").title(t.column.caption).text(t.column.caption).on("touchstart click",(function(e){e.stopPropagation();var n=e.target,o=n.parentElement.querySelector("input");o&&(n.style.display="none",o.style.removeProperty("display"),o.style.width="100%",o.focus(),t.element.setAttribute(ut.eqDragManager.DRAG_DISABLED_ATTR,""))}))})).addChild("input",(function(e){return e.hide().value(t.column.expr.sql).on("blur keydown",(function(e){var n=!1,o=!0;if(e instanceof KeyboardEvent?13===e.keyCode?n=!0:27===e.keyCode&&(n=!0,o=!1):e instanceof FocusEvent&&(n=!0),n){var i=e.target,r=i.parentElement.querySelector("a");r&&(r.style.removeProperty("display"),i.style.display="none"),o&&t.column.expr.sql!==i.value?(t.column.expr.sql=i.value,t.fireColumnChanged()):i.value=t.column.expr.sql,t.element.removeAttribute(ut.eqDragManager.DRAG_DISABLED_ATTR)}}))})):n.addChild("span",(function(e){e.text(t.column.caption).title(t.column.caption)})),n=(0,ut.domel)("div",e).addClass("".concat(this.cssPrefix,"-colelement")).addChild("span",(function(t){t.text(":").title(":")})),n=(0,ut.domel)("div",e).addClass("".concat(this.cssPrefix,"-colelement"),"".concat(this.cssPrefix,"-attrelement")).addClass(dt.z.getMobileCssClass()),this.isEditable()?(this.createDataTypeMenu(),n.addChild("a",(function(e){return e.attr("href","javascript:void(0)").title(r.DataType[t.column.expr.dataType]).text(r.DataType[t.column.expr.dataType]).on("touchstart click",(function(n){n.stopPropagation(),t.dataTypeMenu.showMenu({anchor:e.toDOM(),selectedIds:null,itemSelectedCallback:function(e,n){t.column.expr.dataType=e.id,t.fireColumnChanged()}})}))}))):(this.column.expr.dataType,n.addChild("span",(function(e){e.text(r.DataType[t.column.expr.dataType]).title(r.DataType[t.column.expr.dataType])}))),e},e.prototype.changeTypeToSimple=function(){this.column.getQuery().changeColumnType(this.column,p.EntityAttribute),this.fireColumnChanged()},e.prototype.getDefaultColumnCaption=function(){return"Custom SQL Column"},e.prototype.getDefaultValue=function(){return this.column.expr.sql},e.prototype.getUIS=function(){return!0},e.prototype.changeTypeHandler=function(t){this.changeTypeToSimple()},e.prototype.processExtraButtonMenuItems=function(t,e){return this.changeTypeToSimple(),!0},e.prototype.createFunctionMenu=function(){},e.prototype.getExtraButtonMenuItems=function(){return[{id:"__group",text:r.i18n.getText("ColTypeGroup"),items:[{id:"type",text:r.i18n.getText("ColTypeSimple")}]}]},e.prototype.createDataTypeMenu=function(){var t=[];for(var e in r.DataType)if(!isNaN(Number(e))){var n={id:e,text:r.DataType[e]};t.push(n)}var o=this.column.id;o&&(o+="-DataTypeMenu");var i={items:t,id:o,searchBoxAlwaysShown:!1,domWriteItemsId:!0};this.dataTypeMenu=new gt(i)},e}(xt),St=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),kt=function(t){function e(e){var n=t.call(this,e)||this;return n.options={isSubQuery:!1,activeColumn:null,showAddRow:!0,showHeader:!0,showColumnTitles:!0,allowAggrColumns:!0,allowDuplicates:!0,allowCustomExpressions:!1,allowSorting:!0,attrElementFormat:"{entity} {attr}",titleElementFormat:null,buttons:null,alwaysShowButtons:!1,accentActiveColumn:!0,allowDragDrop:!0,menuOptions:{showSearchBoxAfter:30,searchBoxAutoFocus:!0,activateOnMouseOver:!0,adjustHeight:!0,itemRenderedCallback:null},attrPlacement:0,sortEntities:!1,columnRenderedCallback:null,customExpressionText:0,allowHiddenColumns:!1,showAddAllForEntity:!1,showIndicatorOnLoad:!0},n.landingSlot=(0,ut.domel)("div").addClass("".concat(n.cssPrefix,"-col-landing-slot")).addChildElement((0,ut.domel)("div").toDOM()).toDOM(),n.landingIndex=-1,n.slot.classList.add("".concat(n.cssPrefix,"-panel")),n.group=A.Query,n}return St(e,t),Object.defineProperty(e.prototype,"cssPrefix",{get:function(){return"eqjs-qc"},enumerable:!1,configurable:!0}),e.prototype.getWidgetType=function(){return"columnsPanel"},e.prototype.init=function(e,n){var o=this;t.prototype.init.call(this,e,n),this.setOptions(n),this.renderProgressBlock();var i=e.getModel();this.detachQueryObserver(),this.attachQueryObserver(),ut.eqDragManager.removeDropContainer(this.slot),this.options.allowDragDrop&&ut.eqDragManager.registerDropContainer({element:this.slot,scopes:["entityAttr","entityAttrSort"],onDragEnter:function(t,e){if(o.slot.classList.add("".concat(ct.YR,"-drophover")),"entityAttrSort"===e.item.scope)o.showLandingSlot(e.pageX,e.pageY);else{var n=e.data.attrId;i.checkAttrProperty(n,"useInResult")||(e.dropEffect=ut.DropEffect.Forbid),e.dragImage.classList.add("eqjs-sortable-helper")}},onDragOver:function(t,e){var n=e.data.attrId;("entityAttrSort"===e.item.scope||i.checkAttrProperty(n,"useInResult"))&&o.showLandingSlot(e.pageX,e.pageY)},onDragLeave:function(t,e){"entityAttrSort"===e.item.scope?e.dropEffect=ut.DropEffect.Forbid:(e.dragImage.classList.remove("eqjs-sortable-helper"),e.dragImage.style.removeProperty("width")),o.slot.classList.remove("".concat(ct.YR,"-drophover")),o.hideLandingSlot()},onDrop:function(t,e){if("entityAttrSort"==e.item.scope){var n=o.getQuery().getColumns().indexOf(e.data.column);o.moveColumnCore(n,o.landingIndex)}else{var i=e.data.attrId;o.addNewColumn(i,o.landingIndex)}}})},e.prototype.renderBaseElements=function(){var t=this,e=0;if(this.options.showHeader){var n=(0,ut.domel)("div",this.slot).hide().addClass("".concat(this.cssPrefix,"-header")).addClass(dt.z.getMobileCssClass()).addChild("div",(function(e){return e.addClass("".concat(t.cssPrefix,"-header-expression")).text(r.i18n.getText("HeaderExpression"))}));!1!==this.options.showColumnTitles&&n.addChild("div",(function(e){return e.addClass("".concat(t.cssPrefix,"-header-title")).text(r.i18n.getText("HeaderTitle"))})),this.headerElement=n.toDOM(),e+=this.headerElement.offsetHeight}this.columnsBlock=(0,ut.domel)("div",this.slot).addClass("".concat(this.cssPrefix,"-columns")).addClass(dt.z.getMobileCssClass()).toDOM(),this.options.showAddRow&&(this.addRowElement=(0,ut.domel)("div",this.slot).addClass("".concat(ct.YR,"-addrow"),"".concat(this.cssPrefix,"-addrow"),"".concat(ct.YR,"-addrow-empty")).addClass(dt.z.getMobileCssClass()).addChild("a",(function(e){return e.attr("href","javascript:void(0)").text(r.i18n.getText("CmdClickToAddColumn")).on("click",(function(e){e.preventDefault(),t.showEntitiesMenu({anchor:e.target,selectedIds:null,itemSelectedCallback:function(e,n){if("__AddAll__"===e.id&&e.extra&&Array.isArray(e.extra.ids))e.extra.ids.forEach((function(e){return t.addNewColumn(e)}));else{var o=e.id;t.addNewColumn(o)}return!1}})}))})).toDOM(),e+=this.addRowElement.offsetHeight),this.columnsBlock.style.maxHeight="".concat(this.slot.offsetHeight-e-25,"px")},e.prototype.destroyCore=function(){ut.eqDragManager.removeDropContainer(this.slot),this.detachQueryObserver(),this.slot.innerHTML=""},e.prototype.attachQueryObserver=function(){var t=this,e=this.getQuery();this.queryEventCallbackId=e.addChangedCallback((function(n){var o=n.data;if(o&&(o.part==x.Columns||o.part==x.Aggregation||o.part==x.All)){var i=document.activeElement,r=t.slot.contains(i)||i==document.body;switch(o.action){case w.Modify:var s=o.changee,a=function(e){var n=t.columnsBlock.querySelector("div[data-id='".concat(e.id,"']"));if(n){var o=t.getColumnRenderer(e,n);if(o){var i=o.render();if(r){var s=i.querySelector("a")||i.querySelector(".eqjs-column-button");s&&s.focus()}}}};Array.isArray(s)?s.forEach((function(t){return a(t)})):a(s),t.agjustHeaderVisibility();break;case w.Add:s=o.changee;var l=function(n){var o=e.getColumns().indexOf(n),i=t.addColumnElement(n,o);r&&i.querySelector("a").focus()};Array.isArray(s)?s.forEach((function(t){return l(t)})):l(s),t.agjustHeaderVisibility();break;case w.Delete:s=o.changee;var u=function(e){var n=t.columnsBlock.querySelector("div[data-id='".concat(e.id,"']"));if(n){var o=n.nextSibling,i=n.previousSibling;if(t.columnsBlock.removeChild(n),r){var s=o||i||t.addRowElement,a=s.querySelector("a")||s.querySelector(".eqjs-column-button");a&&a.focus()}}};t.agjustHeaderVisibility(),Array.isArray(s)?s.forEach((function(t){return u(t)})):u(s);break;default:t.refresh()}}}))},e.prototype.detachQueryObserver=function(){this.queryEventCallbackId&&this.getQuery().removeChangedCallback(this.queryEventCallbackId)},e.prototype.getQuery=function(){return this.getContext().getQuery()},e.prototype.showLandingSlot=function(t,e){for(var n=this.columnsBlock.querySelectorAll("[class*=".concat(this.cssPrefix,"-row]")),o=[],i=0;i<n.length;i++){var r=n[i];"none"!==r.style.display&&o.push(r)}if(0===o.length)return this.landingIndex=0,void this.columnsBlock.appendChild(this.landingSlot);var s=(0,ut.getElementAbsolutePos)(this.landingSlot);if(!(e>=s.y&&e<=s.y+this.landingSlot.offsetHeight)){var a=o[0],l=a.offsetHeight,u=(0,ut.getElementAbsolutePos)(a),c=e>u.y+l/2?Math.round((e-u.y+l/2)/l):0;c>o.length&&(c=o.length),c!=this.landingIndex&&(this.landingIndex=c,this.landingIndex<o.length?this.columnsBlock.insertBefore(this.landingSlot,o[this.landingIndex]):this.columnsBlock.appendChild(this.landingSlot),this.landingSlot.scrollIntoView({block:"center",behavior:"smooth"}))}},e.prototype.hideLandingSlot=function(){var t=this;this.landingIndex=-1,setTimeout((function(){t.landingSlot.parentElement&&t.landingSlot.parentElement.removeChild(t.landingSlot)}),10)},e.prototype.setOptions=function(t){r.utils.assignDeep(this.options,t),this.getContext().options.allowCustomExpressions=t.allowCustomExpressions,dt.z.isMobileMode()&&(this.options.buttons=["menu"],this.options.showHeader=!1)},e.prototype.onProcessStartCore=function(){this.options.showIndicatorOnLoad&&(this.progressBlock.parentNode||this.slot.appendChild(this.progressBlock))},e.prototype.onProcessEndCore=function(){this.options.showIndicatorOnLoad&&this.progressBlock.parentNode&&this.slot.removeChild(this.progressBlock)},e.prototype.refreshCore=function(){this.clear(),this.render()},e.prototype.clear=function(){this.slot.innerHTML=""},e.prototype.render=function(){try{this.renderBaseElements(),this.createEntitiesMenu(),this.createColumnMenus(),this.agjustHeaderVisibility(),(0,ut.domel)(this.slot).removeClass(ct.XD).addClass(dt.z.getMobileCssClass());for(var t=this.context.getQuery().getColumns(),e=0,n=t;e<n.length;e++){var o=n[e];this.columnsBlock.appendChild(this.renderColumn(o))}}catch(t){var i=t;this.context.throwError({action:"ColumnsPanel rendering",text:i.message,sourceError:i})}},e.prototype.agjustHeaderVisibility=function(){if(this.headerElement){var t=this.context.getQuery().getColumns();this.headerElement.style.display=t.length?"":"none"}},e.prototype.renderColumn=function(t){var e=this.getColumnRenderer(t);return e?e.render():null},e.prototype.toggleColumnPicked=function(t){var e,n;t&&(e=this.columnsBlock.querySelector("div[data-id=".concat(t.id,"]")))&&(n=e.classList.contains("active"));for(var o=this.columnsBlock.querySelectorAll(".".concat(this.cssPrefix,"-row")),i=0;i<o.length;i++){var r=o[i];(0,ut.domel)(r).removeClass("active"),this.options.alwaysShowButtons||(0,ut.domel)(r).data("show-buttons",null)}e&&!n&&(0,ut.domel)(e).addClass("active").data("show-buttons","")},e.prototype.addNewColumn=function(t,e){var n,o,i=this,r=this.getContext().getModel(),s=this.getQuery(),a=function(t){var e=r.getAttributeById(t);if(!e)return null;if(!e.useInResult){if(!e.lookupAttr)return null;if(t=e.lookupAttr,!(e=r.getAttributeById(t))||!e.useInResult)return null}var n=s.createColumn();return n.caption=i.getDefaultColumnCaption(e),n.sorting=E.None,n.sortIndex=-1,n.expr.tag=p.EntityAttribute,n.expr.kind=l.Attribute,n.expr.dataType=e.dataType,n.expr.setValue(t,!0),n.params.concat(e.params),n};if(Array.isArray(t)){n=[];for(var u=0;u<t.length;u++)(o=a(t[u]))&&n.push(o)}else n=a(t);return this.addColumn(n,e),n},e.prototype.addColumn=function(t,e){var n=this.getQuery();n&&(!(t=Array.isArray(t)?this.checkColumnsArray(t):this.checkColumn(t))||Array.isArray(t)&&0==t.length||(n.addColumnObj(t,e,self),n.fireColumnsChangedEvent(w.Add,t)))},e.prototype.addColumnElement=function(t,e){var n=this.columnsBlock.querySelectorAll("[class*=".concat(this.cssPrefix,"-row]")),o=this.renderColumn(t);return n.length>0&&e<n.length?this.columnsBlock.insertBefore(o,n[e]):(this.columnsBlock.appendChild(o),this.scrollToBottom()),this.options.columnRenderedCallback&&this.options.columnRenderedCallback(o),o},e.prototype.scrollToBottom=function(){this.columnsBlock.scrollTop=this.columnsBlock.scrollHeight-this.columnsBlock.clientHeight},e.prototype.checkColumnsArray=function(t){for(var e=t.length,n=[],o=0;o<e;o++)this.checkColumn(t[o])&&n.push(t[o]);return n},e.prototype.checkColumn=function(t){if(!this.options.allowDuplicates)for(var e=this.getQuery().getColumns(),n=0;n<e.length;n++)if((t.expr.tag===p.EntityAttribute&&e[n].expr.tag===p.EntityAttribute||t.expr.tag===p.ParentEntityAttribute&&e[n].expr.tag===p.ParentEntityAttribute)&&t.expr.value===e[n].expr.value)return null;return t},e.prototype.getDefaultColumnCaption=function(t){var e=this.options.titleElementFormat||this.options.attrElementFormat;return this.getContext().getModel().getAttributeText(t,e)},e.prototype.getColumnsBlock=function(){return this.columnsBlock},e.prototype.getColumnRenderer=function(t,e){switch(t.expr.tag){case p.AggregateFunction:return new Et(this,t,e);case p.CustomSql:return new Dt(this,t,e);case p.EntityAttribute:case p.ParentEntityAttribute:return new xt(this,t,e)}return null},e.prototype.areCustomExpressionsAllowed=function(){return this.getQuery().isEx()&&this.getContext().options.allowCustomExpressions},e.prototype.addAllColumnsToEntitiesList=function(t){var e=this,n=t.filter((function(t){return!t.isEntity})).map((function(t){return t.id}));n.length>0&&t.unshift({id:"__AddAll__",text:r.i18n.getText("AddAllForEntityText"),extra:{ids:n}}),t.forEach((function(t){t.items&&e.addAllColumnsToEntitiesList(t.items)}))},e.prototype.createEntitiesMenu=function(){var t=this.getContext().getModel();if(!t||t.isEmpty())return null;var e=this.slot.id;e&&(e+="-EntitiesMenu");var n=t.getEntitiesTree({addUIC:!1,addUIR:!0,addUIS:!1,attrPlacement:this.options.attrPlacement,sortEntities:this.options.sortEntities});this.options.showAddAllForEntity&&this.addAllColumnsToEntitiesList(n);var o={id:e,items:n,adjustHeight:this.options.adjustEntitiesMenuHeight,domWriteItemsId:this.options.domWriteItemsId};r.utils.assign(o,this.options.menuOptions),this.entitiesMenu=new gt(o)},e.prototype.getSortMenuList=function(){return[{id:"None",text:r.i18n.getText("CmdNotSorted")},{id:"Ascending",text:r.i18n.getText("CmdAscending")},{id:"Descending",text:r.i18n.getText("CmdDescending")},{id:"---",text:"---"}]},e.prototype.getMoveMenuList=function(){return[{id:"MoveTop",text:r.i18n.getText("CmdMoveToFirst")},{id:"MoveUp",text:r.i18n.getText("CmdMoveToPrev")},{id:"MoveDown",text:r.i18n.getText("CmdMoveToNext")},{id:"MoveBottom",text:r.i18n.getText("CmdMoveToLast")}]},e.prototype.createSortMenu=function(){var t=this.getContext().getModel();if(!t||t.isEmpty())return null;var e=this.slot.id;e&&(e+="-SortMenu");var n={id:e,items:this.getSortMenuList().concat(this.moveMenu.getItems()),domWriteItemsId:this.options.domWriteItemsId,showSelected:!0};r.utils.assign(n,this.options.menuOptions),n.searchBoxAlwaysShown=!1,this.sortMenu=new gt(n)},e.prototype.createMoveMenu=function(){var t=this.getContext().getModel();if(!t||t.isEmpty())return null;var e=this.slot.id;e&&(e+="-MoveMenu");var n=r.utils.createArrayFrom(this.getMoveMenuList());this.options.allowHiddenColumns&&(n.push({id:"---",text:"---"}),n.push({id:"IsHidden",text:r.i18n.getText("CmdHiddenColumn")}));var o={items:n,id:e,domWriteItemsId:this.options.domWriteItemsId,showSelected:!0};r.utils.assign(o,this.options.menuOptions),this.moveMenu=new gt(o),o.searchBoxAlwaysShown=!1},e.prototype.showEntitiesMenu=function(t){this.entitiesMenu.showMenu(t)},e.prototype.moveColumn=function(t,e){var n=this.getQuery().getColumns(),o=n.indexOf(t);if(o>=0)switch(e){case"MoveTop":if(0==o)return;this.moveColumnCore(o,0);break;case"MoveUp":if(0==o)return;this.moveColumnCore(o,o-1);break;case"MoveDown":if(o==n.length-1)return;this.moveColumnCore(o,o+1);break;case"MoveBottom":if(o==n.length-1)return;this.moveColumnCore(o,n.length-1)}},e.prototype.moveColumnCore=function(t,e){var n=this.getQuery();if(n){var o=this.columnsBlock.querySelectorAll("[class*=".concat(this.cssPrefix,"-row]")),i=o[t];0==e?this.columnsBlock.insertBefore(i,this.columnsBlock[0]):e>0&&e<o.length-1?t<e?this.columnsBlock.insertBefore(i,o[e+1]):this.columnsBlock.insertBefore(i,o[e]):this.columnsBlock.appendChild(i),n.moveColumn(t,e),n.fireColumnsChangedEvent()}},e.prototype.createColumnMenus=function(){this.createMoveMenu(),this.options.allowSorting&&this.createSortMenu()},e.prototype.renderProgressBlock=function(){this.progressBlock=document.createElement("div"),this.progressBlock.classList.add("".concat(ct.YR,"-progress-win8")),this.progressBlock.classList.add(dt.z.getMobileCssClass()),this.progressBlock.innerHTML='<div class="wBall" id="wBall_1"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_2"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_3"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_4"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_5"><div class="wInnerBall"></div></div>'},e}(st),Mt=function(){function t(t,e,n){this.functionMenu=null,this.formatsMenu=null,this.isMouseOverBlock=!1,this.keepShowingButtons=!1,this.tapedTwice=!1,this.bar=t,this.column=e,this.element=n}return Object.defineProperty(t.prototype,"cssPrefix",{get:function(){return"eqjs-cb"},enumerable:!1,configurable:!0}),t.prototype.render=function(){var t=this;this.baseAttr=this.getAttribute();var e=(0,ut.domel)("div");return e.data("id",this.column.id),this.element&&this.element.parentNode.replaceChild(e.toDOM(),this.element),this.element=e.toDOM(),this.bar.options.allowDragDrop&&ut.eqDragManager.registerDraggableItem({element:this.element,scope:"entityAttrSort",beforeDragStart:function(){return t.element.dispatchEvent((0,ut.createBrowserEvent)("mouseleave"))},onDragStart:function(e){t.hideButtons(),t.element.style.display="none",e.dropEffect=ut.DropEffect.Allow},onDragEnd:function(e){e.data.finishedSuccessfully||t.element.removeAttribute("style")},data:{column:this.column}}),this.column.isReadOnly()||(this.createFunctionMenu(),this.createFormatsMenu()),e.addClass(this.getClassesToAdd()).addClass(dt.z.getMobileCssClass()).addChildElement(this.renderCaptionBlock()).addChildElement(this.renderSortingImage()),dt.z.isMobileMode()||e.addChildElement(this.renderButtonsBlock()),e.on("mouseenter",this.onMouseEnter.bind(this)).on("mouseleave",this.onMouseLeave.bind(this)),(this.bar.options.accentActiveColumn||dt.z.isMobileMode())&&e.on("touchstart click",this.onMouseClick.bind(this)),this.element},t.prototype.fireColumnChanged=function(){this.column.fireChangedEvent()},t.prototype.refresh=function(){this.render()},t.prototype.getAttribute=function(){return this.bar.getContext().getModel().getAttributeByIdSafe(this.column.expr.value)},t.prototype.isEditable=function(){return this.column.enabled&&!this.column.isReadOnly()},t.prototype.renderButtonsBlock=function(){return(0,ut.domel)("div",this.element).addClass("".concat(ct.YR,"-column-buttonsBlock"),"".concat(this.cssPrefix,"-buttonsBlock")).addChildElement(this.renderSortingButton()).addChildElement(this.renderColumnTypeButton()).addChildElement(this.renderColumnFormatButton()).addChildElement(this.renderDeleteButton()).toDOM()},t.prototype.renderCaptionBlock=function(){var t=this;this.column.caption&&""!=this.column.caption||(this.column.caption=this.getDefaultCaption());var e=this.column.getModel(),n=this.baseAttr!==e.nullAttribute?this.column.caption:e.getAttributeText(e.nullAttribute,"{attr}");if(!this.isEditable())return(0,ut.domel)("div").addClass("".concat(this.cssPrefix,"-colelement"),"".concat(this.cssPrefix,"-captionelement")).addClass(dt.z.getMobileCssClass()).addChild("div",(function(e){return e.title(t.column.caption).text(n).attr("tabIndex","0")})).toDOM();var o=!1;return(0,ut.domel)(this.element).on("touchstart dblclick",(function(e){if(e instanceof TouchEvent&&!t.tapedTwice)return t.tapedTwice||(t.tapedTwice=!0,setTimeout((function(){t.tapedTwice=!1}),300)),!0;e.stopPropagation(),o=t.element.querySelector("a")==document.activeElement;var n=t.element.querySelector(".".concat(t.cssPrefix,"-captionelement input")),i=t.element.querySelector(".".concat(t.cssPrefix,"-captionelement a"));return n&&(n.style.width="".concat(t.element.clientWidth,"px"),i.style.display="none",n.style.removeProperty("display"),n.focus(),t.element.setAttribute(ut.eqDragManager.DRAG_DISABLED_ATTR,"")),!1})),(0,ut.domel)("div").addClass("".concat(this.cssPrefix,"-colelement"),"".concat(this.cssPrefix,"-captionelement")).addClass(dt.z.getMobileCssClass()).addChild("a",(function(e){return e.attr("href","javascript:void(0)").title(t.column.caption).text(n).on("keydown",(function(e){var n=e;if((n.ctrlKey||n.metaKey)&&(13==n.keyCode||10==n.keyCode)&&t.isColumnActive()){var o=document.createEvent("MouseEvents");return o.initEvent("dblclick",!0,!0),t.element.dispatchEvent(o),n.stopPropagation(),!1}return!0}))})).addChild("input",(function(e){return e.hide().value(t.column.caption).on("blur keydown",(function(e){var n=!1,i=!0;if(e instanceof KeyboardEvent?13===e.keyCode?n=!0:27===e.keyCode&&(n=!0,i=!1):e instanceof FocusEvent&&(n=!0),n){var r=e.target,s=r.parentElement.querySelector("a");s&&(s.style.removeProperty("display"),r.style.display="none"),i&&t.column.caption!==r.value?(t.column.caption=r.value,t.fireColumnChanged()):r.value=t.column.caption,t.element.removeAttribute(ut.eqDragManager.DRAG_DISABLED_ATTR),o&&t.element.querySelector("a").focus()}}))})).toDOM()},t.prototype.renderSortingImage=function(){var t=this,e="".concat(ct.YR,"-column-sortbutton"),n=e;switch(this.column.sorting){case E.Ascending:n="".concat(e,"-asc");break;case E.Descending:n="".concat(e,"-desc")}return this.column.sorting==E.None?null:(0,ut.domel)("div").addClass("".concat(this.cssPrefix,"-colelement"),"".concat(this.cssPrefix,"-sortimage-placeholder")).addClass(dt.z.getMobileCssClass()).addChild("div",(function(e){return e.addClass("".concat(t.cssPrefix,"-img-sorting"),n).title(r.i18n.getText("ButtonSorting"))})).toDOM()},t.prototype.buttonSortingClickHandler=function(t,e){var n=this;return t.stopPropagation(),this.keepShowingButtons=!0,(this.getUIS()&&this.bar.sortMenu||this.bar.moveMenu).showMenu({anchor:e,selectedIds:null,itemSelectedCallback:function(t,e){var o;if("None"==t.id||"Ascending"==t.id||"Descending"==t.id){var i=n.bar.getQuery();n.column.sorting="None"==(o=t.id)?E.None:"Ascending"==o?E.Ascending:"Descending"==o?E.Descending:void 0,n.column._sortIndex=i.getColumnSortIndex(n.column),n.fireColumnChanged()}else n.bar.moveColumn(n.column,t.id)},menuClosedCallback:function(){n.keepShowingButtons=!1,n.isMouseOverBlock||n.leaveButtonBlock()}}),!1},t.prototype.renderSortingButton=function(){var t=this;if(!this.isEditable())return null;var e=(0,ut.domel)("div").addClass("".concat(ct.YR,"-column-button"),"".concat(ct.YR,"-column-sortbutton"),"".concat(ct.YR,"-column-sortbutton-none")).title(r.i18n.getText("ButtonSorting")).attr("tabIndex","0").on("touchstart click",(function(n){return t.buttonSortingClickHandler(n,e.toDOM())})).on("keypress",(function(t){13==t.keyCode&&t.target.click()}));return e.toDOM()},t.prototype.buttonDeleteClickHandler=function(t){t.stopPropagation();var e=this.bar.getQuery();return e.removeColumn(this.column,this.bar),e.fireColumnsChangedEvent(w.Delete,this.column),!1},t.prototype.renderDeleteButton=function(){var t=this;return this.column.isReadOnly()?null:(0,ut.domel)("div").addClass("".concat(ct.YR,"-column-button"),"".concat(ct.YR,"-column-button-delete")).title(r.i18n.getText("CmdDelete")).attr("tabIndex","0").on("touchstart click",(function(e){return t.buttonDeleteClickHandler(e)})).on("keypress",(function(t){13==t.keyCode&&t.target.click()})).toDOM()},t.prototype.getDefaultCaption=function(){return this.getDefaultTitleText(this.baseAttr)},t.prototype.getDefaultTitleText=function(t){var e=this.bar.options.titleElementFormat||this.bar.options.attrElementFormat;return this.bar.getContext().getModel().getAttributeText(t,e)},t.prototype.getClassesToAdd=function(){var t="";return t+=this.column.enabled?"":" ".concat(this.cssPrefix,"-disabled"),this.column.enabled&&(t+=this.column.isReadOnly()?" ".concat(this.cssPrefix,"-readonly"):""),t},t.prototype.buttonTypeClickHandler=function(t){return t.stopPropagation(),this.keepShowingButtons=!0,this.changeColumnTypeHandler(t),!1},t.prototype.buttonFormatClickHandler=function(t){return t.stopPropagation(),this.keepShowingButtons=!0,this.changeFormatHandler(t),!1},t.prototype.formatButtonIsShown=function(){return!1!==this.bar.options.allowDisplayFormatChange&&this.bar.getContext().getModel().getDisplayFormatsForType(this.column.getDataType()).length>0},t.prototype.changeFormatHandler=function(t){var e=this,n=this.bar.getContext().getModel().getDisplayFormatsForType(this.column.getDataType()),o="{0:__default}";n.filter((function(t){return t.format==e.column.displayFormat})).length>0&&(o=this.column.displayFormat),this.formatsMenu.showMenu({anchor:t.target,selectedIds:o,itemSelectedCallback:function(t,n){return t.id!=o&&("{0:__default}"==t.id?e.column.displayFormat="":e.column.displayFormat=t.id,e.column.fireChangedEvent()),!1},menuClosedCallback:function(){e.keepShowingButtons=!1,e.isMouseOverBlock||e.element.dispatchEvent((0,ut.createBrowserEvent)("mouseleave"))}})},t.prototype.renderColumnTypeButton=function(){var t=this;return this.isEditable()&&!1!==this.bar.options.allowAggrColumns?(0,ut.domel)("div").addClass("".concat(ct.YR,"-column-button"),"".concat(ct.YR,"-column-button-type")).title(r.i18n.getText("ButtonToAggr")).attr("tabIndex","0").on("touchstart click",(function(e){return t.buttonTypeClickHandler(e)})).on("keypress",(function(t){13==t.keyCode&&t.target.click()})).toDOM():null},t.prototype.renderColumnFormatButton=function(){var t=this;return this.isEditable()&&this.formatButtonIsShown()?(0,ut.domel)("div").addClass("".concat(ct.YR,"-column-button"),"".concat(ct.YR,"-column-button-format")).title(r.i18n.getText("ButtonFormat")).attr("tabIndex","0").on("touchstart click",(function(e){return t.buttonFormatClickHandler(e)})).on("keypress",(function(t){13==t.keyCode&&t.target.click()})).toDOM():null},t.prototype.getUIS=function(){return this.bar.getContext().getModel().checkAttrProperty(this.column.expr.value,"useInSorting")},t.prototype.onMouseClick=function(t){this.bar.toggleColumnPicked(this.column),this.adjustButtonsVisibility()},t.prototype.onMouseEnter=function(t){if(!dt.z.isMobileMode())return this.isMouseOverBlock=!0,this.enterButtonBlock(),t.stopPropagation(),!1},t.prototype.onMouseLeave=function(t){if(!dt.z.isMobileMode())return this.isMouseOverBlock=!1,this.leaveButtonBlock(),t.stopPropagation(),!1},t.prototype.isColumnActive=function(){return this.element.classList.contains("active")},t.prototype.hideButtons=function(){dt.z.isMobileMode()?this.onHideButtonsMobile&&this.onHideButtonsMobile():(0,ut.domel)(this.element).data("show-buttons",null)},t.prototype.showButtons=function(){dt.z.isMobileMode()?this.onShowButtonsMobile&&this.onShowButtonsMobile():(0,ut.domel)(this.element).data("show-buttons","")},t.prototype.adjustButtonsVisibility=function(){this.bar.options.alwaysShowButtons||(this.bar.options.accentActiveColumn||dt.z.isMobileMode())&&this.isColumnActive()?this.showButtons():this.hideButtons()},t.prototype.enterButtonBlock=function(){this.showButtons()},t.prototype.leaveButtonBlock=function(){1==this.bar.options.alwaysShowButtons||this.isColumnActive()&&1==this.bar.options.accentActiveColumn||this.hideButtons()},t.prototype.createFunctionMenu=function(){for(var t,e=[],n=this.bar.getContext().getModel().getAggrFunctions(),o=!0,i=null,s=this.column.getDataType(),a=0,l=n;a<l.length;a++){var u=l[a];if(u){var c=u.getAppliedTypesOrDefault().indexOf(s)>=0;this.column.expr.func!==u.id||c||(o=!1),c&&(t=this.bar.getContext().getModel().getAggrFunctionCaption(u.id),i={id:u.id,text:t},e.push(i))}}o||(this.column.expr.func=e[0].id),this.bar.areCustomExpressionsAllowed()&&(i={id:"CustomSqlDivider",text:"---"},e.push(i),i={id:"CUSTOMSQL",text:t=r.i18n.getText("CustomExpression")},e.push(i));var d=this.element.id;d&&(d+="-FunctionsMenu");var h={items:e,id:d,searchBoxAlwaysShown:!1,domWriteItemsId:!0};this.functionMenu=new gt(h)},t.prototype.createFormatsMenu=function(){if(0!=this.bar.options.allowDisplayFormatChange){var t=this.column.id;t&&(t+="-FormatsMenu");var e={items:this.getFormatsMenuItems(),id:t,searchBoxAlwaysShown:!1,showSelected:!0,domWriteItemsId:!0};this.formatsMenu=new gt(e)}},t.prototype.getFormatsMenuItems=function(){var t=this.bar.getContext().getModel().getDisplayFormatsForType(this.column.getDataType());return[{id:"{0:__default}",text:"Default"}].concat(t.map((function(t){return{id:t.format,text:r.i18n.getText("DisplayFormats",t.name)||t.name}})))},t}(),It=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Bt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return It(e,t),e.prototype.getClassesToAdd=function(){return"".concat(t.prototype.getClassesToAdd.call(this)," ").concat(this.cssPrefix,"-row ").concat(this.cssPrefix,"-row-column-entattr")},e.prototype.baseExpressionItemSelectedCallback=function(t,e){var n=t.id;this.column.expr.setValue(n,!0),this.column.caption="",this.refresh(),this.fireColumnChanged()},e.prototype.getUIS=function(){var t=this.column.expr.args[0];return!t||this.bar.getContext().getModel().checkAttrProperty(t.value,"useInSorting")},e.prototype.changeTypeToCustomSql=function(){this.column.getQuery().changeColumnType(this.column,p.CustomSql),this.fireColumnChanged()},e.prototype.changeTypeToAggr=function(t){this.column.getQuery().changeColumnType(this.column,p.AggregateFunction,{funcId:t}),this.fireColumnChanged()},e.prototype.changeColumnTypeHandler=function(t){var e=this;this.functionMenu.showMenu({anchor:t.target,selectedIds:null,itemSelectedCallback:function(t,n){return"CUSTOMSQL"==t.id?e.changeTypeToCustomSql():e.changeTypeToAggr(t.id),!1},menuClosedCallback:function(){e.keepShowingButtons=!1,e.isMouseOverBlock||e.element.dispatchEvent((0,ut.createBrowserEvent)("mouseleave"))}})},e}(Mt),At=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),_t=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return At(e,t),e.prototype.getClassesToAdd=function(){return"".concat(t.prototype.getClassesToAdd.call(this)," ").concat(this.cssPrefix,"-row ").concat(this.cssPrefix,"-row-column-aggr")},e.prototype.getAttribute=function(){return this.bar.getContext().getModel().getAttributeByIdSafe(this.column.expr.args[0].value)},e.prototype.getDefaultCaption=function(){return this.getDefaultTitleText(this.baseAttr)+" "+this.bar.getContext().getModel().getAggrFunctionCaption(this.column.expr.func)},e.prototype.renderColumnTypeButton=function(){var e=t.prototype.renderColumnTypeButton.call(this);return e&&(e.classList.add("aggregated"),e.title=r.i18n.getText("ButtonToSimple")),e},e.prototype.baseExpressionItemSelectedCallback=function(t,e){var n=t.id;this.column.expr.args[0].setValue(n,!0),this.column.caption="",this.fireColumnChanged()},e.prototype.changeTypeToSimple=function(){this.column.getQuery().changeColumnType(this.column,p.EntityAttribute),this.fireColumnChanged()},e.prototype.changeColumnTypeHandler=function(t){this.changeTypeToSimple()},e}(Bt),Pt=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Ot=function(t){function e(e,n){var o=t.call(this,e)||this;return o.options={isSubQuery:!1,activeColumn:null,showAddRow:!0,showHeader:!0,showColumnTitles:!0,allowAggrColumns:!0,allowDuplicates:!0,allowCustomExpressions:!1,allowSorting:!0,attrElementFormat:"{entity} {attr}",titleElementFormat:null,alwaysShowButtons:!1,accentActiveColumn:!0,allowDragDrop:!0,menuOptions:{showSearchBoxAfter:30,searchBoxAutoFocus:!0,activateOnMouseOver:!0,adjustHeight:!0,itemRenderedCallback:null},attrPlacement:0,sortEntities:!1,columnRenderedCallback:null,customExpressionText:0},o.landingSlot=(0,ut.domel)("div").addClass("".concat(ct.YR,"-highlight")).toDOM(),o.landingIndex=-1,o.sortMenuList=[{id:"None",text:r.i18n.getText("CmdNotSorted")},{id:"Ascending",text:r.i18n.getText("CmdAscending")},{id:"Descending",text:r.i18n.getText("CmdDescending")},{id:"---",text:"---"}],o.moveMenuList=[{id:"MoveTop",text:r.i18n.getText("CmdMoveToFirst")},{id:"MoveUp",text:r.i18n.getText("CmdMoveToPrev")},{id:"MoveDown",text:r.i18n.getText("CmdMoveToNext")},{id:"MoveBottom",text:r.i18n.getText("CmdMoveToLast")}],(0,ut.domel)(o.slot).addClass("".concat(o.cssPrefix,"-panel")).addClass(dt.z.getMobileCssClass()),o.group=A.Query,o.customQuery=n,o}return Pt(e,t),Object.defineProperty(e.prototype,"cssPrefix",{get:function(){return"eqjs-cb"},enumerable:!1,configurable:!0}),e.prototype.getWidgetType=function(){return"columnsBar"},e.prototype.init=function(e,n){var o=this;t.prototype.init.call(this,e,n),this.setOptions(n),this.detachQueryObserver(),this.attachQueryObserver(),ut.eqDragManager.removeDropContainer(this.slot),this.options.allowDragDrop&&ut.eqDragManager.registerDropContainer({element:this.slot,scopes:["entityAttrSort"],onDragEnter:function(t,e){o.showLandingSlot(e.pageX,e.pageY)},onDragOver:function(t,e){o.showLandingSlot(e.pageX,e.pageY)},onDragLeave:function(t,e){e.dropEffect=ut.DropEffect.Forbid,o.hideLandingSlot()},onDrop:function(t,e){if(o.landingIndex>=0){var n=o.getQuery().getColumns().indexOf(e.data.column);o.moveColumnCore(n,o.landingIndex)}else e.item.element.removeAttribute("style")}})},e.prototype.attachQueryObserver=function(){var t=this,e=this.getQuery();this.queryEventCallbackId=e.addChangedCallback((function(n){var o=n.data;if(o&&(o.part==x.Columns||o.part==x.Aggregation||o.part==x.All)){var i=document.activeElement,r=t.slot.contains(i)||i==document.body;switch(o.action){case w.Modify:var s=o.changee,a=function(e){var n=t.columnsBlock.querySelector("div[data-id='".concat(e.id,"']"));if(n){var o=t.renderColumn(e,n);if(r){var i=o.querySelector("a");i&&i.focus()}}};Array.isArray(s)?s.forEach((function(t){return a(t)})):a(s);break;case w.Add:s=o.changee;var l=function(n){var o=e.getColumns().indexOf(n);t.addColumnElement(n,o)};Array.isArray(s)?s.forEach((function(t){return l(t)})):l(s);break;case w.Delete:s=o.changee;var u=function(e){var n=t.columnsBlock.querySelector("div[data-id='".concat(e.id,"']"));if(n){var o=n.nextSibling,i=n.previousSibling;if(t.columnsBlock.removeChild(n),r){var s=(o||i||t.addRowButton).querySelector("a");s&&s.focus()}}};Array.isArray(s)?s.forEach((function(t){return u(t)})):u(s);break;default:t.refresh()}}}))},e.prototype.getQuery=function(){return this.customQuery?this.customQuery:this.getContext().getQuery()},e.prototype.destroyCore=function(){ut.eqDragManager.removeDropContainer(this.slot),this.detachQueryObserver(),this.slot.innerHTML=""},e.prototype.detachQueryObserver=function(){this.queryEventCallbackId&&this.getQuery().removeChangedCallback(this.queryEventCallbackId)},e.prototype.setOptions=function(t){this.options=r.utils.assignDeep(this.options,t)},e.prototype.showLandingSlot=function(t,e){for(var n=this.columnsBlock.querySelectorAll("[class*=".concat(this.cssPrefix,"-row]")),o=[],i=0;i<n.length;i++)"none"!==n[i].style.display&&o.push(n[i]);if(0!==o.length){var r=(0,ut.getElementAbsolutePos)(this.landingSlot);if(!(t>=r.x&&t<=r.x+this.landingSlot.offsetWidth&&e>=r.y&&e<=r.y+this.landingSlot.offsetHeight)){var s=this.landingIndex;for(i=0;i<o.length;i++){var a=o[i],l=(0,ut.getElementAbsolutePos)(a),u=a.offsetWidth,c=a.offsetHeight,d=.2*u;if(t>=l.x+d&&t<=l.x+u-d&&e>=l.y+2&&e<=l.y+c-2){s=t>r.x?i+1:i;break}}(s!=this.landingIndex||this.landingSlot.parentElement)&&(this.landingIndex=s,this.landingIndex<=0&&this.columnsBlock.insertBefore(this.landingSlot,o[0]),this.landingIndex<o.length?this.columnsBlock.insertBefore(this.landingSlot,o[this.landingIndex]):this.columnsBlock.appendChild(this.landingSlot))}}else this.landingIndex=0},e.prototype.hideLandingSlot=function(){this.landingIndex=-1,this.landingSlot.parentElement&&this.landingSlot.parentElement.removeChild(this.landingSlot)},e.prototype.onProcessStartCore=function(){},e.prototype.onProcessEndCore=function(){},e.prototype.refreshCore=function(){this.clear(),this.render()},e.prototype.clear=function(){this.slot.innerHTML=""},e.prototype.renderAddRowButton=function(){var t=this;(0,ut.domel)(this.addRowButton).addClass("".concat(ct.YR,"-addrow"),"".concat(this.cssPrefix,"-addrow"),"".concat(ct.YR,"-addrow-empty")).addClass(dt.z.getMobileCssClass()).title(r.i18n.getText("CmdClickToAddColumn")).addChild("a",(function(e){return e.attr("href","javascript:void(0)").on("click",(function(e){e.preventDefault(),t.showEntitiesMenu({anchor:e.target,selectedIds:null,itemSelectedCallback:function(e,n){var o=e.id;return t.addNewColumn(o),!1}})}))})),dt.z.isMobileMode()&&(0,ut.domel)(this.columnsBlock).addChildElement(this.addRowButton)},e.prototype.render=function(){var t=this;this.createEntitiesMenu(),this.options.allowSorting&&this.createSortMenu(),this.createMoveMenu(),this.columnsBlock=(0,ut.domel)("div").addClass("".concat(this.cssPrefix,"-columns")).addClass(dt.z.getMobileCssClass()).toDOM(),this.options.showAddRow&&(this.addRowButton=(0,ut.domel)("div").toDOM(),dt.z.isMobileMode()?(0,ut.domel)(this.columnsBlock).addChildElement(this.addRowButton):(0,ut.domel)(this.slot).addChildElement(this.addRowButton),this.renderAddRowButton()),(0,ut.domel)(this.slot).addChildElement(this.columnsBlock).addChildElement(this.renderColumnButtonsBlockMobile()),this.getQuery().getColumns().forEach((function(e,n){var o=t.renderColumn(e);t.columnsBlock.appendChild(o)}))},e.prototype.renderColumnButtonsBlockMobile=function(){var t=this;return this.columnButtonsBlockMobileArrow=(0,ut.domel)("i").toDOM(),this.columnButtonsBlockMobile=(0,ut.domel)("div").addClass("".concat(this.cssPrefix,"-column-buttonsBlock")).addClass(dt.z.getMobileCssClass()).addChildElement(this.columnButtonsBlockMobileArrow).hide().toDOM(),this.buttonsBlockSortingButton=(0,ut.domel)("div",this.columnButtonsBlockMobile).addClass("".concat(this.cssPrefix,"-column-button"),"".concat(this.cssPrefix,"-column-sortbutton-none")).toDOM(),(0,ut.domel)(this.buttonsBlockSortingButton).on("touchstart click",(function(e){return e.stopPropagation(),t.currentColumnRenderer.buttonSortingClickHandler.call(t.currentColumnRenderer,e,t.buttonsBlockSortingButton),t.toggleColumnPicked(null),t.hideColumnButtonsMobile(),!1})),this.buttonsBlockTypeButton=(0,ut.domel)("div",this.columnButtonsBlockMobile).addClass("".concat(this.cssPrefix,"-column-button"),"".concat(this.cssPrefix,"-column-button-type")).on("touchstart click",(function(e){return e.stopPropagation(),t.currentColumnRenderer.buttonTypeClickHandler.call(t.currentColumnRenderer,e),t.toggleColumnPicked(null),t.hideColumnButtonsMobile(),!1})).toDOM(),this.buttonsBlockFormatButton=(0,ut.domel)("div",this.columnButtonsBlockMobile).addClass("".concat(this.cssPrefix,"-column-button"),"".concat(this.cssPrefix,"-column-button-format")).on("touchstart click",(function(e){return e.stopPropagation(),t.currentColumnRenderer.buttonFormatClickHandler.call(t.currentColumnRenderer,e),t.toggleColumnPicked(null),t.hideColumnButtonsMobile(),!1})).toDOM(),this.buttonsBlockDeleteButton=(0,ut.domel)("div",this.columnButtonsBlockMobile).addClass("".concat(this.cssPrefix,"-column-button"),"".concat(this.cssPrefix,"-column-button-delete")).on("touchstart click",(function(e){return e.stopPropagation(),t.currentColumnRenderer.buttonDeleteClickHandler.call(t.currentColumnRenderer,e),t.toggleColumnPicked(null),t.hideColumnButtonsMobile(),!1})).toDOM(),(0,ut.domel)("div",this.columnButtonsBlockMobile).addClass("".concat(this.cssPrefix,"-column-button-close-block")).on("touchstart click",(function(){t.toggleColumnPicked(null),t.hideColumnButtonsMobile()})),this.columnButtonsBlockMobile},e.prototype.showColumnButtonsMobile=function(t,e,n){this.currentActiveColumn=t,this.currentColumnRenderer=e;var o=n.getBoundingClientRect(),i=n.offsetTop,r=n.offsetLeft;(0,ut.domel)(this.columnButtonsBlockMobileArrow).setStyle("left",(r+o.width/2).toString()+"px"),o.top>100?(0,ut.domel)(this.columnButtonsBlockMobile).removeClass("show-below").setStyle("top",(i-o.height).toString()+"px"):(0,ut.domel)(this.columnButtonsBlockMobile).addClass("show-below").setStyle("top",(i+o.height).toString()+"px"),t.enabled&&!t.isReadOnly()?((0,ut.domel)(this.buttonsBlockSortingButton).show(),(0,ut.domel)(this.buttonsBlockTypeButton).show(),e.formatButtonIsShown()?(0,ut.domel)(this.buttonsBlockFormatButton).show():(0,ut.domel)(this.buttonsBlockFormatButton).hide()):((0,ut.domel)(this.buttonsBlockSortingButton).hide(),(0,ut.domel)(this.buttonsBlockTypeButton).hide()),t.isReadOnly()?(0,ut.domel)(this.columnButtonsBlockMobile).hide():(0,ut.domel)(this.columnButtonsBlockMobile).show()},e.prototype.hideColumnButtonsMobile=function(){(0,ut.domel)(this.columnButtonsBlockMobile).hide()},e.prototype.renderColumn=function(t,e){var n=this,o=this.getColumnRenderer(t,e);if(o){var i=o.render();return o.onShowButtonsMobile=function(){n.showColumnButtonsMobile(t,o,i)},o.onHideButtonsMobile=function(){n.hideColumnButtonsMobile()},i}return null},e.prototype.getColumnRenderer=function(t,e){switch(t.expr.tag){case p.AggregateFunction:return new _t(this,t,e);case p.CustomSql:case p.EntityAttribute:case p.ParentEntityAttribute:return new Bt(this,t,e)}return null},e.prototype.addNewColumn=function(t,e){var n=this,o=this.getContext().getModel(),i=this.getQuery(),r=function(t){var e=o.getAttributeById(t);if(!e)return null;if(!e.useInResult){if(!e.lookupAttr)return null;if(t=e.lookupAttr,!(e=o.getAttributeById(t))||!e.useInResult)return null}var r=i.createColumn();return r.caption=n.getDefaultColumnCaption(e),r.sorting=E.None,r.sortIndex=-1,r.expr.tag=p.EntityAttribute,r.expr.kind=l.Attribute,r.expr.dataType=e.dataType,r.expr.setValue(t,!0),r.params.concat(e.params),r};if(this.getQuery()){var s,a;if(Array.isArray(t)){s=[];for(var u=0;u<t.length;u++)(a=r(t[u]))&&s.push(a)}else s=r(t);return this.addColumn(s,e),s}},e.prototype.toggleColumnPicked=function(t){var e,n;t&&(e=this.columnsBlock.querySelector("div[data-id=".concat(t.id,"]")))&&(n=e.classList.contains("active"));for(var o=this.columnsBlock.querySelectorAll(".".concat(this.cssPrefix,"-row")),i=0;i<o.length;i++){var r=o[i];(0,ut.domel)(r).removeClass("active").data("show-buttons",null)}e&&!n&&(0,ut.domel)(e).addClass("active").data("show-buttons","")},e.prototype.addColumn=function(t,e){var n=this.getQuery();n&&(!(t=Array.isArray(t)?this.checkColumnsArray(t):this.checkColumn(t))||Array.isArray(t)&&0==t.length||(n.addColumnObj(t,e,self),n.fireChangedEvent({part:x.Columns,action:w.Add,changee:t})))},e.prototype.addColumnElement=function(t,e){var n=this.columnsBlock.querySelectorAll("[class*=".concat(this.cssPrefix,"-row]")),o=this.renderColumn(t);n.length>0&&e<n.length-1?this.columnsBlock.insertBefore(o,n[e]):this.columnsBlock.appendChild(o),this.options.columnRenderedCallback&&this.options.columnRenderedCallback(o)},e.prototype.checkColumnsArray=function(t){for(var e=t.length,n=[],o=0;o<e;o++)this.checkColumn(t[o])&&n.push(t[o]);return n},e.prototype.checkColumn=function(t){if(!this.options.allowDuplicates)for(var e=this.getQuery().getColumns(),n=JSON.stringify(t.expr),o=0;o<e.length;o++){if(JSON.stringify(e[o].expr)===n)return null}return t},e.prototype.getDefaultColumnCaption=function(t){var e=this.options.titleElementFormat||this.options.attrElementFormat;return this.getContext().getModel().getAttributeText(t,e)},e.prototype.getColumnsBlock=function(){return this.columnsBlock},e.prototype.showEntitiesMenu=function(t){this.entitiesMenu&&this.entitiesMenu.showMenu(t)},e.prototype.createEntitiesMenu=function(){var t=this.getContext().getModel();if(!t||t.isEmpty())return null;var e=this.slot.id;e&&(e+="-EntitiesMenu");var n={items:t.getEntitiesTree({addUIC:!1,addUIR:!0,addUIS:!1,attrPlacement:this.options.attrPlacement,sortEntities:this.options.sortEntities}),adjustHeight:this.options.adjustEntitiesMenuHeight,id:e,domWriteItemsId:this.options.domWriteItemsId};r.utils.assign(n,this.options.menuOptions),this.entitiesMenu=new gt(n)},e.prototype.createSortMenu=function(){var t=this.getContext().getModel();if(!t||t.isEmpty())return null;var e=this.slot.id;e&&(e+="-SortMenu");var n={items:this.sortMenuList.concat(this.moveMenuList),id:e,domWriteItemsId:this.options.domWriteItemsId};r.utils.assign(n,this.options.menuOptions),n.searchBoxAlwaysShown=!1,this.sortMenu=new gt(n)},e.prototype.createMoveMenu=function(){var t=this.getContext().getModel();if(!t||t.isEmpty())return null;var e=this.slot.id;e&&(e+="-MoveMenu");var n={items:this.moveMenuList,id:e,domWriteItemsId:this.options.domWriteItemsId};r.utils.assign(n,this.options.menuOptions),this.moveMenu=new gt(n),n.searchBoxAlwaysShown=!1},e.prototype.moveColumn=function(t,e){var n=this.getQuery().getColumns(),o=n.indexOf(t);if(o>=0)switch(e){case"MoveTop":if(0==o)return;this.moveColumnCore(o,0);break;case"MoveUp":if(0==o)return;this.moveColumnCore(o,o-1);break;case"MoveDown":if(o==n.length-1)return;this.moveColumnCore(o,o+1);break;case"MoveBottom":if(o==n.length-1)return;this.moveColumnCore(o,n.length-1)}},e.prototype.moveColumnCore=function(t,e){var n=this.getQuery();if(n){var o=this.columnsBlock.querySelectorAll("[class*=".concat(this.cssPrefix,"-row]")),i=o[t];e<=0?this.columnsBlock.insertBefore(i,this.columnsBlock[0]):e<o.length?this.columnsBlock.insertBefore(i,o[e]):this.columnsBlock.appendChild(i),n.moveColumn(t,e),n.fireColumnsChangedEvent(w.All)}},e.prototype.areCustomExpressionsAllowed=function(){return this.getQuery().isEx()&&this.options.allowCustomExpressions},e.globalCounter=0,e}(st),Lt=function(){function t(t,e,n){this.functionMenu=null,this.isMouseOverBlock=!1,this.keepShowingButtons=!1,this.bar=t,this.column=e,this.element=n}return Object.defineProperty(t.prototype,"cssPrefix",{get:function(){return"eqjs-sb"},enumerable:!1,configurable:!0}),t.prototype.render=function(){var t=this;this.baseAttr=this.getAttribute();var e=(0,ut.domel)("div");return e.data("id",this.column.id),this.element&&this.element.parentNode.replaceChild(e.toDOM(),this.element),this.element=e.toDOM(),this.bar.options.allowDragDrop&&ut.eqDragManager.registerDraggableItem({element:this.element,scope:"entityAttrSortSB",beforeDragStart:function(){return t.element.dispatchEvent((0,ut.createBrowserEvent)("mouseleave"))},onDragStart:function(e){t.element.style.display="none",e.dropEffect=ut.DropEffect.Allow},onDragEnd:function(e){e.data.finishedSuccessfully||t.element.removeAttribute("style")},data:{column:this.column}}),e.addClass(this.getClassesToAdd()).addClass(dt.z.getMobileCssClass()).addChildElement(this.renderCaptionBlock()),this.isEditable()&&e.addChildElement(this.renderSortingButton()),this.element},t.prototype.fireColumnChanged=function(){this.column.fireChangedEvent()},t.prototype.refresh=function(){this.render()},t.prototype.getAttribute=function(){return this.bar.getContext().getModel().getAttributeById(this.column.expr.value)},t.prototype.isEditable=function(){return this.column.enabled&&!this.column.isReadOnly()},t.prototype.renderCaptionBlock=function(){var t=this;this.column.caption&&""!=this.column.caption||(this.column.caption=this.getDefaultCaption());var e=this.column.caption;return this.isEditable()||(e+=function(t){switch(t){case E.Ascending:return" ↑";case E.Descending:return" ↓";default:return""}}(this.column.sorting)),(0,ut.domel)("div").addClass("".concat(this.cssPrefix,"-colelement"),"".concat(this.cssPrefix,"-captionelement")).addClass(dt.z.getMobileCssClass()).addChild("div",(function(n){return n.title(t.column.caption).text(e)})).toDOM()},t.prototype.renderSortingButton=function(){var t=this,e="".concat(ct.YR,"-column-sortbutton"),n=e;switch(this.column.sorting){case E.None:n="".concat(e,"-none");break;case E.Ascending:n="".concat(e,"-asc");break;case E.Descending:n="".concat(e,"-desc")}var o=(0,ut.domel)("div").addClass("".concat(this.cssPrefix,"-colelement"),"".concat(this.cssPrefix,"-sortimage-placeholder")).addClass(dt.z.getMobileCssClass()).addChild("div",(function(e){return e.addClass("".concat(t.cssPrefix,"-img-sorting"),n).title(r.i18n.getText("ButtonSorting"))})).on("touchstart click",(function(e){return t.buttonSortingClickHandler(e,o.toDOM())}));return o.toDOM()},t.prototype.buttonSortingClickHandler=function(t,e){var n=this;return t.stopPropagation(),this.keepShowingButtons=!0,this.bar.sortMenu.showMenu({anchor:e,selectedIds:null,itemSelectedCallback:function(t,e){var o;if("None"==t.id||"Ascending"==t.id||"Descending"==t.id){var i=n.bar.getContext().getQuery();n.column.isJustSorted()&&"None"==t.id?(i.removeColumn(n.column,n.bar),i.fireColumnsChangedEvent(w.Delete,n.column,!0)):(n.column.sorting="None"==(o=t.id)?E.None:"Ascending"==o?E.Ascending:"Descending"==o?E.Descending:void 0,n.column._sortIndex=i.getColumnSortIndex(n.column),n.fireColumnChanged())}else n.bar.moveColumn(n.column,t.id)},menuClosedCallback:function(){n.keepShowingButtons=!1}}),!1},t.prototype.getDefaultCaption=function(){return this.getDefaultTitleText(this.baseAttr)},t.prototype.getDefaultTitleText=function(t){var e=this.bar.options.titleElementFormat||this.bar.options.attrElementFormat;return this.bar.getContext().getModel().getAttributeText(t,e)},t.prototype.getClassesToAdd=function(){return"".concat(this.cssPrefix,"-row ").concat(this.cssPrefix,"-row-column-entattr")},t.prototype.getUIS=function(){return this.bar.getContext().getModel().checkAttrProperty(this.column.expr.value,"useInSorting")},t}(),Rt=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Ft=function(t){function e(e){var n=t.call(this,e)||this;return n.options={showAddRow:!0,attrElementFormat:"{entity} {attr}",titleElementFormat:null,allowDragDrop:!0,menuOptions:{showSearchBoxAfter:30,searchBoxAutoFocus:!0,activateOnMouseOver:!0,adjustHeight:!0,itemRenderedCallback:null}},n.sortMenuList=[{id:"None",text:r.i18n.getText("CmdNotSorted")},{id:"Ascending",text:r.i18n.getText("CmdAscending")},{id:"Descending",text:r.i18n.getText("CmdDescending")},{id:"---",text:"---"},{id:"MoveTop",text:r.i18n.getText("CmdMoveToFirst")},{id:"MoveUp",text:r.i18n.getText("CmdMoveToPrev")},{id:"MoveDown",text:r.i18n.getText("CmdMoveToNext")},{id:"MoveBottom",text:r.i18n.getText("CmdMoveToLast")}],n.landingSlot=(0,ut.domel)("div").addClass("".concat(ct.YR,"-highlight")).toDOM(),n.landingIndex=-1,(0,ut.domel)(n.slot).addClass("".concat(n.cssPrefix,"-panel")).addClass(dt.z.getMobileCssClass()),n.group=A.Query,n}return Rt(e,t),Object.defineProperty(e.prototype,"cssPrefix",{get:function(){return"eqjs-sb"},enumerable:!1,configurable:!0}),e.prototype.getWidgetType=function(){return"sortingBar"},e.prototype.init=function(e,n){var o=this;t.prototype.init.call(this,e,n),this.setOptions(n),this.destroyCore(),this.attachQueryObserver(),ut.eqDragManager.removeDropContainer(this.slot),this.options.allowDragDrop&&ut.eqDragManager.registerDropContainer({element:this.slot,scopes:["entityAttrSortSB"],onDragEnter:function(t,e){o.showLandingSlot(e.pageX,e.pageY)},onDragOver:function(t,e){o.showLandingSlot(e.pageX,e.pageY)},onDragLeave:function(t,e){e.dropEffect=ut.DropEffect.Forbid,o.hideLandingSlot()},onDrop:function(t,e){o.landingIndex>=0?o.getQuery().setColumnSortIndex(e.data.column,o.landingIndex):e.item.element.removeAttribute("style")}})},e.prototype.setOptions=function(t){r.utils.assignDeep(this.options,t)},e.prototype.attachQueryObserver=function(){var t=this,e=this.getQuery();this.queryEventCallbackId=e.addChangedCallback((function(e){var n=e.data;!n||n.part!=x.SortingColumns&&n.part!=x.Columns&&n.part!=x.All||t.refresh()}))},e.prototype.detachQueryObserver=function(){this.queryEventCallbackId&&this.getQuery().removeChangedCallback(this.queryEventCallbackId)},e.prototype.getQuery=function(){return this.getContext().getQuery()},e.prototype.getModel=function(){return this.getContext().getModel()},e.prototype.destroyCore=function(){this.detachQueryObserver(),this.clear()},e.prototype.refreshCore=function(){this.clear(),this.render()},e.prototype.renderAddRowButton=function(){var t=this;(0,ut.domel)(this.addRowButton).addClass("".concat(ct.YR,"-addrow"),"".concat(this.cssPrefix,"-addrow"),"".concat(ct.YR,"-addrow-empty")).addClass(dt.z.getMobileCssClass()).title(r.i18n.getText("CmdClickToAddColumn")).addChild("a",(function(e){return e.attr("href","javascript:void(0)").on("click",(function(e){e.preventDefault(),t.showEntitiesMenu({anchor:e.target,selectedIds:null,itemSelectedCallback:function(e,n){var o=e.id;return t.addNewColumn(o),!1}})}))})),dt.z.isMobileMode()&&(0,ut.domel)(this.columnsBlock).addChildElement(this.addRowButton)},e.prototype.showEntitiesMenu=function(t){this.entitiesMenu.showMenu(t)},e.prototype.createEntitiesMenu=function(){var t=this.getModel();if(!t||t.isEmpty())return null;var e=this.slot.id;e&&(e+="-EntitiesMenu");var n={items:t.getEntitiesTree({addUIC:!1,addUIR:!1,addUIS:!0}),adjustHeight:this.options.adjustEntitiesMenuHeight,id:e,domWriteItemsId:this.options.domWriteItemsId};this.entitiesMenu=new gt(n)},e.prototype.createSortMenu=function(){var t=this.getModel();if(!t||t.isEmpty())return null;var e=this.slot.id;e&&(e+="-SortMenu");var n={items:this.sortMenuList,id:e,searchBoxAlwaysShown:!1};this.sortMenu=new gt(n)},e.prototype.render=function(){var t=this;this.createEntitiesMenu(),this.createSortMenu(),this.columnsBlock=(0,ut.domel)("div").addClass("".concat(this.cssPrefix,"-columns")).addClass(dt.z.getMobileCssClass()).toDOM(),this.options.showAddRow&&(this.addRowButton=(0,ut.domel)("div").toDOM(),dt.z.isMobileMode()?(0,ut.domel)(this.columnsBlock).addChildElement(this.addRowButton):(0,ut.domel)(this.slot).addChildElement(this.addRowButton),this.renderAddRowButton()),(0,ut.domel)(this.slot).addChildElement(this.columnsBlock),this.getQuery().getSortedColumns().forEach((function(e,n){var o=t.renderColumn(e);t.columnsBlock.appendChild(o)}))},e.prototype.addNewColumn=function(t){var e=this,n=this.getModel(),o=this.getQuery();if(this.getQuery()){var i=function(t){var i=n.getAttributeById(t);if(!i)return null;if(!i.useInSorting){if(!i.lookupAttr)return null;if(t=i.lookupAttr,!(i=n.getAttributeById(t))||!i.useInSorting)return null}var r=o.createColumn(!0);return r.caption=e.getDefaultColumnCaption(i),r._sorting=E.Ascending,r.expr.tag=p.EntityAttribute,r.expr.dataType=i.dataType,r.expr.setValue(t,!0),r.params.concat(i.params),r}(t);return this.getQuery().addColumn({column:i})}},e.prototype.getDefaultColumnCaption=function(t){var e=this.options.titleElementFormat||this.options.attrElementFormat;return this.getModel().getAttributeText(t,e)},e.prototype.renderColumn=function(t,e){var n=new Lt(this,t,e);return n?n.render():null},e.prototype.clear=function(){this.slot.innerHTML=""},e.prototype.moveColumn=function(t,e){var n=this.getQuery(),o=n.getSortedColumns(),i=n.getColumnSortIndex(t);if(i>=0)switch(e){case"MoveTop":n.setColumnSortIndex(t,0);break;case"MoveUp":n.setColumnSortIndex(t,i>0?i-1:0);break;case"MoveDown":n.setColumnSortIndex(t,i<o.length-1?i+1:o.length-1);break;case"MoveBottom":n.setColumnSortIndex(t,o.length-1)}},e.prototype.showLandingSlot=function(t,e){for(var n=this.columnsBlock.querySelectorAll("[class*=".concat(this.cssPrefix,"-row]")),o=[],i=0;i<n.length;i++)"none"!==n[i].style.display&&o.push(n[i]);if(0!==o.length){var r=(0,ut.getElementAbsolutePos)(this.landingSlot);if(!(t>=r.x&&t<=r.x+this.landingSlot.offsetWidth&&e>=r.y&&e<=r.y+this.landingSlot.offsetHeight)){var s=this.landingIndex;for(i=0;i<o.length;i++){var a=o[i],l=(0,ut.getElementAbsolutePos)(a),u=a.offsetWidth,c=a.offsetHeight,d=.2*u;if(t>=l.x+d&&t<=l.x+u-d&&e>=l.y+2&&e<=l.y+c-2){s=t>r.x?i+1:i;break}}(s!=this.landingIndex||this.landingSlot.parentElement)&&(this.landingIndex=s,this.landingIndex<=0&&this.columnsBlock.insertBefore(this.landingSlot,o[0]),this.landingIndex<o.length?this.columnsBlock.insertBefore(this.landingSlot,o[this.landingIndex]):this.columnsBlock.appendChild(this.landingSlot))}}else this.landingIndex=0},e.prototype.hideLandingSlot=function(){this.landingIndex=-1,this.landingSlot.parentElement&&this.landingSlot.parentElement.removeChild(this.landingSlot)},e}(st);!function(t){t[t.None=0]="None",t[t.Value=1]="Value",t[t.Attribute=2]="Attribute",t[t.Operator=4]="Operator",t[t.Addition=8]="Addition",t[t.Removal=16]="Removal",t[t.All=255]="All",t[t.NoAddition=-9]="NoAddition",t[t.NoRemoval=-17]="NoRemoval",t[t.FixedConditionList=5]="FixedConditionList"}(vt||(vt={}));var qt,Qt=function(){function t(t,e,n){this.panel=t,this.text=e,this.element=n||(0,ut.domel)("div").toDOM()}return Object.defineProperty(t.prototype,"cssPrefix",{get:function(){return"eqjs-qp"},enumerable:!1,configurable:!0}),t.prototype.refresh=function(){this.render()},t.prototype.render=function(){var t=this;return(0,ut.domel)(this.element).html("").addClass(this.getClassesToAdd()).addClass(dt.z.getMobileCssClass()).addChild("span",(function(e){return e.text(t.text).title(t.text)})).toDOM(),this.element},t.prototype.getClassesToAdd=function(){return"".concat(this.cssPrefix,"-condelement")},t}(),Nt=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}();!function(t){t[t.AddCondition=0]="AddCondition",t[t.AddGroup=1]="AddGroup",t[t.Enable=2]="Enable",t[t.Delete=4]="Delete",t[t.Menu=5]="Menu",t[t.Parameterized=6]="Parameterized",t[t.InJoin=7]="InJoin"}(qt||(qt={}));var jt=function(){function t(t,e,n){this.panel=t,this.condition=e,this.element=n||(0,ut.domel)("div").toDOM()}return Object.defineProperty(t.prototype,"cssPrefix",{get:function(){return"eqjs-qp"},enumerable:!1,configurable:!0}),t.prototype.refresh=function(){this.render()},t.prototype.clear=function(){this.element&&(this.element.className="",this.element.removeAttribute("data-id"),this.element.removeAttribute("style"),(0,ut.domel)(this.element).html(""))},t.prototype.render=function(t){return this.clear(),this.coreRender(t),this.panel.options.onConditionRendered&&this.panel.options.onConditionRendered(this.condition,this.element),this.element},t.prototype.isEditable=function(){return this.condition.enabled&&!this.condition.isReadOnly()},t}(),Ht=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Nt(e,t),e.prototype.getClassesToAdd=function(){var t="".concat(this.cssPrefix,"-row ").concat(this.cssPrefix,"-row-condition");if(t+=this.condition.isInJoin()?" ".concat(this.cssPrefix,"-condition-injoin"):"",t+=this.condition.isParameterized()?" ".concat(this.cssPrefix,"-condition-parameterized"):"",!dt.z.isMobileMode()){var e=this.condition.getLevel();e>0&&(t+=" ".concat(this.cssPrefix,"-level-").concat(e))}return t+=this.condition.enabled?"":" ".concat(this.cssPrefix,"-disabled"),this.condition.enabled&&(t+=this.condition.isReadOnly()?" ".concat(this.cssPrefix,"-readonly"):""),t},e.prototype.coreRender=function(t){var e=this,n=this.panel.getContext().getModel(),i=n.getOperatorById(this.condition.getOperatorId()),r=o.parseOperatorFormat(i),s=null,a=r.length,l=(0,ut.domel)("div");this.element&&this.element.parentNode&&this.element.parentNode.replaceChild(l.toDOM(),this.element),this.element=l.toDOM(),l.addClass(this.getClassesToAdd()).addClass(dt.z.getMobileCssClass()).data("id",this.condition.id).data("condrow","").addChildElement(this.renderCheckbox()).addChildElement(this.renderConjunction());for(var u=t,c=i==n.nullOperator?Math.min(a,this.condition.expressions.length+1):a,d=function(t){if("operator"===(s=r[t]).type){var e=h.panel.getOperatorRenderer(h.condition,s.text);e&&l.addChildElement(e.render())}else if("expression"===s.type){var n=u&&s.index>0,o=h.panel.getExpressionRenderer(h.condition.expressions[s.index]);if(o){var i=o.render(n);l.addChildElement(i),setTimeout((function(){o.adjustWidth()}),100)}u=u&&!n}else"text"===s.type&&l.addChildElement(new Qt(h.panel,s.text).render())},h=this,p=0;p<c;p++)d(p);(this.panel.options.accentActiveCondition||dt.z.isMobileMode())&&l.on("click",(function(t){return t.stopPropagation(),e.panel.toggleConditionPicked(e.condition),e.adjustButtonsVisibility(),dt.z.isMobileMode()||e.element.dispatchEvent((0,ut.createBrowserEvent)("mouseenter")),!1})),l.addChildElement(this.renderButtonsBlock()),dt.z.isMobileMode()||l.on("mouseenter",(function(t){return e.isMouseOverBlock=!0,e.enterButtonBlock(),t.stopPropagation(),!1})).on("mouseleave",(function(t){return e.isMouseOverBlock=!1,!e.keepShowingButtons&&(0,ut.domel)(e.buttonsBlock).isVisible()&&e.leaveButtonBlock(),t.stopPropagation(),!1}))},e.prototype.setConditionParameterized=function(t){this.condition.setParameterized(t),this.condition.fireChangedEvent()},e.prototype.setConditionInJoin=function(t){this.condition.setInJoin(t),this.condition.fireChangedEvent()},e.prototype.getConditionMenu=function(){return this.panel.getConditionMenu()},e.prototype.renderConjunction=function(){var t=this.condition.getParent();if(!t)return null;var e=0==r.utils.findItemIndexById(t.getConditions(),this.condition.id);if(this.panel.options.showConjunctions&&!e){var n=o.linkTypeToStr(this.condition.getParent().linkType),i=r.i18n.getText("Conj"+n);return(0,ut.domel)("span").text(i).title(i).addClass("".concat(this.cssPrefix,"-condelement ").concat(this.cssPrefix,"-condition-conjuction")).toDOM()}return null},e.prototype.renderCheckbox=function(){var t=this;return this.panel.options.showCheckboxes&&!this.condition.isReadOnly()?(0,ut.domel)("div").title(r.i18n.getText("CmdToggleEnable")).attr("tabIndex","0").addClass("".concat(this.cssPrefix,"-condelement ").concat(this.cssPrefix,"-condition-checkbox")).addClass("".concat(this.condition.enabled?"enabled":"")).on("click",(function(){return t.condition.enabled=!t.condition.enabled,t.condition.fireChangedEvent(),!1})).on("keypress",(function(t){[13,32].includes(t.keyCode)&&t.target.click()})).toDOM():null},e.prototype.isConditionActive=function(){return this.element.classList.contains("active")},e.prototype.hideButtons=function(){(0,ut.domel)(this.element).data("show-buttons",null)},e.prototype.showButtons=function(){(0,ut.domel)(this.element).data("show-buttons","")},e.prototype.adjustButtonsVisibility=function(){(this.panel.options.alwaysShowButtonsInConditions||this.panel.options.accentActiveCondition&&this.isConditionActive())&&this.showButtons()},e.prototype.enterButtonBlock=function(){this.showButtons()},e.prototype.leaveButtonBlock=function(){this.panel.options.alwaysShowButtonsInConditions||this.isConditionActive()&&this.panel.options.accentActiveCondition||this.hideButtons()},e.prototype.conditionMenuHandler=function(t,e){var n=this;switch(t){case qt.AddCondition:if(!this.condition.isGroup())return;var o=this.panel.getEntitiesMenu();o&&o.showMenu({anchor:e.target,itemSelectedCallback:function(t){var e=n.panel.getQuery(),o={parent:n.condition,attributeId:t.id},i=e.addSimpleCondition(o);return i&&e.fireConditionsChangedEvent(w.Add,i),!1}});break;case qt.AddGroup:if(!this.condition.isGroup())return;var i=this.panel.getQuery(),r={parent:this.condition},s=this.panel.getQuery().addConditionGroup(r);s&&i.fireConditionsChangedEvent(w.Add,s);break;case qt.Enable:this.condition.enabled=!this.condition.enabled,this.condition.fireChangedEvent();break;case qt.Delete:var a=this.condition.getParent();if(!a)return;var l=a.getConditions(),u=l.indexOf(this.condition);u>=0&&(l.splice(u,1),this.condition.getQuery().fireConditionsChangedEvent(w.Delete,this.condition));break;case qt.Menu:var c=this.getConditionMenu();this.keepShowingButtons=!0,c.showMenu({anchor:e.target,selectedIds:this.getConditionMenuSelectedItems(),itemSelectedCallback:function(t){var o;switch(t.id){case"enable":o=qt.Enable;break;case"delete":o=qt.Delete;break;case"param":o=qt.Parameterized;break;case"inJoin":o=qt.InJoin;break;case"addCondition":o=qt.AddCondition;break;case"addGroup":o=qt.AddGroup}n.conditionMenuHandler(o,e)},itemFilterCallback:function(t){var e=n.condition.enabled||"enable"===t.id||"delete"===t.id;if("enable"===t.id){var o=n.condition.getParent();e=e&&o&&o.enabled}else"delete"===t.id?e=e&&(n.panel.options.editableParts&vt.Removal)===vt.Removal:"addGroup"!==t.id&&"addCondition"!==t.id||(e=e&&(n.panel.options.editableParts&vt.Addition)===vt.Addition);return e},menuClosedCallback:function(){n.keepShowingButtons=!1,n.isMouseOverBlock||n.leaveButtonBlock()}});break;case qt.Parameterized:this.condition.setParameterized(!this.condition.isParameterized()),this.condition.fireChangedEvent();break;case qt.InJoin:this.condition.setInJoin(!this.condition.isInJoin()),this.condition.fireChangedEvent()}return e.stopPropagation(),!1},e.prototype.getConditionMenuSelectedItems=function(){var t=[];return this.condition.enabled&&t.push("enable"),this.condition.isParameterized()&&t.push("param"),this.condition.isInJoin()&&t.push("inJoin"),t},e.prototype.renderButtonsBlock=function(){var t=this,e=function(e){(0,ut.domel)(e.target).addClass("".concat(t.cssPrefix,"-condition-button-active"))},n=function(e){(0,ut.domel)(e.target).removeClass("".concat(t.cssPrefix,"-condition-button-active"))},o=(0,ut.domel)("div").addClass("".concat(this.cssPrefix,"-condition-buttonsBlock")).addClass(dt.z.getMobileCssClass());if(this.buttonsBlock=o.toDOM(),this.condition.isReadOnly())return this.buttonsBlock;var i=this.getButtonsToShow();return i.indexOf("addCondition")>=0&&this.condition.enabled&&(this.panel.options.editableParts&vt.Addition)==vt.Addition&&o.addChild("div",(function(o){o.addClass("".concat(t.cssPrefix,"-button-placeholder")).data("btnplaceholder","").addChild("div",(function(o){o.addClass("".concat(t.cssPrefix,"-condition-button ").concat(t.cssPrefix,"-condition-button-addCondition")).attr("tabIndex","0").data("button","").title(r.i18n.getText("CmdAddCondition")).on("click",(function(e){return t.conditionMenuHandler(qt.AddCondition,e)})).on("keypress",(function(t){13==t.keyCode&&t.target.click()})).on("mouseenter",e).on("mouseleave",n)}))})),(i.indexOf("addGroup")>=0||i.indexOf("addPredicate")>=0)&&this.condition.enabled&&(this.panel.options.editableParts&vt.Addition)==vt.Addition&&o.addChild("div",(function(o){o.addClass("".concat(t.cssPrefix,"-button-placeholder")).data("btnplaceholder","").addChild("div",(function(o){o.addClass("".concat(t.cssPrefix,"-condition-button ").concat(t.cssPrefix,"-condition-button-addPredicate")).attr("tabIndex","0").data("button","").title(r.i18n.getText("CmdAddCondGroup")).on("click",(function(e){return t.conditionMenuHandler(qt.AddGroup,e)})).on("keypress",(function(t){13==t.keyCode&&t.target.click()})).on("mouseenter",e).on("mouseleave",n)}))})),this.getButtonsToShow().indexOf("enable")>=0&&this.condition.getParent()&&this.condition.getParent().enabled&&o.addChild("div",(function(o){o.addClass("".concat(t.cssPrefix,"-button-placeholder")).data("btnplaceholder","").addChild("div",(function(o){o.addClass("".concat(t.cssPrefix,"-condition-button ").concat(t.cssPrefix,"-condition-button-enable")).attr("tabIndex","0").data("button","").title(r.i18n.getText("CmdToggleEnable")).addClass(t.condition.enabled?"enabled":"").on("click",(function(e){return t.conditionMenuHandler(qt.Enable,e)})).on("keypress",(function(t){13==t.keyCode&&t.target.click()})).on("mouseenter",e).on("mouseleave",n)}))})),this.getButtonsToShow().indexOf("delete")>=0&&this.condition.getParent()&&(this.panel.options.editableParts&vt.Removal)==vt.Removal&&o.addChild("div",(function(o){o.addClass("".concat(t.cssPrefix,"-button-placeholder")).data("btnplaceholder","").addChild("div",(function(o){o.addClass("".concat(t.cssPrefix,"-condition-button ").concat(t.cssPrefix,"-condition-button-delete")).attr("tabIndex","0").data("button","").title(r.i18n.getText("CmdDelete")).on("click",(function(e){return t.conditionMenuHandler(qt.Delete,e)})).on("keypress",(function(t){13==t.keyCode&&t.target.click()})).on("mouseenter",e).on("mouseleave",n)}))})),this.getButtonsToShow().indexOf("menu")>=0&&o.addChild("div",(function(o){o.addClass("".concat(t.cssPrefix,"-button-placeholder")).data("btnplaceholder","").addChild("div",(function(o){o.addClass("".concat(t.cssPrefix,"-condition-button ").concat(t.cssPrefix,"-condition-button-menu")).attr("tabIndex","0").data("button","").title(r.i18n.getText("ButtonMenu")).on("click",(function(e){return t.conditionMenuHandler(qt.Menu,e)})),dt.z.isMobileMode()||o.on("keypress",(function(t){13==t.keyCode&&t.target.click()})).on("mouseenter",e).on("mouseleave",n)}))})),this.adjustButtonsVisibility(),this.buttonsBlock},e.prototype.getButtonsToShow=function(){return this.panel.options.buttons&&this.panel.options.buttons.condition&&Array.isArray(this.panel.options.buttons.condition)?this.panel.options.buttons.condition:["enable","delete"]},e}(jt),Wt=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Gt=function(t){function e(e){var n=t.call(this,"a",e)||this;return n.attr("href","javascript:void(0)"),n.on("click",(function(t){return t.preventDefault(),n.appear(),!1})),n}return Wt(e,t),e.prototype.onGetMenu=function(t){return this._onGetMenu=t,this},e.prototype.onItemSelected=function(t){return this._onItemSelected=t,this},e.prototype.appear=function(){var t=this,e=this._onGetMenu?this._onGetMenu():null;e&&e.showMenu({anchor:this.element,itemSelectedCallback:function(e){return t._onItemSelected&&t._onItemSelected(e.id),!1}})},e}(ut.DomElementBuilder);function zt(t){return new Gt(t)}var Vt,Ut=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Yt=function(t){function e(e,n,o){var i=t.call(this,e,n,o)||this;return i.isRoot=!n.getParent(),i}return Ut(e,t),e.prototype.getClassesToAdd=function(){var t="".concat(this.cssPrefix,"-group");return this.isRoot&&(t+=" ".concat(this.cssPrefix,"-group-root")),t},e.prototype.coreRender=function(t){(0,ut.domel)(this.element).addClass(this.getClassesToAdd()).addClass(dt.z.getMobileCssClass()).addChildElement(this.renderGroupRow()).addChildElement(this.renderConditions(t)).data("id",this.condition.id).data("group","")},e.prototype.renderGroupRow=function(){return this.isRoot&&!this.panel.options.showRootRow?null:new Jt(this.panel,this.condition).render()},e.prototype.renderConditions=function(t){var e=this,n=(0,ut.domel)("div");return n.addClass("".concat(this.cssPrefix,"-conditions")).addClass("".concat(dt.z.getMobileCssClass())).data("conditions",""),this.isRoot&&n.addClass("".concat(this.cssPrefix,"-conditions-root")),this.condition.getConditions().forEach((function(o,i,r){var s=e.panel.getConditionRenderer(o);s&&n.addChildElement(s.render(t&&i==r.length-1))})),n.toDOM()},e}(jt),Jt=function(t){function e(e,n,o){var i=t.call(this,e,n,o)||this;return i.isRoot=!i.condition.getParent(),i}return Ut(e,t),e.prototype.getButtonsToShow=function(){return this.panel.options.buttons&&this.panel.options.buttons.group&&Array.isArray(this.panel.options.buttons.group)?this.panel.options.buttons.group:["addCondition","addGroup","enable","delete"]},e.prototype.getClassesToAdd=function(){var t;if(this.isRoot)t="".concat(this.cssPrefix,"-row ").concat(this.cssPrefix,"-row-group ").concat(this.cssPrefix,"-row-group-root");else{t="".concat(this.cssPrefix,"-row ").concat(this.cssPrefix,"-row-group");var e=this.condition.getLevel();e>0&&(t+=" ".concat(this.cssPrefix,"-level-").concat(e)),t+=this.condition.enabled?"":" ".concat(this.cssPrefix,"-disabled"),this.condition.enabled&&(t+=this.condition.isReadOnly()?" ".concat(this.cssPrefix,"-readonly"):"")}return t},e.prototype.coreRender=function(t){var e=this,n=(0,ut.domel)(this.element).addClass(this.getClassesToAdd()).addClass(dt.z.getMobileCssClass()).data("group-row","").addChildElement(this.renderCheckbox()).addChildElement(this.renderConjunction()),o=this.condition.getLevel();o>0&&n.addClass("".concat(this.cssPrefix,"-level-").concat(o)),this.buildGroupElements(n,this.getGroupTitle()),this.panel.options.accentActiveCondition&&n.on("click",(function(t){e.panel.toggleConditionPicked(e.condition),e.adjustButtonsVisibility(),dt.z.isMobileMode()||n.toDOM().dispatchEvent((0,ut.createBrowserEvent)("mouseenter"))})),n.addChildElement(this.renderButtonsBlock()),dt.z.isMobileMode()||n.on("mouseenter",(function(t){return e.isMouseOverBlock=!0,e.enterButtonBlock(),t.stopPropagation(),!1})).on("mouseleave",(function(t){return e.isMouseOverBlock=!1,!e.keepShowingButtons&&(0,ut.domel)(e.buttonsBlock).isVisible()&&e.leaveButtonBlock(),t.stopPropagation(),!1}))},e.prototype.getGroupTitle=function(){var t;return this.isRoot&&!dt.z.isMobileMode()?(t=r.i18n.getText("RootConditionGroupTitle"))||(t=r.i18n.getText("RootPredicateTitle")):(t=r.i18n.getText("ConditionGroupTitle"))||(t=r.i18n.getText("PredicateTitle")),t},e.prototype.buildGroupElements=function(t,e){var n=this,s=e.indexOf("{lt}");if(s<0)t.addText(r.i18n.getText("ErrIncorrectGroupTitleFormat")),t.addClass("".concat(this.cssPrefix,"-error"));else{s>0&&t.addChild("span",(function(t){t.addClass("".concat(n.cssPrefix,"-grelement")).addText(e.substring(0,s))}));var a=o.linkTypeToStr(this.condition.linkType),l=r.utils.findItemById(i.predicateLinkTypeList,a);l||(l=i.predicateLinkTypeList[0]),this.isEditable()?zt(t.toDOM()).onGetMenu((function(){return n.getLinkTypeMenu()})).onItemSelected((function(t){n.condition.linkType=o.strToLinkType(t),n.condition.fireChangedEvent()})).addText(r.i18n.getText(l.key)).title(r.i18n.getText(l.key)).addClass("".concat(this.cssPrefix,"-grelement")):t.addChild("span",(function(t){t.text(r.i18n.getText(l.key)).title(r.i18n.getText(l.key)).addClass("".concat(n.cssPrefix,"-grelement"))})),t.addChild("span",(function(t){t.addClass("".concat(n.cssPrefix,"-grelement")).addText(e.substring(s+4))}))}},e.prototype.getConditionMenu=function(){return this.panel.getConditionGroupMenu(null==this.condition.getParent())},e.prototype.getLinkTypeMenu=function(){return this.panel.getLinkTypeMenu()},e.prototype.renderConjunction=function(){return this.isRoot?null:t.prototype.renderConjunction.call(this)},e.prototype.renderCheckbox=function(){return this.isRoot?null:t.prototype.renderCheckbox.call(this)},e.prototype.leaveButtonBlock=function(){this.panel.options.alwaysShowButtonsInGroups||this.isConditionActive()&&this.panel.options.accentActiveCondition||this.hideButtons()},e.prototype.adjustButtonsVisibility=function(){(this.panel.options.alwaysShowButtonsInGroups||this.panel.options.accentActiveCondition&&this.isConditionActive())&&this.showButtons()},e}(Ht),Kt=function(){function t(t){this.element=t||(0,ut.domel)("div").toDOM()}return t.prototype.refresh=function(){this.render()},t.prototype.render=function(t){var e=this;return void 0===t&&(t=!1),this.labelElement=this.renderLabelElement(),(0,ut.domel)(this.element).html("").addClass(this.getClassesToAdd()).addClass(dt.z.getMobileCssClass()).addChildElement(this.labelElement),this.isEditable()&&(this.renderEditor(),t&&setTimeout((function(){return e.showEditor()}),50)),this.element},t.prototype.isEditable=function(){return!0},t.prototype.renderLabelElement=function(){var t=this,e=this.getLabelText();return this.isEditable()?(0,ut.domel)("a").attr("href","javascript:void(0)").title(e).text(e).on("click",(function(e){return e.preventDefault(),t.showEditor(),!1})).toDOM():(0,ut.domel)("span").title(e).text(e).toDOM()},t.prototype.getClassesToAdd=function(){return""},t.prototype.getLabelText=function(){return this.getEmptyText()},t.prototype.getEmptyText=function(){return"<empty>"},t}(),Xt=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),$t=function(t){function e(e,n,o,i){var r=t.call(this,i)||this;return r.panel=e,r.expression=n,r.valueEditor=o,r}return Xt(e,t),Object.defineProperty(e.prototype,"cssPrefix",{get:function(){return"eqjs-qp"},enumerable:!1,configurable:!0}),e.prototype.render=function(e){return void 0===e&&(e=!1),t.prototype.render.call(this,e),this.panel.options.onExpressionRendered&&this.panel.options.onExpressionRendered(this.expression,this.element),this.element},e.prototype.getContext=function(){return this.panel.getContext()},e.prototype.isReadOnly=function(){var t=this.expression.getParent();return!t.enabled||t.isReadOnly()},e.prototype.isEditable=function(){return!this.isReadOnly()},e.prototype.getClassesToAdd=function(){return"".concat(this.cssPrefix,"-condelement ").concat(this.cssPrefix,"-valueelement")},e.prototype.getLabelText=function(){return this.expression.isEmpty()?this.getEmptyText():this.expression.value},e.prototype.getEmptyText=function(){return this.panel.options.emptyTextValue||r.i18n.getText("MsgEmptyScalarValue")},e.prototype.setValue=function(t,e){this.expression.setValue(t),e||this.expression.getParent().fireChangedEvent(I.Value)},e.prototype.getValue=function(){return this.expression.value},e.prototype.validateInput=function(t){return{success:!0,value:t}},e.prototype.showValidationError=function(t,e){this.getContext().throwError({action:"ui.validation",text:t})},e.prototype.isEmptyValue=function(){var t=this.getValue();return null==t||!t},e.prototype.adjustWidth=function(){},e}(Kt),Zt=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),te=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Zt(e,t),e.prototype.renderEditor=function(){var t=this;this.inputBuilder=(0,ut.domel)("input").hide().addClass("".concat(this.cssPrefix,"-ve-editbox")).type("text").on("blur",(function(e){if(t.inputBuilder.isVisible()&&!t.dontProcessBlur){var n=t.validateInput(t.inputElement.value);return n.success?(t.setValue(t.inputElement.value),t.closeEditor()):(t.dontProcessBlur=!0,t.inputElement.focus(),setTimeout((function(){t.dontProcessBlur=!1}),200),t.showValidationError(n.message,e.target)),e.stopPropagation(),!1}})).on("keydown",(function(e){if(27===e.keyCode)return t.closeEditor(),e.stopPropagation(),!1;if(13===e.keyCode&&t.inputBuilder.isVisible()){t.dontProcessBlur=!0;var n=t.validateInput(t.inputElement.value);return n.success?(t.setValue(t.inputElement.value),t.closeEditor(),t.dontProcessBlur=!1):(t.inputElement.focus(),t.showValidationError(n.message,e.target),setTimeout((function(){t.dontProcessBlur=!1}),200)),e.stopPropagation(),!1}})),this.inputElement=this.inputBuilder.toDOM(),(0,ut.domel)(this.element).addChildElement(this.inputElement)},e.prototype.showEditor=function(){var t=200;if(!dt.z.isMobileMode()){var e=this.element.offsetLeft,n=this.element.offsetWidth>t?this.element.offsetWidth:t,o=this.element.parentElement.clientWidth-e-55;this.inputBuilder.removeStyle("left").removeStyle("right"),o<t?this.inputBuilder.setStyle("right","55px").setStyle("width","".concat(t,"px")):o<n?this.inputBuilder.setStyle("left","".concat(e,"px")).setStyle("width","".concat(o,"px")):this.inputBuilder.setStyle("left","".concat(e,"px")).setStyle("width","".concat(n,"px"))}(0,ut.domel)(this.labelElement).hide(),this.inputBuilder.value(this.getValue()).show(),this.inputElement.focus()},e.prototype.closeEditor=function(){this.inputBuilder.hide(),(0,ut.domel)(this.labelElement).show(),this.labelElement.focus()},e.prototype.validateInput=function(t){this.inputBuilder.removeClass("eqjs-invalid");var e={success:!0,value:t};return this.expression.kind==l.List?this.validateListInput(t,e):this.validateScalarInput(t,e),e},e.prototype.validateListInput=function(t,e){for(var n=0,o=t.split(/\s*,\s*/);n<o.length;n++){var i=o[n];if(this.validateScalarInput(i,e),!e.success)return}},e.prototype.validateScalarInput=function(t,e){if(t&&r.utils.isNumericType(this.expression.dataType)){var n=+t;isNaN(n)&&(e.success=!1,e.message='"'+t+'" '+r.i18n.getText("ErrNotNumber")),r.utils.isIntType(this.expression.dataType)&&n!=parseInt(t,10)&&(e.success=!1,e.message='"'+t+'" '+r.i18n.getText("ErrIncorrectInteger"))}},e.prototype.showValidationError=function(e,n){t.prototype.showValidationError.call(this,e,n),this.inputBuilder.addClass("eqjs-invalid")},e.prototype.isEditable=function(){return t.prototype.isEditable.call(this)&&(this.panel.options.editableParts&vt.Value)===vt.Value},e}($t),ee=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),ne=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.menuItemsList=[],e.showWhenReady=!1,e}return ee(e,t),e.prototype.isEditable=function(){return!this.isReadOnly()&&(this.panel.options.editableParts&vt.Value)===vt.Value},e.prototype.setValue=function(t,e){void 0===e&&(e=!1);var n=this.adjustNewValue(t);if(t!==this.expression.value){var o=this.getValueText(t);this.expression.setContent(n,o),e||this.expression.getParent().fireChangedEvent(I.Value)}return!0},e.prototype.getValueText=function(t){var e="";if(Array.isArray(t))for(var n=0,o=this.menuItemsList;n<o.length;n++){var i=o[n];t.indexOf(i.id)>=0&&(e+=i.text+",")}else for(var r=0,s=this.menuItemsList;r<s.length;r++){(i=s[r]).id===t&&(e+=i.text+",")}return e&&(e=e.substring(0,e.length-1)),e},e.prototype.getEmptyText=function(){return this.panel.options.emptyTextList||r.i18n.getText("MsgEmptyListValue")},e.prototype.getListName=function(){return this.valueEditor.name},e.prototype.renderEditor=function(){var t=this;this.fillMenuItemsList((function(){t.renderMenuBlock()}))},e.prototype.getLabelText=function(){return this.expression.isEmpty()?this.getEmptyText():this.expression.getText()},e.prototype.showLoader=function(){},e.prototype.hideLoader=function(){},e.prototype.showEditor=function(){var t=this;this.menu?this.menu.showMenu({anchor:this.labelElement,selectedIds:this.getValuesAsArray(),itemSelectedCallback:function(e,n){if(t.menu.options.multiselect){if(n){for(var o=[],i=n.length,r=0;r<i;r++)o.push(n[r].id);t.setValue(o)}}else t.setValue(e.id);return!1}}):(this.showWhenReady=!0,this.showLoader())},e.prototype.closeEditor=function(){this.menu.hideMenu()},e.prototype.renderMenuBlock=function(){var t=!1;this.expression&&(t=this.expression.kind===l.List);var e=this.panel,n={items:this.menuItemsList,multiselect:t,container:e?e.options.menuContainer:null,showSelected:!0,showItemIds:!!e&&e.options.showIdsForListItems};e&&r.utils.assignDeep(n,e.options.menuOptions);var o=this.element.id;o&&(n.id=o+"-EditorMenu"),e&&(n.domWriteItemsId=e.options.domWriteItemsId),n.buttons={submit:r.i18n.getText("ButtonApply"),cancel:r.i18n.getText("ButtonCancel")},this.menu=new gt(n)},e.prototype.getValuesAsArray=function(){if(this.expression.kind!==l.List)return[this.expression.value];if(this.expression.value){var t=this.expression.value.match(/"[^"\\]*(?:\\.[^"\\]*)*"|[^,]+/g);return t?t.map((function(t){return'"'==t.charAt(0)&&'"'==t.charAt(t.length-1)?(t=t.substring(1,t.length-1)).replace(/\"/g,'"'):t})):[]}return[]},e.prototype.adjustNewValue=function(t){return Array.isArray(t)?t.map((function(t){return t.indexOf(",")>=0?'"'+(t=t.replace(/"/g,'"'))+'"':t})).join(","):t},e.prototype.fillMenuItemsList=function(t){this.menuItemsList=this.valueEditor.values,t&&t()},e.prototype.takeDefaultValue=function(){if(this.menuItemsList)for(var t=this.menuItemsList.length,e=this.valueEditor.defValue,n=0;n<t;n++){var o=this.menuItemsList[n];if(o.isDefault||e==o.id){this.setValue(o.id,!0);break}}},e}($t),oe=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.isLoading=!1,e.onClickTemp=null,e}return ee(e,t),e.prototype.renderEditor=function(){var t=this;this.isLoading||(this.isLoading=!0,this.fillMenuItemsList((function(){if(t.isLoading=!1,t.isEmptyValue()&&t.takeDefaultValue(),!t.expression.isEmpty()&&t.expression._isDefaultValue){var e=t.getValueText(t.expression.value);t.expression.setContent(t.expression.value,e),t.expression.getParent().fireChangedEvent()}t.renderMenuBlock(),t.showWhenReady&&(t.showWhenReady=!1,t.hideLoader(),t.showEditor())})))},e.prototype.showLoader=function(){this.labelElement.style.display="none",this.loaderElement||(this.loaderElement=(0,ut.domel)("div",this.element).addClass("".concat(this.cssPrefix,"-ve-loader")).toDOM()),this.loaderElement.style.display="block"},e.prototype.hideLoader=function(){this.loaderElement.style.display="none",this.labelElement.removeAttribute("style")},e.prototype.fillMenuItemsList=function(t){var e=this,n=this.getListName(),o=this.panel.getContext().getListRequestHandler();i.constLists[n]?(this.menuItemsList=i.constLists[n],t&&t()):o&&o({listName:n,editorId:this.valueEditor.id,editorParams:this.valueEditor.extraParams,value:this.getValue()},(function(n){e.menuItemsList=n,t&&t()}))},e}(ne),ie=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return ee(e,t),e.prototype.fillMenuItemsList=function(t){var e=this,n=this.panel.getContext(),o=(this.valueEditor,n.getListRequestHandler());o&&o({listName:"SQL",editorId:this.valueEditor.id,editorParams:this.valueEditor.extraParams,value:this.getValue()},(function(n){e.menuItemsList=n,t&&t()}))},e}(oe),re=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),se=function(t){function e(e,n,o,i){var r=t.call(this,e,n,null,i)||this;return r.menu=o,r}return re(e,t),e.prototype.renderEditor=function(){},e.prototype.getLabelText=function(){var t=this.panel.getContext().getModel(),e=this.expression.value,n=e?t.getAttributeByIdSafe(e):null,o=this.panel.options.attrElementFormat;return n?t.getAttributeText(n,o):this.getEmptyText()},e.prototype.setValue=function(e,n){void 0===n&&(n=!1),n=n&&e!==this.expression.value;var o=t.prototype.setValue.call(this,e,!0);return n||this.expression.getParent().fireChangedEvent(I.EntityAttr|I.Operator),o},e.prototype.isEditable=function(){return!this.isReadOnly()&&(this.panel.options.editableParts&vt.Attribute)===vt.Attribute},e.prototype.getEmptyText=function(){return this.panel.options.emptyTextAttribute||r.i18n.getText("MsgEmptyAttrValue")},e.prototype.getClassesToAdd=function(){return"".concat(this.cssPrefix,"-condelement ").concat(this.cssPrefix,"-attrelement")},e.prototype.adjustWidth=function(){dt.z.isMobileMode()||this.element.clientWidth>this.element.parentElement.clientWidth/2&&(0,ut.domel)(this.element).addClass("".concat(this.cssPrefix,"-attrelement-wide"))},e}(ne),ae=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),le=function(t){function e(e){return t.call(this,e)||this}return ae(e,t),e.prototype.showEditor=function(){var t=this,e=this.getMenu();e&&e.showMenu({anchor:this.labelElement,itemSelectedCallback:function(e){return t.itemSelected(e.id),!1}})},e.prototype.closeEditor=function(){var t=this.getMenu();t&&t.hideMenu()},e}(Kt),ue=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),ce=function(t){function e(e,n,o){var i=t.call(this,o)||this;return i.panel=e,i.menu=n,i}return ue(e,t),Object.defineProperty(e.prototype,"cssPrefix",{get:function(){return"eqjs-qp"},enumerable:!1,configurable:!0}),e.prototype.getLabelText=function(){return r.i18n.getText("CmdClickToAddCondition")},e.prototype.getClassesToAdd=function(){return"".concat(ct.YR,"-addrow ").concat(this.cssPrefix,"-addrow")},e.prototype.isEditable=function(){return t.prototype.isEditable.call(this)&&(this.panel.options.editableParts&vt.Addition)===vt.Addition},e.prototype.renderLabelElement=function(){var t=this,e=this.getLabelText();return this.isEditable()?this.labelElement=(0,ut.domel)("a").attr("href","javascript:void(0)").title(e).text(e).on("click",(function(e){return e.preventDefault(),t.showEditor(),!1})).toDOM():this.labelElement=(0,ut.domel)("div").toDOM(),this.labelElement},e.prototype.renderEditor=function(){},e.prototype.itemSelected=function(t){var e=this.panel.getQuery(),n={parent:e.getRootCondition(),attributeId:t},o=e.addSimpleCondition(n);o&&e.fireConditionsChangedEvent(w.Add,o)},e.prototype.getMenu=function(){return this.menu},e}(le),de=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),he=function(t){function e(e,n,o,i){var r=t.call(this,i)||this;return r.panel=e,r.condition=n,r.displayedText=o,r}return de(e,t),Object.defineProperty(e.prototype,"cssPrefix",{get:function(){return"eqjs-qp"},enumerable:!1,configurable:!0}),e.prototype.renderEditor=function(){var t=this,e=this.panel.getContext().getModel(),n=this.panel.getQuery(),o=[],i=(this.condition&&this.condition.expressions&&this.condition.expressions[0]?this.condition.expressions[0].value:null)?e.getAttributeById(this.condition.expressions[0].value):null;i&&i.operators&&i.operators.forEach((function(i){var s=e.getOperatorById(i),a=function(t){return t.defaultOperand.kind==l.Query}(s);!n.isEx()&&a||!s||t.panel.options.isSubQuery&&a||o.push({id:i,text:r.i18n.getText("Operators",i,"caption")||s.caption})}));var s={items:o,adjustHeight:this.panel.options.adjustEntitiesMenuHeight,id:r.utils.generateId("opmn"),domWriteItemsId:this.panel.options.domWriteItemsId};r.utils.assign(s,this.panel.options.menuOptions),this.menu=new gt(s)},e.prototype.getLabelText=function(){return this.displayedText},e.prototype.getEmptyText=function(){return this.panel.options.emptyTextOperator||r.i18n.getText("MsgEmptyOperator")},e.prototype.getClassesToAdd=function(){return"".concat(this.cssPrefix,"-condelement ").concat(this.cssPrefix,"-operelement")},e.prototype.isEditable=function(){return this.condition.enabled&&!this.condition.isReadOnly()&&(this.panel.options.editableParts&vt.Operator)===vt.Operator},e.prototype.itemSelected=function(t){this.condition.setOperatorId(t),this.condition.fireChangedEvent(I.Operator)},e.prototype.getMenu=function(){return this.menu},e}(le),pe=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),fe=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.dtp=null,e.internalDateFormat="yyyy-MM-dd",e.internalTimeFormat="HH:mm",e}return pe(e,t),e.prototype.renderEditor=function(){},e.prototype.showEditor=function(){var t=this;if(!this.dtp){var e={yearRange:this.panel.options.yearRange,showCalendar:this.expression.dataType!==r.DataType.Time,showTimePicker:this.expression.dataType!==r.DataType.Date,oneClickDateSelection:this.panel.options.oneClickDateSelection,showDateTimeInput:this.panel.options.showDateTimeInput,onApply:function(e){var n=t.convertToInternalFormat(e);t.setValue(n),t.dtp=null,setTimeout((function(){return t.labelElement.focus()}),100)},onCancel:function(){t.labelElement.innerText=t.getLabelText(),t.dtp=null,setTimeout((function(){return t.labelElement.focus()}),100)},onDateTimeChanged:function(e){var n=r.i18n.dateTimeToStr(e,t.expression.dataType);t.labelElement.innerText=n}};this.dtp=this.panel.options.dateTimePickerResolver?this.panel.options.dateTimePickerResolver(e):new ut.DefaultDateTimePicker(e);var n=this.expression.getModel(),o=this.expression.value,i=new Date;i=this.expression.dataType!=r.DataType.Time&&n.isDateMacro(o)?n.getDateMacroValue(o):this.expression.dataType==r.DataType.Time&&n.isTimeMacro(o)?n.getTimeMacroValue(o):this.convertFromInternalFormat(o),this.dtp.setDateTime(i),this.dtp.show(this.element)}},e.prototype.closeEditor=function(){this.dtp.cancel(),this.dtp=null},e.prototype.getLabelText=function(){if(!this.expression.value)return this.getEmptyText();var t=this.expression.value,e=this.expression.getModel();if(!e)throw new Error("DataModel is not defined for "+this.expression.value);if(e.isDateMacro(t)||e.isTimeMacro(t)){var n=t.substring(3,t.length-2),o=r.i18n.getText(n);return o||"${{Today}}"}return r.i18n.dateTimeToStr(this.convertFromInternalFormat(t),this.expression.dataType)},e.prototype.isEditable=function(){return t.prototype.isEditable.call(this)&&(this.panel.options.editableParts&vt.Value)===vt.Value},e.prototype.convertFromInternalFormat=function(t){return r.utils.strToDateTime(t,this.internalDateFormat+" "+this.internalTimeFormat)},e.prototype.convertToInternalFormat=function(t){return r.utils.dateTimeToStr(t,this.internalDateFormat+" "+this.internalTimeFormat)},e}($t),ge=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),ye=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return ge(e,t),e.prototype.renderEditor=function(){this.dialogBlockBody=(0,ut.domel)("div").addClass("kfrm-form").toDOM(),this.createEntitiesMenu(),this.renderColumnBlock(),this.renderQueryPanelBlock()},e.prototype.isEditable=function(){return t.prototype.isEditable.call(this)&&(this.panel.options.editableParts&vt.Value)===vt.Value},e.prototype.setValue=function(t,e){t instanceof R&&(this.expression.subQuery=t,e||this.expression.getParent().fireChangedEvent(I.Value))},e.prototype.createEntitiesMenu=function(){var t=this.getContext().getModel(),e=this.expression.dataType;if(this.colEntitiesList=t.getEntitiesTreeWithFilter((function(t,n){return n?n.useInConditions&&n.dataType===e:t.attributes&&t.useInConditions})),!t||t.isEmpty())return null;var n=this.element.getAttribute("data-id");n&&(n+="-SubColumnMenu");var o={items:this.colEntitiesList,adjustHeight:this.panel.options.adjustEntitiesMenuHeight,id:n,isSubQuery:!0,domWriteItemsId:this.panel.options.domWriteItemsId};r.utils.assign(o,this.panel.options.menuOptions),this.colEntitiesMenu=new gt(o)},e.prototype.renderColumnBlock=function(){var t=this;this.columnBlock=(0,ut.domel)("div",this.dialogBlockBody).addClass("kfrm-field").addChild("label",(function(t){return t.addText(r.i18n.getText("SubQueryColumnTitle"))})).addChild("a",(function(e){return t.columnElement=e.attr("href","javascript:void(0)").on("click",(function(e){t.colEntitiesMenu.showMenu({anchor:t.columnElement,selectedIds:null,itemSelectedCallback:function(e,n){var o=e.id;return t.setResultAttributeId(o),!1}})})).toDOM()})).toDOM()},e.prototype.getEmptyText=function(){return this.panel.options.emptyTextValue||r.i18n.getText("MsgSubQueryValue")},e.prototype.renderQueryPanelBlock=function(){var t=(0,ut.domel)("div",this.dialogBlockBody).addClass("kfrm-field").addChild("label",(function(t){return t.addText(r.i18n.getText("SubQueryQueryPanelCaption"))})).toDOM();this.queryPanelBlock=(0,ut.domel)("div",t).toDOM();var e=this.element.getAttribute("data-id");e&&(this.queryPanelBlock.id=e+"-SubQueryPanel")},e.prototype.setResultAttributeId=function(t){var e=this.getContext().getModel().getAttributeById(t);if(e){var n=this.getSubQuery(),o=n.getColumns(),i=void 0;if(o.length>0)(i=o[0]).expr.setValue(t),i.expr.dataType=e.dataType,i.fireChangedEvent();else{(i=n.createColumn()).sorting=E.None,i.sortIndex=-1;var r=new k(i);r.setValue(t),r.tag=p.EntityAttribute,r.kind=l.Attribute,r.dataType=e.dataType,i.expr=r,o.push(i),n.fireColumnsChangedEvent(w.Add,i)}this.columnElement.innerText=this.getAttributeText(e)}},e.prototype.getSubQuery=function(){return this.queryPanel.getQuery()},e.prototype.getAttributeText=function(t){if(!t)return r.i18n.getText("SubQueryEmptyColumn");var e=r.i18n.getText("Attributes",t.id);e||(e=t.caption);var n=this.panel.options.attrElementFormat;if(!n)return e;var o=n.replace(new RegExp("{attr}","g"),e),i=this.getContext().getModel().getFullEntityPathByAttr(t.id,".");return o.replace(new RegExp("{entity}","g"),i)},e.prototype.showEditor=function(){var t=this,e=this.panel,n=this.getContext();this.queryPanelBlock.innerHTML="";var o=n.createQuery();this.expression.subQuery&&o.loadFromData(this.expression.subQuery.toJSONData());var i=r.utils.assign({},e.options);i.isSubQuery=!0,i.showAddRow=!0,i.menuContainer=document.body,i.menuOptions.isSubQuery=!0,i.entitiesListFilter=function(t,n){if(e.options.entitiesListFilter){var o=n||{};o.isSubQuery=!0,e.options.entitiesListFilter(t,o)}},this.queryPanel=new be(this.queryPanelBlock,o),this.queryPanel.init(this.panel.getContext(),i);var s=null,a=o.getColumns();if(0==a.length){var u=this.expression.getParent();if(u.expressions.length>0){var c=u.expressions[0];s=c.tag==p.EntityAttribute||c.kind==l.Attribute?c.value:null}}else s=a[0].expr.value;s?this.setResultAttributeId(s):this.columnElement.innerText=r.i18n.getText("SubQueryEmptyColumn"),this.queryPanel.refresh();var d=this.queryPanelBlock.querySelector(".eqjs-qp-conditions-root");d&&(d.style.minHeight="100px"),this.panel.getContext().getServices().getDialogService().open({title:r.i18n.getText("SubQueryDialogTitle"),body:this.dialogBlockBody,width:this.panel.options.subQueryDialogWidth,closable:!0,cancelable:!0,onSubmit:function(){var e=t.queryPanel.getQuery();return!!e.tryValidate({checkExpressions:!0})&&(t.setValue(e),!0)}})},e.prototype.closeEditor=function(){},e}($t),me=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),ve=function(t){function e(e,n,o,i){var r=t.call(this,e,n,o,i)||this;return r.expression.tag=p.ParentColumn,r}return me(e,t),e.prototype.fillMenuItemsList=function(t){var e=this.panel.getQuery().getParentQuery(),n=this.expression.getParent().expressions[0].dataType;this.menuItemsList=e.getColumns().filter((function(t){return t.expr.dataType==n})).map((function(t){return{id:t.id,text:t.caption}})),t&&t()},e}(oe),Ce=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),be=function(t){function e(e,n){var o=t.call(this,e)||this;return o.options={editableParts:vt.All,isSubQuery:!1,activeCondition:null,entitiesPopupHandler:null,entitiesListFilter:null,menuContainer:document.body,showRootRow:!0,showAddRow:!0,showCheckboxes:!1,allowParameterization:!1,allowInJoinConditions:!1,showPoweredBy:!1,buttons:{condition:null,group:null},alwaysShowButtonsInGroups:!1,alwaysShowButtonsInConditions:!1,showConjunctions:!0,accentActiveCondition:!0,activateRootOnStart:!0,yearRange:"c-10:c+10",oneClickDateSelection:!0,showDateTimeInput:!1,attrElementFormat:"{entity} {attr}",menuOptions:{showSearchBoxAfter:30,searchBoxAutoFocus:!0,activateOnMouseOver:!0,itemRenderedCallback:null},allowDragDrop:!0,attrPlacement:0,sortEntities:!1,subQueryDialogWidth:600,subQueryDialogHeight:300,dialogZIndex:1e5,numberListSeparators:[",",";"],autoEditNewCondition:!1,onConditionRendered:null,onGetConditionRenderer:null,onGetExpressionRenderer:null,onGetOperatorRenderer:null,onOperatorRendered:null,onGetAddRowRenderer:null,defaultQuery:null,showIndicatorOnLoad:!0},o.customQuery=null,o.landingSlot=(0,ut.domel)("div").addClass("".concat(o.cssPrefix,"-cond-landing-slot")).addChildElement((0,ut.domel)("div").toDOM()).toDOM(),o.slot.classList.contains("".concat(o.cssPrefix,"-panel"))||o.slot.classList.add("".concat(o.cssPrefix,"-panel")),o.group=A.Query,n&&(o.customQuery=n),o}return Ce(e,t),Object.defineProperty(e.prototype,"cssPrefix",{get:function(){return"eqjs-qp"},enumerable:!1,configurable:!0}),e.prototype.getWidgetType=function(){return"queryPanel"},e.prototype.init=function(e,n){var o=this;if(t.prototype.init.call(this,e,n),this.setOptions(n),this.renderProgressBlock(),this.detachQueryObserver(),this.attachQueryObserver(),ut.eqDragManager.removeDropContainer(this.slot),this.options.allowDragDrop){var i=this.getContext().getModel();ut.eqDragManager.registerDropContainer({element:this.slot,scopes:["entityAttr"],onDragEnter:function(t,e){o.slot.classList.add("".concat(ct.YR,"-drophover")),e.dragImage.classList.add("eqjs-sortable-helper"),o.showLandingSlot();var n=e.data.attrId;i.checkAttrProperty(n,"useInConditions")||(e.dropEffect=ut.DropEffect.Forbid)},onDragOver:function(t,e){},onDragLeave:function(t,e){e.dragImage.classList.remove("eqjs-sortable-helper"),e.dragImage.style.removeProperty("width"),o.slot.classList.remove("".concat(ct.YR,"-drophover")),o.hideLangindSlot()},onDrop:function(t,e){var n=o.getQuery(),i={parent:n.getRootCondition(),attributeId:e.data.attrId},r=n.addSimpleCondition(i);r&&n.fireConditionsChangedEvent(w.Add,r)}})}},e.prototype.destroyCore=function(){ut.eqDragManager.removeDropContainer(this.slot),this.detachQueryObserver(),this.slot.innerHTML=""},e.prototype.getEntitiesMenu=function(){return this.entitiesMenu},e.prototype.getConditionMenu=function(){return this.conditionMenu},e.prototype.getLinkTypeMenu=function(){return this.linkTypeMenu},e.prototype.getConditionGroupMenu=function(t){return void 0===t&&(t=!1),t?this.rootGroupMenu:this.groupMenu},e.prototype.attachQueryObserver=function(){var t=this,e=this.getQuery();this.queryEventCallbackId=e.addChangedCallback((function(e){var n=e.data;if(n&&(n.part==x.Conditions||n.part==x.All)){var o=document.activeElement,i=t.slot.contains(o)||o==document.body;switch(n.action){case w.Modify:var r=n.changee,s=function(e,o){var r=t.slot.querySelector("div[data-id=".concat(e.id,"]"));if(r){o=o&&(n.condPart&I.Operator)===I.Operator&&e.expressions.length>1&&(e.expressions[1]._isDefaultValue||""==e.expressions[1].value||null==e.expressions[1].value);var s=r.classList.contains("active"),a=t.getConditionRenderer(e,r);if(a){var l=a.render(o);if(s&&t.toggleConditionPicked(e),i&&!o){var u=l.querySelector("a")||l.querySelector(".eqjs-qp-condition-button");u&&(0,ct.n6)(u)}}}},a=t.options.autoEditNewCondition;Array.isArray(r)?(r.forEach((function(t){return s(t,a)})),a=!1):s(r,a);break;case w.Add:r=n.changee;var l=function(e){var n=t.getConditionRenderer(e);if(n){var o=e.getParent(),r=t.slot.querySelector("div[data-id=".concat(o.id,"]"));if(r){var s=r.lastChild;if(s){var a=n.render(t.options.autoEditNewCondition);s.appendChild(a),a.scrollIntoView(!1),i&&!t.options.autoEditNewCondition&&a.querySelector("a").focus()}}}};Array.isArray(r)?r.forEach((function(t){return l(t)})):l(r);break;case w.Delete:r=n.changee;var u=function(e){var n=t.slot.querySelector("div[data-id=".concat(e.id,"]"));if(n){var o=t.slot.querySelector("div[data-id=".concat(e.getParent().id,"] > .eqjs-qp-row-group")),r=n.nextSibling,s=n.previousSibling;if(n.parentElement.removeChild(n),i){var a=r||s||o,l=a.querySelector("a")||a.querySelector(".eqjs-qp-condition-button");l&&l.focus()}}};Array.isArray(r)?r.forEach((function(t){return u(t)})):u(r);break;default:t.refresh()}}}))},e.prototype.detachQueryObserver=function(){this.queryEventCallbackId&&this.getQuery().removeChangedCallback(this.queryEventCallbackId)},e.prototype.getQuery=function(){return this.customQuery?this.customQuery:this.context.getQuery()},e.prototype.refreshCore=function(){this.clear(),this.render()},e.prototype.setOptions=function(t){r.utils.assignDeep(this.options,t),this.options.dateFormatValue&&r.i18n.updateLocaleSettings({editDateFormat:this.options.dateFormatValue}),this.options.dateFormatDisplay&&r.i18n.updateLocaleSettings({shortDateFormat:this.options.dateFormatDisplay}),void 0===this.options.editableParts&&(this.options.editableParts=vt.All),dt.z.isMobileMode()&&(this.options.buttons=this.options.buttons||{},this.options.buttons.condition=["menu"],this.options.buttons.group=["menu"])},e.prototype.clear=function(){this.slot.innerHTML=""},e.prototype.render=function(){try{this.entitiesMenu=this.createEntitiesMenu(),this.createConditionMenus(),this.createLinkTypeMenu(),this.rootContainer=(0,ut.domel)("div",this.slot).toDOM(),(0,ut.domel)(this.slot).removeClass(ct.XD).addClass(dt.z.getMobileCssClass());var t=this.getQuery().getRootCondition(),e=this.getConditionRenderer(t,this.rootContainer);if(e&&e.render(),this.options.showAddRow){this.addRowElement=(0,ut.domel)("div",this.slot).toDOM();var n=this.getAddRowRenderer(this.addRowElement);n&&n.render()}}catch(t){var o=t;this.context.throwError({action:"QueryPanel rendering",text:o.message,sourceError:o})}},e.prototype.getConditionRenderer=function(t,e){var n;if(this.options.onGetConditionRenderer&&(n=this.options.onGetConditionRenderer(t,e)))return n;switch(t.tag){case M.Simple:return new Ht(this,t,e);case M.Group:return new Yt(this,t,e)}return null},e.prototype.getExpressionRenderer=function(t,e){if(!t)throw"Expression is not defined in the condition";var n,o,i=this.getContext().getModel(),s=t.getParent(),a=i.getOperatorById(s.getOperatorId()),u=i.getAttributeByIdSafe(s.expressions[0].value),c=i.getOperand(u,a,t.getIndex());o=(n=c&&c.editor&&c.editor.tag!==b.Unknown?c.editor:u&&u.defaultEditor?u.defaultEditor:new h).tag;var d=t.dataType;if(d==r.DataType.Unknown&&(d=u.dataType),t.kind===l.Attribute){if(0===t.getIndex())return new se(this,t,this.entitiesMenu,e);var p=this.createEntitiesMenu((function(t,e){return!e||e.useInConditions&&e.dataType===d}));return new se(this,t,p,e)}if(t.kind===l.Query?o=b.SubQuery:t.kind===l.Scalar?o!=b.Unknown||t.dataType!==r.DataType.Date&&t.dataType!==r.DataType.DateTime&&t.dataType!==r.DataType.Time||(o=b.DateTime):t.kind==l.ParentColumn&&(o=b.BindToParentColumn),this.options.onGetExpressionRenderer){var f=this.options.onGetExpressionRenderer(this,t,n,e);if(f)return f}switch(o){case b.List:return new ne(this,t,n,e);case b.SqlList:return new ie(this,t,n,e);case b.CustomList:return new oe(this,t,n,e);case b.DateTime:return new fe(this,t,n,e);case b.SubQuery:return new ye(this,t,n,e);case b.BindToParentColumn:return new ve(this,t,n,e);default:return new te(this,t,n,e)}},e.prototype.getOperatorRenderer=function(t,e,n){var o;return this.options.onGetOperatorRenderer&&(o=this.options.onGetOperatorRenderer(t,e,n)),o||new he(this,t,e,n)},e.prototype.getAddRowRenderer=function(t){var e;return this.options.onGetAddRowRenderer&&(e=this.options.onGetAddRowRenderer(t)),e||new ce(this,this.entitiesMenu,t)},e.prototype.createEntitiesMenu=function(t){var e=this.getContext().getModel();if(!e||e.isEmpty())return null;var n=this.slot.id||"eq-querypanel";n+="-EntitiesMenu";var o={items:e.getEntitiesTree({addUIC:!0,addUIR:!1,addUIS:!1,attrPlacement:this.options.attrPlacement,sortEntities:this.options.sortEntities},t),adjustHeight:this.options.adjustEntitiesMenuHeight,id:n,domWriteItemsId:this.options.domWriteItemsId};return r.utils.assign(o,this.options.menuOptions),new gt(o)},e.prototype.showEntitiesMenu=function(t){this.entitiesMenu.showMenu(t)},e.prototype.createConditionMenus=function(){var t=this.getQuery(),e=this.slot.id||"eq-querypanel";e+="-ConditionMenu";var n=[{id:"enable",text:r.i18n.getText("MenuEnable")},{id:"delete",text:r.i18n.getText("CmdDelete")}];t.isEx()&&((this.options.allowParameterization||this.options.allowInJoinConditions)&&n.push({id:"delimiter",text:"---"}),this.options.allowParameterization&&n.push({id:"param",text:r.i18n.getText("MenuParameterization")}),this.options.allowInJoinConditions&&n.push({id:"inJoin",text:r.i18n.getText("MenuJoinCond")}));var o={items:n,adjustHeight:this.options.adjustEntitiesMenuHeight,id:e,domWriteItemsId:this.options.domWriteItemsId,showSearchBoxAfter:100,showSelected:!0};r.utils.assign(o,this.options.menuOptions),this.conditionMenu=new gt(o);e=this.slot.id||"eq-querypanel";e+="-GroupMenu";o={items:n=[{id:"enable",text:r.i18n.getText("MenuEnable")},{id:"delete",text:r.i18n.getText("CmdDelete")},{id:"delimiter",text:"---"},{id:"addCondition",text:r.i18n.getText("CmdAddCondition")},{id:"addGroup",text:r.i18n.getText("CmdAddCondGroup")}],adjustHeight:this.options.adjustEntitiesMenuHeight,id:e,domWriteItemsId:this.options.domWriteItemsId,showSearchBoxAfter:100,showSelected:!0};r.utils.assign(o,this.options.menuOptions),this.groupMenu=new gt(o);e=this.slot.id||"eq-querypanel";e+="-RootGroupMenu";o={items:n=[{id:"addCondition",text:r.i18n.getText("CmdAddCondition")},{id:"addGroup",text:r.i18n.getText("CmdAddCondGroup")}],adjustHeight:this.options.adjustEntitiesMenuHeight,id:e,domWriteItemsId:this.options.domWriteItemsId,showSearchBoxAfter:100,showSelected:!0};r.utils.assign(o,this.options.menuOptions),this.rootGroupMenu=new gt(o)},e.prototype.createLinkTypeMenu=function(){var t=this.slot.id;t&&(t+="-LinkTypeMenu");var e={items:i.predicateLinkTypeList.map((function(t){return{id:t.id,text:r.i18n.getText(t.key)}})),adjustHeight:this.options.adjustEntitiesMenuHeight,id:t,domWriteItemsId:this.options.domWriteItemsId};r.utils.assign(e,this.options.menuOptions),this.linkTypeMenu=new gt(e)},e.prototype.toggleConditionPicked=function(t,e){var n,o;void 0===e&&(e=void 0),t&&(n=this.slot.querySelector("div[data-id=".concat(t.id,"][data-condrow], div[data-id=").concat(t.id,"] > div[data-group-row]")))&&(o=n.classList.contains("active"));for(var i=this.slot.querySelectorAll(".".concat(this.cssPrefix,"-row")),r=0;r<i.length;r++){var s=i[r];s.hasAttribute("data-group-row")?this.options.alwaysShowButtonsInGroups||(0,ut.domel)(s).data("show-buttons",null):this.options.alwaysShowButtonsInConditions||(0,ut.domel)(s).data("show-buttons",null),(0,ut.domel)(s).removeClass("active")}n&&!o&&(0,ut.domel)(n).addClass("active").data("show-buttons","")},e.prototype.showLandingSlot=function(){var t=this.slot.querySelector(".eqjs-qp-conditions-root");t&&(t.appendChild(this.landingSlot),this.landingSlot.scrollIntoView({block:"center",behavior:"smooth"}))},e.prototype.hideLangindSlot=function(){this.landingSlot.parentElement&&this.landingSlot.parentElement.removeChild(this.landingSlot)},e.prototype.onProcessStartCore=function(){this.options.showIndicatorOnLoad&&(this.progressBlock.parentNode||this.slot.appendChild(this.progressBlock))},e.prototype.onProcessEndCore=function(){this.options.showIndicatorOnLoad&&this.progressBlock.parentNode&&this.slot.removeChild(this.progressBlock)},e.prototype.renderProgressBlock=function(){this.progressBlock=document.createElement("div"),this.progressBlock.classList.add("".concat(ct.YR,"-progress-win8")),this.progressBlock.classList.add(dt.z.getMobileCssClass()),this.progressBlock.innerHTML='<div class="wBall" id="wBall_1"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_2"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_3"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_4"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_5"><div class="wInnerBall"></div></div>'},e}(st),xe=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),we=function(t){function e(e){var n=t.call(this,e)||this;return n.options={applyOnClose:!0,showApplyButton:!0,showClearButton:!0,queryPanel:{showAddRow:!0,showCheckboxes:!0,alwaysShowButtonsInGroups:!0}},n.headerClickListener=n.headerClickHandler.bind(n),n.group=A.Query,n}return xe(e,t),e.prototype.getWidgetType=function(){return"filterBar"},Object.defineProperty(e.prototype,"cssPrefix",{get:function(){return"eqjs-fb"},enumerable:!1,configurable:!0}),e.prototype.init=function(e,n){t.prototype.init.call(this,e,n),this.setOptions(n),this.destroyCore(),this.qpElement=(0,ut.domel)("div").addClass("".concat(this.cssPrefix,"-querypanel")).toDOM(),this.queryPanel=new be(this.qpElement),this.queryPanel.init(e,this.options.queryPanel||{}),this.attachQueryObserver()},e.prototype.setOptions=function(t){this.options=r.utils.assignDeep(this.options,t)},e.prototype.applyBtnClick=function(t){this.applyFilter()},e.prototype.clearBtnClick=function(t){this.clearFilter()},e.prototype.showQueryPanel=function(t){var e=this;(0,ut.slideDown)(this.qpBlock,200,(function(){e.updateHeader(),t&&t()}))},e.prototype.hideQueryPanel=function(){var t=this;(0,ut.slideUp)(this.qpBlock,200,(function(){t.updateHeader(),t.options.applyOnClose&&t.applyFilter()}))},e.prototype.headerClickHandler=function(t){t.preventDefault(),(0,ut.domel)(this.qpBlock).isVisible()?this.hideQueryPanel():this.showQueryPanel()},e.prototype.updateHeader=function(){if(this.headerTextElement){var t="",e=this.getContext().getQuery();e&&(t=e.getConditionsText()),""==t&&(t=r.i18n.getText("StrNoFilterDefined")),(0,ut.domel)(this.headerTextElement).text(t).attr("title",t),!e||e.isEmptyConditions()?((0,ut.domel)(this.headerTextElement).hide(),(0,ut.domel)(this.headerLinkElement).show(),(0,ut.domel)(this.qpBlock).isVisible()||((0,ut.domel)(this.headerArrowBlock).hide(),this.headerElement.style.cursor="",this.headerElement.removeEventListener("click",this.headerClickListener))):(this.headerElement.style.cursor="pointer",this.headerElement.removeEventListener("click",this.headerClickListener),this.headerElement.addEventListener("click",this.headerClickListener),(0,ut.domel)(this.headerTextElement).show(),(0,ut.domel)(this.headerLinkElement).hide(),(0,ut.domel)(this.headerArrowBlock).show()),(0,ut.domel)(this.qpBlock).isVisible()?this.headerArrowElement.classList.add("".concat(this.cssPrefix,"-header-arrowUp")):this.headerArrowElement.classList.remove("".concat(this.cssPrefix,"-header-arrowUp")),this.textResize()}},e.prototype.render=function(){var t=this;(0,ut.domel)(this.slot).addClass("".concat(this.cssPrefix,"-container")).addClass(dt.z.getMobileCssClass()).addChild("div",(function(e){return t.headerElement=e.addClass("".concat(t.cssPrefix,"-header")).addChild("div",(function(e){return t.headerIconElement=e.addClass("".concat(t.cssPrefix,"-header-icon")).toDOM()})).addChild("div",(function(e){return t.headerTextBlock=e.addClass("".concat(t.cssPrefix,"-header-textblock")).addChild("div",(function(e){return t.headerTextElement=e.addClass("".concat(t.cssPrefix,"-header-text")).toDOM()})).addChild("div",(function(e){return t.headerLinkElement=e.addClass("".concat(t.cssPrefix,"-header-text ").concat(t.cssPrefix,"-header-link")).text(r.i18n.getText("StrNoFilterClickToAdd")).hide().on("click",(function(){t.queryPanel.showEntitiesMenu({anchor:t.headerLinkElement,selectedIds:null,itemSelectedCallback:function(e,n){var o=e.id;t.showQueryPanel((function(){var e=t.getContext().getQuery(),n={parent:e.getRootCondition(),attributeId:o},i=e.addSimpleCondition(n);i&&e.fireConditionsChangedEvent(w.Add,i)}))}})})).toDOM()})).toDOM()})).addChild("div",(function(e){return t.headerArrowBlock=e.addClass("".concat(t.cssPrefix,"-header-arrowblock")).addChild("div",(function(e){return t.headerArrowElement=e.addClass("".concat(t.cssPrefix,"-header-arrow")).toDOM()})).toDOM()})).toDOM()})).addChild("div",(function(e){return t.qpBlock=e.addClass("".concat(t.cssPrefix,"-querypanelblock")).addClass(dt.z.getMobileCssClass()).hide().addChildElement(t.qpElement).toDOM()})),(this.options.showApplyButton||this.options.showClearButton)&&(this.buttonsBlock=(0,ut.domel)("div",this.qpBlock).addClass("".concat(this.cssPrefix,"-buttonsblock")).addClass(dt.z.getMobileCssClass()).toDOM()),this.options.showApplyButton&&(0,ut.domel)("a",this.buttonsBlock).attr("href","javascript:void(0)").addClass("".concat(this.cssPrefix,"-button ").concat(this.cssPrefix,"-button-apply")).text(r.i18n.getText("ButtonApply")).on("click",this.applyBtnClick.bind(this)),this.options.showClearButton&&(0,ut.domel)("a",this.buttonsBlock).attr("href","javascript:void(0)").addClass("".concat(this.cssPrefix,"-button ").concat(this.cssPrefix,"-button-clear")).text(r.i18n.getText("CmdClear")).on("click",this.clearBtnClick.bind(this)),window.addEventListener("resize",(function(){t.textResize()})),this.updateHeader(),this.queryPanel.refresh(),setTimeout((function(){return t.textResize()}),500)},e.prototype.refreshCore=function(){this.clear(),this.render()},e.prototype.clear=function(){this.slot.innerHTML=""},e.prototype.applyFilter=function(){this.options.applyFilterCallback&&this.options.applyFilterCallback()},e.prototype.clearFilter=function(){var t=this.getContext().getQuery();t&&(t.clearConditions(),t.fireConditionsChangedEvent(w.All))},e.prototype.textResize=function(){this.headerTextBlock.style.width=this.slot.clientWidth-this.headerIconElement.offsetWidth-((0,ut.domel)(this.headerArrowBlock).isVisible()?this.headerArrowBlock.offsetWidth:0)+"px"},e.prototype.destroyCore=function(){this.queryPanel&&this.queryPanel.destroy(),this.detachQueryObserver(),this.slot.innerHTML=""},e.prototype.attachQueryObserver=function(){var t=this,e=this.getContext().getQuery();this.queryEventCallbackId=e.addChangedCallback((function(e){t.updateHeader()}))},e.prototype.detachQueryObserver=function(){var t=this.getContext().getQuery();t&&t.removeChangedCallback(this.queryEventCallbackId)},e}(st),Ee=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Te=function(t){function e(e){var n=t.call(this,e)||this;return n.contentElement=e,n.group=A.Result,n}return Ee(e,t),e.prototype.getWidgetType=function(){return"htmlContent"},e.prototype.init=function(e,n){t.prototype.init.call(this,e,n)},e.prototype.refreshCore=function(){this.clear(),this.context.resultContent&&this.render()},e.prototype.render=function(){this.context.resultContent&&(this.contentElement.innerHTML+=this.context.resultContent)},e.prototype.clear=function(){this.contentElement.innerHTML=""},e.prototype.destroyCore=function(){this.clear()},e}(st),De=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Se=function(t){function e(e){var n=t.call(this,e)||this;return n.options={maxButtonCount:10,useBootstrap:!1},n}return De(e,t),e.prototype.getWidgetType=function(){return"eqHtmlGrid"},e.prototype.init=function(e,n){t.prototype.init.call(this,e,n),this.setOptions(n)},e.prototype.setOptions=function(t){r.utils.assignDeep(this.options,t)},e.prototype.refreshCore=function(){t.prototype.refreshCore.call(this),this.renderPageNavigator()},e.prototype.destroyCore=function(){this.slot.innerHTML=""},e.prototype.renderPageNavigator=function(){var t=this,e=document.getElementById("PageNavigator");if(e){var n=parseInt(e.getAttribute("data-pagecount")),o=parseInt(e.getAttribute("data-pageindex"));if(n>1){var i=function(e){var n=e.target;if(n.hasAttribute("data-page")){var o=parseInt(n.getAttribute("data-page"));t.context.fetchDataChunk({chunk:{page:o},success:function(){t.context.refreshWidgets(A.Result)}})}},r=this.options.maxButtonCount||10,s=o-1,a=s-s%r+1,l=a+r-1;l>n&&(l=n);var u=document.createElement("ul");this.options.useBootstrap?u.className="pagination":u.className="eqv-pagination",this.options.pageItemCssClass&&(u.className+=" "+this.options.pageItemCssClass);var c=document.createElement("li");this.options.useBootstrap&&(c.className="page-item");var d=document.createElement("span");if(d.setAttribute("aria-hidden","true"),this.options.useBootstrap&&(d.className="page-link"),1==a)c.className+=" disabled";else{if(this.options.useBootstrap)(d=document.createElement("a")).setAttribute("href","javascript:void(0)"),d.setAttribute("data-page","".concat(a-1)),d.className="page-link";else(p=document.createElement("a")).setAttribute("href","javascript:void(0)"),p.setAttribute("data-page","".concat(a-1)),d=p;d.addEventListener("click",i)}d.innerHTML="&laquo;",c.appendChild(d),u.appendChild(c);for(var h=a;h<=l;h++)c=document.createElement("li"),this.options.useBootstrap&&(c.className="page-item"),h==o&&(c.className+=" active"),(d=document.createElement("a")).setAttribute("href","javascript:void(0)"),d.innerHTML=h.toString(),d.setAttribute("data-page",h.toString()),d.className="page-link",d.addEventListener("click",i),c.appendChild(d),u.appendChild(c);if(c=document.createElement("li"),this.options.useBootstrap&&(c.className="page-item"),(d=document.createElement("span")).setAttribute("aria-hidden","true"),this.options.useBootstrap&&(d.className="page-link"),l==n)c.className+="disabled";else{var p;if(this.options.useBootstrap)(d=document.createElement("a")).setAttribute("href","javascript:void(0)"),d.setAttribute("data-page","".concat(l+1)),d.className+=" page-link";else(p=document.createElement("a")).setAttribute("href","javascript:void(0)"),p.setAttribute("data-page","".concat(l+1)),d=p;d.addEventListener("click",i)}d.innerHTML="&raquo;",c.appendChild(d),u.appendChild(c),e.appendChild(u)}}},e}(Te),ke=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Me=function(t){function e(e){var n=t.call(this,e)||this;return n.options={useCustomLocaleSettings:!1},n.slot=e,n.group=A.Result,n}return ke(e,t),e.prototype.getWidgetType=function(){return"grid"},e.prototype.init=function(e,n){t.prototype.init.call(this,e,n),n&&r.utils.assignDeep(this.options,n)},e.prototype.refreshCore=function(){this.clear(),this.context.resultTable&&this.render()},e.prototype.render=function(){this.options.beforeTableRendering&&this.options.beforeTableRendering(this.context.resultTable),this.applyDisplayFormats()},e.prototype.applyDisplayFormats=function(){},e.prototype.clear=function(){this.slot.innerHTML=""},e}(st),Ie=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Be=function(){return Be=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Be.apply(this,arguments)},Ae=function(t){function e(e){var n=t.call(this,e)||this;return n.hasCustomTotalsSettings=!1,n.options={autoRefresh:!0},n.group=A.Result,n}return Ie(e,t),e.prototype.getWidgetType=function(){return"easyGrid"},e.prototype.init=function(e,n){var o=this;t.prototype.init.call(this,e,n);var i=Be(Be({},n),{slot:this.slot,dataTable:e.resultTable});this.options=r.utils.assign(this.options,n),i.onPlusButtonClick=function(t){return o.addColumnClickHandler(t)},i.onColumnMoved=function(t){return o.columnMovedHandler(t)},i.aggregates?this.hasCustomTotalsSettings=!0:i.aggregates={settings:e.getQuery().getAggregationSettings(),calculator:null},i.aggregates.calculator=this.context.getServices().getAggregatesCalculator(),this.destroy(),this.grid=new ut.EasyGrid(i),this.options.autoRefresh&&this.attachQueryObserver()},e.prototype.refreshCore=function(){this.clear(),this.updateTotalsSettings(),this.render()},e.prototype.render=function(){this.createEntitiesMenu(),this.grid.refresh()},e.prototype.attachQueryObserver=function(){},e.prototype.destroyCore=function(){this.detachQueryObserver(),this.grid&&this.grid.destroy(),this.slot.innerHTML=""},e.prototype.detachQueryObserver=function(){this.queryEventCallbackId&&this.getContext().getQuery().removeChangedCallback(this.queryEventCallbackId)},e.prototype.updateTotalsSettings=function(){var t=this.getContext();if(!this.hasCustomTotalsSettings){var e=t.getQuery().getAggregationSettings();this.grid.options.aggregates.settings=e}},e.prototype.createEntitiesMenu=function(){var t=this.getContext().getModel();if(t&&!t.isEmpty()){var e=this.slot.id;e&&(e+="-EntitiesMenu");var n={items:t.getEntitiesTree({addUIC:!1,addUIR:!0,addUIS:!1}),id:e};r.utils.assign(n,this.options.menuOptions),this.entitiesMenu=new gt(n)}},e.prototype.getModel=function(){return this.context.getModel()},e.prototype.getQuery=function(){return this.context.getQuery()},e.prototype.clear=function(){this.grid&&this.grid.clear()},e.prototype.addColumnClickHandler=function(t){var e=this;this.entitiesMenu.showMenu({anchor:t.sourceEvent.target,selectedIds:null,itemSelectedCallback:function(t,n){var o=t.id;return e.addNewColumn(o),!1}})},e.prototype.columnMovedHandler=function(t){var e=this.getQuery(),n=r.utils.findItemIndexById(e.getColumns(),t.columnId);n>=0&&(e.moveColumn(n,t.newIndex),e.fireChangedEvent({part:x.Columns,action:w.All,source:this}))},e.prototype.addNewColumn=function(t){var e=this,n=this.getContext().getModel(),o=this.getContext().getQuery();if(this.getContext().getQuery())return this.addColumn(function(t){var i=n.getAttributeById(t);if(!i)return null;if(!i.useInSorting){if(!i.lookupAttr)return null;if(t=i.lookupAttr,!(i=n.getAttributeById(t))||!i.useInSorting)return null}var r=o.createColumn();return r.caption=e.getDefaultColumnCaption(i),r.sorting=E.None,r.sortIndex=-1,r.expr.tag=p.EntityAttribute,r.expr.setValue(t,!0),r.params.concat(i.params),r}(t))},e.prototype.getDefaultColumnCaption=function(t){var e=this.options.titleElementFormat||this.options.attrElementFormat;return this.getContext().getModel().getAttributeText(t,e)},e.prototype.addColumn=function(t){var e=this.getContext().getQuery();if(e&&(t=this.checkColumn(t)))return t=e.addColumn({caption:t.caption,attributeId:t.expr.value,sorting:t.sorting,sortIndex:t.sortIndex}),e.fireChangedEvent({part:x.Columns,action:w.Add,changee:t,source:this}),t},e.prototype.checkColumn=function(t){for(var e=this.getContext().getQuery().getColumns(),n=JSON.stringify(t.expr.saveToData()),o=0;o<e.length;o++){if(JSON.stringify(e[o].expr.saveToData())===n)return null}return t},e}(Me),_e=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Pe=function(t){function e(e){var n=t.call(this,e)||this;return n.panel=e,n.group=A.Statement,"TEXTAREA"!==n.panel.tagName&&(n.panel.innerHTML='<div class="eqv-sql-panel-result"></div>',n.panel=n.panel.querySelector("div")),n}return _e(e,t),e.prototype.getWidgetType=function(){return"statementPanel"},e.prototype.refreshCore=function(){this.clear(),this.render()},e.prototype.render=function(){this.panel.textContent=this.context.resultStatement?this.context.resultStatement:"";var t=this.panel.innerHTML.replace(/\r\n/g,"<br />").replace(/ /g,"&nbsp;&nbsp;");this.panel.innerHTML=t},e.prototype.destroyCore=function(){this.clear()},e.prototype.clear=function(){this.panel.innerHTML=""},e}(st),Oe=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Le=function(t){function e(e){var n=t.call(this,e)||this;return n.element=e,n.element.style.display="none",n.group=A.All,n}return Oe(e,t),e.prototype.getWidgetType=function(){return"processIndicator"},e.prototype.onProcessStartCore=function(){this.element.style.display=""},e.prototype.onProcessEndCore=function(){this.element.style.display="none"},e}(st),Re=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Fe=function(t){function e(e){var n=t.call(this,e)||this;return n.clickHandler=function(){return n.openDialog()},n.columnsBar=null,n.queryPanel=null,n.ddQuery=null,n.cssPrefix=ct.YR,n.group=A.None,n}return Re(e,t),e.prototype.getWidgetType=function(){return"manageDrillDown"},e.prototype.init=function(e,n){t.prototype.init.call(this,e,n),this.options=n,this.refresh(),this.slot.addEventListener("click",this.clickHandler)},e.prototype.destroyCore=function(){this.slot.removeEventListener("click",this.clickHandler)},e.prototype.openDialog=function(){var t=this,e=this.context.getServices().getDialogService(),n=this.context.getQuery(),o=this.context.getModel(),i=(0,ut.domel)("div").addClass("".concat(this.cssPrefix,"-manage-drilldown")).addChildElement(this.renderColumnsBarBlock()).addChildElement(this.renderQueryPanelBlock()).toDOM(),s=o.addOrUpdateOperator({id:"BindToParentColumn",caption:"is bound to",format:"{expr1} [[is bound to]] {expr2}",paramCount:2,kind:l.ParentColumn,appliedTypes:[r.DataType.String,r.DataType.Bool,r.DataType.Float,r.DataType.Int32,r.DataType.Int64,r.DataType.Word]});s.defaultOperand.dataType=r.DataType.String,s.defaultOperand.kind=l.ParentColumn,o.runThroughEntities((function(t){var e=t.operators.indexOf(s.id);e>0&&r.utils.moveArrayItem(t.operators,e,0)}),null),this.ddQuery=new R(o,null,{parent:n,context:this.context});var a=this.context.getQuery().getDrillDowns();if(a.length){var u=a[0];this.ddQuery.loadFromData(u.toJSONData())}e.open({title:"Manage Drill Down",body:i,cancelable:!0,closable:!1,beforeOpen:function(){var e=i.getElementsByClassName("".concat(t.cssPrefix,"-columnsbar-slot"))[0];t.columnsBar=new Ot(e,t.ddQuery),t.columnsBar.init(t.context,t.options.columnsBar);var n=i.getElementsByClassName("".concat(t.cssPrefix,"-querypanel-slot"))[0];t.queryPanel=new be(n,t.ddQuery),t.queryPanel.init(t.context,t.options.queryPanel),t.columnsBar.refresh(),t.queryPanel.refresh()},onSubmit:function(){return t.submitDialog()},onDestroy:function(){t.destroyDialog()}})},e.prototype.renderQueryPanelBlock=function(){var t=this;return(0,ut.domel)("div").addClass("".concat(this.cssPrefix,"-querypanel-block")).addChild("div",(function(e){return e.addClass("".concat(t.cssPrefix,"-querypanel-caption"))})).addChild("div",(function(e){return e.addClass("".concat(t.cssPrefix,"-querypanel-slot"))})).toDOM()},e.prototype.renderColumnsBarBlock=function(){var t=this;return(0,ut.domel)("div").addClass("".concat(this.cssPrefix,"-columnsbar-block")).addChild("div",(function(e){return e.addClass("".concat(t.cssPrefix,"-columnsbar-caption"))})).addChild("div",(function(e){return e.addClass("".concat(t.cssPrefix,"-columnsbar-slot"))})).toDOM()},e.prototype.submitDialog=function(){if(this.ddQuery.tryValidate({checkExpressions:!0})){var t=this.context.getQuery().getDrillDowns();if(t.length)t[0].loadFromData(this.ddQuery.toJSONData()),this.context.getQuery().fireChangedEvent();else if(!this.ddQuery.isEmpty())this.context.getQuery().addDrillDown().loadFromData(this.ddQuery.toJSONData()),this.context.getQuery().fireChangedEvent();return!0}return!1},e.prototype.destroyDialog=function(){this.context.getModel().removeOperator("BindToParentColumn",!0),this.ddQuery=null,this.columnsBar&&this.columnsBar.destroy(),this.columnsBar=null,this.queryPanel&&this.queryPanel.destroy(),this.queryPanel=null},e}(st);!function(t){t.DataGrid="DATA_GRID",t.Chart="CHART",t.PivotTable="PIVOT_TABLE"}(Vt||(Vt={}));var qe,Qe=__webpack_require__(702),Ne=function(){function t(t){this.context=t,this.promise=null}return t.prototype.show=function(t){var e=this;if(void 0===t&&(t=null),!this.promise){var n=this.context.getExportFormats();if(0==n.length)throw Error("No exporter has been registered.");t=t||n[0],this.promise=new Qe((function(n,o){var i=e.context.getServices().getDialogService(),s=(0,ut.domel)("div").addClass("kdlg-form-section").addChild("div",(function(n){return n.addClass("kfrm-form").addChild("div",(function(n){return n.addClass("kfrm-fields col-a-1 label-align-right").addChild("label",(function(t){return t.addClass("kdlg-form-label","kflex-20").attr("for","export_format").addText(r.i18n.getText("ExportDlgFmtLabel"))})).addChild("div",(function(n){return n.addClass("kfrm-select").addChild("select",(function(n){n.attr("name","export_format").id("exportFormat");for(var o=0,i=e.context.getExportFormats();o<i.length;o++){var s=i[o];n.addOption({value:s,title:r.i18n.getText(s)||s,selected:t==s})}}))}))}))})).toDOM();i.open({title:r.i18n.getText("ExportDlgTitle"),body:s,onSubmit:function(){var t=s.querySelector("#exportFormat").value;return e.context.exportResult({format:t,success:n,error:o}),!0}})}))}return this.promise.finally((function(){return e.promise=null}))},t}(),je=__webpack_require__(702),He=function(t,e,n,o){return new(n||(n=je))((function(i,r){function s(t){try{l(o.next(t))}catch(t){r(t)}}function a(t){try{l(o.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((o=o.apply(t,e||[])).next())}))},We=function(t,e){var n,o,i,r,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;r&&(r=0,a[0]&&(s=0)),s;)try{if(n=1,o&&(i=2&a[0]?o.return:a[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,a[1])).done)return i;switch(o=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,o=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],o=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}},Ge=function(){function t(t,e){var n=this;this.container=t,this.title=r.i18n.getText("Facets","DefaultFacetTitle"),this.cssPrefix="eqjs-facet",this.dialogTitle=r.i18n.getText("Facets","DefaultDlgTitle"),this.options={},this.canDisplayFlag=!0,this.downloadAllClickHandler=function(){var t=n.getContext().resultTable;if(t.elasticChunks){var e=n.getDialogService().openProgress({title:r.i18n.getText("Facets","LoadDataDlgTitle"),onSubmit:function(){return n.refresh()},determinated:!1});n.loadElasticChunk().then((function(t){e.submit()})).catch((function(t){e.submit(),n.getContext().throwError(t)}))}else{var o=t.getCachedRows().length,i=t.getTotal()-t.getCachedCount(),s=n.getDialogService().openProgress({title:r.i18n.getText("Facets","LoadDataDlgTitle"),content:r.i18n.getText("Facets","LoadDataDlgContent").replace("{loadedRecs}","0").replace("{totalRecs}","".concat(i)),onSubmit:function(){return n.refresh()},determinated:!0}),a=0;setTimeout((function(){t.getRows({offset:o,limit:i}).then((function(t){var e=(a+=t.length)/i;s.updateContent(r.i18n.getText("Facets","LoadDataDlgContent").replace("{loadedRecs}","".concat(a)).replace("{totalRecs}","".concat(i))),s.updateProgress(e)})).catch((function(t){s.submit(),n.getContext().throwError(t)}))}),10)}},r.utils.assignDeep(this.options,e)}return t.prototype.init=function(t){this.slot=t,this.contentDiv=(0,ut.domel)("div",this.slot).addClass("".concat(this.cssPrefix,"-content")).toDOM(),this.displayMessageDiv=(0,ut.domel)("div",this.slot).hide().toDOM()},t.prototype.showSettingsDialog=function(){var t=this;return new je((function(e){var n=t.getDialogService(),o=t.renderDialogContent(),i=n.open({title:t.dialogTitle,body:o,cancelable:!0,closable:!1,onSubmit:function(){var n=t.submitSettingsDialog();return n&&e(!0),n},onCancel:function(){e(!1)}});t.afterDialogOpened(i)}))},t.prototype.afterDialogOpened=function(t){},t.prototype.renderDialogContent=function(){var t,e=(0,ut.domel)("div").addClass("kfrm-form").addChild("div",(function(e){return t=e.addClass("".concat(dt.z.isIE()?"kfrm-fields-ie col-ie-1-4 label-align-right":"kfrm-fields col-a-1 label-align-right")).toDOM()}));return this.renderFormFields(e.toDOM(),t),e.toDOM()},t.prototype.renderFormFields=function(t,e){var n=this,o=e;dt.z.isIE()&&(o=(0,ut.domel)("div",e).addClass("kfrm-field-ie").toDOM()),(0,ut.domel)(o).addChild("label",(function(t){return t.attr("for","tab_name").addText(r.i18n.getText("Facets","TabNameLabel"))})).addChild("input",(function(t){return t.id("facetTabName").name("tab_name").type("text").attr("value",n.title)}))},t.prototype.submitSettingsDialog=function(){var t=document.querySelector("#facetTabName");return 0!=t.value.length&&(this.title=t.value,!0)},t.prototype.getDialogService=function(){return this.getContext().getServices().getDialogService()},t.prototype.canDisplay=function(){var t=this.getContext().resultTable;return t.getCachedCount()==t.getTotal()},t.prototype.showErrorMessage=function(t){this.displayMessageDiv.innerHTML=t,this.displayMessageDiv.classList.add("".concat(this.cssPrefix,"-error-message")),(0,ut.domel)(this.displayMessageDiv).show()},t.prototype.showUnableDisplayMessage=function(t){var e=this.getContext().resultTable;this.displayMessageDiv.innerHTML=t||r.i18n.getText("Facets","ErrNotEnoughData").replace("{totalRecs}","".concat(e.getTotal())).replace("{cachedRecs}","".concat(e.getCachedCount())).replace(/\[(.*)\]/g,"<a href='javascript:void(0)' class=\"".concat(this.cssPrefix,'-download-all-link">$1</a>'));var n=this.displayMessageDiv.querySelector("a.".concat(this.cssPrefix,"-download-all-link"));n&&n.addEventListener("click",this.downloadAllClickHandler),(0,ut.domel)(this.contentDiv).hide(),(0,ut.domel)(this.displayMessageDiv).show()},t.prototype.hideUnableDisplayMessage=function(){(0,ut.domel)(this.displayMessageDiv).hide(),(0,ut.domel)(this.contentDiv).show()},t.prototype.getContext=function(){return this.container.getContext()},t.prototype.getQuery=function(){return this.getContext().getQuery()},t.prototype.saveToData=function(){return{title:this.title,type:this.getType()}},t.prototype.loadFromData=function(t){t&&(this.title=t.title)},t.prototype.refresh=function(){this.hideUnableDisplayMessage(),this.canDisplay()?this.refreshCore():this.showUnableDisplayMessage()},t.prototype.loadElasticChunk=function(){return He(this,void 0,void 0,(function(){var t,e,n=this;return We(this,(function(o){return t=this.getContext().resultTable,e=t.getCachedRows().length,[2,t.getRows({offset:e,limit:t.chunkSize}).then((function(e){return t.totalIsKnown()?je.resolve():n.loadElasticChunk()}))]}))}))},t.prototype.onResize=function(){},t}();!function(t){t[t.Column=3]="Column",t[t.Histogram=4]="Histogram",t[t.Bar=5]="Bar",t[t.Combo=6]="Combo",t[t.Area=7]="Area",t[t.Line=9]="Line",t[t.Pie=10]="Pie",t[t.Polar=11]="Polar",t[t.Doughnut=12]="Doughnut",t[t.Radar=13]="Radar",t[t.SteppedLine=14]="SteppedLine"}(qe||(qe={}));var ze,Ve,Ue=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Ye=function(t){function e(e){var n=t.call(this,e)||this;return n.chartType=qe.Pie,n.supportedChartTypes=[],n.dataTable=null,n.potentialLabelColumns=[],n.potentialDataColumns=[],n.labelColumn=-1,n.dataColumns=[],n.options={chartType:qe.Pie,showOnPaging:!1,hideSettings:!1,legend:{show:!1,position:"right"}},n.element=e,n.group=A.Result,n}return Ue(e,t),Object.defineProperty(e.prototype,"cssPrefix",{get:function(){return"eqjs-chart"},enumerable:!1,configurable:!0}),e.prototype.init=function(e,n){t.prototype.init.call(this,e,n),this.dataTable=e.resultTable,this.setOptions(n)},e.prototype.hasData=function(){var t=null!=this.dataTable;return t&&(t=this.dataTable.getCachedCount()>0),t},e.prototype.hasColumnsForChart=function(){return this.potentialLabelColumns.length>0&&this.potentialDataColumns.length>0},e.prototype.refreshCore=function(){this.prepareChartData(),this.render()},e.prototype.setOptions=function(t){if(r.utils.assignDeep(this.options,t),this.supportedChartTypes=this.getSupportedChartTypes(),0==this.supportedChartTypes.length)throw Error("Chart widget should support at least one chart type");t.chartType&&this.supportedChartTypes.indexOf(t.chartType)>=0?this.chartType=t.chartType:this.chartType=this.supportedChartTypes[0]},e.prototype.getOptions=function(){return this.options},e.prototype.getChartTypeName=function(t){switch(t){case qe.Area:return r.i18n.getText("ChartType","Area");case qe.Bar:return r.i18n.getText("ChartType","Bar");case qe.Column:return r.i18n.getText("ChartType","Column");case qe.Combo:return r.i18n.getText("ChartType","Combo");case qe.Doughnut:return r.i18n.getText("ChartType","Doughnut");case qe.Polar:return r.i18n.getText("ChartType","Polar");case qe.Radar:return r.i18n.getText("ChartType","Radar");case qe.Histogram:return r.i18n.getText("ChartType","Histogram");case qe.Line:return r.i18n.getText("ChartType","Line");case qe.SteppedLine:return r.i18n.getText("ChartType","SteppedLine");default:return r.i18n.getText("ChartType","Pie")}},e.prototype.updateSettings=function(t,e){void 0===e&&(e=!0),void 0!==t.showLegend&&(this.options.legend=this.options.legend||{},this.options.legend.show=t.showLegend),this.chartType=t.type,this.labelColumn=t.labelColumn,this.dataColumns[0]=t.dataColumn,e&&this.updateChartColumns()},e.prototype.prepareChartData=function(){var t=this;if(this.dataTable){this.potentialLabelColumns=[],this.potentialDataColumns=[];for(var e=this.dataTable.columns.count,n=0;n<e;n++){var o=this.dataTable.columns.get(n),i=o.type,s=o.label;this.potentialLabelColumns.push({idx:n,label:s}),r.utils.isNumericType(i)&&this.potentialDataColumns.push({idx:n,label:s})}if(-1!=this.labelColumn?this.potentialLabelColumns.filter((function(e){return e.idx==t.labelColumn})).length||(this.labelColumn=-1):this.labelColumn=this.potentialLabelColumns.length>0?this.potentialLabelColumns[0].idx:-1,this.dataColumns.length){var a=this.potentialDataColumns.map((function(t){return t.idx}));this.dataColumns=this.dataColumns.filter((function(t){return a.indexOf(t)>=0})),this.dataColumns.length||(this.dataColumns=this.potentialDataColumns.length>0?[].concat(this.potentialDataColumns[0].idx):[])}else this.dataColumns=this.potentialDataColumns.length>0?[].concat(this.potentialDataColumns[0].idx):[];this.initChart()}},e.prototype.getSupportedChartTypes=function(){var t=this;return(this.options.supportedChartTypes?this.options.supportedChartTypes:Object.keys(qe).map((function(t){return qe[t]}))).filter((function(e){return t.hasChartTypes.indexOf(e)>=0}))},e.prototype.getCurrentChartType=function(){return this.chartType},e.prototype.render=function(){var t=this;if(this.clear(),this.hasData()&&this.hasColumnsForChart()&&this.context.resultTable.getTotal()==this.context.resultTable.getCachedCount()){var e=document.createElement("div");(0,ut.addCssClass)(e,"".concat(this.cssPrefix,"-header"));var n=document.createElement("div");if((0,ut.addCssClass)(n,"".concat(this.cssPrefix,"-main")),this.canDraw()){for(var o=document.createElement("select"),i=0,r=this.supportedChartTypes;i<r.length;i++){var s=r[i],a=document.createElement("option");a.value=s.toString(),a.text=this.getChartTypeName(s),o.appendChild(a)}o.value=this.chartType.toString(),e.appendChild(o),o.addEventListener("change",(function(e){var n=e.target.value;t.chartType=parseInt(n),t.refresh()})),this.settingsDiv=document.createElement("div"),(0,ut.addCssClass)(this.settingsDiv,"".concat(this.cssPrefix,"-settings")),(0,ut.hideElement)(this.settingsDiv),n.appendChild(this.settingsDiv),this.chartDiv=document.createElement("div"),(0,ut.addCssClass)(this.chartDiv,"".concat(this.cssPrefix,"-content")),(0,ut.hideElement)(this.chartDiv),n.appendChild(this.chartDiv),this.initSettingsDiv();var l=document.createElement("div");(0,ut.addCssClass)(l,"".concat(this.cssPrefix,"-settings-icon")),l.title="Settings",e.appendChild(l),l.addEventListener("click",(function(e){t.toggleSettings()})),this.drawChart(100)}else this.addContentDiv(n,"Unable to render the chart. None of the supported chart libraries (ChartJS, Google Charts, etc) is found.");this.options.hideSettings||this.element.appendChild(e),this.element.appendChild(n),this.element.style.display=""}else this.element.style.display="none"},e.prototype.addContentDiv=function(t,e){var n=document.createElement("div");(0,ut.addCssClass)(n,"".concat(this.cssPrefix,"-no-data")),n.innerText=e,t.appendChild(n)},e.prototype.clear=function(){this.element.innerHTML=""},e.prototype.drawChart=function(t){var e=this;(0,ut.showElement)(this.chartDiv),t>0?setTimeout((function(){return e.drawCore()}),t):this.drawCore()},e.prototype.initSettingsDiv=function(){var t=this,e=document.createElement("div");e.textContent="SETTINGS",(0,ut.addCssClass)(e,"".concat(this.cssPrefix,"-settings-header")),this.settingsDiv.appendChild(e);var n=document.createElement("div");(0,ut.addCssClass)(n,"".concat(this.cssPrefix,"-settings-single")),this.settingsDiv.appendChild(n);var o=document.createElement("span");(0,ut.showElement)(o),o.textContent="Label column",n.appendChild(o);var i=document.createElement("select");(0,ut.showElement)(i),n.appendChild(i);for(var r=0,s=this.potentialLabelColumns;r<s.length;r++){var a=s[r];(p=document.createElement("option")).value=a.idx.toString(),p.text=a.label,i.appendChild(p)}this.labelColumn>=0&&(i.value=this.labelColumn.toString()),i.addEventListener("change",(function(e){t.labelColumn=parseInt(e.target.value),t.updateChartColumns(),t.toggleSettings((function(){t.drawChart(100)}))}));var l=document.createElement("div");(0,ut.addCssClass)(l,"".concat(this.cssPrefix,"-settings-single")),this.settingsDiv.appendChild(l);var u=document.createElement("span");(0,ut.showElement)(u),u.textContent="Data column",l.appendChild(u);var c=document.createElement("select");(0,ut.showElement)(c),l.appendChild(c);for(var d=0,h=this.potentialDataColumns;d<h.length;d++){var p;a=h[d];(p=document.createElement("option")).value=a.idx.toString(),p.text=a.label,c.appendChild(p)}this.dataColumns.length>0&&this.dataColumns[0]>=0&&(c.value=this.dataColumns[0].toString()),c.addEventListener("change",(function(e){t.dataColumns[0]=parseInt(e.target.value),t.updateChartColumns(),t.toggleSettings((function(){t.drawChart(100)}))}))},e.prototype.getPotentialLabelColumns=function(){return this.potentialLabelColumns},e.prototype.getPotentialDataColumns=function(){return this.potentialDataColumns},e.prototype.getLabelColumnIndex=function(){return this.labelColumn},e.prototype.getDataColumnIndex=function(){return this.dataColumns[0]},e.prototype.toggleSettings=function(t){var e,n;(0,ut.isVisible)(this.chartDiv)?(e=this.chartDiv,n=this.settingsDiv):(e=this.settingsDiv,n=this.chartDiv),(0,ut.toggleVisibility)(e,n,{complete:t})},e}(st),Je=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Ke=function(t){function e(e){var n=t.call(this,e)||this;return n.colors=["#4dc9f6","#f67019","#f53794","#537bc4","#acc236","#166a8f","#00a950","#58595b","#8549ba"],n.chartLabels=[],n.chartColumns=[],n.hasChartTypes=[qe.Column,qe.Bar,qe.Area,qe.Line,qe.SteppedLine,qe.Doughnut,qe.Polar,qe.Radar,qe.Pie],n.options.legend={show:!1,position:"bottom"},n}return Je(e,t),e.prototype.getWidgetType=function(){return"chartChartJs"},e.hasChartJs=function(){return"undefined"!=typeof Chart},e.prototype.canDraw=function(){return e.hasChartJs()},e.prototype.initChart=function(){e.hasChartJs()&&this.labelColumn>=0&&this.dataColumns&&this.dataColumns.length>0&&this.updateChartColumns()},e.prototype.drawCore=function(){if(e.hasChartJs()&&this.dataTable&&this.dataTable.getCachedCount()>0){var t=this.generateConfig(),n=this.getChartCanvas(this.chartDiv).getContext("2d");new Chart(n,t)}},e.prototype.updateChartColumns=function(){if(this.dataTable){this.chartLabels=[],this.chartColumns=[];for(var t=this.dataTable.getCachedRows(),e=0;e<t.length;e++)this.chartLabels.push(t[e].getValue(this.labelColumn)),this.chartColumns.push(t[e].getValue(this.dataColumns[0]))}},e.prototype.getChartCanvas=function(t){var e=t.getElementsByTagName("canvas");return e&&e.length>0?e[0]:(0,ut.addElement)(t,"canvas")},e.prototype.generateConfig=function(){var t,e=[],n=this.dataTable.columns.get(this.dataColumns[0]).label,o=!0;if(this.chartType==qe.Pie||this.chartType==qe.Doughnut||this.chartType==qe.Polar||this.chartType==qe.Bar||this.chartType==qe.Column)for(var i=0;i<this.chartLabels.length;i++)e.push(this.colors[i%this.colors.length]);else e=[this.colors[3]];this.chartType!=qe.Line&&this.chartType!=qe.SteppedLine||(o=!1,t=this.colors[3]),this.options.legend=this.options.legend||{};var r={data:this.chartColumns,backgroundColor:e,borderColor:t,label:n,fill:o};this.chartType==qe.SteppedLine&&(r.stepped=this.chartType===qe.SteppedLine,r.steppedLine=this.chartType===qe.SteppedLine);var s=this.options.legend.show&&(this.chartType==qe.Pie||this.chartType==qe.Radar||this.chartType==qe.Polar||this.chartType==qe.Doughnut);return{type:this.getChartType(),data:{datasets:[r],labels:this.chartLabels},options:{legend:{display:s,position:this.options.legend.position||"bottom"},title:{display:!0,text:n}}}},e.prototype.getChartType=function(){switch(this.chartType){case qe.Column:return"bar";case qe.Bar:return"horizontalBar";case qe.Area:case qe.SteppedLine:case qe.Line:return"line";case qe.Doughnut:return"doughnut";case qe.Polar:return"polarArea";case qe.Radar:return"radar";case qe.Pie:default:return"pie"}},e}(Ye),Xe=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),$e=function(t){function e(e){var n=t.call(this,e)||this;return n.hasChartTypes=[qe.Column,qe.Bar,qe.Histogram,qe.Combo,qe.Area,qe.Line,qe.SteppedLine,qe.Pie,qe.Doughnut],n.options.legend={show:!0,position:"right"},n}return Xe(e,t),e.prototype.getWidgetType=function(){return"chartGoogle"},e.prototype.canDraw=function(){return e.hasGoogleCharts()},e.hasGoogleCharts=function(){return"undefined"!=typeof google&&void 0!==google.charts},e.prototype.initChart=function(){e.hasGoogleCharts()&&this.labelColumn>=0&&this.dataColumns&&this.dataColumns.length>0&&(this.googleDataView=new google.visualization.DataView(this.convertToGoogleFormat()),this.updateChartColumns())},e.prototype.convertToGoogleType=function(t){switch(t){case r.DataType.Date:return"date";case r.DataType.DateTime:return"datetime";case r.DataType.Time:return"timeofday";case r.DataType.Byte:case r.DataType.Word:case r.DataType.Int32:case r.DataType.Int64:case r.DataType.Currency:case r.DataType.Float:return"number";default:return"string"}},e.prototype.convertToGoogleValue=function(t,e){return e===r.DataType.Bool?t?t.toString():null:t},e.prototype.convertToGoogleFormat=function(){for(var t=new google.visualization.DataTable,e=this.dataTable.columns,n=0;n<e.count;n++){var o=e.get(n);t.addColumn(this.convertToGoogleType(o.type),o.label,o.id)}var i=this.dataTable.getCachedRows();t.addRows(i.length);for(n=0;n<i.length;n++)for(var r=i[n],s=0;s<e.count;s++)t.setCell(n,s,this.convertToGoogleValue(r.getValue(s),e.get(s).type));return t},e.prototype.drawCore=function(){if(null!=this.googleDataView){this.options.legend=this.options.legend||{};var t={width:"100%",height:"100%",chartArea:{width:this.getChartAreaWidth}};this.chartType==qe.Doughnut&&(t.pieHole=.4),this.options.legend.show?t.legend={position:this.options.legend.position}:t.legend="none",this.createChart(this.chartDiv).draw(this.googleDataView,t)}},e.prototype.getChartAreaWidth=function(t){return t==qe.Pie?"100%":"50%"},e.prototype.updateChartColumns=function(){this.googleDataView&&this.googleDataView.setColumns([].concat(this.labelColumn).concat(this.dataColumns))},e.prototype.createChart=function(t){switch(this.chartType){case qe.Column:return new google.visualization.ColumnChart(t);case qe.Histogram:return new google.visualization.Histogram(t);case qe.Bar:return new google.visualization.BarChart(t);case qe.Combo:return new google.visualization.ComboChart(t);case qe.Area:return new google.visualization.AreaChart(t);case qe.Line:return new google.visualization.LineChart(t);case qe.SteppedLine:return new google.visualization.SteppedAreaChart(t);case qe.Pie:case qe.Doughnut:default:return new google.visualization.PieChart(t)}},e}(Ye),Ze=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),tn=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.title=r.i18n.getText("Facets","Chart","FacetTitle"),e.dialogTitle=r.i18n.getText("Facets","Chart","DlgTitle"),e}return Ze(e,t),e.prototype.init=function(e){t.prototype.init.call(this,e),$e.hasGoogleCharts()?this.chart=new $e(this.contentDiv):this.chart=new Ke(this.contentDiv);var n=this.container.options?this.container.options.supportedChartTypes:null;this.chart.init(this.getContext(),{legend:{show:!1},showOnPaging:!0,hideSettings:!0,supportedChartTypes:n}),(0,ut.domel)(this.slot).hide()},e.prototype.destroy=function(){this.chart&&this.chart.destroy()},e.prototype.getType=function(){return Vt.Chart},e.prototype.renderFormFields=function(e,n){var o=this;t.prototype.renderFormFields.call(this,e,n);var i=dt.z.isIE(),s=i?"kfrm-fields-ie is-horizontal":"kfrm-fields is-horizontal",a=document.createElement("select");a.id="chart_type_selector",a.name="chart_type_selector";for(var l=0,u=this.chart.getSupportedChartTypes();l<u.length;l++){var c=u[l];(v=document.createElement("option")).value=c.toString(),v.text=this.chart.getChartTypeName(c),a.appendChild(v)}a.value=this.chart.getCurrentChartType().toString(),this.settings||(this.chart.prepareChartData(),this.settings={type:this.chart.getCurrentChartType().toString(),labelColumn:"".concat(this.chart.getLabelColumnIndex()>=0?this.chart.getLabelColumnIndex():""),dataColumn:"".concat(this.chart.getDataColumnIndex()>=0?this.chart.getDataColumnIndex():""),showLegend:!1});var d=document.createElement("select");d.name="label_column_selector",d.id="label_column_selector";for(var h=0,p=this.chart.getPotentialLabelColumns();h<p.length;h++){var f=p[h];(v=document.createElement("option")).value=f.idx.toString(),v.text=f.label,d.appendChild(v)}d.value=this.settings.labelColumn;var g=document.createElement("select");g.id="data_column_selector",g.name="data_column_selector";for(var y=0,m=this.chart.getPotentialDataColumns();y<m.length;y++){var v;f=m[y];(v=document.createElement("option")).value=f.idx.toString(),v.text=f.label,g.appendChild(v)}g.value=this.settings.dataColumn.toString();var C=n,b=function(){return i?(0,ut.domel)("div",n).addClass("kfrm-field-ie").toDOM():n};i?(0,ut.domel)(e).addChildElement(b()):(0,ut.domel)(n).addChild("div").addChild("div"),C=b(),(0,ut.domel)(C).addChild("label",(function(t){return t.attr("for","chart_type_selector").text(r.i18n.getText("Facets","Chart","ChartTypeSelectorLabel"))})).addChild("div",(function(t){return t.addClass("kfrm-select").addChildElement(a)})),C=b(),(0,ut.domel)(C).addChild("label",(function(t){return t.attr("for","label_column_selector").text(r.i18n.getText("Facets","Chart","LabelColumnSelectorLabel"))})).addChild("div",(function(t){return t.addClass("kfrm-select").addChildElement(d)})),C=b(),(0,ut.domel)(C).addChild("label",(function(t){return t.attr("for","data_column_selector").text(r.i18n.getText("Facets","Chart","DataColumnSelectorLabel"))})).addChild("div",(function(t){return t.addClass("kfrm-select").addChildElement(g)})),C=b(),(0,ut.domel)(C).addChild("div").addChild("div",(function(t){return t.addClass(s).addChild("label",(function(t){return t.addClass("checkbox").addChild("input",(function(t){t.id("show_legend").type("checkbox"),o.settings.showLegend&&t.attr("checked","")})).addText(" "+r.i18n.getText("Facets","Chart","ShowLegendLabel"))}))}))},e.prototype.afterDialogOpened=function(t){this.getContext().resultTable.columns.getItems().filter((function(t){return r.utils.isNumericType(t.type)})).length<=0&&(t.showAlert("The dataset should contain at least one numeric column to build a chart","error"),t.getSubmitButtonElement().disabled=!0)},e.prototype.submitSettingsDialog=function(){var e=t.prototype.submitSettingsDialog.call(this),n=document.getElementById("chart_type_selector"),o=parseInt(n.value),i=document.getElementById("label_column_selector"),r=parseInt(i.value),s=document.getElementById("data_column_selector"),a=parseInt(s.value),l=document.getElementById("show_legend").checked;return e&&(this.settings={type:o,labelColumn:r,dataColumn:a,showLegend:l},this.canDisplay()&&this.refresh()),e},e.prototype.getSettings=function(){return this.settings},e.prototype.saveToData=function(){var e=t.prototype.saveToData.call(this);return this.settings&&(e.chartType=this.settings.type,e.labelCol=this.settings.labelColumn,e.dataCol=this.settings.dataColumn,e.showLeg=this.settings.showLegend),e},e.prototype.loadFromData=function(e){t.prototype.loadFromData.call(this,e),e&&(this.settings={type:e.chartType,dataColumn:e.dataCol,labelColumn:e.labelCol,showLegend:e.showLeg})},e.prototype.refreshCore=function(){this.chart&&(this.settings&&this.chart.updateSettings(this.settings),this.chart.prepareChartData(),this.chart.refresh())},e.prototype.onResize=function(){this.refresh()},e}(Ge),en=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}();!function(t){t.Sum="SUM",t.Average="AVG",t.Min="MIN",t.Max="MAX",t.Count="COUNT"}(ze||(ze={})),function(t){t[t.ColumnField=0]="ColumnField",t[t.RowField=1]="RowField",t[t.CellData=2]="CellData"}(Ve||(Ve={}));var nn=/{0:(.*?)}/g,on=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.title=r.i18n.getText("Facets","Pivot","FacetTitle"),e.dialogTitle=r.i18n.getText("Facets","Pivot","DlgTitle"),e.pivotTable=new r.EasyDataTable,e}return en(e,t),e.prototype.init=function(e){var n=this;t.prototype.init.call(this,e),this.options.maxRowCount=this.options.maxRowCount||500,this.options.viewportRowsCount=this.options.viewportRowsCount||50,this.grid=new ut.EasyGrid({slot:this.contentDiv,dataTable:this.pivotTable,paging:{enabled:!1,pageSize:this.options.maxRowCount},viewportRowsCount:this.options.viewportRowsCount,useRowNumeration:!1,showPlusButton:!1,allowDragDrop:!1,onGetCellRenderer:function(t,e){if(t.dataColumn){if("total"==t.dataColumn.id)return function(t,n,o,i){e(t,n,o,i),o.classList.add("pivot-cell-total")};if(n.settings.totalsRow)if(0===n.pivotTable.columns.getIndex(t.dataColumn.id))return function(t,o,i,s){Number.parseInt(s.getAttribute("data-row-idx"))===n.pivotTable.getCachedCount()-1&&(t=r.i18n.getText("Facets","Pivot","TotalGridLabel")),e(t,o,i,s)}}}})},e.prototype.getType=function(){return Vt.PivotTable},e.prototype.destroy=function(){this.grid&&this.grid.destroy()},e.prototype.createAggrFuncSelectBuilder=function(t){for(var e=this.getContext().getModel(),n=(0,ut.domel)("select"),o=function(t){n.addChild("option",(function(n){n.attr("value",t).text(e.getAggrFunctionCaption(t))}))},i=0,r=Object.keys(ze).map((function(t){return ze[t]}));i<r.length;i++){o(r[i])}var s=n.toDOM().querySelectorAll("option");return null!=t?s.forEach((function(e){e.value==t&&(e.selected=!0)})):s[0].selected=!0,n},e.prototype.createColumnsSelectBuilder=function(t,e,n){for(var o=this.getContextDataTable(),i=(0,ut.domel)("select"),s=null,a=0,l=function(e){var n=o.columns.get(e),l=n.label,u=n.type,c=n.id;if(t&&t.indexOf(u)<0)return"continue";null===s&&r.utils.isNumericType(u)&&(s=a),i.addChild("option",(function(t){t.attr("value",c).text(l)})),a++},u=0;u<o.columns.count;u++)l(u);var c=Array.from(i.toDOM().querySelectorAll("option"));if(c.length>0)if(null!=e)for(var d=0,h=c;d<h.length;d++){var p=h[d];if(p.value==e){i.toDOM().value=p.value;break}}else switch(n){case Ve.ColumnField:i.toDOM().value=c[0].value;break;case Ve.RowField:i.toDOM().value=c.length>1?c[1].value:c[0].value;break;case Ve.CellData:i.toDOM().value=null===s?c[0].value:c[s].value}return i},e.prototype.renderFormFields=function(e,n){var o=this;t.prototype.renderFormFields.call(this,e,n);var i=this.settings||{totalsRow:!0,totalsCol:!0},s=[r.DataType.String,r.DataType.Date,r.DataType.DateTime,r.DataType.Int32,r.DataType.Int64,r.DataType.Word,r.DataType.Byte],a=[r.DataType.String,r.DataType.Float,r.DataType.Int32,r.DataType.Int64,r.DataType.Word,r.DataType.Byte,r.DataType.Currency],l=dt.z.isIE(),u=n,c=l?"kfrm-fields-ie is-horizontal":"kfrm-fields is-horizontal",d=function(){return l?(0,ut.domel)("div",n).addClass("kfrm-field-ie").toDOM():n};l?(0,ut.domel)(n).addChildElement(d()):(0,ut.domel)(n).addChild("div").addChild("div"),u=d(),(0,ut.domel)(u).addChild("label",(function(t){return t.attr("for","column_field").text(r.i18n.getText("Facets","Pivot","ColumnFieldSelectorLabel"))})).addChild("div",(function(t){return t.addClass(c).addChild("div",(function(t){return t.addClass("kfrm-select").attr("name","column_field").addChildElement(o.createColumnsSelectBuilder(s,i.colName,Ve.ColumnField).id("pivotTableColFieldSelector").toDOM())})).addChild("button",(function(t){return t.addClass("kfrm-button").addClass("eqjs-facets-button-swap").attr("title",r.i18n.getText("Facets","Pivot","SwapBtnTitle")).on("click",(function(){var t=document.getElementById("pivotTableColFieldSelector"),e=document.getElementById("pivotTableRowFieldSelector"),n=t.value;t.value=e.value,e.value=n}))}))})),u=d(),(0,ut.domel)(u).addChild("label",(function(t){return t.attr("for","row_field").text(r.i18n.getText("Facets","Pivot","RowFieldSelectorLabel"))})).addChild("div",(function(t){return t.addClass("kfrm-select").attr("name","row_field").addChildElement(o.createColumnsSelectBuilder(s,i.rowName,Ve.RowField).id("pivotTableRowFieldSelector").toDOM())})),u=d(),(0,ut.domel)(u).addChild("label",(function(t){return t.attr("for","data_function").text(r.i18n.getText("Facets","Pivot","CellDataSelectorLabel"))})).addChild("div",(function(t){return t.addClass(c).addChild("div",(function(t){return t.addClass("kfrm-select").attr("name","data_function").addChildElement(o.createAggrFuncSelectBuilder(i.aggrFunc).id("pivotTableAggrFuncSelector").toDOM())})).addChild("label",(function(t){return t.addText("of ")})).addChild("div",(function(t){return t.addClass("kfrm-select").attr("name","data_column").addChildElement(o.createColumnsSelectBuilder(a,i.fieldName,Ve.CellData).on("change",(function(t){var e=t.target.value;o.validateSelectedField(e)})).id("pivotTableCellFieldSelector").toDOM())}))})),u=d(),(0,ut.domel)(u).addChild("div").addChild("div",(function(t){return t.addClass(c).addChild("label",(function(t){return t.addClass("checkbox").addChild("input",(function(t){t.id("pivotTableHasTotalsRow").type("checkbox"),i.totalsRow&&t.attr("checked","")})).addText(" "+r.i18n.getText("Facets","Pivot","TotalsRowLabel"))})).addChild("label",(function(t){return t.addClass("checkbox").addChild("input",(function(t){t.id("pivotTableHasTotalsCol").type("checkbox"),i.totalsCol&&t.attr("checked","")})).addText(" "+r.i18n.getText("Facets","Pivot","TotalsColLabel"))}))}))},e.prototype.afterDialogOpened=function(t){var e=document.getElementById("pivotTableCellFieldSelector").value;e&&this.validateSelectedField(e),this.getQuery().getColumns().length<=2&&(t.showAlert("The dataset should contain at least three columns to build a pivot table","error"),t.getSubmitButtonElement().disabled=!0)},e.prototype.validateSelectedField=function(t){var e=this.getContextDataTable(),n=e.columns.getIndex(t),o=e.columns.get(n),i=document.getElementById("pivotTableAggrFuncSelector");o.type==r.DataType.String?(i.disabled=!0,i.value=ze.Count):i.disabled=!1},e.prototype.submitSettingsDialog=function(){var e=t.prototype.submitSettingsDialog.call(this);return e&&(this.settings={colName:document.getElementById("pivotTableColFieldSelector").value,rowName:document.getElementById("pivotTableRowFieldSelector").value,aggrFunc:document.getElementById("pivotTableAggrFuncSelector").value,fieldName:document.getElementById("pivotTableCellFieldSelector").value,totalsRow:document.getElementById("pivotTableHasTotalsRow").checked,totalsCol:document.getElementById("pivotTableHasTotalsCol").checked},this.refresh()),e},e.prototype.saveToData=function(){var e=t.prototype.saveToData.call(this);return this.settings&&r.utils.assignDeep(e,this.settings),e},e.prototype.loadFromData=function(e){t.prototype.loadFromData.call(this,e),e&&(this.settings=r.utils.assignDeep(this.settings,e),"AVERAGE"==this.settings.aggrFunc&&(this.settings.aggrFunc=ze.Average))},e.prototype.refreshCore=function(){if(this.updatePivotData(),this.grid){var t=this.pivotTable.getTotal();t>this.grid.options.paging.pageSize&&(this.contentDiv.classList.remove("pivot-grid-with-totals"),this.showErrorMessage(r.i18n.getText("Facets","ErrTooMuchData"))),this.options.viewportRowsCount>t?this.grid.options.viewportRowsCount=t:this.grid.options.viewportRowsCount=this.options.viewportRowsCount,this.grid.refresh()}},e.prototype.getContextDataTable=function(){return this.getContext().resultTable},e.prototype.updatePivotData=function(){this.pivotTable.clear();var t=this.getContextDataTable();if(t&&0!=t.getTotal()&&this.settings){var e=this.settings.colName,n=this.settings.rowName,o=this.settings.fieldName,i=t.columns.getIndex(e),s=t.columns.getIndex(n),a=t.columns.getIndex(o);if(null!=i&&null!=s&&null!=a){for(var l=t.columns.get(a),u=t.columns.get(i),c=t.columns.get(s),d=c.label,h=c.type,p=u.label,f=[],g=[],y=t.getCachedRows(),m=0;m<y.length;m++){var v=y[m].getValue(i);f.indexOf(v)<0&&f.push(v);var C=y[m].getValue(s);g.indexOf(C)<0&&g.push(C)}this.pivotTable.columns.add({id:d+"\\"+p,label:d+"\\"+p,description:"",type:h,dfmt:c.displayFormat,style:c.style});var b=[],x=null;r.utils.isNumericType(u.type)?x=this.formatNumber:r.utils.getDateDataTypes().indexOf(u.type)>=0&&(x=this.formatDate);for(m=0;m<f.length;m++){if(v=f[m]){var w=x?x(u,v):v;this.pivotTable.columns.add({id:v,label:w,description:"",dfmt:l.displayFormat,type:this.settings.aggrFunc!==ze.Count?l.type:r.DataType.Int64,style:l.style})}else b.push(m)}var E=[];for(m=0;m<g.length;m++)E.push([]),E[m].push(g[m]);for(m=0;m<g.length;m++)for(var T=0;T<f.length;T++)b.indexOf(T)>=0||E[m].push(this.calcAggrFunc(this.settings.aggrFunc,{colName:this.settings.colName,rowName:this.settings.rowName,fieldName:this.settings.fieldName,rowValue:g[m],colValue:f[T]}));if(this.settings.totalsCol){this.pivotTable.columns.add({id:"total",label:r.i18n.getText("Facets","Pivot","TotalGridLabel"),description:"",dfmt:l.displayFormat,type:this.settings.aggrFunc!==ze.Count?l.type:r.DataType.Int64});for(m=0;m<E.length;m++){var D=E[m],S=0;this.settings.aggrFunc!=ze.Min&&this.settings.aggrFunc!=ze.Max||(S=D[1]);for(T=1;T<D.length;T++){null!==(_=D[T])&&(this.settings.aggrFunc===ze.Min?_<S&&(S=_):this.settings.aggrFunc===ze.Max?_>S&&(S=_):S+=_)}this.settings.aggrFunc===ze.Average&&(S/=D.length-1),D.push(S)}}for(var k=0,M=E;k<M.length;k++){D=M[k];this.pivotTable.addRow(D)}if(this.settings.totalsRow){var I=[];I.push(null);for(m=1;m<this.pivotTable.columns.count;m++){var B=this.pivotTable.getCachedRows(),A=0;this.settings.aggrFunc!=ze.Min&&this.settings.aggrFunc!=ze.Max||(A=B[0].getValue(m));for(T=0;T<B.length;T++){var _;null!==(_=B[T].getValue(m))&&(this.settings.aggrFunc===ze.Min?_<A&&(A=_):this.settings.aggrFunc===ze.Max?_>A&&(A=_):A+=_)}this.settings.aggrFunc===ze.Average&&(A/=B.length),I.push(A)}this.pivotTable.addRow(I),this.contentDiv.classList.add("pivot-grid-with-totals")}else this.contentDiv.classList.remove("pivot-grid-with-totals")}else this.showUnableDisplayMessage(r.i18n.getText("Facets","ErrQueryChanged"))}},e.prototype.calcAggrFunc=function(t,e){switch(t){case ze.Sum:return this.sum(e);case ze.Average:return this.average(e);case ze.Min:return this.min(e);case ze.Max:return this.max(e);case ze.Count:return this.count(e);default:return 0}},e.prototype.getSettings=function(){return this.settings},e.prototype.formatDate=function(t,e){var n="[object Date]"===Object.prototype.toString.call(e),o=(e||"").toString();if(n)if(t&&t.displayFormat&&nn.test(t.displayFormat))o=t.displayFormat.replace(nn,(function(n,o){return r.i18n.dateTimeToStr(e,t.type,o)}));else{var i=r.i18n.getCurrentLocale(),s={hour:"numeric",minute:"numeric",second:"numeric"};switch(t.type){case r.DataType.Date:o=e.toLocaleDateString(i);break;case r.DataType.Time:o=e.toLocaleTimeString(i,s);break;case r.DataType.DateTime:o="".concat(e.toLocaleDateString(i)," ").concat(e.toLocaleTimeString(i,s))}}return o},e.prototype.formatNumber=function(t,e){var n=(e||"").toString();return"number"==typeof e&&(n=t&&t.displayFormat&&nn.test(t.displayFormat)?t.displayFormat.replace(nn,(function(t,n){return r.i18n.numberToStr(e,n)})):e.toLocaleString()),n},e.prototype.sum=function(t){for(var e=0,n=this.getContextDataTable().getCachedRows(),o=0;o<n.length;o++){var i=n[o].getValue(t.rowName),r=n[o].getValue(t.colName);if(i===t.rowValue&&r===t.colValue)e+=n[o].getValue(t.fieldName)}return e},e.prototype.average=function(t){for(var e=0,n=0,o=this.getContextDataTable().getCachedRows(),i=0;i<o.length;i++){var r=o[i].getValue(t.rowName),s=o[i].getValue(t.colName);if(r===t.rowValue&&s===t.colValue)e+=o[i].getValue(t.fieldName),n++}return 0!=n&&(e/=n),e},e.prototype.min=function(t){for(var e=Number.MAX_SAFE_INTEGER,n=this.getContextDataTable().getCachedRows(),o=0;o<n.length;o++){var i=n[o].getValue(t.rowName),r=n[o].getValue(t.colName);if(i===t.rowValue&&r===t.colValue){var s=n[o].getValue(t.fieldName);s<e&&(e=s)}}return e==Number.MAX_SAFE_INTEGER?null:e},e.prototype.max=function(t){for(var e=Number.MIN_SAFE_INTEGER,n=this.getContextDataTable().getCachedRows(),o=0;o<n.length;o++){var i=n[o].getValue(t.rowName),r=n[o].getValue(t.colName);if(i===t.rowValue&&r===t.colValue){var s=n[o].getValue(t.fieldName);s>e&&(e=s)}}return e==Number.MIN_SAFE_INTEGER?null:e},e.prototype.count=function(t){for(var e=0,n=this.getContextDataTable().getCachedRows(),o=0;o<n.length;o++){var i=n[o].getValue(t.rowName),r=n[o].getValue(t.colName);i===t.rowValue&&r===t.colValue&&e++}return e},e}(Ge),rn=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),sn=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.grid=null,e.title=r.i18n.getText("Facets","DataTable","FacetTitle"),e.dialogTitle=r.i18n.getText("Facets","DataTable","DlgTitle"),e}return rn(e,t),e.prototype.init=function(e){t.prototype.init.call(this,e),this.reinitGrid()},e.prototype.getSettings=function(){return this.settings},e.prototype.reinitGrid=function(){this.grid&&this.grid.destroy();var t=this.container.options||{};t.gridResolver&&(this.grid=t.gridResolver(this.contentDiv,this.getType())),null==this.grid&&(this.grid=new Ae(this.contentDiv)),t.grid=t.grid||{},t.grid.autoRefresh=!1,t.grid.addColumns=!1;var e=this.getContext();t.grid.totals=this.settings,this.grid.init(e,t.grid)},e.prototype.getType=function(){return Vt.DataGrid},e.prototype.canDisplay=function(){return!0},e.prototype.refreshCore=function(){this.grid&&this.grid.refresh()},e.prototype.destroy=function(){this.grid&&this.grid.destroy()},e}(Ge),an=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),ln=function(t){function e(e){var n=t.call(this,e)||this;return n.facets=[],n.options={},n.group=A.Result,n}return an(e,t),e.prototype.destroyCore=function(){for(var t=0,e=this.facets;t<e.length;t++){e[t].destroy()}this.clear()},e.prototype.createFacetTab=function(t){var e=this.options[t];switch(t){case Vt.Chart:return new tn(this,e);case Vt.PivotTable:return new on(this,e);default:return new sn(this,e)}},e.prototype.getQuery=function(){return this.getContext().getQuery()},e}(st),un=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),cn=function(t){function e(e){var n=t.call(this,e)||this;return n.activeFacetIndex=-1,n.firstRender=!0,n.options={showExportButton:!0,showRefreshButton:!0,showMaximizeButton:!0,maximize2Window:!1,showProcessIndicator:!0,facetTypes:[Vt.DataGrid,Vt.Chart,Vt.PivotTable]},n.menuItems=[{id:Vt.DataGrid,text:r.i18n.getText("Facets","AddMenuItems","DataTable")},{id:Vt.Chart,text:r.i18n.getText("Facets","AddMenuItems","Chart")},{id:Vt.PivotTable,text:r.i18n.getText("Facets","AddMenuItems","Pivot")}],n.menuItemsFilter=function(t){return!(n.options.facetTypes.indexOf(t.id)<0)&&(t.id!==Vt.DataGrid||0===n.facets.filter((function(t){return t.getType()==Vt.DataGrid})).length)},n.slot.classList.contains("".concat(n.cssPrefix,"-panel"))||n.slot.classList.add("".concat(n.cssPrefix,"-panel")),n.renderProcessBlock(),n}return un(e,t),Object.defineProperty(e.prototype,"cssPrefix",{get:function(){return"eqjs-facets"},enumerable:!1,configurable:!0}),e.prototype.getWidgetType=function(){return"facetsPanel"},e.prototype.init=function(e,n){t.prototype.init.call(this,e,n),this.setOptions(n),this.destroyCore(),this.attachQueryObserver(),this.loadFacets()},e.prototype.attachQueryObserver=function(){var t=this,e=this.getQuery();this.queryEventCallbackId&&e.removeChangedCallback(this.queryEventCallbackId),this.queryEventCallbackId=e.addChangedCallback((function(e){var n=e.data;n.part==x.All&&n.source!=t&&(t.reloadFacets(),t.refreshCore(!0))}))},e.prototype.refreshCore=function(t){void 0===t&&(t=!1),(this.firstRender||t)&&(this.clear(),this.createAddMenu(),this.render()),this.validateAddFacetButton(),this.renderActiveFacet(),this.updateTotalRecords()},e.prototype.createAddMenu=function(){this.addMenu=new gt({items:this.menuItems,id:"FacetType-List"})},e.prototype.updateTotalRecords=function(){var t=this.getContext().resultTable.getTotal();this.recordsDiv.innerHTML=r.i18n.getText("Facets","TotalRecordsLabel")+" "+t,0==t?(0,ut.domel)(this.exportDiv).hide():(0,ut.domel)(this.exportDiv).show()},e.prototype.renderProcessBlock=function(){this._processBlock=(0,ut.domel)("div").addClass("".concat(this.cssPrefix,"-spinner")).addChild("div",(function(t){return t.addClass("".concat(ct.YR,"-progress-win8"),dt.z.getMobileCssClass()).addHtml('<div class="wBall" id="wBall_1"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_2"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_3"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_4"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_5"><div class="wInnerBall"></div></div>')})).toDOM()},e.prototype.onProcessStartCore=function(){this.options.showProcessIndicator&&!this._processBlock.parentNode&&this.bodyDiv&&(this.bodyDiv.childNodes.forEach((function(t){(0,ut.domel)(t).hide()})),this.bodyDiv.appendChild(this._processBlock))},e.prototype.onProcessEndCore=function(){if(this.options.showProcessIndicator&&this._processBlock.parentNode)try{this._processBlock.parentNode.removeChild(this._processBlock)}catch(t){}finally{this.renderActiveFacet(!1)}},e.prototype.render=function(){var t=this;this.firstRender=!1,this.headerDiv=(0,ut.domel)("div",this.slot).addClass("".concat(this.cssPrefix,"-header")).toDOM(),this.tabsDiv=(0,ut.domel)("div",this.headerDiv).addClass("".concat(this.cssPrefix,"-tabs")).toDOM(),this.tabsUl=(0,ut.domel)("ul",this.tabsDiv).addClass("".concat(this.cssPrefix,"-nav-tabs")).toDOM(),this.bodyDiv=(0,ut.domel)("div",this.slot).addClass("".concat(this.cssPrefix,"-body")).toDOM();for(var e=0,n=this.facets;e<n.length;e++){var o=n[e];this.renderFacet(o)}(0,ut.domel)(this.tabsDiv).addChild("div",(function(e){return t.addFacetButton=e.addClass("".concat(t.cssPrefix,"-add-button")).title(r.i18n.getText("Facets","NewFacetTitle")).addChild("a",(function(t){return t.attr("href","javascript:void(0)")})).on("click",(function(e){return t.addClickHandler(e)})).toDOM()}));var i=(0,ut.domel)("div",this.headerDiv).addClass("".concat(this.cssPrefix,"-manage")).toDOM();if(this.recordsDiv=(0,ut.domel)("div",i).addClass("".concat(this.cssPrefix,"-total-recs")).toDOM(),this.options.showRefreshButton||this.options.showExportButton||this.options.showMaximizeButton){var s=(0,ut.domel)("div",i).addClass("".concat(this.cssPrefix,"-total-buttons")).toDOM();this.options.showExportButton&&(this.exportDiv=(0,ut.domel)("button",s).on("click",(function(){return t.exportHandler()})).addClass("".concat(this.cssPrefix,"-button")).addClass("".concat(this.cssPrefix,"-button-export")).title(r.i18n.getText("Facets","ExportBtnTitle")).toDOM()),this.options.showRefreshButton&&(0,ut.domel)("button",s).on("click",(function(){return t.refreshHandler()})).addClass("".concat(this.cssPrefix,"-button")).addClass("".concat(this.cssPrefix,"-button-refresh")).title(r.i18n.getText("Facets","RefreshBtnTitle")),this.options.showMaximizeButton&&(this.maximizeButton=(0,ut.domel)("button",s).on("click",(function(){return t.options.maximize2Window?t.maximizeHandler(!0):t.maximizeHandler()})).addClass("".concat(this.cssPrefix,"-button")).addClass("".concat(this.cssPrefix,"-button-maximize")).title(r.i18n.getText("Facets","MaximizeBtnTitle")).toDOM())}},e.prototype.refreshHandler=function(){var t=this.getContext();t.fetchData({success:function(){t.refreshWidgets(A.Result)}})},e.prototype.exportHandler=function(){var t=this.getContext();new Ne(t).show()},e.prototype.maximizeHandler=function(t){var e=(0,ut.domel)(this.slot);if(t)e.toggleClass("".concat(ct.YR,"-maximized-2window")),this.slot.classList.contains("".concat(ct.YR,"-maximized-2window"))?(this.maximizeButton.title=r.i18n.getText("Facets","RestoreBtnTitle"),this.maximizeButton.classList.toggle("".concat(this.cssPrefix,"-button-maximize"),!1),this.maximizeButton.classList.toggle("".concat(this.cssPrefix,"-button-restore"),!0)):(this.maximizeButton.title=r.i18n.getText("Facets","MaximizeBtnTitle"),this.maximizeButton.classList.toggle("".concat(this.cssPrefix,"-button-restore"),!1),this.maximizeButton.classList.toggle("".concat(this.cssPrefix,"-button-maximize"),!0));else{var n=!this.slot.hasAttribute("data-is-maximized");n?(this.slot.setAttribute("data-is-maximized",""),this.maximizeButton.title=r.i18n.getText("Facets","RestoreBtnTitle"),this.maximizeButton.classList.toggle("".concat(this.cssPrefix,"-button-maximize"),!1),this.maximizeButton.classList.toggle("".concat(this.cssPrefix,"-button-restore"),!0)):(this.slot.removeAttribute("data-is-maximized"),this.maximizeButton.title=r.i18n.getText("Facets","MaximizeBtnTitle"),this.maximizeButton.classList.toggle("".concat(this.cssPrefix,"-button-restore"),!1),this.maximizeButton.classList.toggle("".concat(this.cssPrefix,"-button-maximize"),!0)),document.querySelectorAll("[data-hide-on-max]").forEach((function(t){n?t.setAttribute("style","display: none;"):t.removeAttribute("style")}))}this.facets.forEach((function(t){return t.onResize()}))},e.prototype.renderActiveFacet=function(t){var e=this;void 0===t&&(t=!0),this.tabsUl.querySelectorAll("li").forEach((function(t,n){t.classList.contains("active")&&t.classList.remove("active"),e.activeFacetIndex===n&&t.classList.add("active")})),this.bodyDiv.querySelectorAll(".".concat(ct.YR,"-facet")).forEach((function(n,o){(0,ut.domel)(n).hide(),e.activeFacetIndex===o&&((0,ut.domel)(n).show(),t&&e.facets[o].refresh())}))},e.prototype.renderFacet=function(t){this.renderFacetTab(t);var e=this.renderFacetSlot(t);t.init(e)},e.prototype.renderFacetTab=function(t){var e=this;return(0,ut.domel)("li",this.tabsUl).addChild("span",(function(n){return n.addClass("".concat(ct.YR,"-facet-settings")).on("click",(function(n){n.stopPropagation(),e.settingsClickHandler(t)}))})).addChild("a",(function(e){return e.addText(t.title).attr("href","javascript:void(0)")})).addChild("span",(function(n){return n.addClass("".concat(ct.YR,"-facet-close")).on("click",(function(n){n.stopPropagation(),e.closeClickHandler(t)}))})).on("click",(function(n){return e.selectClickHandler(t)})).toDOM()},e.prototype.renderFacetSlot=function(t){return(0,ut.domel)("div",this.bodyDiv).addClass("".concat(ct.YR,"-facet")).hide().toDOM()},e.prototype.refreshFacetTabs=function(){var t=this;this.tabsUl.querySelectorAll("li").forEach((function(e){t.tabsUl.removeChild(e)}));for(var e=0,n=this.facets;e<n.length;e++){var o=n[e];this.renderFacetTab(o)}},e.prototype.removeFacet=function(t){var e=this.facets.indexOf(t);if(e>=0){this.facets.splice(e,1);var n=this.tabsUl.childNodes[e];this.tabsUl.removeChild(n);var o=this.bodyDiv.childNodes[e];this.bodyDiv.removeChild(o),this.facets.length>0?this.activeFacetIndex=e<this.facets.length?e:this.facets.length-1:this.activeFacetIndex=-1,this.renderActiveFacet(),this.validateAddFacetButton()}},e.prototype.addClickHandler=function(t){var e=this;this.addMenu.showMenu({anchor:t.target,itemFilterCallback:this.menuItemsFilter,itemSelectedCallback:function(t){var n=e.createFacetTab(t.id),o=e.renderFacetSlot(n);n.init(o),n.showSettingsDialog().then((function(t){t?(e.facets.push(n),e.activeFacetIndex=e.facets.length-1,e.renderFacetTab(n),e.renderActiveFacet(),e.saveFacets()):e.bodyDiv.removeChild(o)})).catch((function(t){return console.error(t)}))}})},e.prototype.selectClickHandler=function(t){var e=this.facets.indexOf(t);this.setActiveFacet(e)},e.prototype.settingsClickHandler=function(t){var e=this;t.showSettingsDialog().then((function(t){t&&(e.refreshFacetTabs(),e.renderActiveFacet(),e.saveFacets())})).catch((function(t){return console.error(t)}))},e.prototype.closeClickHandler=function(t){var e=this;this.getDialogService().openConfirm(r.i18n.getText("Facets","RemoveFacetDlgTitle"),r.i18n.getText("Facets","RemoveFacetDlgContent").replace("{facetTitle}",t.title)).then((function(n){n&&(e.removeFacet(t),e.saveFacets())})).catch((function(t){return console.error(t)}))},e.prototype.clear=function(){this.firstRender=!0,this.slot.innerHTML=""},e.prototype.createDefaultFacetIfNotExist=function(){if(0===this.facets.length){var t=this.createFacetTab(Vt.DataGrid);this.facets.push(t),this.activeFacetIndex=0}},e.prototype.validateAddFacetButton=function(){this.addFacetButton.hidden=0==this.addMenu.getItems().filter(this.menuItemsFilter).length},e.prototype.setActiveFacet=function(t){this.activeFacetIndex!=t&&(this.activeFacetIndex=t,this.renderActiveFacet(),this.saveFacets(!0))},e.prototype.setOptions=function(t){r.utils.assignDeep(this.options,t)},e.prototype.getDialogService=function(){return this.getContext().getServices().getDialogService()},e.prototype.saveFacets=function(t){void 0===t&&(t=!1);var e=this.getQuery();e.innerData=e.innerData||{},e.innerData.facets={active:this.activeFacetIndex,items:this.facets.map((function(t){return t.saveToData()}))},e.fireChangedEvent({part:x.Facets,action:t?w.Activate:w.All,source:this})},e.prototype.reloadFacets=function(){for(var t=0,e=this.facets;t<e.length;t++){e[t].destroy()}this.loadFacets()},e.prototype.loadFacets=function(){var t=this.getQuery();if(this.facets=[],t.innerData&&t.innerData.facets){for(var e=0,n=t.innerData.facets.items;e<n.length;e++){var o=n[e],i=this.createFacetTab(o.type);i.loadFromData(o),this.facets.push(i)}var r=t.innerData.facets.active;this.activeFacetIndex=r>=0?r:this.facets.length-1}else this.createDefaultFacetIfNotExist()},e}(ln),dn=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),hn=function(t){function e(e){var n=t.call(this,e)||this;return n.options={defFormat:"csv",enableExport:!0},n.clickHandler=function(t){n.slot.hasAttribute("disabled")||new Ne(n.context).show(n.options.defFormat)},n.group=A.All,n}return dn(e,t),e.prototype.getWidgetType=function(){return"exportWidget"},e.prototype.init=function(e,n){t.prototype.init.call(this,e,n),this.options=r.utils.assignDeep(this.options,n),this.slot.addEventListener("click",this.clickHandler)},e.prototype.refreshCore=function(){this.options.enableExport&&this.context.resultTable&&this.context.resultTable.getCachedCount()>0?this.slot.removeAttribute("disabled"):this.slot.setAttribute("disabled","")},e.prototype.destroyCore=function(){this.slot.removeAttribute("disabled"),this.slot.removeEventListener("click",this.clickHandler)},e}(st),pn=function(){function t(t){if(this.selectState={columns:[]},this.funcMap={},!t||!t.slot)throw new Error("slot is required");if(!t||!t.query)throw new Error("query is required");this.slot=t.slot,this.query=t.query,this.onChanged=t.onChanged,this.dropSelectState(),this.dropState()}return Object.defineProperty(t.prototype,"cssPrefix",{get:function(){return"eqjs-as"},enumerable:!1,configurable:!0}),t.prototype.render=function(){this.createFunctionMenu(),this.setInitialState(),this.changed()},t.prototype.setInitialState=function(){for(var t=this.query.getAggregationSettings(),e=t.getInternalGroups(),n=t.getAggregates(),o=0,i=e;o<i.length;o++){var r=i[o];this.state.groups.push({columns:r.columns})}for(var s=0,a=n;s<a.length;s++){var l=a[s];this.state.aggregates.push({colId:l.colId,funcId:l.funcId})}this.state.grandTotals=t.hasGrandTotals(),this.state.recordCount=t.hasRecordCount()},t.prototype.getAvailableColumns=function(){return this.query.getColumns().filter((function(t){return t.enabled}))},t.prototype.renderCore=function(){var t=this;this.slot.innerHTML="";for(var e=this.getAvailableColumns(),n=(0,ut.domel)(this.slot),o=null,i=null,s=null,a=this.state.aggregates,l=-1,u=function(e){if(o&&o.columns.indexOf(e.id)>=0)return c.renderColumn(i,e,!0),"continue";if(null!=(o=c.getGroupForColumn(e.id))){l++;var u=(0,ut.domel)("div",c.slot).addClass("".concat(c.cssPrefix,"-group")).data("gindex","".concat(l));return i=(0,ut.domel)("div",u.toDOM()).addClass("".concat(c.cssPrefix,"-columns")),c.renderColumn(i,e,!0),"continue"}var d=a.filter((function(t){return t.colId==e.id}))[0];if(d){var h=(0,ut.domel)("div",c.slot).addClass("".concat(c.cssPrefix,"-aggr"));return c.renderColumn(h,e,!0,d.funcId),h.addChild("div",(function(e){return e.addClass("".concat(t.cssPrefix,"-buttons")).addChild("button",(function(e){return e.addClass("".concat(t.cssPrefix,"-unaggr-btn")).title(r.i18n.getText("AggrSettings","UnaggrBtn")).on("click",t.removeAggrBtnClickHandler.bind(t))}))})),"continue"}if(c.selectState.columns.indexOf(e.id)>=0){if(null==s){var p=(0,ut.domel)("div",c.slot).addClass("".concat(c.cssPrefix,"-selected"));s=(0,ut.domel)("div",p.toDOM()).addClass("".concat(c.cssPrefix,"-columns"))}return c.renderColumn(s,e,!1),"continue"}c.renderColumn(n,e,!1)},c=this,d=0,h=e;d<h.length;d++){u(h[d])}if(s){var p=(0,ut.domel)("div",s.toDOM().parentElement).addClass("".concat(this.cssPrefix,"-buttons"));p.addChild("button",(function(e){return e.addClass("".concat(t.cssPrefix,"-group-btn")).title(r.i18n.getText("AggrSettings","GroupBtn")).on("click",t.groupBtnClickHandler.bind(t))})),1==this.selectState.columns.length&&p.addChild("button",(function(e){return e.addClass("".concat(t.cssPrefix,"-aggr-btn")).title(r.i18n.getText("AggrSettings","AggrBtn")).on("click",t.aggrBtnClickHandler.bind(t))}))}(0,ut.domel)(this.slot).addChild("div",(function(e){return e.addClass("".concat(t.cssPrefix,"-counts")).addChild("label",(function(e){return e.addClass("eqjs-ctrl-switch").addChild("input",(function(e){e.attr("type","checkbox"),t.state.recordCount&&e.attr("checked",""),e.on("change",t.countsCheckboxChangeHandler.bind(t))})).addChild("span",(function(t){return t.addClass("slider round")})).addChild("span",(function(t){return t.addClass("switch-text").addText(r.i18n.getText("AggrSettings","GroupCountsLabel"))}))}))})).addChild("div",(function(e){return e.addClass("".concat(t.cssPrefix,"-grandtotals")).addChild("label",(function(e){return e.addClass("eqjs-ctrl-switch").addChild("input",(function(e){e.attr("type","checkbox"),t.state.grandTotals&&e.attr("checked",""),e.on("change",t.grandCheckboxChangeHandler.bind(t))})).addChild("span",(function(t){return t.addClass("slider round")})).addChild("span",(function(t){return t.addClass("switch-text").addText(r.i18n.getText("AggrSettings","GrandTotalsLabel"))}))}))})),this.slot.querySelectorAll(".".concat(this.cssPrefix,"-group")).forEach((function(e){(0,ut.domel)(e).addChild("div",(function(e){return e.addClass("".concat(t.cssPrefix,"-buttons")).addChild("button",(function(e){return e.addClass("".concat(t.cssPrefix,"-ungroup-btn")).title(r.i18n.getText("AggrSettings","UngroupBtn")).on("click",t.removeGroupBtnClickHandler.bind(t))}))}))})),this.validateCheckboxes()},t.prototype.validateCheckboxes=function(){if(0!==this.selectState.columns.length){for(var t,e,n=null,o=0;o<this.slot.childNodes.length;o++){(s=this.slot.childNodes[o]).classList.contains("".concat(this.cssPrefix,"-selected"))?t&&t.classList.contains("".concat(this.cssPrefix,"-column"))&&(e=t):s.classList.contains("".concat(this.cssPrefix,"-column"))&&t&&t.classList.contains("".concat(this.cssPrefix,"-selected"))&&(n=s),t=s}for(o=0;o<this.slot.childNodes.length;o++){(s=this.slot.childNodes[o]).classList.contains("".concat(this.cssPrefix,"-column"))&&s!=e&&s!=n&&s.firstElementChild.firstElementChild.setAttribute("disabled","")}var i=".".concat(this.cssPrefix,"-selected>.").concat(this.cssPrefix,"-columns>.").concat(this.cssPrefix,"-column"),r=this.slot.querySelectorAll(i);for(o=1;o<r.length-1;o++){var s;(s=r[o]).firstElementChild.firstElementChild.setAttribute("disabled","")}}},t.prototype.isValid=function(){var t=this.selectState.columns.length,e=this.state.aggregates.length>0,n=this.state.groups.length>0,o=this.state.grandTotals,i=this.state.recordCount;return!t&&(n?e||i:!!e&&(n||o))},t.prototype.getValidationMessage=function(){var t=this.selectState.columns.length,e=this.state.aggregates.length>0,n=this.state.groups.length>0,o=this.state.grandTotals,i=this.state.recordCount;return"".concat(t?r.i18n.getText("AggrSettings","SelectedError"):!n||e||i?!e||n||o?r.i18n.getText("AggrSettings","NoGroupsOrAggrError"):r.i18n.getText("AggrSettings","NoGroupsOrGrandError"):r.i18n.getText("AggrSettings","NoAggrOrCountError")," ")},t.prototype.getSettings=function(){for(var t=new r.AggregationSettings(this.query),e=0,n=this.state.groups;e<n.length;e++){var o=n[e];t.addGroup({columns:o.columns})}for(var i=0,s=this.state.aggregates;i<s.length;i++){var a=s[i];t.addAggregateColumn(a.colId,a.funcId)}return this.state.grandTotals&&t.addGrandTotals(),this.state.recordCount&&t.addCounts(),t},t.prototype.renderColumn=function(t,e,n,o){var i=this;void 0===o&&(o=null),t.addChild("div",(function(t){t.data("colid",e.id);var r=o?"".concat(e.caption," (").concat(i.funcMap[o].caption,")"):e.caption;n?t.addClass("".concat(i.cssPrefix,"-column-used")).addText(r):t.addClass("".concat(i.cssPrefix,"-column")).addChild("label",(function(t){return t.addClass("checkbox").addChild("input",(function(t){t.attr("type","checkbox"),i.selectState.columns.indexOf(e.id)>=0&&t.attr("checked",""),t.on("change",i.colCheckboxChangeHandler.bind(i))})).addText(r)}))}))},t.prototype.getGroupForColumn=function(t){var e=this.getGroupIndexForColumn(t);return e>=0?this.state.groups[e]:null},t.prototype.getGroupIndexForColumn=function(t){for(var e=0;e<this.state.groups.length;e++){if(this.state.groups[e].columns.indexOf(t)>=0)return e}return-1},t.prototype.grandCheckboxChangeHandler=function(t){this.state.grandTotals=!this.state.grandTotals,this.onChanged&&this.onChanged()},t.prototype.countsCheckboxChangeHandler=function(t){this.state.recordCount=!this.state.recordCount,this.onChanged&&this.onChanged()},t.prototype.colCheckboxChangeHandler=function(t){var e=t.target.parentElement.parentElement.getAttribute("data-colid"),n=this.selectState.columns.indexOf(e);if(n>=0)this.selectState.columns.splice(n,1);else{this.selectState.columns.push(e);var o=this.getAvailableColumns();this.selectState.columns=this.selectState.columns.sort((function(t,e){return o.findIndex((function(e){return e.id==t}))-o.findIndex((function(t){return t.id==e}))}))}this.changed()},t.prototype.groupBtnClickHandler=function(){this.state.groups.push({columns:this.selectState.columns});var t=this.getAvailableColumns();this.state.groups=this.state.groups.sort((function(e,n){return t.findIndex((function(t){return t.id==e.columns[0]}))-t.findIndex((function(t){return t.id==n.columns[0]}))})),this.dropSelectState(),this.changed()},t.prototype.removeGroupBtnClickHandler=function(t){var e=t.target,n=Number.parseInt(e.parentElement.parentElement.getAttribute("data-gindex"));this.state.groups.splice(n,1),this.changed()},t.prototype.removeAggrBtnClickHandler=function(t){var e=t.target.parentElement.parentElement.querySelector(".".concat(this.cssPrefix,"-column-used")).getAttribute("data-colid"),n=this.state.aggregates.findIndex((function(t){return t.colId==e}));n>=0&&(this.state.aggregates.splice(n,1),this.changed())},t.prototype.aggrBtnClickHandler=function(t){var e=this,n=(this.query.getModel(),this.selectState.columns[0]),o=this.getAvailableColumns().filter((function(t){return t.id==n}))[0];this.functionMenu.showMenu({anchor:t.target,itemFilterCallback:function(t){return e.funcMap[t.id].appliedTypes.indexOf(o.expr.dataType)>=0},itemSelectedCallback:function(t){e.state.aggregates.push({colId:n,funcId:t.id}),e.dropSelectState(),e.changed()}})},t.prototype.clear=function(){this.dropSelectState(),this.dropState(),this.changed()},t.prototype.dropSelectState=function(){this.selectState={columns:[]}},t.prototype.dropState=function(){this.state={groups:[],aggregates:[],recordCount:!0,grandTotals:!1}},t.prototype.changed=function(){this.onChanged&&this.onChanged(),this.renderCore()},t.prototype.createFunctionMenu=function(){for(var t=this.query.getModel(),e=[],n=0,o=this.query.getModel().getAggrFunctions();n<o.length;n++){var i=o[n];if(i){this.funcMap[i.id]=i;var r=t.getAggrFunctionCaption(i.id),s={id:i.id,text:r};e.push(s)}}var a=this.slot.id;a&&(a+="-FunctionsMenu");var l={items:e,id:a,searchBoxAlwaysShown:!1,domWriteItemsId:!0};this.functionMenu=new gt(l)},t}(),fn=__webpack_require__(702),gn=function(){function t(t){this.context=t,this.promise=null}return t.prototype.show=function(t){var e=this,n=t||this.context.getQuery();return this.query=this.context.createQuery(),this.query.loadFromData(n.toJSONData()),this.promise||(this.promise=new fn((function(t,o){var i=e.context.getServices().getDialogService();e.body=e.renderBody();var s=i.open({title:r.i18n.getText("AggrSettings","AggrDialogTitle"),body:e.body,onSubmit:function(){return!(e.query.enableAggregation&&!e.renderer.isValid())&&(n.enableAggregation=e.query.enableAggregation,n.enableAggregation&&n.useAggregation((function(t){var n=e.renderer.getSettings();t.loadFromData(n.saveToData())})),n.fireChangedEvent({part:x.Aggregation,wasModified:!1}),t(),!0)},onCancel:function(){t()}});e.renderer=new pn({slot:e.body.querySelector("#AggrSettingsComponent"),query:e.query,onChanged:function(){s.clearAlert();var t=e.renderer.isValid();if(!t){var n=e.renderer.getValidationMessage();s.showAlert(n,"warning")}s.getRootElement().querySelector(".kfrm-button.is-info").disabled=!t&&e.query.enableAggregation}}),e.query.enableAggregation&&e.renderer.render()}))),this.promise.catch((function(t){return console.error(t)})).finally((function(){return e.promise=null}))},t.prototype.renderBody=function(){var t=this;return(0,ut.domel)("div").addChild("div",(function(e){return e.addClass("eqjs-as-enableaggr").addChild("label",(function(e){return e.addClass("eqjs-ctrl-switch").addChild("input",(function(e){e.attr("type","checkbox"),t.query.enableAggregation&&e.attr("checked",""),e.on("change",t.enableAggrCheckBoxChangeHandler.bind(t))})).addChild("span",(function(t){return t.addClass("slider round")})).addChild("span",(function(t){return t.addClass("switch-text").addText(r.i18n.getText("AggrSettings","EnableAggrLabel"))}))}))})).addChild("div",(function(t){return t.id("AggrSettingsComponent")})).toDOM()},t.prototype.enableAggrCheckBoxChangeHandler=function(t){if(this.query.enableAggregation=!this.query.enableAggregation,this.body.querySelector("#AggrSettingsComponent").innerHTML="",this.query.enableAggregation)this.renderer.render();else{var e=this.body?this.body.closest(".kdlg-modal").querySelector("footer .kfrm-button.is-info"):null;e&&(e.disabled=!1)}},t}(),yn=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),mn=function(t){function e(e,n){var o=t.call(this,e)||this;return o.linkClickCallback=function(){new gn(o.context).show(o.getQuery())},o.queryEventCallbackId=null,o.customQuery=n,o.group=A.Query|A.QueryStatus,o}return yn(e,t),e.prototype.init=function(e,n){t.prototype.init.call(this,e,n),this.destroyCore(),this.attachQueryObserver()},Object.defineProperty(e.prototype,"cssPrefix",{get:function(){return"eqjs-aggrb"},enumerable:!1,configurable:!0}),e.prototype.getWidgetType=function(){return"aggregationBar"},e.prototype.refreshCore=function(){this.render()},e.prototype.getLinkText=function(){var t=this.getQuery();if(t.enableAggregation){for(var e=t.getAggregationSettings(),n=e.getInternalGroups(),o=e.getAggregates(),i=[],s=t.getColumns(),a=0,l=n;a<l.length;a++){var u=l[a].columns.map((function(t){var e=s.find((function(e){return e.id==t}));return e?e.caption:""}));i.push("[".concat(u.join(", "),"]"))}for(var c=i.join(", "),d=[],h=t.getModel().getAggrFunctions(),p=function(t){var e=s.find((function(e){return e.id==t.colId})),n=h.find((function(e){return e.id==t.funcId}));e&&n&&d.push("".concat(e.caption," (").concat(n.caption,")"))},f=0,g=o;f<g.length;f++){p(g[f])}var y=d.join(", ");return"".concat(c||r.i18n.getText("AggrSettings","NoGroupsLabel")," ::: ").concat(y?"<".concat(y,">"):r.i18n.getText("AggrSettings","NoAggrsLabel"))}return r.i18n.getText("AggrSettings","EmptySettingsLabel")},e.prototype.render=function(){this.slot.classList.add("".concat(this.cssPrefix,"-panel"));var t=dt.z.getMobileCssClass();t&&this.slot.classList.add(t),this.dialogLink||(this.dialogLink=document.createElement("a"),this.dialogLink.setAttribute("href","javascript:void(0)"),this.slot.appendChild(this.dialogLink)),this.dialogLink.textContent=this.getLinkText(),this.dialogLink.removeEventListener("click",this.linkClickCallback),this.dialogLink.addEventListener("click",this.linkClickCallback)},e.prototype.clear=function(){this.slot.innerHTML="",this.dialogLink=null},e.prototype.attachQueryObserver=function(){var t=this,e=this.getQuery();this.queryEventCallbackId=e.addChangedCallback((function(e){t.refreshCore()}))},e.prototype.detachQueryObserver=function(){this.queryEventCallbackId&&this.getQuery().removeChangedCallback(this.queryEventCallbackId)},e.prototype.destroyCore=function(){this.clear(),this.detachQueryObserver()},e.prototype.getQuery=function(){return this.customQuery||this.context.getQuery()},e}(st),vn=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Cn=function(t){function e(e){var n=t.call(this,e)||this;return n.changeLocale=function(){var t=n.selectEl.value;r.i18n.setCurrentLocale(t),n.context.refreshWidgets(A.All)},n.group=A.None,n}return vn(e,t),e.prototype.init=function(e,n){t.prototype.init.call(this,e,n),this.clear(),this.render()},e.prototype.getWidgetType=function(){return"changeLocale"},e.prototype.render=function(){var t=r.i18n.getLocales();if(t.length>1){this.selectEl=document.createElement("select");for(var e=0,n=t;e<n.length;e++){var o=n[e],i=document.createElement("option");i.value=o.locale,i.innerHTML=this.displayLocaleName(o),this.selectEl.appendChild(i)}this.selectEl.value=r.i18n.getCurrentLocale(),this.selectEl.classList.add("eqv-select"),this.selectEl.addEventListener("change",this.changeLocale),this.slot.appendChild(this.selectEl)}},e.prototype.displayLocaleName=function(t){return t.englishName&&t.displayName?"".concat(t.englishName," - ").concat(t.displayName):t.englishName?t.englishName:t.displayName?t.displayName:t.locale},e.prototype.clear=function(){this.slot.innerHTML=""},e.prototype.destroyCore=function(){this.clear()},e}(st),bn=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),xn=function(t){function e(e){var n=t.call(this,e)||this;return n.queryEventCallbackId=null,n.group=A.Query|A.QueryStatus,n}return bn(e,t),e.prototype.init=function(e,n){t.prototype.init.call(this,e,n),this.destroyCore(),this.attachQueryObserver()},Object.defineProperty(e.prototype,"cssPrefix",{get:function(){return"eqjs-query-name"},enumerable:!1,configurable:!0}),e.prototype.getWidgetType=function(){return"queryName"},e.prototype.refreshCore=function(){this.render()},e.prototype.render=function(){this.slot.classList.add("".concat(this.cssPrefix));var t=dt.z.getMobileCssClass();t&&this.slot.classList.add(t),this.nameSlot||(this.nameSlot=document.createElement("div"),this.nameSlot.classList.add("".concat(this.cssPrefix,"-text")),this.nameSlot.classList.add("".concat(this.cssPrefix,"-theme")),this.slot.appendChild(this.nameSlot)),this.asteriskSlot||(this.asteriskSlot=document.createElement("span"),this.asteriskSlot.innerHTML="*",this.asteriskSlot.classList.add("".concat(this.cssPrefix,"-asterisk")),this.slot.appendChild(this.asteriskSlot)),this.tooltipSlot||(this.tooltipSlot=document.createElement("span"),this.tooltipSlot.classList.add("".concat(this.cssPrefix,"-tooltip")),this.tooltipSlot.classList.add("".concat(this.cssPrefix,"-theme")),this.slot.appendChild(this.tooltipSlot));var e=this.context.getQuery().getName();this.nameSlot.textContent=e,this.tooltipSlot.textContent=e,this.asteriskSlot.style.visibility=this.context.getQuery().isModified()?"visible":"hidden"},e.prototype.clear=function(){this.slot.innerHTML="",this.nameSlot=null,this.tooltipSlot=null,this.asteriskSlot=null},e.prototype.attachQueryObserver=function(){var t=this,e=this.context.getQuery();this.queryEventCallbackId=e.addChangedCallback((function(e){t.refreshCore()}))},e.prototype.detachQueryObserver=function(){this.queryEventCallbackId&&this.context.getQuery().removeChangedCallback(this.queryEventCallbackId)},e.prototype.destroyCore=function(){this.clear(),this.detachQueryObserver()},e}(st),wn=function(){function t(){this.domRoots=[document],this.defaultViewOptions={enableExport:!0,disableConfirmationOnQueryChange:!1,queryFileExtensions:"text/xml,application/json",result:{clearResultOnQueryChange:!0,showChart:!0,showProcessIndicator:!0},widgets:{resultGrid:{addColumns:!1}},handlers:{}},this.viewOptions={},this.resultOptions={},this.enableExport=!1,this.resetContext(),this.renderSpinner()}return t.prototype.resetContext=function(){this.context=new rt,this.context.getServices().registerDialogServiceResolver((function(){return new ut.DefaultDialogService}))},t.prototype.init=function(t){try{this.context.initStart(),t&&t.shadowRoots&&(this.domRoots=this.domRoots.concat(t.shadowRoots)),this.viewOptions=this.initOptions(t),this.resultOptions=r.utils.assignDeep(this.defaultViewOptions.result,this.viewOptions.result),this.initWidgets(this.viewOptions),this.context.init(this.viewOptions),this.initDone()}catch(t){this.context.throwError({action:"Init",sourceError:t})}},t.prototype.initOptions=function(t){return(t=r.utils.assignDeep(this.defaultViewOptions,t)).widgets.easyGrid||(t.widgets.easyGrid=t.widgets.resultGrid||{}),t.columnTitleFormat&&(t.widgets.entitiesPanel=t.widgets.entitiesPanel||{},t.widgets.entitiesPanel.columnTitleFormat=t.widgets.entitiesPanel.columnTitleFormat||t.columnTitleFormat,t.widgets.columnsBar=t.widgets.columnsBar||{},t.widgets.columnsBar.titleElementFormat=t.widgets.columnsBar.titleElementFormat||t.columnTitleFormat,t.widgets.columnsPanel=t.widgets.columnsPanel||{},t.widgets.columnsPanel.titleElementFormat=t.widgets.columnsPanel.titleElementFormat||t.columnTitleFormat),t.widgets.easyGrid.paging=r.utils.assignDeep({},t.result.paging,t.widgets.easyGrid.paging),this.enableExport=t.enableExport||!1,t.widgets.exportWidget||(t.widgets.exportWidget={}),t.widgets.exportWidget.enableExport=this.enableExport,t},t.prototype.initWidgets=function(t){var e="QueryPanel",n="ColumnsPanel",o="EntitiesPanel",i="ResultPanel",r="ColumnsBar",s="FilterBar",a="ProcessBar",l="StatementPanel",u="ChangeLocale",c="QueryNameLabel",d="ResultFacetsPanel",h="ResultCount",p="ExportButton",f="AggregationBar";t.slots&&(c=t.slots.queryNameLabel||c,e=t.slots.queryPanel||e,n=t.slots.columnsPanel||n,r=t.slots.columnsBar||r,o=t.slots.entitiesPanel||o,i=t.slots.resultPanel||i,l=t.slots.statementPanel||l,a=t.slots.processBar||a,u=t.slots.changeLocale||u,d=t.slots.facetsPanel||d,h=t.slots.resultCountSpan||h,s=t.slots.filterBar||s,p=t.slots.exportButtons||p,f=t.slots.aggregationBar||f);var g=this.resolveElement(o);g&&!this.entitiesPanelWidget&&(this.entitiesPanelWidget=this.createEntitiesPanelWidget(g),this.context.addWidget(this.entitiesPanelWidget));var y=this.resolveElement(n);y&&!this.columnsPanelWidget&&(this.columnsPanelWidget=this.createColumnsPanelWidget(y),this.context.addWidget(this.columnsPanelWidget));var m=this.resolveElement(r);m&&!this.columnsBarWidget&&(this.columnsBarWidget=this.createColumnsBarWidget(m),this.context.addWidget(this.columnsBarWidget));var v=this.resolveElement(e);if(v&&!this.queryPanelWidget&&(this.queryPanelWidget=this.createQueryPanelWidget(v),this.context.addWidget(this.queryPanelWidget)),this.resultPanelSlot=this.resolveElement(i),this.resultPanelSlot){if(!this.resultGridWidget){var C=(0,ut.addElement)(this.resultPanelSlot,"div",{cssClass:"eqv-result-grid"});this.resultGridWidget=this.createResultGridWidget(C),this.context.addWidget(this.resultGridWidget)}if(this.resultOptions.showChart&&!this.chartWidget){var b=(0,ut.addElement)(this.resultPanelSlot,"div",{cssClass:"eqv-chart-panel"});b.style.display="none",this.chartWidget=this.createChartWidget(b),this.context.addWidget(this.chartWidget)}}var x=this.resolveElement(c);x&&!this.queryNameWidget&&(this.queryNameWidget=this.createQueryNameWidget(x),this.context.addWidget(this.queryNameWidget));var w=this.resolveElement(s);w&&!this.filterBarWidget&&(this.filterBarWidget=this.createFilterBarWidget(w),this.context.addWidget(this.filterBarWidget));var E=this.resolveElement("SortingBar");E&&!this.sortingBarWidget&&(this.sortingBarWidget=this.createSortingBarWidget(E),this.context.addWidget(this.sortingBarWidget));var T=this.resolveElement(a);T&&!this.processWidget&&(this.processWidget=this.createProcessWidget(T),this.context.addWidget(this.processWidget));var D=this.resolveElement(l);D&&!this.statementPanelWidget&&(this.statementPanelWidget=this.createStatementPanelWidget(D),this.context.addWidget(this.statementPanelWidget));var S=this.resolveElement(u);if(S){var k=this.createLocaleWidget(S);this.context.addWidget(k)}var M=this.resolveElement(d);M&&!this.resultFacetPanelWidget&&(this.resultFacetPanelWidget=this.createResultFacetsPanel(M),this.context.addWidget(this.resultFacetPanelWidget));var I=this.resolveElement(p);I&&!this.exportWidget&&(this.exportWidget=this.createExportWidget(I),this.context.addWidget(this.exportWidget)),this.resultCountSlot=this.resolveElement(h);var B=this.resolveElement(f);B&&!this.aggregationBarWidget&&(this.aggregationBarWidget=this.createAggregationBarWidget(B),this.context.addWidget(this.aggregationBarWidget))},t.prototype.initDone=function(){},t.prototype.resolveElement=function(t){if("string"==typeof t){for(var e=0,n=this.domRoots;e<n.length;e++){var o=n[e].getElementById(t);if(o)return o}return null}return t},t.prototype.resolveElementsByClassName=function(t){for(var e=[],n=0,o=this.domRoots;n<o.length;n++)for(var i=o[n].querySelectorAll("."+t),r=0;r<i.length;r++)e.push(i[r]);return e},t.prototype.displayRecordsCount=function(t){this.resultCountSlot&&void 0!==t&&(this.resultCountSlot.style.display="inline",this.resultCountSlot.innerHTML=r.i18n.getText("MsgResultCount").replace("{0}",t.toString()))},t.prototype.getContext=function(){return this.context},t.prototype.setDialogService=function(t){this.context.getServices().registerDialogServiceResolver((function(){return t}))},t.prototype.executeQuery=function(t){console.warn("`executeQuery` is deprecated. Use `fetchData` instead"),this.fetchData(t)},t.prototype.fetchData=function(t){var e=this;t=t||{refresh:!0},this.context.clearResult(),this.context.getQuery().isEmpty()&&!this.resultOptions.fetchEmptyQueries||(this.showResultSpinner(),this.context.fetchData({elasticPaging:t.elasticPaging,success:function(n){e.hideResultSpinner(),e.toggleExportButtons(),e.displayRecordsCount(e.context.resultTable.getTotal()),!0===t.refresh&&e.context.refreshWidgets(A.Result),t.callback&&t.callback(),t.success&&t.success()},error:function(){e.hideResultSpinner()}}))},t.prototype.toggleExportButtons=function(){this.enableExport&&this.context.resultTable&&this.context.resultTable.getCachedCount()>0?this.enableExportButtons():this.disableExportButtons()},t.prototype.enableExportButtons=function(){},t.prototype.disableExportButtons=function(){},t.prototype.renderSpinner=function(){this._spinnerDiv=(0,ut.domel)("div").addClass("eqjs-result-spinner").addChild("div",(function(t){return t.addClass("".concat(ct.YR,"-progress-win8"),dt.z.getMobileCssClass()).addHtml('<div class="wBall" id="wBall_1"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_2"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_3"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_4"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_5"><div class="wInnerBall"></div></div>')})).toDOM()},t.prototype.showResultSpinner=function(){if(this.resultOptions.showProcessIndicator&&this.resultPanelSlot&&!this._spinnerDiv.parentNode){for(var t=0;t<this.resultPanelSlot.children.length;t++){var e=this.resultPanelSlot.children[t];(0,ut.domel)(e).hide()}this.resultPanelSlot.appendChild(this._spinnerDiv)}},t.prototype.hideResultSpinner=function(){if(this.resultOptions.showProcessIndicator&&this.resultPanelSlot&&this._spinnerDiv.parentNode){this._spinnerDiv.parentNode.removeChild(this._spinnerDiv);for(var t=0;t<this.resultPanelSlot.children.length;t++){var e=this.resultPanelSlot.children[t];(0,ut.domel)(e).show()}}},t.prototype.createChartWidget=function(t){return this.resultOptions.chartWidgetResolver?this.resultOptions.chartWidgetResolver(t):new Ke(t)},t.prototype.createResultGridWidget=function(t){return this.resultOptions.resultGridResolver?this.resultOptions.resultGridResolver(t):new Ae(t)},t.prototype.createEntitiesPanelWidget=function(t){return new pt(t)},t.prototype.createColumnsPanelWidget=function(t){return new kt(t)},t.prototype.createQueryPanelWidget=function(t){return new be(t)},t.prototype.createLocaleWidget=function(t){return new Cn(t)},t.prototype.createProcessWidget=function(t){return new Le(t)},t.prototype.createColumnsBarWidget=function(t){return new Ot(t)},t.prototype.createFilterBarWidget=function(t){return new we(t)},t.prototype.createSortingBarWidget=function(t){return new Ft(t)},t.prototype.createQueryNameWidget=function(t){return new xn(t)},t.prototype.createStatementPanelWidget=function(t){return new Pe(t)},t.prototype.createResultFacetsPanel=function(t){return new cn(t)},t.prototype.createExportWidget=function(t){return new hn(t)},t.prototype.createAggregationBarWidget=function(t){return new mn(t)},t.prototype.detach=function(){this.entitiesPanelWidget&&(this.entitiesPanelWidget.destroy(),this.entitiesPanelWidget=null),this.columnsPanelWidget&&(this.columnsPanelWidget.destroy(),this.columnsPanelWidget=null),this.queryPanelWidget&&(this.queryPanelWidget.destroy(),this.queryPanelWidget=null),this.columnsBarWidget&&(this.columnsBarWidget.destroy(),this.columnsBarWidget=null),this.resultGridWidget&&(this.resultGridWidget.destroy(),this.resultGridWidget=null),this.chartWidget&&(this.chartWidget.destroy(),this.chartWidget=null),this.queryNameWidget&&(this.queryNameWidget.destroy(),this.queryNameWidget=null),this.processWidget&&(this.processWidget.destroy(),this.processWidget=null),this.localeWidget&&(this.localeWidget.destroy(),this.localeWidget=null),this.statementPanelWidget&&(this.statementPanelWidget.destroy(),this.statementPanelWidget=null),this.filterBarWidget&&(this.filterBarWidget.destroy(),this.filterBarWidget=null),this.sortingBarWidget&&(this.sortingBarWidget.destroy(),this.sortingBarWidget=null),this.statementWidget&&(this.statementWidget.destroy(),this.statementWidget=null),this.exportWidget&&(this.exportWidget.destroy(),this.exportWidget=null),this.resultFacetPanelWidget&&(this.resultFacetPanelWidget.destroy(),this.resultFacetPanelWidget=null),this.resultCountSlot&&(this.resultCountSlot.innerHTML="",this.resultCountSlot=null),this.resultPanelSlot&&(this.resultPanelSlot.innerHTML="",this.resultPanelSlot=null),this.domRoots=[document],this.resetContext()},t}(),En=__webpack_require__(702),Tn=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Dn=function(t){function e(){var e=t.call(this)||this;e.exportButtons=[],e.disabledClass="eqjs-disabled",e.dropdownContainerClass="eqv-dropdown-container",e.dropdownButtonClass="eqv-drop-button",e.dropdownContentClass="eqv-dropdown-content",e.dropdownShowClass="eqv-dropdown-show",e._querySaveTemplate='<div id="kdlg-dialog-form" class="kfrm-form">\n <div class="kfrm-fields label-above">\n <label for="kdlg-dialog-form-input" id="kdlg-dialog-form-content"></label>\n <input type="text" name="kdlg-dialog-form-input" id="kdlg-dialog-form-input" />\n </div>\n </div>',e.queryListMenu=null,e.fetchDataButtonClickHandler=e.fetchDataButtonClick.bind(e),e.clearQueryButtonClickHandler=e.clearQueryButtonClick.bind(e),e.newQueryButtonClickHandler=e.newQueryButtonClick.bind(e),e.loadQueryButtonClickHandler=e.loadQueryButtonClick.bind(e),e.saveQueryButtonClickHandler=e.saveQueryButtonClick.bind(e),e.copyQueryButtonClickHandler=e.copyQueryButtonClick.bind(e),e.removeQueryButtonClickHandler=e.removeQueryButtonClick.bind(e),e.storageButtonClickHandler=e.storageDropButtonClick.bind(e),e.saveQueryToFileButtonClickHandler=e.saveQueryToFileButtonClick.bind(e),e.loadQueryFromFileButtonClickHandler=e.loadQueryFromFileButtonClick.bind(e);var n=e;return e.exportButtonClickHandler=function(t){if(!this.classList.contains(n.disabledClass)){var e=this.getAttribute("data-format");n.getContext().exportResult({format:e})}},e.queryChangedHandler=function(t){var n=t.data;e.resultOptions.clearResultOnQueryChange&&(e.context.clearResult(),e.context.refreshWidgets(A.Result)),e.disableExportButtons(),e.resultCountSlot&&(e.resultCountSlot.style.display="none"),e.viewOptions.syncQueryOnChange&&e.syncQuery(),e.viewOptions.fetchDataOnChange&&(!n||n.part!=x.ExtraData&&n.part!=x.Facets)&&e.fetchData()},e.outsideClickHandler=function(t){var n=null;t.target.matches(".".concat(e.dropdownButtonClass))?n=t.target.parentElement.querySelector(".".concat(e.dropdownContentClass)):t.target.matches(".".concat(e.dropdownButtonClass," > span"))&&(n=t.target.parentElement.parentElement.querySelector(".".concat(e.dropdownContentClass)));for(var o=e.resolveElementsByClassName(e.dropdownContentClass),i=0;i<o.length;i++){var r=o[i];n!=r&&r.classList.contains(e.dropdownShowClass)&&r.classList.remove(e.dropdownShowClass)}},e}return Tn(e,t),e.prototype.refreshQueryList=function(){var t=this;this.queryListPanel&&(this.queryListPanel.innerHTML="",this.context.loadQueryList({success:function(e){var n=(0,ut.domel)("ul",t.queryListPanel).addClass("list-group list-group-flush");e.map((function(e){n.addChild("li",(function(n){n.addClass("list-group-item").setStyle("cursor","pointer").data("id",e.id).text(e.name).on("click",(function(){t.checkIfQueryModified((function(){return t.loadQuery(e.id)}))}))}))}))}}))},e.prototype.initOptions=function(e){return void 0===(e=t.prototype.initOptions.call(this,e)).syncQueryOnChange&&(e.syncQueryOnChange=!0),e},e.prototype.initWidgets=function(e){var n=this;t.prototype.initWidgets.call(this,e);var o="eqjs-export",i="QueryContentJson",r="ClearQueryButton",s="NewQueryButton",a="LoadQueryButton",l="SaveQueryButton",u="CopyQueryButton",c="RemoveQueryButton",d="StorageDropButton",h="FetchDataButton",p="LoadQueryFromFileButton",f="SaveQueryToFileButton",g="QueryListPanel";e.slots&&(i=e.slots.queryContentInput||i,h=e.slots.fetchDataButton||h,r=e.slots.clearQueryButton||r,s=e.slots.newQueryButton||s,a=e.slots.loadQueryButton||a,l=e.slots.saveQueryButton||l,u=e.slots.copyQueryButton||u,c=e.slots.removeQueryButton||c,d=e.slots.storageButton||d,o=e.slots.exportClass||o,p=e.slots.loadQueryFromFileButton||p,f=e.slots.saveQueryToFileButton||f,g=e.slots.queryListPanel||g),this.exportButtons=this.domRoots.reduce((function(t,e){return t.concat(Array.from(e.querySelectorAll(".".concat(o))))}),[]),e.enableExport||this.hideExportButtons(),this.disableExportButtons();this.exportButtons.forEach((function(t){t.addEventListener("click",n.exportButtonClickHandler)})),this.fetchDataButton||(this.fetchDataButton=this.resolveElement(h),this.fetchDataButton||(this.fetchDataButton=this.resolveElement("ExecuteQueryButton")),this.fetchDataButton&&this.fetchDataButton.addEventListener("click",this.fetchDataButtonClickHandler)),this.clearQueryButton||(this.clearQueryButton=this.resolveElement(r),this.clearQueryButton&&this.clearQueryButton.addEventListener("click",this.clearQueryButtonClickHandler)),this.newQueryButton||(this.newQueryButton=this.resolveElement(s),this.newQueryButton&&this.newQueryButton.addEventListener("click",this.newQueryButtonClickHandler)),this.loadQueryButton||(this.loadQueryButton=this.resolveElement(a),this.loadQueryButton&&this.loadQueryButton.addEventListener("click",this.loadQueryButtonClickHandler)),this.saveQueryButton||(this.saveQueryButton=this.resolveElement(l),this.saveQueryButton&&this.saveQueryButton.addEventListener("click",this.saveQueryButtonClickHandler)),this.copyQueryButton||(this.copyQueryButton=this.resolveElement(u),this.copyQueryButton&&this.copyQueryButton.addEventListener("click",this.copyQueryButtonClickHandler)),this.removeQueryButton||(this.removeQueryButton=this.resolveElement(c),this.removeQueryButton&&this.removeQueryButton.addEventListener("click",this.removeQueryButtonClickHandler)),this.storageDropButton||(this.storageDropButton=this.resolveElement(d),this.storageDropButton&&this.storageDropButton.addEventListener("click",this.storageButtonClickHandler)),this.saveQueryToFileButton||(this.saveQueryToFileButton=this.resolveElement(f),this.saveQueryToFileButton&&this.saveQueryToFileButton.addEventListener("click",this.saveQueryToFileButtonClickHandler)),this.queryListPanel||(this.queryListPanel=this.resolveElement(g),this.queryListPanel||(this.queryListPanel=this.resolveElement("QueryListSlot")),this.queryListPanel&&this.context.addEventListener("ready",(function(){n.refreshQueryList()}))),this.loadQueryFromFileButton||(this.loadQueryFromFileButton=this.resolveElement(p),this.loadQueryFromFileButton&&(this.loadQueryFromFileInput=document.createElement("input"),this.loadQueryFromFileInput.type="file",this.loadQueryFromFileInput.accept=e.queryFileExtensions,this.loadQueryFromFileInput.style.display="none",document.body.appendChild(this.loadQueryFromFileInput),this.loadQueryFromFileInput.addEventListener("change",this.loadQueryFromFileInputSelect.bind(this)),this.loadQueryFromFileButton.addEventListener("click",this.loadQueryFromFileButtonClickHandler))),window.addEventListener("click",this.outsideClickHandler)},e.prototype.initDone=function(){t.prototype.initDone.call(this),this.context.getQuery().addChangedCallback(this.queryChangedHandler)},e.prototype.syncQuery=function(){var t=this;this.context.syncQuery({success:function(e){e.statement&&t.context.refreshWidgets(A.Statement)}})},e.prototype.disableExportButtons=function(){var t=this;this.exportButtons.forEach((function(e){e.disabled=!0,e.classList.contains(t.disabledClass)||e.classList.add(t.disabledClass)}))},e.prototype.enableExportButtons=function(){var t=this;this.exportButtons.forEach((function(e){e.disabled=!1,e.classList.contains(t.disabledClass)&&e.classList.remove(t.disabledClass)}))},e.prototype.hideExportButtons=function(){this.exportButtons.forEach((function(t){t.style.display="none"}))},e.prototype.clearQueryButtonClick=function(){this.context.clearQuery(),this.context.refreshWidgets(A.Statement)},e.prototype.createNewQuery=function(t){return this.context.newQuery(t)},e.prototype.loadQuery=function(t){t&&this.context.loadQuery({queryId:t,silent:!1})},e.prototype.saveQuery=function(t,e){var n=this;this.context.saveQuery({success:function(){t&&t(),n.context.getQuery().fireChangedEvent({part:x.Properties,wasModified:!1}),n.refreshQueryList()},error:e})},e.prototype.saveCurrentQuery=function(t,e){var n=this;void 0===t&&(t=!1);var o=this.context.getQuery();o.isNewbie||t?this.showSaveQueryDialog((function(t){return new En((function(e){t&&(o.regenerateId(),o.setName(t),o.fireChangedEvent({part:x.Properties,wasModified:!0}),n.saveQuery((function(){e({success:!0})}),(function(t){return e({success:!1,message:t})})))}))})):this.saveQuery(e)},e.prototype.checkIfQueryModified=function(t){var e=this;this.context.getQuery().isModified()&&!this.viewOptions.disableConfirmationOnQueryChange?this.showQueryChangedDialog((function(n){n?e.saveCurrentQuery(!1,t):t()})):t()},e.prototype.removeCurrentQuery=function(){var t=this;this.context.removeQuery({success:function(){t.createNewQuery({useStorage:!1}),t.resultCountSlot&&(t.resultCountSlot.style.display="none"),t.context.clearResult(),t.refreshQueryList()}})},e.prototype.showNewQueryDialog=function(t){var e=this.context.getServices().getDialogService(),n=r.i18n.getText("NewQueryDefName"),o=e.open({title:r.i18n.getText("NewQueryTitle"),body:this._querySaveTemplate,submitable:!0,closable:!0,cancelable:!0,submitOnEnter:!0,arrangeParents:!1,beforeOpen:function(){var t=document.getElementById("kdlg-dialog-form-input");n&&(t.value=n),document.getElementById("kdlg-dialog-form-content").innerHTML=r.i18n.getText("NewQueryContent"),t.focus()},onSubmit:function(){var e=document.getElementById("kdlg-dialog-form-input").value;if(e&&e.replace(/\s/g,"").length>0){if(!t)return!0;o.disableButtons();var n=o.getRootElement().querySelector("header"),i=(0,ut.domel)("div",n).addClass("eqjs-process-bar local").toDOM();t(e).then((function(t){n.removeChild(i),o.enableButtons(),t.success?o.close():o.showAlert(t.message,"error")}))}return!1}})},e.prototype.showQueryChangedDialog=function(t){this.context.getServices().getDialogService().openConfirm(r.i18n.getText("QueryChangedTitle"),r.i18n.getText("QueryChangedContent"),t)},e.prototype.showSaveQueryDialog=function(t){var e=this.context.getServices().getDialogService(),n=this.context.getQuery(),o=n.isNewbie?n.getName():r.i18n.getText("SaveQueryDefName").replace("{queryName}",n.getName()),i=e.open({title:r.i18n.getText("SaveQueryTitle"),body:this._querySaveTemplate,submitable:!0,closable:!0,cancelable:!0,submitOnEnter:!0,arrangeParents:!1,beforeOpen:function(){var t=document.getElementById("kdlg-dialog-form-input");t.value=o,document.getElementById("kdlg-dialog-form-content").innerHTML=r.i18n.getText("SaveQueryContent"),t.focus()},onSubmit:function(){var e=document.getElementById("kdlg-dialog-form-input").value;if(e&&e.replace(/\s/g,"").length>0){if(!t)return!0;i.disableButtons();var n=i.getRootElement().querySelector("header"),o=(0,ut.domel)("div",n).addClass("eqjs-process-bar local").toDOM();t(e).then((function(t){i.enableButtons(),n.removeChild(o),t.success?i.close():i.showAlert(t.message,"error")}))}return!1}})},e.prototype.showRemoveQueryDialog=function(t){var e=this.context.getServices().getDialogService(),n=this.context.getQuery();e.openConfirm(r.i18n.getText("RemoveQueryTitle"),r.i18n.getText("RemoveQueryContent").replace("{queryName}",n.getName()),t)},e.prototype.showSaveQueryToFileDialog=function(t){var e=this.getContext().getServices().getDialogService(),n=this.context.getQuery(),o=this.renderSaveToFileDialogBody(n.getName()),i=e.open({title:r.i18n.getText("SaveQueryToFileDlgTitle"),body:o,onSubmit:function(){var e=o.querySelector("#kdlgFileNameInput"),n=e?e.value:"Query",r=o.querySelector("#kdlgFileFormatSelector"),s=r?r.value:"json";if(t){i.disableButtons();var a=i.getRootElement().querySelector("header"),l=(0,ut.domel)("div",a).addClass("eqjs-process-bar local").toDOM();return t(n,s).then((function(t){i.enableButtons(),a.removeChild(l),t.success?i.close():i.showAlert(t.message,"error")})),!1}return!0}})},e.prototype.renderSaveToFileDialogBody=function(t,e){void 0===e&&(e="json");var n=dt.z.isIE(),o=n?"kfrm-fields-ie col-ie-1-4 label-align-right":"kfrm-fields col-a-1 label-align-right",i=n?"kfrm-fields-ie is-horizontal":"kfrm-fields is-horizontal";return(0,ut.domel)("div").addClass("kfrm-form").addChild("div",(function(n){n.addClass(o).addChild("label",(function(t){return t.attr("for","file_name").addText(r.i18n.getText("FileNameLabel"))})).addChild("div",(function(n){return n.addClass(i).addChild("input",(function(e){return e.id("kdlgFileNameInput").name("file_name").type("text").attr("value",t)})).addChild("label",(function(t){return t.addText(".")})).addChild("div",(function(t){return t.addClass("kfrm-select").addChild("select",(function(t){return t.id("kdlgFileFormatSelector").addClass("kdlg-form-control").addOption({value:"xml",selected:"xml"===e}).addOption({value:"json",selected:"json"===e})}))}))}))})).toDOM()},e.prototype.newQueryButtonClick=function(){var t=this;this.checkIfQueryModified((function(){t.createNewQuery()}))},e.prototype.saveQueryToFileButtonClick=function(){var t=this;this.showSaveQueryToFileDialog((function(e,n){return new En((function(o){t.context.getQueryFile({fileName:e,format:n,success:function(){return o({success:!0})},error:function(t){return o({success:!1,message:t})}})}))}))},e.prototype.loadQueryFromFileButtonClick=function(){var t=this;this.checkIfQueryModified((function(){t.showLoadQueryFromFileDialog()}))},e.prototype.showLoadQueryFromFileDialog=function(){this.loadQueryFromFileInput.click()},e.prototype.loadQueryFromFileInputSelect=function(){var t=this,e=this.loadQueryFromFileInput.files.item(0),n=new FormData;n.append(e.name,e),this.loadQueryFromFileInput.value="",this.context.uploadQueryFile({data:n,success:function(){t.syncQuery(),t.refreshQueryList()}})},e.prototype.loadQueryButtonClick=function(){var t=this;this.context.loadQueryList({success:function(e){t.fillLoadQueryButtonMenu(e),t.queryListMenu.showMenu({anchor:t.loadQueryButton,adjustHeight:!1,itemSelectedCallback:function(e){t.checkIfQueryModified((function(){return t.loadQuery(e.id)}))}})}})},e.prototype.fillLoadQueryButtonMenu=function(t){var e=this.getContext().getQuery();this.queryListMenu=new gt({items:t.map((function(t){return{id:t.id,text:t.name}})),selectedIds:e.getId()})},e.prototype.saveQueryButtonClick=function(){this.saveCurrentQuery()},e.prototype.copyQueryButtonClick=function(){this.saveCurrentQuery(!0)},e.prototype.removeQueryButtonClick=function(){var t=this;this.showRemoveQueryDialog((function(e){e&&t.removeCurrentQuery()}))},e.prototype.storageDropButtonClick=function(){var t=this,e=this.storageDropButton.parentElement.querySelector(".".concat(this.dropdownContentClass));e&&window.setTimeout((function(){return e.classList.toggle(t.dropdownShowClass)}),100)},e.prototype.fetchDataButtonClick=function(){this.fetchData()},e.prototype.detach=function(){var e=this;this.enableExportButtons(),this.exportButtons.forEach((function(t){t.removeEventListener("click",e.exportButtonClickHandler)})),this.exportButtons=[],this.fetchDataButton&&(this.fetchDataButton.removeEventListener("click",this.fetchDataButtonClickHandler),this.fetchDataButton=null),this.clearQueryButton&&(this.clearQueryButton.removeEventListener("click",this.clearQueryButtonClickHandler),this.clearQueryButton=null),this.newQueryButton&&(this.newQueryButton.removeEventListener("click",this.newQueryButtonClickHandler),this.newQueryButton=null),this.loadQueryButton&&(this.loadQueryButton.removeEventListener("click",this.loadQueryButtonClickHandler),this.loadQueryButton=null),this.saveQueryButton&&(this.saveQueryButton.removeEventListener("click",this.saveQueryButtonClickHandler),this.saveQueryButton=null),this.copyQueryButton&&(this.copyQueryButton.removeEventListener("click",this.copyQueryButtonClickHandler),this.copyQueryButton=null),this.removeQueryButton&&(this.removeQueryButton.removeEventListener("click",this.removeQueryButtonClickHandler),this.removeQueryButton=null),this.storageDropButton&&(this.storageDropButton.removeEventListener("click",this.storageButtonClickHandler),this.storageDropButton=null),this.saveQueryToFileButton&&(this.saveQueryToFileButton.removeEventListener("click",this.saveQueryToFileButtonClickHandler),this.saveQueryToFileButton=null),this.queryListPanel&&(this.queryListPanel=null),this.loadQueryFromFileButton&&(this.loadQueryFromFileInput&&document.body.removeChild(this.loadQueryFromFileInput),this.loadQueryFromFileButton.removeEventListener("click",this.loadQueryFromFileButtonClickHandler),this.loadQueryFromFileButton=null),t.prototype.detach.call(this)},e}(wn),Sn=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),kn=function(t){function e(){return t.call(this)||this}return Sn(e,t),e.prototype.initOptions=function(e){var n=this;return(e=t.prototype.initOptions.call(this,e)).result.fetchEmptyQueries=!0,this.context.getQuery().addChangedCallback((function(){n.resultOptions.clearResultOnQueryChange&&n.context.clearResult(),e.syncQueryOnChange&&n.context.syncQuery()})),this.context.addEventListener("ready",this.fetchData.bind(this)),e},e.prototype.initWidgets=function(e){var n=this;if(t.prototype.initWidgets.call(this,e),this.sortingBarWidget&&this.context.getQuery().addChangedCallback((function(t){var e=t.data;!e||e.part!=x.SortingColumns&&e.part!=x.Columns&&e.part!=x.All||n.fetchData()})),this.filterBarWidget){var o=this.filterBarWidget.getWidgetType();e.widgets[o]=e.widgets[o]||{},e.widgets[o].applyFilterCallback||(e.widgets[o].applyFilterCallback=function(){n.fetchData()})}},e.prototype.applyQueryFilter=function(){console.warn("applyQueryFilter is obsolete. Use fetchData instead"),this.fetchData()},e.prototype.fetchData=function(){t.prototype.fetchData.call(this,{refresh:!0})},e}(wn),Mn=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),In=function(t){function e(){return t.call(this)||this}return Mn(e,t),e.prototype.createResultGridWidget=function(t){return new Se(t)},e.prototype.applyQueryFilter=function(){console.warn("applyQueryFilter is obsolete. Use fetchData instead"),this.fetchData()},e}(kn),Bn=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),An=function(t){function e(){var e=t.call(this)||this;return e.reports=[],e.reportCache=[],e.exportButtons=[],e.exportClass="eqjs-export",e.disabledClass="eqjs-disabled",e.enableExport=!1,e.useReportCache=!0,e.syncReportOnChange=!0,e._reportSaveTemplate='<div id="kdlg-dialog-form" class="kfrm-form">\n <div class="kfrm-fields label-above">\n <label for="kdlg-dialog-form-input" id="kdlg-dialog-form-content"></label>\n <input type="text" name="kdlg-dialog-form-input" id="kdlg-dialog-form-input" />\n <label for="kdlg-dialog-form-textarea" id="kdlg-dialog-form-desc-label"></label>\n <textarea type="text" name="kdlg-dialog-form-textarea" id="kdlg-dialog-form-textarea"></textarea>\n </div>\n </div>',e.context.useStoredQueryOnFetch=!0,e.exportButtonClickHandler=function(t,n){if(!t.classList.contains(e.disabledClass)){var o=t.getAttribute("data-format");e.context.exportResult({format:o})}},e.clearReportButtonClickHandler=e.clearReportButtonClick.bind(e),e.newReportButtonClickHandler=e.newReportButtonClick.bind(e),e.loadReportButtonClickHandler=e.loadReportButtonClick.bind(e),e.saveReportButtonClickHandler=e.saveReportButtonClick.bind(e),e.removeReportButtonClickHandler=e.removeReportButtonClick.bind(e),e.reloadReportDataButtonClickHandler=e.reloadReportDataButtonClick.bind(e),dt.z.onMobileModeChanged((function(t){document.location.reload()})),e}return Bn(e,t),e.prototype.initOptions=function(e){return void 0!==(e=t.prototype.initOptions.call(this,e)).syncQueryOnChange&&(this.syncReportOnChange=e.syncQueryOnChange),void 0!==e.syncReportOnChange&&(this.syncReportOnChange=e.syncReportOnChange),e.syncQueryOnChange=this.syncReportOnChange,void 0!==e.useReportCache&&(this.useReportCache=e.useReportCache),this.defaultReportId=e.defaultReportId,e},e.prototype.initDone=function(){var e=this;t.prototype.initDone.call(this),this.context.getQuery().addChangedCallback((function(t){var n=t.data;n&&("query.switched"==n.changeType?(e.context.clearResult(),e.context.refreshWidgets(A.Result),e.context.refreshWidgets(A.Query)):(e.disableExportButtons(),e.resultCountSlot&&(e.resultCountSlot.style.display="none")));var o=!n||"query.switched"==n.changeType||n.part==x.ExtraData||n.part==x.Facets,i=!1;e.syncReportOnChange&&(n&&"query.switched"!=n.changeType&&!n.noSync&&(i=!0,e.syncReport({success:function(){!o&&e.viewOptions.fetchDataOnChange&&e.fetchData()}})));!o&&e.resultOptions.clearResultOnQueryChange&&(e.context.clearResult(),e.context.refreshWidgets(A.Result)),o||i||!e.viewOptions.fetchDataOnChange||e.fetchData()})),window.setTimeout((function(){e.context.loadQueryList({success:function(t){Array.isArray(t)&&(e.reports=t,e.reports.filter((function(t){return t.id==e.defaultReportId})).length>0?e.renderReportList({reportId:e.defaultReportId}):e.renderReportList())}})}),100)},e.prototype.initWidgets=function(e){var n=this;t.prototype.initWidgets.call(this,e);var o="ClearReportButton",i="NewReportButton",r="LoadReportButton",s="SaveReportButton",a="RemoveReportButton",l="ReloadReportDataButton",u="ResultCount",c="ResultExportButtons",d=this.exportClass;e.slots&&(u=e.slots.resultCountSpan||u,c=e.slots.exportButtons||c,o=e.slots.clearReportButton||o,i=e.slots.newReportButton||i,r=e.slots.loadReportButton||r,s=e.slots.saveReportButton||s,a=e.slots.removeReportButton||a,l=e.slots.reloadReportDataButton||l,d=e.slots.exportClass||d),this.exportButtons=this.domRoots.reduce((function(t,e){return t.concat(Array.from(e.querySelectorAll(".".concat(d))))}),[]),this.enableExport=e.enableExport,this.enableExport?this.exportButtons.forEach((function(t){t.addEventListener("click",n.exportButtonClickHandler)})):this.hideExportButtons(),this.exportButtonsContainer=this.resolveElement(c),this.clearReportButton||(this.clearReportButton=this.resolveElement(o),this.clearReportButton&&this.clearReportButton.addEventListener("click",this.clearReportButtonClickHandler)),this.newReportButton||(this.newReportButton=this.resolveElement(i),this.newReportButton&&this.newReportButton.addEventListener("click",this.newReportButtonClickHandler)),this.loadReportButton||(this.loadReportButton=this.resolveElement(r),this.loadReportButton&&this.loadReportButton.addEventListener("click",this.loadReportButtonClickHandler)),this.saveReportButton||(this.saveReportButton=this.resolveElement(s),this.saveReportButton&&this.saveReportButton.addEventListener("click",this.saveReportButtonClickHandler)),this.removeReportButton||(this.removeReportButton=this.resolveElement(a),this.removeReportButton&&this.removeReportButton.addEventListener("click",this.removeReportButtonClickHandler)),this.reloadReportDataButton||(this.reloadReportDataButton=this.resolveElement(l),this.reloadReportDataButton||(this.reloadReportDataButton=this.resolveElement("UpdateReportButton")),this.reloadReportDataButton&&this.reloadReportDataButton.addEventListener("click",this.reloadReportDataButtonClickHandler)),this.reportListSlot=document.getElementById("ReportList"),this.resultCountSlot=this.resolveElement(u)},e.prototype.newReport=function(){var t=this,e=this.context.getServices().getDialogService().open({title:r.i18n.getText("NewReportDlgTitle"),body:this._reportSaveTemplate,submitable:!0,closable:!0,cancelable:!0,submitOnEnter:!0,arrangeParents:!1,beforeOpen:function(){var t=document.getElementById("kdlg-dialog-form-input");t.value=r.i18n.getText("NewReportDefName"),document.getElementById("kdlg-dialog-form-content").innerHTML=r.i18n.getText("SaveReportDlgLabel"),document.getElementById("kdlg-dialog-form-desc-label").innerHTML=r.i18n.getText("ReportDescLabel"),t.focus()},onSubmit:function(){var n=document.getElementById("kdlg-dialog-form-input").value;if(n&&n.replace(/\s/g,"").length>0){e.clearAlert(),e.disableButtons();var o=e.getRootElement().querySelector("header"),i=(0,ut.domel)("div",o).addClass("eqjs-process-bar local").toDOM(),r=document.getElementById("kdlg-dialog-form-textarea").value;t.context.newQuery({name:n,description:r,success:function(){e.close();var n=t.context.getQuery(),o=n.getId();t.insertIntoReportList({id:o,name:n.getName(),description:n.getDescription()}),t.renderReportList({reportId:o})},error:function(t){o.removeChild(i),e.enableButtons(),e.showAlert(t,"error")}})}return!1}})},e.prototype.loadReport=function(t){var e=this;if(!t)throw"Empty report ID!";var n=this.findReportById(t);if(n){var o=this.context.getQuery(),i=function(){e.renderReportProps(),e.context.resultTable.clear(),o.fireChangedEvent({part:x.All,noSync:!0,changeType:"query.switched"}),e.fetchData()},r=this.useReportCache?this.getReportContentFromCache(n):null;r?(o.clear(),o.loadFromJson(r,{validate:!1}),i()):this.context.loadQuery({queryId:t,silent:!0,success:function(){e.saveReportContentInCache(n,o.toJSON()),i()}}),this.setActiveReport(t)}},e.prototype.saveCurrentReportAs=function(){var t=this,e=this.context.getQuery(),n=this.context.getServices().getDialogService().open({title:r.i18n.getText("SaveReportDlgTitle"),body:this._reportSaveTemplate,submitable:!0,closable:!0,cancelable:!0,submitOnEnter:!0,arrangeParents:!1,beforeOpen:function(){var t=document.getElementById("kdlg-dialog-form-input");t.value=e.getName(),document.getElementById("kdlg-dialog-form-content").innerHTML=r.i18n.getText("SaveReportDlgLabel"),document.getElementById("kdlg-dialog-form-desc-label").innerHTML=r.i18n.getText("ReportDescLabel"),document.getElementById("kdlg-dialog-form-textarea").value=e.getDescription(),t.focus()},onSubmit:function(){var o=document.getElementById("kdlg-dialog-form-input").value;if(o&&o.replace(/\s/g,"").length>0){e.setId(r.utils.generateId(o.replace(/\s/g,""))),n.clearAlert(),n.disableButtons();var i=n.getRootElement().querySelector("header"),s=(0,ut.domel)("div",i).addClass("eqjs-process-bar local").toDOM(),a=document.getElementById("kdlg-dialog-form-textarea").value;e.setDescription(a),t.context.newQuery({clearQuery:!1,name:o,success:function(){n.close(),t.context.refreshWidgets(A.Query);var o=t.context.getQuery().getId();t.fetchData(),t.insertIntoReportList({id:o,name:e.getName(),description:e.getDescription()}),t.renderReportList({reportId:o}),t.setActiveReport(o),t.renderReportProps()},error:function(t){i.removeChild(s),n.enableButtons(),n.showAlert(t,"error")}})}return!1}})},e.prototype.removeCurrentReport=function(){var t=this,e=this.context.getQuery();this.context.getServices().getDialogService().openConfirm(r.i18n.getText("RemoveReportDlgTitle"),r.i18n.getText("RemoveReportContent").replace("{reportName}",e.getName())).then((function(n){if(n){var o=e.getId();t.context.removeQuery({queryId:o,success:function(){var e=t.removeFromReportList(o);t.renderReportList({reportIndex:e})}})}}))},e.prototype.syncReport=function(t){var e=this;if(this.useReportCache){var n=this.context.getQuery(),o=this.findReportById(n.getId());o&&(o.lastUpdated=Date.now(),this.saveReportContentInCache(o,n.toJSON()))}this.context.syncQuery({success:function(n){n.query&&e.context.refreshWidgets(A.Query),n.statement&&e.context.refreshWidgets(A.Statement),t&&t.success&&t.success(n)}})},e.prototype.setActiveReport=function(t){for(var e=this.reportListSlot.querySelectorAll("li"),n=0;n<e.length;n++){var o=e[n];o.classList.remove("active"),o.getAttribute("data-rid")===t&&o.classList.add("active")}},e.prototype.renderReportProps=function(){var t=this.context.getQuery();document.getElementById("ReportTitle").innerHTML=t.getName();var e=document.querySelector(".columns-bar");if(e){e.innerHTML="<strong>Columns:</strong>";for(var n=0,o=t.getColumns();n<o.length;n++){var i=o[n];e.innerHTML+='<span class="label label-default">'+i.caption+"</span> "}}},e.prototype.renderReportList=function(t){if(this.renderReportPanels(),!this.reportListSlot.matches("li")){this.reportListSlot.innerHTML="",t=t||{reportId:this.reports.length>0?this.reports[0].id:null};var e=document.createElement("ul");e.className="list-group list-group-flush",this.reportListSlot.appendChild(e);for(var n=0,o=this.reports;n<o.length;n++){var i=o[n];this.renderReportItemInList(i,e)}if(t.reportId&&this.loadReport(t.reportId),void 0!==t.reportIndex){var r=t.reportIndex;r>=this.reports.length&&(r=this.reports.length-1),r<0&&this.reports.length>0&&(r=0),r>=0&&this.loadReport(this.reports[r].id)}}},e.prototype.detach=function(){var e=this;this.exportButtonsContainer&&(this.showExportButtons(),this.exportButtons.forEach((function(t){t.removeEventListener("click",e.exportButtonClickHandler)})),this.exportButtons=[],this.exportButtonsContainer=null),this.clearReportButton&&(this.clearReportButton.removeEventListener("click",this.clearReportButtonClickHandler),this.clearReportButton=null),this.newReportButton&&(this.newReportButton.removeEventListener("click",this.newReportButtonClickHandler),this.newReportButton=null),this.loadReportButton&&(this.loadReportButton.removeEventListener("click",this.loadReportButtonClickHandler),this.loadReportButton=null),this.saveReportButton&&(this.saveReportButton.addEventListener("click",this.saveReportButtonClickHandler),this.saveReportButton=null),this.removeReportButton&&(this.removeReportButton.removeEventListener("click",this.removeReportButtonClickHandler),this.removeReportButton=null),this.reloadReportDataButton&&(this.reloadReportDataButton.removeEventListener("click",this.reloadReportDataButtonClickHandler),this.removeReportButton=null),this.reportListSlot&&(this.reportListSlot.innerHTML="",this.reportListSlot=null),this.resultCountSlot&&(this.resultCountSlot.innerHTML="",this.resultCountSlot=null),t.prototype.detach.call(this)},e.prototype.renderReportItemInList=function(t,e){var n=this;e||(e=this.reportListSlot.querySelector("ul"));var o=t.name||t.description||"",i=document.createElement("li");i.className="list-group-item",i.style.cursor="pointer",i.setAttribute("data-rid",t.id),i.innerText=o,t.description&&(i.title=t.description),i.addEventListener("click",(function(t){var e=t.target.getAttribute("data-rid");n.loadReport(e),n.setActiveReport(e)})),e.appendChild(i)},e.prototype.renderReportPanels=function(){var t=document.getElementById("ReportsContainer"),e=document.getElementById("NoReportPanel");this.reports.length>0?(this.hideElement(e),this.showElement(t)):(this.hideElement(t),this.showElement(e))},e.prototype.hideElement=function(t){t&&(t.style.visibility="hidden")},e.prototype.showElement=function(t){t&&t.style.removeProperty("visibility")},e.prototype.insertIntoReportList=function(t){this.reports.push(t)},e.prototype.removeFromReportList=function(t){var e=this.indexOfReportById(t);return e>=0&&this.reports.splice(e,1),e},e.prototype.indexOfReportById=function(t){for(var e=0;e<this.reports.length;e++)if(this.reports[e].id===t)return e;return-1},e.prototype.clearReportButtonClick=function(){this.clearErrors(),this.context.clearQuery()},e.prototype.reloadReportDataButtonClick=function(){this.fetchData()},e.prototype.saveReportButtonClick=function(){this.saveCurrentReportAs()},e.prototype.loadReportButtonClick=function(){this.loadReport("LastQuery")},e.prototype.removeReportButtonClick=function(){this.removeCurrentReport()},e.prototype.newReportButtonClick=function(){this.newReport()},e.prototype.errorHandler=function(t){},e.prototype.clearErrors=function(){},e.prototype.disableExportButtons=function(){this.hideExportButtons()},e.prototype.enableExportButtons=function(){this.showExportButtons()},e.prototype.hideExportButtons=function(){this.exportButtonsContainer&&(this.exportButtonsContainer.style.display="none")},e.prototype.showExportButtons=function(){this.exportButtonsContainer&&(this.exportButtonsContainer.style.display="initial")},e.prototype.saveReportContentInCache=function(t,e){var n=this.findReportCacheItem(t.id);n||(n={id:t.id},this.reportCache.push(n)),n.lastUpdated=t.lastUpdated,n.content=e},e.prototype.getReportContentFromCache=function(t){var e=this.findReportCacheItem(t.id);return e&&e.lastUpdated===t.lastUpdated?e.content:null},e.prototype.findReportById=function(t){for(var e=0,n=this.reports;e<n.length;e++){var o=n[e];if(o.id===t)return o}return null},e.prototype.findReportCacheItem=function(t){for(var e=0,n=this.reportCache;e<n.length;e++){var o=n[e];if(o.id===t)return o}return null},e}(wn);r.i18n.addMapper((function(t){if(t||t.texts)for(var e in t.texts)switch(e){case"PredicateTitle":t.texts.ConditionGroupTitle=t.texts[e];break;case"RootPredicateTitle":t.texts.RootConditionGroupTitle=t.texts[e];break;case"ErrIncorrectPredicateTitleFormat":t.texts.ErrIncorrectGroupTitleFormat=t.texts[e];break;case"ButtonAddPredicate":t.texts.ButtonAddGroup=t.texts[e];break;case"ButtonDelete":t.texts.CmdDelete=t.texts[e];break;case"ButtonClear":t.texts.CmdClear=t.texts[e];break;case"ButtonEnable":t.texts.CmdToggleEnable=t.texts[e];break;case"ButtonAddCondition":t.texts.CmdAddCondition=t.texts[e];break;case"ButtonAddGroup":t.texts.CmdAddCondGroup=t.texts[e]}})),r.i18n.updateDefaultTexts({AltMenuAttribute:"Attribute",AltMenuConstantExpression:"Constant expression",ButtonApply:"Apply",ButtonCancel:"Cancel",ButtonClose:"Close",ButtonNext:"Next",ButtonPrev:"Prev",ButtonNow:"Now",ButtonOK:"OK",MenuEnable:"Enabled",MenuParameterization:"Parameterized",MenuJoinCond:"Use in JOIN",CmdClear:"Clear",CmdDelete:"Delete",CmdToggleEnable:"Toggle enable",CmdToggleEnableCustom:"Custom Expression columns are not supported",CmdAddCondition:"Add condition",CmdAddCondGroup:"Add group of conditions",ButtonSelectAll:"Select all",ButtonDeselectAll:"Clear selection",ButtonAddColumns:"Add column(s)",ButtonAddConditions:"Add condition(s)",CmdClickToAddCondition:"[Add new condition]",CmdDeleteRow:"Delete this row",ErrIncorrectGroupTitleFormat:"Incorrect condition group title format",ErrNotNumber:" is not a number",ErrIncorrectInteger:"Incorrect integer value",ErrIncorrectNumberList:"Incorrect list format",False:"False",LinkTypeAll:"all",LinkTypeAny:"any",LinkTypeNone:"none",LinkTypeNotAll:"not all",ConjAll:"and",ConjAny:"or",ConjNotAll:"and",ConjNone:"or",MsgApplySelection:"[Apply selection]",MsgAs:"as",MsgEmptyList:"(empty list)",MsgEmptyListValue:"[select value]",MsgEmptyScalarValue:"[enter value]",MsgSubQueryValue:"[edit sub-query]",MsgEmptyAttrValue:"[select attribute]",MsgEmptyOperator:"[Unrecognized operator]",MsgEmptyCustomSql:"[enter SQL expression]",MsgCustomSql:"[Custom SQL]",MsgNoResult:"No result",MsgResultCount:"{0} records found",MsgOf:"of",ConditionGroupTitle:"{lt} of the following apply",RootConditionGroupTitle:"Select records where {lt} of the following apply",StrAddConditions:"Add conditions",SubQueryDialogTitle:"Edit sub-query",SubQueryColumnTitle:"Column:",SubQueryEmptyColumn:"[select column]",SubQueryQueryPanelCaption:"Conditions",True:"True",ButtonSorting:"Sorting",ButtonToAggr:"Change to aggregate column",ButtonToSimple:"Change to simple column",ButtonFormat:"Display format",CmdAscending:"Ascending",CmdClickToAddColumn:"[Add new column]",CmdDeleteColumn:"Delete column",CmdDeleteSorting:"Delete sorting",CmdDescending:"Descending",CmdGroupSort:"Sorting",CmdGroupFormat:"Display format",CmdNotSorted:"Not sorted",ColTypeAggrFunc:"Aggregate function",ColTypeCompound:"Calculated",ColTypeGroup:"Column type",ColTypeSimple:"Simple column",HeaderExpression:"Expression",HeaderSorting:"Sorting",HeaderTitle:"Title",SortHeaderColumn:"Column",SortHeaderSorting:"Sorting",StrAddColumns:"Add columns",CustomExpression:"Custom Expression",AddAllForEntityText:"[Add all attributes]",CmdMoveToStart:"Move to start",CmdMoveRight:"Move right",CmdMoveLeft:"Move left",CmdMoveToEnd:"Move to the end",CmdMoveUp:"Move up",CmdMoveDown:"Move down",ButtonMenu:"Show menu",CmdToSimple:"Not aggregated",CmdMoveToFirst:"Move to the first",CmdMoveToPrev:"Move to the previous",CmdMoveToNext:"Move to the next",CmdMoveToLast:"Move to the last",CmdHiddenColumn:"Hidden",RowButtonTitle:"Click to see the available options",EntityToggle:"Toggle entity",StrNoFilterDefined:"No filter defined",StrNoFilterClickToAdd:"No filter defined. Click to add a new condition",HintHours:"Hours",HintMinutes:"Minutes",RemoveQueryTitle:"Confirmation",RemoveQueryContent:"Remove query [{queryName}]?",NewQueryTitle:"New query",NewQueryContent:"New query name: ",NewQueryDefName:"New query",SaveQueryTitle:"Save query",SaveQueryContent:"Query name: ",SaveQueryDefName:"{queryName} copy",QueryChangedTitle:"Confirmation",QueryChangedContent:"The query was changed. Do you want to save it first?",UpdateQuerySelector:"[click here to load the query]",FileNameLabel:"File name: ",SaveQueryToFileDlgTitle:"Save query to file",NewReportDefName:"New report",NewReportDlgTitle:"New report",SaveReportDlgTitle:"Save report",SaveReportDlgLabel:"Report name:",ReportDescLabel:"Description: ",RemoveReportDlgTitle:"Remove report",RemoveReportContent:"Are you sure you want to remove '{reportName}'?",Facets:{TotalRecordsLabel:"Total records:",AddMenuItems:{Chart:"Chart",Pivot:"Pivot table",DataTable:"Data table"},LoadDataDlgTitle:"Downloading data",LoadDataDlgContent:"Records loaded: {loadedRecs}/{totalRecs}",RefreshBtnTitle:"Refresh",ExportBtnTitle:"Export",MaximizeBtnTitle:"Maximize",RestoreBtnTitle:"Restore Down",RemoveFacetDlgTitle:"Remove facet",RemoveFacetDlgContent:"Are you sure, that you want to delete {facetTitle} tab?",DefaultDlgTitle:"Setup facet",DefaultFacetTitle:"",NewFacetTitle:"New Facet",TabNameLabel:"Tab name",ErrQueryChanged:"FAILED TO DISPLAY. QUERY WAS CHANGED",ErrNotEnoughData:"We can't display the graph because not all data for this query is loaded. \n The total number of records: {totalRecs}, currently loaded: {cachedRecs}. \n You can [download the result]. Please note: this may take some time and consume a lot of memory.",ErrTooMuchData:"Too much data. The grid is not able to display it",Chart:{FacetTitle:"Chart",DlgTitle:"Chart settings",DataColumnSelectorLabel:"Data column",LabelColumnSelectorLabel:"Label column",ChartTypeSelectorLabel:"Chart type",ShowLegendLabel:"Show legend (if available)"},Pivot:{FacetTitle:"Pivot table",DlgTitle:"Pivot settings",SwapBtnTitle:"Swap column and row fields",ColumnFieldSelectorLabel:"Column field",RowFieldSelectorLabel:"Row field",CellDataSelectorLabel:"Cell data",TotalsRowLabel:"Totals row",TotalsColLabel:"Totals column",TotalGridLabel:"Total"},DataTable:{FacetTitle:"Result table",DlgTitle:"Table facet settings"}},TotalsDlgLabel:"Totals",GrandTotalsLabel:"Grand totals",TotalsDlgTitle:"Select totals",ExportDlgTitle:"Export result",ExportDlgFmtLabel:"Format",csv:"CSV",excel:"Excel",pdf:"PDF","excel-html":"HTML (Excel-compatible)",AggrSettings:{GroupBtn:"Group selected column(s)",UngroupBtn:"Ungroup columns",AggrBtn:"Aggregate selected column",UnaggrBtn:"Remove column aggregation",GrandTotalsLabel:"Show grand totals",GroupCountsLabel:"Show record count for groups",AggrDialogTitle:"Aggregation/grouping",EnableAggrLabel:"Enable aggregation",SelectedError:"Complete the action with selected column(s)",NoGroupsOrAggrError:"Add at least one group or aggregation",NoGroupsOrGrandError:"Add at least one group, or enable grand totals",NoAggrOrCountError:"Add at least one aggregation, or enable records count",NoGroupsLabel:"No groups",NoAggrsLabel:"No aggregations",EmptySettingsLabel:"[ Click to setup ]"},ChartType:{Area:"Area chart",Bar:"Bar chart",Column:"Column chart",Combo:"Combo chart",Doughnut:"Doughnut chart",Polar:"Polar chart",Radar:"Radar chart",Histogram:"Histogram chart",Line:"Line chart",SteppedLine:"Stepped line chart",Pie:"Pie chart"}}),K.prototype.registerDialogServiceResolver=function(t){this.dialogServiceResolver=t},K.prototype.getDialogService=function(){if(!this.dialogService){if(!this.dialogServiceResolver)throw"DialogServiceResolver is not defined";this.dialogService=this.dialogServiceResolver()}return this.dialogService},Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector),window.NodeList&&!window.NodeList.prototype.forEach&&(window.NodeList.prototype.forEach=Array.prototype.forEach),Array.prototype.findIndex||(Array.prototype.findIndex=function(t){if(null==this)throw new TypeError("Array.prototype.findIndex called on null or undefined");if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var e,n=Object(this),o=n.length>>>0,i=arguments[1],r=0;r<o;r++)if(e=n[r],t.call(i,e,r,n))return r;return-1});var _n={core:r,ui:ut};window.easyqueryCore=t,window.easydata=_n}(),window.easyquery=__webpack_exports__})();
2
2
  //# sourceMappingURL=eq.community.min.js.map