@true-directive/base
Version:
The set of base classes for the TrueDirective Grid
85 lines • 116 kB
JavaScript
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("TrueDirectiveBase",[],e):"object"==typeof exports?exports.TrueDirectiveBase=e():t.TrueDirectiveBase=e()}(window,function(){return i={},o.m=n=[function(t,e,n){t.exports=n(1)},function(t,e,n){"use strict";n.r(e),n.d(e,"Dates",function(){return l}),n.d(e,"Strings",function(){return s}),n.d(e,"Keys",function(){return g}),n.d(e,"KeyInfo",function(){return r}),n.d(e,"Utils",function(){return h}),n.d(e,"FilterPipe",function(){return M}),n.d(e,"PagePipe",function(){return L}),n.d(e,"SortPipe",function(){return H}),n.d(e,"SummaryPipe",function(){return U}),n.d(e,"DateParserFormatter",function(){return V}),n.d(e,"NumberFormat",function(){return Y}),n.d(e,"NumberParserFormatter",function(){return q}),n.d(e,"Internationalization",function(){return X}),n.d(e,"Locale",function(){return Z}),n.d(e,"Mask",function(){return ut}),n.d(e,"MaskSection",function(){return st}),n.d(e,"MaskSectionAction",function(){return it}),n.d(e,"MaskResult",function(){return rt}),n.d(e,"MaskSectionType",function(){return ht}),n.d(e,"MaskSectionValue",function(){return $}),n.d(e,"MaskSettings",function(){return at}),n.d(e,"MaskState",function(){return ft}),n.d(e,"MaskValue",function(){return et}),n.d(e,"MenuAction",function(){return pt}),n.d(e,"ColumnType",function(){return p}),n.d(e,"DetectionMode",function(){return c}),n.d(e,"GridPart",function(){return y}),n.d(e,"LazyLoadingMode",function(){return m}),n.d(e,"RenderMode",function(){return C}),n.d(e,"EditorShowMode",function(){return b}),n.d(e,"SelectionMode",function(){return N}),n.d(e,"PopupPosition",function(){return _}),n.d(e,"CancelableEvent",function(){return vt}),n.d(e,"CloseEvent",function(){return bt}),n.d(e,"CheckedChangedEvent",function(){return xt}),n.d(e,"ValueChangedEvent",function(){return St}),n.d(e,"FilterShowEvent",function(){return _t}),n.d(e,"RowDragEvent",function(){return Ot}),n.d(e,"RowClickEvent",function(){return Tt}),n.d(e,"CellClickEvent",function(){return Mt}),n.d(e,"ContextMenuEvent",function(){return Pt}),n.d(e,"CellPosition",function(){return Ft}),n.d(e,"CellRange",function(){return At}),n.d(e,"CellHighlighter",function(){return It}),n.d(e,"Column",function(){return kt}),n.d(e,"ColumnBand",function(){return jt}),n.d(e,"DataQuery",function(){return Ut}),n.d(e,"Filter",function(){return R}),n.d(e,"FilterOperator",function(){return S}),n.d(e,"GridLayoutRange",function(){return Gt}),n.d(e,"GridLayoutSelection",function(){return Vt}),n.d(e,"GridLayout",function(){return Yt}),n.d(e,"GridAppearance",function(){return qt}),n.d(e,"PageInfo",function(){return Xt}),n.d(e,"RowLayout",function(){return Jt}),n.d(e,"RowPosition",function(){return $t}),n.d(e,"RowDragOverseer",function(){return te}),n.d(e,"SortInfo",function(){return D}),n.d(e,"SortType",function(){return F}),n.d(e,"Summary",function(){return B}),n.d(e,"SummaryType",function(){return W}),n.d(e,"UIAction",function(){return oe}),n.d(e,"UIActionType",function(){return ne}),n.d(e,"ValueFormatter",function(){return se}),n.d(e,"Selection",function(){return ae}),n.d(e,"GridSettings",function(){return ce}),n.d(e,"AxInject",function(){return fe}),n.d(e,"AxInjectConsumer",function(){return de}),n.d(e,"ColumnCollection",function(){return me}),n.d(e,"DataSource",function(){return ye}),n.d(e,"GridUIHandler",function(){return Ne}),n.d(e,"GridExporter",function(){return Se}),n.d(e,"LayoutsHandler",function(){return Ce}),n.d(e,"RowCalculator",function(){return Oe}),n.d(e,"GridState",function(){return De});
/**
* Copyright (c) 2018-2019 Aleksey Melnikov, True Directive Company.
* @link https://truedirective.com/
* @license MIT
*/
var l=(i.isEmpty=function(t){return null==t||void 0===t.getTime||NaN===t.getTime()},i.getTimeNull=function(t){return null==t?null:t.getTime()},i.equals=function(t,e){return!t&&!e||!(!t||!e)&&t.getTime()===e.getTime()},i.compare=function(t,e){return t||e?!t&&e?-1:t&&!e?1:t.getTime()===e.getTime()?0:t.getTime()>e.getTime()?1:-1:0},i.today=function(){var t=new Date;return new Date(t.getFullYear(),t.getMonth(),t.getDate())},i.yesterday=function(){var t=new Date;return new Date(t.getFullYear(),t.getMonth(),t.getDate()-1)},i.nextDate=function(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate()+1)},i.addDays=function(t,e){return new Date(t.getFullYear(),t.getMonth(),t.getDate()+e)},i.firstDateOfWeek=function(t,e){var n=t.getDay();return n<e&&(n+=7),n-=e,new Date(t.getFullYear(),t.getMonth(),t.getDate()-n)},i.lastDateOfWeek=function(t,e){e=i.firstDateOfWeek(t,e);return new Date(e.getFullYear(),e.getMonth(),e.getDate()+6)},i.lastDateOfPrevWeek=function(t,e){e=i.firstDateOfWeek(t,e);return new Date(e.getFullYear(),e.getMonth(),e.getDate()-1)},i.firstDateOfNextWeek=function(t,e){e=i.lastDateOfWeek(t,e);return new Date(e.getFullYear(),e.getMonth(),e.getDate()+1)},i.firstDateOfMonth=function(t){return new Date(t.getFullYear(),t.getMonth(),1)},i.lastDateOfMonth=function(t){return new Date(t.getFullYear(),t.getMonth()+1,0)},i.firstDateOfNextMonth=function(t){t=i.lastDateOfMonth(t);return new Date(t.getFullYear(),t.getMonth(),t.getDate()+1)},i.lastDateOfNextMonth=function(t){return i.lastDateOfMonth(i.firstDateOfNextMonth(t))},i.firstDateOfPrevMonth=function(t){t=i.lastDateOfPrevMonth(t);return i.firstDateOfMonth(t)},i.lastDateOfPrevMonth=function(t){t=i.firstDateOfMonth(t);return new Date(t.getFullYear(),t.getMonth(),t.getDate()-1)},i.dateBetween=function(t,e,n){return t.getTime()>=e.getTime()&&t.getTime()<=n.getTime()},i.isSameMonth=function(t,e){return null!=t&&(null!=e&&(t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth()))},i.isSameYear=function(t,e){return null!=t&&(null!=e&&t.getFullYear()===e.getFullYear())},i.yearTwoDigits=function(t){t=t.getFullYear();return(t+"").substring((t+"").length-2)},i);
/**
* Copyright (c) 2018-2019 Aleksey Melnikov, True Directive Company.
* @link https://truedirective.com/
* @license MIT
*/function i(){}var s=(o.decorate=function(t,e,n,i){var o=t.toLowerCase().indexOf(e);return 0<=o?t.substring(0,o)+n+t.substring(o,o+e.length)+i+t.substring(o+e.length):t},o);
/**
* Copyright (c) 2018-2019 Aleksey Melnikov, True Directive Company.
* @link https://truedirective.com/
* @license MIT
*/function o(){}var r=function(t,e){void 0===e&&(e=""),this.code=t,this.char=e},g=(a.isFunctional=function(t){return 112<=t&&t<=123},a.keyChar=function(t){if(null===t)return"";if(0<t.keyCode&&t.keyCode<32)return"";var e=t.char;return e=void 0===e?t.key:e},a.generateEvent=function(t,e,n,i,o){return{keyCode:e,key:n=void 0===n?"":n,char:n,shiftKey:i=void 0===i?!1:i,ctrlKey:o=void 0===o?!1:o,target:t,preventDefault:function(t){}}},a.whichKeyHasBeenPressed=function(t,e,n,i,o){return t===e&&n===i-1?new r(a.RIGHT):t===e&&n===i+1?new r(a.LEFT):1===o?t.substring(0,i)===e.substring(0,i)&&t.substring(i+1,t.length)===e.substring(i,e.length)||t.substring(0,i)===e.substring(0,i)&&t.substring(n+1,t.length)===e.substring(i,e.length)&&n===i+1?new r(a.BACKSPACE):new r(0,e.substring(n,n+1)):t.substring(0,n-1)===e.substring(0,n-1)&&t.substring(n,t.length)===e.substring(n-1,e.length)?new r(a.BACKSPACE):t.substring(0,n)===e.substring(0,n)&&t.substring(n+1,t.length)===e.substring(n,e.length)?new r(a.DELETE):new r(0,e.substring(n,n+1))},a.BACKSPACE=8,a.TAB=9,a.ENTER=13,a.ESCAPE=27,a.SPACE=32,a.PAGE_UP=33,a.PAGE_DOWN=34,a.END=35,a.HOME=36,a.LEFT=37,a.UP=38,a.RIGHT=39,a.DOWN=40,a.INSERT=45,a.DELETE=46,a.A=65,a.C=67,a.V=86,a.X=88,a.Y=89,a.Z=90,a);function a(){}
/**
* Copyright (c) 2018-2019 Aleksey Melnikov, True Directive Company.
* @link https://truedirective.com/
* @license MIT
*/
var p,h=(u.isAncestor=function(t,e){if(!e)return!1;for(var n=e;n&&n!==t;)n=n.parentNode;return n===t},u.isClassDescendant=function(t,e){if(!t)return!1;for(var n=t;n;){if(n&&n.classList&&n.classList.contains(e))return!0;n=n.parentNode}return!1},u.moveArrayItem=function(t,e,n){if(n>=t.length)for(var i=n-t.length+1;i--;)t.push(void 0);t.splice(n,0,t.splice(e,1)[0])},u.htmlToPlaintext=function(t){var e=new RegExp("<[^>]+>","gm");return t?String(t).replace(e,""):""},Object.defineProperty(u,"userAgent",{get:function(){return navigator.userAgent||navigator.vendor},enumerable:!0,configurable:!0}),u.detectIOS=function(){return new RegExp("iPad|iPhone|iPod").test(u.userAgent)},u.detectFirefox=function(){return-1<u.userAgent.toLowerCase().indexOf("firefox")},u.detectSafari=function(){var t=u.userAgent.toLowerCase().indexOf("safari"),e=u.userAgent.toLowerCase().indexOf("chrome");return-1<t&&e<=-1},u.detectAndroid=function(){return new RegExp("android","i").test(u.userAgent)},u.detectMobile=function(){return u.detectIOS()||u.detectAndroid()},u.detectIE=function(){return new RegExp("MSIE|Trident","i").test(u.userAgent)},u.purifyDate=function(t){return null==t||isNaN(t.getTime())?null:t},u);function u(){}(yt=p=p||{}).STRING="STRING",yt.NUMBER="NUMBER",yt.DATETIME="DATETIME",yt.BOOLEAN="BOOLEAN",yt.REFERENCE="REFERENCE",yt.IMAGE="IMAGE",yt.CHECKBOX="CHECKBOX",yt.HTML="HTML",yt.UNSAFE_HTML="UNSAFE_HTML",yt.CUSTOM="CUSTOM";var c=(f.DEFAULT=new f("Default"),f.MANUAL=new f("Manual"),f);function f(t){this.name=t}var y=(d.LEFT=new d("left"),d.CENTER=new d(""),d.RIGHT=new d("right"),d.DRAG_ITEM=new d("dragItem"),d.GROUPED_COLUMN=new d("groupedColumn"),d);function d(t){this.name=t}var m=(v.NONE=new v("None"),v.INCREMENTAL=new v("Incremental"),v.FRAGMENTARY=new v("Fragmentary"),v);function v(t){this.name=t}var C=(w.ALL=new w("All"),w.VISIBLE=new w("Visible"),w.VISIBLE_ROWS=new w("VisibleRows"),w);function w(t){this.name=t}var b=(E.NONE=new E("NONE"),E.ON_MOUSE_DOWN=new E("ON_MOUSE_DOWN"),E.ON_FOCUS=new E("ON_FOCUS"),E.ON_CLICK_FOCUSED=new E("ON_CLICK_FOCUSED"),E.ON_DBL_CLICK=new E("ON_DBL_CLICK"),E);function E(t){this.name=t}var N=(x.NONE=new x("NONE"),x.CELL=new x("CELL"),x.ROW=new x("ROW"),x.RANGE=new x("RANGE",!0),x.ROW_AND_RANGE=new x("ROW_AND_RANGE",!0),x);function x(t,e){void 0===e&&(e=!1),this.name=t,this.range=e}var S,_=(O.RELATIVE=new O("RELATIVE"),O.ABSOLUTE=new O("ABSOLUTE"),O.MODAL=new O("MODAL"),O);function O(t){this.name=t}(n=S=S||{}).NONE="NONE",n.BETWEEN="BETWEEN",n.NOT_BETWEEN="NOT_BETWEEN",n.CONTAINS="CONTAINS",n.NOT_CONTAINS="NOT_CONTAINS",n.EQUALS="EQUALS",n.NOT_EQUALS="NOT_EQUALS",n.EMPTY="EMPTY",n.NOT_EMPTY="NOT_EMPTY",n.SET="SET";var R=(Object.defineProperty(T.prototype,"txtValue",{get:function(){return this.value?this.value+"":""},enumerable:!0,configurable:!0}),T.prototype.clearItems=function(){this.items.splice(0,this.items.length)},T.prototype.clone=function(t){return new T(this.fieldName,this.operator,this.value,this.value2,this.items.slice(),t,this.format,this.caption,this.type)},T.prototype.valueToString=function(t,e,n){if(!0===t)return e.translate("True");if(!1===t)return e.translate("False");t=n.format(this.type,this.format,t);return this.type===p.STRING?"'"+t+"'":t},T.prototype.toString=function(e,n){var i=this,t="["+this.caption+"]",o="",r="",s="",l="",a="";switch(null!==this.value&&(s=this.valueToString(this.value,e,n)),null!==this.value2&&(l=this.valueToString(this.value2,e,n)),0<this.items.length&&(a=this.items.map(function(t){return i.valueToString(t,e,n)}).join(", ")),this.operator){case S.EQUALS:o=" = ",r=s;break;case S.NOT_EQUALS:o=" <> ",r=s;break;case S.CONTAINS:o="Contains",r=s;break;case S.NOT_CONTAINS:o="Not contains",r=s;break;case S.BETWEEN:o="Between",r=s+" "+e.translate("And").toUpperCase()+" "+l;break;case S.NOT_BETWEEN:o="Not between",r=s+" "+e.translate("And").toUpperCase()+" "+l;break;case S.EMPTY:o="Is empty";break;case S.NOT_EMPTY:o="Is not empty";break;case S.SET:o="In",r="("+a+")"}return t+" "+(o=e.translate(o).toUpperCase())+" "+r},T);
/**
* Copyright (c) 2018-2019 Aleksey Melnikov, True Directive Company.
* @link https://truedirective.com/
* @license MIT
*/function T(t,e,n,i,o,r,s,l,a){void 0===o&&(o=[]),void 0===r&&(r=!1),void 0===s&&(s=""),void 0===l&&(l=""),void 0===a&&(a=p.STRING),this.fieldName=t,this.operator=e,this.value=n,this.value2=i,this.items=o,this.active=r,this.format=s,this.caption=l,this.type=a,this.orFilter=null}var M=(P.prototype.isEmpty=function(t){return null==t||""===t},P.prototype.match=function(i,t,e,o,r){var s=this;void 0===r&&(r=null);var l=!0;if(o&&(l=!1,t.some(function(t){var e,n=i[t.fieldName];if(t.type===p.STRING&&n&&0<=n.toLowerCase().indexOf(o))return l=!0;if(t.type===p.REFERENCE&&n&&0<=n.toLowerCase().indexOf(o))return l=!0;if((t.type===p.UNSAFE_HTML||t.type===p.HTML)&&""!==t.displayField&&n&&0<=n.toLowerCase().indexOf(o))return l=!0;if(t.type===p.DATETIME&&s._searchStringApplicableForDates&&(null!==r&&(e=r.displayedValue(t,n,i)+"")&&0<=e.toLowerCase().indexOf(o)))return l=!0;if(t.type===p.NUMBER&&s._searchStringApplicableForNumbers&&(null!==r&&(e=r.displayedValue(t,n,i)+"")&&0<=e.toLowerCase().indexOf(o)))return l=!0;return!1}),!l))return!1;for(var n=0;n<e.length;n++){var a=e[n],u=i[a.fieldName],c=u,h=a.value,f=a.value2,d=u?(u+"").toLowerCase():"";a.operator===S.EMPTY&&(l=this.isEmpty(u)),a.operator===S.NOT_EMPTY&&(l=!this.isEmpty(u)),a.type===p.DATETIME&&(c=null!==c?c.getTime():null,h=null!==h?h.getTime():null,f=null!==f?f.getTime():null),a.type===p.BOOLEAN&&(h=a.value,a.operator===S.EQUALS&&c!==h&&(l=!1),a.operator===S.NOT_EQUALS&&c===h&&(l=!1)),a.operator===S.SET&&a.items.indexOf(c)<0&&(l=!1),a.operator===S.CONTAINS&&d.indexOf(a.txtValue.toLowerCase())<0&&(l=!1),a.operator===S.NOT_CONTAINS&&0<=d.indexOf(a.txtValue.toLowerCase())&&(l=!1),a.operator===S.EQUALS&&d!==a.txtValue.toLowerCase()&&(l=!1),a.operator===S.NOT_EQUALS&&d===a.txtValue.toLowerCase()&&(l=!1),a.operator===S.BETWEEN&&(c<h||f<c)&&(l=!1),a.operator===S.NOT_BETWEEN&&h<=c&&c<=f&&(l=!1)}return l},P.prototype.transform=function(t,e,n,i,o){var r=this;return t&&(i=i.toLowerCase(),/\d/.test(i)&&(this._searchStringApplicableForDates=!0,this._searchStringApplicableForNumbers=!0),i||void 0!==n&&0!==n.length?t.filter(function(t){return r.match(t,e,n,i,o)}):t)},P);function P(){this._searchStringApplicableForNumbers=!1,this._searchStringApplicableForDates=!1}var F,L=(A.prototype.transform=function(t,e){for(var n=[],i=e.offset;i<e.offset+e.limit;)t[i]||(t[i]={__ax:"empty"}),n.push(t[i]),i++;return n},A);
/**
* Copyright (c) 2018-2019 Aleksey Melnikov, True Directive Company.
* @link https://truedirective.com/
* @license MIT
*/function A(){}(e=F=F||{}).NONE="None",e.ASC="ASC",e.DESC="DESC";var D=(I.prototype.set=function(t,e){this.fieldName=t,this.sortType=e},I.prototype.invert=function(){this.sortType===F.NONE?this.sortType=F.ASC:this.sortType=this.sortType===F.ASC?F.DESC:F.NONE},I.prototype.sort=function(t){this.sortType===F.ASC&&this.fieldName===t?this.sortType=F.DESC:(this.fieldName=t,this.sortType=F.ASC)},I.prototype.toString=function(){var t=this.sortType+"";return this.fieldName+" "+t},I);
/**
* Copyright (c) 2018-2019 Aleksey Melnikov, True Directive Company.
* @link https://truedirective.com/
* @license MIT
*/function I(t,e){this.fieldName=t,this.sortType=e}var H=(k.compare=function(t,e,n){return null==t&&null==e?0:null==t?n===F.ASC?-1:1:null==e?n===F.ASC?1:-1:t===e?0:n===F.ASC?e<t?1:-1:t<e?1:-1},k.prototype.transform=function(t,l,a){return void 0===a&&(a=[]),t?null===l||0===l.length&&0===a.length?t:t.concat().sort(function(o,r){for(var s=0,t=0;t<a.length;t++)if("break"===function(t){var e=1,n=a[t],i=l.find(function(t){return t.fieldName===n.fieldName});i&&i.sortType===F.DESC&&(e=-1);t=o[n.fieldName],i=r[n.fieldName];return null===i&&null!==t||i<t?(s=+e,"break"):null===t&&null!==i||t<i?(s=-1*e,"break"):void 0}(t))break;if(0!==s)return s;if(0===l.length)return 0;for(t=0;t<l.length;t++){var e=l[t],e=k.compare(o[e.fieldName],r[e.fieldName],e.sortType);if(0!==e)return e}return 0}):[]},k);
/**
* Copyright (c) 2018-2019 Aleksey Melnikov, True Directive Company.
* @link https://truedirective.com/
* @license MIT
*/function k(){}var W=(j.SUM=new j("Sum","Sum","SUM"),j.MIN=new j("Minimum","Min","MIN"),j.MAX=new j("Maximum","Max","MAX"),j.COUNT=new j("Count","Count","TOTAL"),j.AVERAGE=new j("Average","Avg","AVG"),j);function j(t,e,n){this.name=t,this.shortName=e,this.footerText=n}var B=function(t){this.type=t},U=(G.prototype.transform=function(t,e,n){if(n===W.COUNT)return t.length;var i=null,o=0;return n!==W.SUM&&n!==W.AVERAGE||(i=0),t.forEach(function(t){n!==W.SUM&&n!==W.AVERAGE||null!==t[e.fieldName]&&(i+=t[e.fieldName],o++),n===W.MIN&&(i=null===i||t[e.fieldName]<i?t[e.fieldName]:i),n===W.MAX&&(i=null===i||t[e.fieldName]>i?t[e.fieldName]:i)}),n===W.AVERAGE&&(0<o?i/=o:i=null),i},G);
/**
* Copyright (c) 2018-2019 Aleksey Melnikov, True Directive Company.
* @link https://truedirective.com/
* @license MIT
*/function G(){}var V=(z.invalidDate=function(){return new Date("*")},z.daysInMonth=function(t,e){return new Date(t,e,0).getDate()},z.parse=function(t,e){if(""===t)return null;for(var n=t,i=0,o=1,r=1,s=1970,l=0,a=0,u=0,c=0,h="",f=0;f<e.sections.length;f++){var d=e.sections[f],p=d.sectionType.datePart;if(null!==p){var m=d.extract(n,i),i=m.nextSectionPos(),g=m.section.value(),m=void 0,m=NaN;if(d.isNumeric()){if(0<=g.indexOf(e.settings.placeholder))return z.invalidDate();if((m=d.numericValue(d.removePlaceholders(g)))<d.sectionType.min||m>d.sectionType.max)return z.invalidDate()}else if(d.hasOptions()){if((m=d.sectionType.options.indexOf(g))<0)return z.invalidDate();m++}if(isNaN(m))return z.invalidDate();"H"===p&&(l=m),"h"===p&&12===(l=m)&&(l=0),"tt"===p&&(h=g),"mi"===p&&(a=m),"ss"===p&&(u=m),"ms"===p&&(c=m),"d"===p&&(o=m),"m"===p&&(r=m),"yy"===p&&(s=m<50?2e3+m:1900+m),"yyyy"===p&&(s=m)}}return"pm"===h.toLowerCase()&&(l+=12),z.daysInMonth(s,r)<o?z.invalidDate():new Date(s,r-1,o,l,a,u,c)},z.format=function(t,e){if(l.isEmpty(t))return"";for(var n="",i=0;i<e.sections.length;i++){var o=e.sections[i],r=o.sectionType.datePart,s=NaN;"yyyy"===r&&(s=t.getFullYear()),"yy"===r&&(s=t.getFullYear(),s-=2e3<=s?2e3:1900),"m"===r&&(s=t.getMonth()+1),"d"===r&&(s=t.getDate()),"H"===r&&(s=t.getHours()),"h"===r&&(0===(s=t.getHours())?s=12:12<s&&(s-=12)),"mi"===r&&(s=t.getMinutes()),"ss"===r&&(s=t.getSeconds()),"ms"===r&&(s=t.getMilliseconds()),"tt"===r&&(s=12<=t.getHours()?2:1);n+=(o.hasOptions()?o.sectionType.options[s-1]:o.autoCorrectVal(s+""))+o.delimiter}return n},z);
/**
* Copyright (c) 2018-2019 Aleksey Melnikov, True Directive Company.
* @link https://truedirective.com/
* @license MIT
*/function z(){}var Y=(K.isDigit=function(t){return 0<="0123456789".indexOf(t)},K.parseFormat=function(t){t=t.split(/[\{\}]/);if(t.length<3)return null;var e=new K;e.prefix=t[0];var n=t[1].trim();e.postfix=t[2];for(var i={int:"",intMax:"",fMin:"",fMax:""},o="spec",r=0;r<n.length;r++){var s=n[r],l=K.isDigit(s);if(!l&&"EDFNedfn+-. ".indexOf(s)<0)return null;0===r&&0<="+-".indexOf(s)&&(e.signum=!0),"spec"===o&&0<="EDFNedfn".indexOf(s)?(e.specifier=s.toUpperCase(),o="int"):"spec"!==o&&"int"!==o||!l?("intmax"===(o="int"===o&&"-"===s?"intmax":o)&&l&&(i.intMax+=s),"fmin"===(o="fmin"===(o="."===s?"fmin":o)&&"-"===s?"fmax":o)&&l&&(i.fMin+=s),"fmax"===o&&l&&(i.fMax+=s)):(i.int+=s,o="int")}return""!==i.int&&(e.intMin=+i.int),""!==i.intMax&&(e.intMax=+i.intMax),""!==i.fMin&&(e.fractionMin=+i.fMin),""!==i.fMax?e.fractionMax=+i.fMax:e.fractionMax=e.fractionMin,e},K);
/**
* Copyright (c) 2018-2019 Aleksey Melnikov, True Directive Company.
* @link https://truedirective.com/
* @license MIT
*/function K(){this.prefix="",this.postfix="",this.specifier="D",this.intMin=1,this.intMax=16,this.fractionMin=0,this.fractionMax=0}var q=(Q.unclotheNumber=function(t,e){if(null===e)return{prefix:"",number:t,postfix:""};var n=t,i="",o="",t=e.postfix.length;n.substring(n.length-t,n.length)===e.postfix&&(o=e.postfix,n=n.substring(0,n.length-t));t=e.prefix.length;return n.substring(0,t)===e.prefix&&(i=e.prefix,n=n.substring(t,n.length)),{prefix:i,number:n,postfix:o}},Q.splitNumber=function(t,e){var n="",i="",o=t.search(/e/i);0<=o&&(i=t[o]);var r=t.split(/e/i),o=r[0],r=1<r.length?r[1]:"";0<o.length&&0<="-+".indexOf(o[0])&&(n=o[0],o=o.substring(1,t.length));t=o.split(e[0]),e="";return 1<t.length&&(e=o[t[0].length]),{signum:n,int:t[0],decimalSeparator:e,fraction:1<t.length?t[1]:"",e:i,orderOfMagnitude:r}},Q.roundTo=function(t,e){return Math.round(t*Math.pow(10,e))*Math.pow(10,-e)},Q.format=function(t,e,n){var i;if(e&&"string"==typeof e){if(null===(i=Y.parseFormat(e)))throw new Error("Invalid format")}else i=e;i.specifier.toLowerCase();e=Math.sign(t)<0?"-":"";i.signum&&""===e&&(e="+");for(var t=Q.roundTo(Math.abs(t),i.fractionMax).toFixed(i.fractionMax).split("."),o=t[0],r=1<t.length?t[1]:"";r.length>i.fractionMin&&"0"===r.substring(r.length-1);)r=r.substring(0,r.length-1);for(;o.length<i.intMin;)o="0"+o;if("n"===i.specifier.toLowerCase()&&1<n.length)for(var s=3;s<o.length;s+=4)o=o.substring(0,o.length-s)+n[1]+o.substring(o.length-s);e=i.prefix+e+o;return""!==r&&(e+=n[0]+r),e+=i.postfix},Q.parse=function(t,e,n){e=Y.parseFormat(e),t=Q.unclotheNumber(t,e);if(""===t.number)return null;e=Q.splitNumber(t.number,n),t=1<n.length?n[1]:"",n=""!==t?e.int.split(t):e.int,t=1;return(t="-"===e.signum?-1:t)*(+n.join("")+(""!==e.fraction.length?+e.fraction*Math.pow(10,-e.fraction.length):0))*Math.pow(10,e.orderOfMagnitude)},Q.canAcceptKey=function(t,e,n,i,o,r,s,l){void 0===s&&(s=-1),void 0===l&&(l=!1);var a=Y.parseFormat(i),u=Q.unclotheNumber(t,a),c=Q.splitNumber(u.number,o),h=u.prefix.length,f=u.prefix.length+u.number.length,d=h+c.signum.length,i=d+c.int.length,t=i+c.decimalSeparator.length,u=t+c.fraction.length;if(e===g.DELETE)return(!l||r!==s||r!==t-1)&&!(f<=r);if(e===g.BACKSPACE)return(!l||"0"!==c.int||r!==h+c.signum.length||s!==h+c.signum.length+1)&&(!(f<r)&&((!l||"0"!==c.int||r!==s||r!==h+c.signum.length+1)&&(!l||r!==s||r!==t)));if(0<="+-".indexOf(n)){if(""===c.signum&&r===h)return!0;if(""!==c.e)if(r===u+c.e.length)return!0}if("e"===n.toLowerCase()&&"e"===a.specifier.toLowerCase()&&r===u)return!0;if(0<o.length&&n===o[0]&&0<a.fractionMax){if(r===h+c.signum.length+c.int.length)return!0;if(""===c.decimalSeparator)return!0}return 0<="0123456789".indexOf(n)&&(!(""!==c.signum&&r<=h)&&(!(r<h)&&(!(f<r)&&(!(d<=r&&r<=i&&c.int.split(o[1]).join("").length>=a.intMax)&&!(r===u&&c.fraction.length>=a.fractionMax&&""!==c.decimalSeparator)))))},Q.reformat=function(t,e,n,i,o,r){if(void 0===r&&(r=!1),""===t)return{value:"",selStart:0,selEnd:0,canInput:!0};for(var s=Y.parseFormat(e),e=Q.unclotheNumber(t,s),l=Q.splitNumber(e.number,n),a=(n[0],n[1]),u=i-e.prefix.length-l.signum.length,c=o-e.prefix.length-l.signum.length;1<l.int.length&&"0"===l.int[0];)l.int=l.int.substring(1),0<u&&u--,0<c&&c--;for(var h=l.int.split(a),f=h[0].length,d=u,p=c,m=1;m<h.length;m++)f<u&&(d-=a.length),f<c&&(p-=a.length),f+=h[m].length+a.length;if(u=d,c=p,l.int=h.join(""),"n"===s.specifier.toLowerCase())for(m=3;m<l.int.length;m+=4)u>l.int.length-m&&(u+=a.length),c>l.int.length-m&&(c+=a.length),l.int=l.int.substring(0,l.int.length-m)+a+l.int.substring(l.int.length-m);if(r||""!==l.int||""===l.fraction||(l.int="0",u++,c++),r&&null!==s&&(""!==l.signum||""!==l.int||""!==l.fraction))for(;l.int.length<s.intMin;)l.int="0"+l.int,c++;if(l.fraction=l.fraction.replace(a,""),r&&null!==s&&(""!==l.int||""!==l.signum))for(;l.fraction.length<s.fractionMin;)l.fraction+="0";l.fraction=l.fraction.substring(0,s.fractionMax);e=s.prefix;return u+=e.length,c+=e.length,""!==l.signum&&(e+=l.signum,u+=l.signum.length,c+=l.signum.length),e+=l.int,r?""!==l.fraction&&(e+=n[0]+l.fraction):0<=t.indexOf(n[0])&&(e+=n[0]+l.fraction),"e"===s.specifier.toLowerCase()&&(e+=l.e,e+=l.orderOfMagnitude),{value:e+=s.postfix,selStart:u,selEnd:c}},Q);function Q(){}var X=(J.prototype.localeChangedEvent=function(t){},Object.defineProperty(J.prototype,"currentLocaleName",{get:function(){return this._currentLocaleName},set:function(t){this._currentLocaleName=t,this.localeChangedEvent(this.locale)},enumerable:!0,configurable:!0}),J.prototype.addLocale=function(e){this.locales.find(function(t){return t.shortName===e.shortName})||this.locales.push(e)},Object.defineProperty(J.prototype,"locale",{get:function(){var e=this,t=this.locales.find(function(t){return t.shortName===e._currentLocaleName});return t||this.locales[0]},enumerable:!0,configurable:!0}),J.prototype.translate=function(t){var e=this.locale.translates[t];return e||t},J);
/**
* Copyright (c) 2018-2019 Aleksey Melnikov, True Directive Company.
* @link https://truedirective.com/
* @license MIT
*/function J(){this.locales=[],this.locales.push({name:"English",shortName:"en-US",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"],shortDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],longDayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],firstDayOfWeek:0,dateFormat:"mm/dd/yyyy",timeHMFormat:"hh:mi am",timeHMSFormat:"hh:mi:ss am",dateTimeHMFormat:"mm/dd/yyyy hh:mi am",dateTimeHMSFormat:"mm/dd/yyyy hh:mi:ss am",separators:[".",","],currency:"${N1-12.2}",translates:{CONTAINS:"Contains",NOT_CONTAINS:"Not contains",BETWEEN:"Between",NOT_BETWEEN:"Not between",EQUALS:"Equals",NOT_EQUALS:"Not equals",EMPTY:"Empty",NOT_EMPTY:"Not empty",SET_OF_ITEMS:"Set"}}),this._currentLocaleName=this.locales[0].shortName}var Z=function(){this.shortMonthNames=[],this.longMonthNames=[],this.shortDayNames=[],this.longDayNames=[],this.firstDayOfWeek=0,this.separators=[],this.currency="",this.translates={}},$=(tt.prototype.append=function(t){this.afterChars+=t},tt.prototype.value=function(t){return null!==(t=void 0===t?null:t)?this.beforeChars+t+this.afterChars:this.beforeChars+this.currentChar+this.afterChars},Object.defineProperty(tt.prototype,"length",{get:function(){return this.value().length},enumerable:!0,configurable:!0}),tt);function tt(t,e,n){e=n-e;if(e<0||e>t.length)return this.beforeChars=t,this.currentChar="",void(this.afterChars="");this.beforeChars=t.substring(0,e),this.currentChar=t.substring(e,1+e),this.afterChars=t.substring(1+e)}
/**
* Copyright (c) 2018-2019 Aleksey Melnikov, True Directive Company.
* @link https://truedirective.com/
* @license MIT
*/
var et=(nt.prototype.nextSectionPos=function(){return this.before.length+this.section.length+this.delimiter.length},nt.prototype.update=function(t,e){return this.section=new $(t,this.sectionPos,e),this.value()},nt.prototype.value=function(){return this.before+this.section.value()+this.delimiter+this.after},nt);function nt(){}var it=(ot.NONE=new ot("NONE"),ot.APPLY=new ot("APPLY"),ot.SKIP=new ot("SKIP"),ot.GO_FWD=new ot("GO_FWD"),ot.GO_BACK=new ot("GO_BACK"),ot.GO_BACK_AND_DELETE=new ot("GO_BACK_AND_DELETE"),ot.GO_BACK_AND_BACKSPACE=new ot("GO_BACK_AND_BACKSPACE"),ot);function ot(t){this.name=t}var rt=function(t,e,n){this.newValue=t,this.action=e,this.nextSectionPos=n},st=(Object.defineProperty(lt.prototype,"length",{get:function(){if(this.hasOptions()){var e=99;return this.sectionType.options.forEach(function(t){t.length<e&&(e=t.length)}),e}return this.section.length},enumerable:!0,configurable:!0}),Object.defineProperty(lt.prototype,"maxLength",{get:function(){if(this.hasOptions()){var e=0;return this.sectionType.options.forEach(function(t){t.length>e&&(e=t.length)}),e}return(this.sectionType&&this.sectionType.max&&(""+this.sectionType.max).length>this.section.length?""+this.sectionType.max:this.section).length},enumerable:!0,configurable:!0}),lt.prototype.isEmptySection=function(){return""===this.section},lt.prototype.hasOptions=function(){return this.sectionType&&this.sectionType.options&&0<this.sectionType.options.length},lt.prototype.hasRegExp=function(){return this.sectionType&&void 0!==this.sectionType.regExp},lt.prototype.isNumeric=function(){return this.sectionType&&this.sectionType.numeric},lt.prototype.numericValue=function(t){return+t},lt.prototype.checkMinMax=function(t){return null===t?null:this.sectionType?(void 0!==this.sectionType.min&&t<this.sectionType.min&&(t=this.sectionType.min),t=void 0!==this.sectionType.max&&t>this.sectionType.max?this.sectionType.max:t):t},lt.prototype.removePlaceholders=function(t){return t.split(this.settings.placeholder).join("")},lt.prototype.incValue=function(t){if(this.hasOptions()){var e=this.sectionType.options.indexOf(t);return e<this.sectionType.options.length-1?this.sectionType.options[e+1]:this.sectionType.options[0]}if(this.isNumeric()&&void 0!==this.sectionType.max){e=this.numericValue(t);isNaN(e)?e=void 0===this.sectionType.min?0:this.sectionType.min:e++;for(var n=""+this.checkMinMax(e);n.length<this.length;)n="0"+n;return n}return t},lt.prototype.decValue=function(t){if(this.hasOptions()){var e=this.sectionType.options.indexOf(t);return 0<e?this.sectionType.options[e-1]:this.sectionType.options[this.sectionType.options.length-1]}if(this.isNumeric()&&void 0!==this.sectionType.min){e=this.numericValue(t);isNaN(e)?e=void 0===this.sectionType.min?0:this.sectionType.max:e--;for(var n=""+this.checkMinMax(e);n.length<this.length;)n="0"+n;return n}return t},lt.prototype.autoCorrectVal=function(e){if(!this.sectionType)return e;if(this.hasOptions())return e=!this.sectionType.options.find(function(t){return t.toLowerCase()===e.toLowerCase()})?0<this.sectionType.options.length?this.sectionType.options[0]:"":e;var t=e;if(this.isNumeric()){var n=this.numericValue(t);if(isNaN(n)||""===e)return e;if("yyyy"===this.sectionType.datePart)if(2===e.length)n+=n<50?2e3:1900;else if(4!==e.length)return e;if(null!==(n=this.settings.autoCorrect?this.checkMinMax(n):n))for(t=""+n;t.length<this.length;)t="0"+t}for(;t.length<this.length;)t+=this.settings.placeholder;return t},lt.prototype.extract=function(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=0);var o=new et,r=this.length,i=e+r;if(this.length<this.maxLength){for(var s=e;s<t.length&&s<e+this.maxLength&&(""===this.delimiter||t[s]!==this.delimiter[0]);)s++;i=s}var l=i,a=l;if(""!==this.delimiter)for(;a<t.length;){if(t[a]!==this.delimiter[a-l])break;a++}i>t.length&&(i=t.length),a>t.length&&(a=t.length);r=t.substring(e,i);if(r.length>this.maxLength)throw new Error("Invalid value length: "+r);i=n-e;return o.sectionPos=e,o.before=t.substring(0,e),o.section=new $(r,e,n),o.delimiter=t.substring(l,a),o.after=t.substring(a),o.inSection=0<=i&&i<=o.section.length,o},lt.prototype.skip=function(t,e){t=new rt(t.value(),it.SKIP,t.nextSectionPos());return t.selStart=e,t},lt.prototype.none=function(t){return new rt(t.value(),it.NONE,t.nextSectionPos())},lt.prototype.apply=function(t,e,n,i,o){void 0===i&&(i=1),void 0===o&&(o=!1);var r=n-t.sectionPos;if(o&&e.length===this.maxLength&&r>=e.length-1&&0<i&&(e=this.autoCorrectVal(e),t.delimiter=this.delimiter),t.update(e,n),0<i)return this.goFwd(t,n,1,!1);if(i<0)return this.goBack(t,n,1,!1,o);t=new rt(t.value(),it.APPLY,t.nextSectionPos());return t.selStart=n,t.selLength=this.settings.replaceMode&&r<this.length?1:0,t},lt.prototype.applyDelimiter=function(t,e){var n=this.autoCorrectVal(t.section.value());t.update(n,e),t.delimiter=this.delimiter;e=new rt(t.value(),it.GO_FWD,t.nextSectionPos());return e.selStart=t.nextSectionPos(),e},lt.prototype.goBack=function(t,e,n,i,o){void 0===i&&(i=!1),void 0===o&&(o=!1);var r=new rt(t.value(),it.APPLY,t.nextSectionPos());if(0===e&&n<=1)return r.selLength=0,r;o&&e>t.sectionPos+this.maxLength&&this.settings.replaceMode&&(e=t.sectionPos+this.maxLength),r.selStart=e-1,r.selLength=this.settings.replaceMode?1:0;o=r.selStart-t.sectionPos;return o>=this.length&&o>=t.section.length&&(r.selLength=0),r.selStart-t.sectionPos<0&&""!==t.before&&(r.action=i?it.GO_BACK_AND_DELETE:it.GO_BACK),r.selStart<0&&(r.selStart=0),0===r.selLength&&0===e&&(r.selLength=0),r},lt.prototype.goFwd=function(t,e,n,i){void 0===i&&(i=!1);t.sectionPos;i=new rt(t.value(),it.APPLY,t.nextSectionPos());this.settings.replaceMode&&0===n&&""!==t.section.currentChar?(i.selStart=e,i.selLength=1):""!==t.after||""!==t.section.afterChars?(i.selStart=e+1,i.selLength=""!==t.section.currentChar&&this.settings.replaceMode?1:0,i.selStart-t.sectionPos>=this.length&&""===t.section.afterChars&&(i.selLength=0)):(i.selStart=e+1,i.selLength=0);n=i.selStart-t.sectionPos;return(n>t.section.length||n===this.maxLength&&""!==t.after)&&(e=this.autoCorrectVal(t.section.value()),t.delimiter=this.delimiter,t.update(e,n),i.newValue=t.value(),i.nextSectionPos=t.nextSectionPos(),i.selStart=t.section.length,i.action=it.GO_FWD),i},lt.prototype.isDigit=function(t){return/\d/.test(t)},lt.prototype.applyKey=function(t,e,n,i,o,r,s,l){void 0===s&&(s=!1),void 0===l&&(l=!1);var a=this.extract(t,i,o,r);if(o<i)return this.none(a);if(!(a.inSection||t.length===o&&l))return this.skip(a,o);var u=o-i;if(u===this.maxLength&&""===this.delimiter&&""!==a.after)return this.skip(a,o);if((n!==this.delimiter[0]||!s)&&(this.isEmptySection()||o===i+a.section.length&&a.section.length===this.maxLength&&1===n.length))return a.delimiter=this.delimiter,a.update(this.autoCorrectVal(a.section.value()),o),this.skip(a,a.nextSectionPos());if(1===n.length){var c=a.section.beforeChars;if(c+=n,this.hasOptions()&&c!==a.section.beforeChars){var h=null;if(this.sectionType.options.some(function(t){return u<t.length&&t.substring(0,c.length).toLowerCase()===c.toLowerCase()&&(h=t,!0)}),null!==h)return this.apply(a,h,o,1,l)}if(this.hasRegExp()){var f=a.section.value(n);if(this.sectionType.regExp.test(f))return this.apply(a,f,o,1,l)}if(!this.hasRegExp()&&!this.hasOptions()&&!this.isEmptySection()){f=!1;if(f=u<this.maxLength&&this.sectionType.numeric&&this.isDigit(n)?!0:f)return this.apply(a,a.section.value(n),o,1,l)}if(""!==this.delimiter&&n===this.delimiter[0]&&s)return""!==this.removePlaceholders(a.section.value())||this.isEmptySection()?this.applyDelimiter(a,o):this.apply(a,a.section.value(),o,0)}return e===g.DELETE?u>=this.length&&""===a.section.afterChars?(""===a.after&&(a.delimiter=""),this.apply(a,a.section.beforeChars,o,0)):""===a.after&&""===a.section.afterChars?(a.delimiter="",this.apply(a,a.section.beforeChars,o,0)):this.apply(a,a.section.value(this.settings.placeholder),o,0):e===g.BACKSPACE?0===a.section.length?this.goBack(a,o,r,!0,l):""===a.section.beforeChars?""===a.before?this.none(a):this.goBack(a,o,r,!0,l):(a.section.beforeChars=a.section.beforeChars.substring(0,a.section.beforeChars.length-1),a.section.beforeChars.length>=this.length&&""===a.after||""===a.section.currentChar&&""===a.after?a.delimiter="":a.section.beforeChars.length<this.length&&(a.section.beforeChars+=this.settings.placeholder),this.apply(a,a.section.value(),o,-1,l)):e===g.LEFT?this.goBack(a,o,r,!1,l):e===g.RIGHT?this.goFwd(a,o,r):e===g.UP&&this.settings.incDecByArrows?this.apply(a,this.incValue(a.section.value()),o,0):e===g.DOWN&&this.settings.incDecByArrows?this.apply(a,this.decValue(a.section.value()),o,0):this.none(a)},lt.prototype.setDefaultVariant=function(t,e){if(!this.settings.defaultOptions)return t;if(!this.hasOptions())return t;e=this.extract(t,e,0,0);return t=""===this.removePlaceholders(e.section.value())?this.apply(e,this.sectionType.options[0],0,0).newValue:t},lt.prototype.selectFirst=function(t,e){t=this.extract(t,e,e,0),t=new rt(t.value(),it.APPLY,t.nextSectionPos());return t.selStart=e,t.selLength=this.settings.replaceMode?1:0,this.isEmptySection()&&(t.selLength=0),t},lt.prototype.selectLast=function(t,e,n){void 0===n&&(n=!1);var i=this.extract(t,e,e,0),t=new rt(i.value(),it.APPLY,i.nextSectionPos());return this.settings.replaceMode?!n&&i.section.length>=this.length&&i.section.length<this.maxLength||this.isEmptySection()?(t.selStart=e+i.section.length,t.selLength=0):(t.selStart=e+i.section.length-1,t.selLength=1):(t.selStart=e+i.section.length-1,t.selLength=0),t},lt.prototype.autoCorrect=function(t,e,n,i){t=this.extract(t,e,n,0),e=t.section.value(),e=this.autoCorrectVal(e);t.update(e,n);t=new rt(t.value(),it.APPLY,t.nextSectionPos());return t.selStart=t.newValue.length,t.selLength=0,t},lt);function lt(t,e,n,i){void 0===i&&(i=null),this.settings=t,this.section=e,this.delimiter=n,this.sectionType=i}var at=function(t,e){void 0===e&&(e=!0),this.placeholder=t,this.replaceMode=e,this.autoCorrect=!0,this.appendPlaceholders=!0,this.allowIncomplete=!1,this.incDecByArrows=!1,this.defaultOptions=!0,this.sectionTypes=[]},ut=(Object.defineProperty(ct.prototype,"settings",{get:function(){return null===this._settings?ct.defaultSettings:this._settings},set:function(e){this._settings=e,this.sections.forEach(function(t){return t.settings=e}),this.updateMask()},enumerable:!0,configurable:!0}),Object.defineProperty(ct.prototype,"pattern",{get:function(){return this._pattern},set:function(t){this._pattern=t,this.updateMask()},enumerable:!0,configurable:!0}),ct.prototype.selectSectionType=function(e){var t=this.settings.sectionTypes.find(function(t){return void 0!==t.selectors.find(function(t){return t===e})});return void 0!==t?t:ct.sectionTypes.find(function(t){return void 0!==t.selectors.find(function(t){return t===e})})},ct.prototype.selectSectionTypeByFirstChar=function(e){var t=this.settings.sectionTypes.find(function(t){return null!==t.selectors.find(function(t){return t[0]===e})});return null!==t?t:ct.sectionTypes.find(function(t){return null!==t.selectors.find(function(t){return t[0]===e})})},ct.prototype.addEmptySection=function(t){this.sections.push(new st(this.settings,"",t))},ct.prototype.addSection=function(t,e){var n=this.selectSectionType(t);if(n){n=new st(this.settings,t,e,n);n.delimiter=e,this.sections.push(n)}else{for(var i=0;i<t.length;i++)this.addEmptySection(t[i]);for(i=0;i<e.length;i++)this.addEmptySection(e[i])}},ct.prototype.pureValue=function(n){if(null===n)return n;var i=0,o="";return this.sections.forEach(function(t){var e=t.extract(n,i);o+=t.removePlaceholders(e.section.value()),i=e.nextSectionPos()}),o},ct.prototype.applyPureValue=function(i){if(null===i)return i;var o="",r=0;return this.sections.forEach(function(t){var e=t.section.length,n=i.substring(r,r+e);o+=n,r+=e,i.length>=r&&(o+=t.delimiter)}),o=this.settings.appendPlaceholders?this.appendPlaceholders(o):o},ct.prototype.updateMask=function(){var t;switch(this.sections=[],this._pattern){case"date":t=this.localeDateFormat;break;case"time":case"timeHM":t=this.localeTimeHMFormat;break;case"timeHMS":t=this.localeTimeHMSFormat;break;case"dateTime":case"dateTimeHM":t=this.localeDateTimeHMFormat;break;case"dateTimeHMS":t=this.localeDateTimeHMSFormat;break;default:t=this._pattern}if(t&&0!==t.length)for(var e=0;e<t.length;){var n=t[e],i=null,o="";if(0<=this._singles.indexOf(n))o=n,i=this.selectSectionType(n);else for(var r=t.length;e<=r&&(o=t.substring(e,r),!(i=this.selectSectionType(o)));r--);if(i){e+=o.length;for(var s="";0<=ct.delimiterChars.indexOf(t[e]);)s+=t[e],e++;""===s&&e<t.length&&null===this.selectSectionTypeByFirstChar(t[e])&&(s=t[e],e++),this.addSection(o,s)}else this.addSection("",n),e++}},ct.prototype.appendPlaceholders=function(t){for(var e=0,n=0;n<this.sections.length;){for(var i=this.sections[n],o=i.extract(t,e);o.section.length<i.length;)o.section.append(this.settings.placeholder);o.delimiter=i.delimiter,t=o.value(),e=o.nextSectionPos(),n++}return t},ct.prototype.checkMask=function(t){return null!==t&&((""!==t||""===this.pattern)&&""!==this.applyMask(t))},ct.prototype.applyMask=function(t,e){void 0===e&&(e=!0);for(var n=0,i=t,o=0;o<this.sections.length;o++){var r=this.sections[o],s=r.extract(i,n);s.delimiter=r.delimiter;var l=s.section.value(),l=r.removePlaceholders(l);if(r.isNumeric()){var a=r.numericValue(l);if(isNaN(a)||""===l)return""}if(l.length<r.length){if(!r.sectionType||!r.sectionType.datePart)return"";if("yyyy"===r.sectionType.datePart&&2!==l.length)return"";if(l.length<1)return""}e&&(l=r.autoCorrectVal(l)),i=s.update(l,0),n=s.nextSectionPos()}return i=i.substring(0,n)},ct.prototype.applyKeyAtPos=function(t,e,n,i,o){var r=(o=void 0===o?0:o)-i,s=0,l=null,a=null,u=0,c=!0;this.settings.appendPlaceholders&&(t=this.appendPlaceholders(t));for(var h=0;h<this.sections.length;h++){var f=(l=this.sections[h]).applyKey(t,e,n,s,i,r,c,h===this.sections.length-1);if(f.action===it.NONE)return null;if(this.settings.appendPlaceholders&&(f.newValue=this.appendPlaceholders(f.newValue)),f.action===it.APPLY)return f;if(f.action===it.GO_BACK_AND_DELETE&&null!==a){var d=a.selectLast(f.newValue,u,!0);return a.applyKey(d.newValue,g.DELETE,"",u,d.selStart,d.selLength)}if(f.action===it.GO_BACK_AND_BACKSPACE&&null!==a){d=a.selectLast(f.newValue,u);return a.applyKey(d.newValue,g.DELETE,"",u,d.selStart,d.selLength)}if(f.action===it.GO_BACK&&null!==a)return a.selectLast(f.newValue,u);if(f.action===it.GO_FWD){if(h<this.sections.length-1){var p=this.sections[h+1],m=p.setDefaultVariant(f.newValue,f.nextSectionPos);return p.selectFirst(m,f.nextSectionPos)}return l.autoCorrect(f.newValue,s,f.selStart,f.selLength)}if(f.action!==it.SKIP){if(s>t.length)return null}else null!==l&&""!==l.section&&(a=l,u=s),""===l.section&&i<f.nextSectionPos&&(c=!1),t=f.newValue,i=f.selStart,s=f.nextSectionPos}return null},ct.maskWithPattern=function(t,e){var n=new ct;return n.setLocale(t.locale),n.pattern=e,n},ct.prototype.setLocale=function(t){this.localeDateFormat=t.dateFormat,this.localeTimeHMFormat=t.timeHMFormat,this.localeTimeHMSFormat=t.timeHMSFormat,this.localeDateTimeHMFormat=t.dateTimeHMFormat,this.localeDateTimeHMSFormat=t.dateTimeHMSFormat,this._separators[0]=t.separators[0],this._separators[1]=t.separators[1],this.selectSectionType("mmm").options=t.shortMonthNames.map(function(t){return t.toLowerCase()}),this.selectSectionType("MMM").options=t.shortMonthNames.map(function(t){return t.toUpperCase()}),this.updateMask()},ct.defaultSettings=new at("_"),ct.delimiterChars=" .,()/|-:+ '",ct.sectionTypes=[{selectors:["HH"],numeric:!0,min:0,max:23,datePart:"H"},{selectors:["h"],numeric:!0,min:1,max:12,datePart:"h"},{selectors:["hh"],numeric:!0,min:1,max:12,datePart:"h"},{selectors:["mi","MI"],numeric:!0,min:0,max:59,datePart:"mi"},{selectors:["ss","SS"],numeric:!0,min:0,max:59,datePart:"ss"},{selectors:["TT","AM","PM"],numeric:!1,options:["AM","PM"],datePart:"tt"},{selectors:["tt","am","pm"],numeric:!1,options:["am","pm"],datePart:"tt"},{selectors:["fff"],numeric:!0,datePart:"ms"},{selectors:["d","dd","DD"],numeric:!0,min:1,max:31,datePart:"d"},{selectors:["m","mm","MM"],numeric:!0,min:1,max:12,datePart:"m"},{selectors:["mmm"],numeric:!1,datePart:"m"},{selectors:["MMM"],numeric:!1,datePart:"m"},{selectors:["yy","YY"],numeric:!0,min:0,max:99,datePart:"yy"},{selectors:["yyyy","YYYY"],numeric:!0,min:0,max:9999,datePart:"yyyy"},{selectors:["b"],numeric:!0,min:0,max:255},{selectors:["~"],numeric:!1,regExp:/[-+]/},{selectors:["*"],numeric:!1,regExp:/[\d\w]/},{selectors:["l","L"],numeric:!1,regExp:/\w/},{selectors:["n","N"],numeric:!1,regExp:/\d/}],ct);function ct(){this._settings=null,this._separators=[".",","],this._singles="*aAnN#0",this.localeDateFormat="",this.localeTimeHMFormat="",this.localeTimeHMSFormat="",this.localeDateTimeHMFormat="",this.localeDateTimeHMSFormat="",this.sections=[]}var ht=function(){this.selectors=[],this.numeric=!1,this.min=null,this.max=null,this.minL=null,this.maxL=null,this.datePart=null},ft=(dt.EMPTY=new dt("EMPTY"),dt.TYPING=new dt("..."),dt.OK=new dt("OK"),dt);
/**
* Copyright (c) 2018-2019 Aleksey Melnikov, True Directive Company.
* @link https://truedirective.com/
* @license MIT
*/function dt(t){this.name=t}
/**
* Copyright (c) 2018-2019 Aleksey Melnikov, True Directive Company.
* @link https://truedirective.com/
* @license MIT
*/
var pt=(mt.CUSTOM=new mt("Custom Action","Custom"),mt.COPY=new mt("Copy","copy"),mt.COPY_WITH_HEADERS=new mt("Copy with headers","copy"),mt.EXPORT_CSV=new mt("Export to CSV","export"),mt.EXPORT_XLS=new mt("Export to XLSX","export"),mt.FILTER=new mt("Filter","column"),mt.GROUP_BY_COLUMN=new mt("Group by this column","column"),mt.HIDE=new mt("Hide this column","column"),mt.COLUMN_LIST=new mt("Column list","column"),mt.SORT_ASC=new mt("Sort Ascending","sort","true-icon-sort-alt-up"),mt.SORT_DESC=new mt("Sort Descending","sort","true-icon-sort-alt-down"),mt);function mt(t,e,n){void 0===n&&(n=""),this.name=t,this.group=e,this.icon=n,this.disabled=!1}var gt,yt=(gt=function(t,e){return(gt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}gt(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),vt=(Ct.prototype.cancel=function(){this._isCanceled=!0},Object.defineProperty(Ct.prototype,"isCanceled",{get:function(){return this._isCanceled},enumerable:!0,configurable:!0}),Ct);function Ct(){this._isCanceled=!1}var wt,bt=(yt(Et,wt=vt),Et);function Et(t){var e=wt.call(this)||this;return e.result=t,e.confirmed=!1,e}var Nt,xt=function(t,e,n,i){this.target=t,this.row=e,this.fieldName=n,this.value=i},St=function(t,e){this.row=t,this.fieldName=e},_t=function(t,e){this.target=t,this.filter=e},Ot=(yt(Rt,Nt=vt),Rt);function Rt(t,e,n){var i=Nt.call(this)||this;return i.rows=t,i.target=e,i.position=n,i}var Tt=function(t,e){this.row=t,this.originalEvent=e},Mt=function(t,e){this.cell=t,this.originalEvent=e},Pt=function(t,e){this.cell=t,this.originalEvent=e},Ft=(Lt.prototype.clone=function(){return new Lt(this.row,this.rowIndex,this.fieldName,this.keyValue)},Lt.prototype.equals=function(t){return null!==t&&((null!==this.keyValue&&this.keyValue===t.keyValue||this.row===t.row)&&this.fieldName===t.fieldName)},Lt);function Lt(t,e,n,i){void 0===i&&(i=null),this.row=t,this.rowIndex=e,this.fieldName=n,this.keyValue=i}var At=(Object.defineProperty(Dt.prototype,"fromRow",{get:function(){return(null!==this.toCell&&this.toCell.rowIndex<this.fromCell.rowIndex?this.toCell:this.fromCell).rowIndex},enumerable:!0,configurable:!0}),Object.defineProperty(Dt.prototype,"toRow",{get:function(){return(!(null!==this.toCell&&this.toCell.rowIndex<this.fromCell.rowIndex)&&null!==this.toCell?this.toCell:this.fromCell).rowIndex},enumerable:!0,configurable:!0}),Object.defineProperty(Dt.prototype,"fromField",{get:function(){return this.fromCell.fieldName},enumerable:!0,configurable:!0}),Object.defineProperty(Dt.prototype,"toField",{get:function(){return(null===this.toCell?this.fromCell:this.toCell).fieldName},enumerable:!0,configurable:!0}),Dt.prototype.equals=function(t,e){return(e===N.ROW||e===N.ROW_AND_RANGE)&&this.fromCell.row===t.fromCell.row&&null===this.toCell&&null===t.toCell||this.fromCell.row===t.fromCell.row&&(this.fromCell.fieldName===t.fromCell.fieldName&&((null!==this.toCell||null===t.toCell)&&((null===this.toCell||null!==t.toCell)&&!!this.toCell.equals(t.toCell))))},Dt.prototype.clone=function(){var t=new Dt(this.fromCell.clone());return null!==this.toCell&&(t.toCell=this.toCell.clone()),t},Dt.prototype.extend=function(t){if(t.fieldName!==this.fromCell.fieldName||t.rowIndex!==this.fromCell.rowIndex)return!(!this.toCell&&!t)&&(!this.toCell&&t?(this.toCell=t,!0):this.toCell&&!t?!(this.toCell=null):(this.toCell.row!==t.row||this.toCell.rowIndex!==t.rowIndex||this.toCell.fieldName!==t.fieldName)&&(this.toCell=t,!0));t=null!==this.toCell;return this.toCell=null,t},Dt);
/**
* Copyright (c) 2018-2019 Aleksey Melnikov, True Directive Company.
* @link https://truedirective.com/
* @license MIT
*/function Dt(t){this.fromCell=t,this.toCell=null}var It=(Ht.highlight=function(t,e,n,i){if(!n||!i)return i;var o=t.toLowerCase();if(""===o)return i;if(e.type===p.NUMBER&&!/\d/.test(o))return i;var r="<span class='true-hl'>",t="</span>";if(e.type!==p.UNSAFE_HTML&&e.type!==p.HTML)return s.decorate(i,o,r,t);t=(t=s.decorate(n,o,r,t)).replace("> ","> ").replace(" <"," <");return i.replace(n,t)},Ht);function Ht(){}var kt=(Object.defineProperty(Wt.prototype,"isChecked",{get:function(){return this._checked},enumerable:!0,configurable:!0}),Wt.prototype.setChecked=function(t){this._checked=t},Object.defineProperty(Wt.prototype,"isCheckbox",{get:function(){return this.type===p.CHECKBOX},enumerable:!0,configurable:!0}),Object.defineProperty(Wt.prototype,"isNumeric",{get:function(){return this.type===p.NUMBER},enumerable:!0,configurable:!0}),Object.defineProperty(Wt.prototype,"isBoolean",{get:function(){return this.type===p.BOOLEAN},enumerable:!0,configurable:!0}),Object.defineProperty(Wt.prototype,"isText",{get:function(){return this.type===p.STRING||this.type===p.REFERENCE||this.type===p.HTML||this.type===p.UNSAFE_HTML},enumerable:!0,configurable:!0}),Object.defineProperty(Wt.prototype,"canReorder",{get:function(){return!this.isCheckbox&&this.columnReorder},enumerable:!0,configurable:!0}),Object.defineProperty(Wt.prototype,"canResize",{get:function(){return!this.isCheckbox&&this.columnResize},enumerable:!0,configurable:!0}),Wt.prototype.createFilter=function(t,e){void 0===e&&(e=null);var n=null,i=[],o=null,r=null;switch(e=this.type===p.STRING||this.type===p.REFERENCE||this.type===p.HTML||this.type===p.UNSAFE_HTML?null!==e?e:S.CONTAINS:this.type===p.BOOLEAN?null!==e?e:S.SET:null!==e?e:S.BETWEEN){case S.BETWEEN:case S.NOT_BETWEEN:r=Array.isArray(t)&&2===t.length?(o=t[0],t[1]):o=t;break;case S.SET:Array.isArray(t)?i=t:i.push(t);break;default:r=o=t}return(n=new R(this.fieldName,e,o,r,i)).format=this.format,n.caption=this.caption,n.type=this.type,n},Wt.prototype.addSummary=function(t){this.summaries.push(new B(t))},Wt.prototype.setSummary=function(t,e){null===(e=void 0===e?null:e)?(this.clearSummaries(),null!==t&&this.summaries.push(new B(t))):null===t?this.summaries.splice(this.summaries.indexOf(e),1):e.type=t},Wt.prototype.clearSummaries=function(){this.summaries.splice(0,this.summaries.length)},Wt.prototype.clone=function(){var t=new Wt(this.fieldName,this.caption,this.width,this.type,this.band,this.format);return t.allowEdit=this.allowEdit,t},Wt);function Wt(t,e,n,i,o,r){void 0===e&&(e=null),void 0===n&&(n=150),void 0===i&&(i=p.STRING),void 0===o&&(o=""),void 0===r&&(r=""),this.fieldName=t,this.caption=e,this.width=n,this.type=i,this.band=o,this.format=r,this.autoWidthMin=void 0,this.autoWidthPriority=0,this.autoWidthFixed=!1,this.columnResize=!