jscharting
Version:
JavaScript charting library
105 lines • 95.9 kB
JavaScript
/*
* modules/toolbar.js v3.4.0.20230215
* (c) 2009-2023 Corporate Web Solutions Ltd.
* All client side / JavaScript code may not be used in any way without a valid JSCharting license.
* License holder usage is governed by the license.txt terms included with the distribution.
* To license JSCharting for your own use, please visit jscharting.com
*/
'use strict';(function(d){function p(d,b){function a(){this.constructor=d}C(d,b);d.prototype=null===b?Object.create(b):(a.prototype=b.prototype,new a)}function J(d){var b="function"===typeof Symbol&&d[Symbol.iterator],a=0;return b?b.call(d):{next:function(){d&&a>=d.length&&(d=void 0);return{value:d&&d[a++],done:!d}}}}function D(d,b){var a="function"===typeof Symbol&&d[Symbol.iterator];if(!a)return d;d=a.call(d);var c,e=[];try{for(;(void 0===b||0<b--)&&!(c=d.next()).done;)e.push(c.value)}catch(g){var h=
{error:g}}finally{try{c&&!c.done&&(a=d["return"])&&a.call(d)}finally{if(h)throw h.error;}}return e}function M(){for(var d=[],b=0;b<arguments.length;b++)d=d.concat(D(arguments[b]));return d}function N(f){var b,a,c,e=[];f=d.jsLib.map(f,function(a){return[[a[0],a[1]],[a[0]+a[2],a[1]],[a[0],a[1]+a[3]],[a[0]+a[2],a[1]+a[3]]]});try{for(var h=J(f),g=h.next();!g.done;g=h.next()){var m=g.value;try{for(var k=(a=void 0,J(m)),l=k.next();!l.done;l=k.next()){var n=l.value;e.push(n);var r=d.jsLib.isUndefined(r)||
n[0]<r?n[0]:r,y=d.jsLib.isUndefined(y)||n[1]<y?n[1]:y,z=d.jsLib.isUndefined(z)||n[0]>z?n[0]:z,p=d.jsLib.isUndefined(p)||n[1]>p?n[1]:p}}catch(E){a={error:E}}finally{try{l&&!l.done&&(c=k.return)&&c.call(k)}finally{if(a)throw a.error;}}}}catch(E){var q={error:E}}finally{try{g&&!g.done&&(b=h.return)&&b.call(h)}finally{if(q)throw q.error;}}var t={min:null,max:null},u={min:null,max:null},v={min:null,max:null},w={min:null,max:null};d.jsLib.each(e,function(a){var c=a[0];a=a[1];if(c==r){var e=u;e.min=null==
e.min||a<e.min?a:e.min;e.max=null==e.max||a>e.max?a:e.max}c==z&&(e=v,e.min=null==e.min||a<e.min?a:e.min,e.max=null==e.max||a>e.max?a:e.max);a==y&&(e=t,e.min=null==e.min||c<e.min?c:e.min,e.max=null==e.max||c>e.max?c:e.max);a==p&&(e=w,e.min=null==e.min||c<e.min?c:e.min,e.max=null==e.max||c>e.max?c:e.max)});q=[];b=[[t.min,y],[t.max,y],[z,v.min],[z,v.max],[w.max,p],[w.min,p],[r,u.max],[r,u.min]];a=b.length;c=b[0];for(e=0;e<a;e++)if(h=b[e],!x||x[0]!==h[0]||x[1]!==h[1])if(e!=a-1||c[0]!==h[0]||c[1]!==h[1]){var x=
h;q.push(h)}q.push(c);return q}function O(d){d=d.keyCode;return d===q.Up||d===q.Right||d===q.Down||d===q.Left}function F(f){var b=f.items,a=f.defaultItem,c=f.itemsBox;c&&"vertical"===c.layout&&(f.defaultItem=f.defaultItem||{},f.defaultItem.width="*");P(f);b&&d.jsLib.eachKey(b,function(c){var e=b[c];if(e&&!d.jsLib.isString(e)){var g=e.icon;g&&g.path&&(g.width=d.jsLib.def(g.width)?g.width:"auto",g.height=d.jsLib.def(g.height)?g.height:"auto");b[c]=a&&!0!==e.ignoreDefault?d.jsLib.merge({},a,e):e;F(b[c])}})}
function P(d){if(d&&d.type){var b=d.type.split(":");d.type=b[0];d.mode||(d.mode=b[1]||null)}}function Q(){d.chartInitializers.toolbar=R;d.chartOptionsAppliers.toolbar=function(d,b,a){b.isRendered&&(b._toolbar.options(d),a.needRefresh=!0)}}function R(f){f.flowEvents.beforeSetUserOptions.on(function(b){"chart"===b.type&&(b=b.owner,b._toolbar=new S(b))});f.flowEvents.beforeApplyLayout.on(function(b){if("chart"===b.type){b=b.owner;var a=b.currentOptions.toolbar||{},c=d.jsLib.epa(a,["items","zoom"]);c&&
0===Object.keys(d.jsLib.omit(c,["position","visible"])).length&&(a=d.jsLib.cloneDeep(a),delete a.items.zoom);b._toolbar.options(a);b.triggerOptionsApplied("toolbar",b._toolbar)}});f.flowEvents.beforeSnapshot.on(function(b){"chart"===b.type&&b.owner._toolbar.visible(!1)});f.flowEvents.afterSnapshot.on(function(b){"chart"===b.type&&b.owner._toolbar.visible(!0)});f.flowEvents.beforeOptionsNormalization.on(function(b){if("chart"===b.type){var a=b.owner;b=b.options;a._toolbar&&b.toolbar&&a._toolbar.normalizeToolbarOptions(b.toolbar)}});
f.flowEvents.beforeDefaultsApply.on(function(b){"chart"===b.type&&(b.options.toolbar=b.owner._toolbar.defaults())})}var C=function(d,b){C=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,c){a.__proto__=c}||function(a,c){for(var e in c)c.hasOwnProperty(e)&&(a[e]=c[e])};return C(d,b)},K=function(f){f=f?f.boxDefaults(1):d.consts.boxDefaults(1);return{fill:f.fill,radius:3,padding:[3,6],visible:!0,boxVisible:!1,animation:!1,outline:f.outline,label:{},states:{hover:{fill:"rgb(220,220,220)"}}}},
T=d.jsLib.plainArray(["margin"]),U=d.jsLib.plainArray(["padding","shape"]),V=d.jsLib.plainArray(["stroke","stroke-dasharray","stroke-opacity","stroke-width"]),G=!1,t=function(f){function b(a,c,e,b){var h=f.call(this,a,c,e)||this;h.target=e;h.parentItem=b;h._itemsVisible=!1;h._itemsBoxVisible=!1;h._itemsBoxHideTimeoutId=null;h._rootPanelShowTimeoutId=null;h._toolbarLocked=!1;h._items=[];h._forceChangeAllow=!1;h._selectedChildItem=null;h._isStackReversed=!1;h._stackedPosition=!1;h._parentVisibility=
!0;h.documentClickHandler=function(a){G=!0;a=a.target;h.rootPanel.isPatched&&!h.isDescendant(a,h.rootPanel.el.el)&&h.showItems(!1)};h.documentMoveHandler=function(a){var c=h.rootVisuals.main;a=c.toRelativeXY(a);var e=[0,0,c.width.px,c.height.px],b=d.bboxLib.pointInside(e,a),g=function(){!d.jsLib.isNull(h._itemsBoxHideTimeoutId)&&clearTimeout(h._itemsBoxHideTimeoutId);h._itemsBoxHideTimeoutId=null},f=function(){h._itemsBoxHideTimeoutId=setTimeout(function(){h.hideItemsBox()},30);return!1};b&&!h._mainEntered&&
h.mainEnterHandler();!b&&h._mainEntered&&h.mainAreaLeaveHandler();h._mainEntered=b;if(h._focusObtained||!h._itemsVisible||b)return g();b=h.rootVisuals.itemsBox;c=[b.globalX-c.globalX,b.globalY-c.globalY,b.width.px,b.height.px];if(d.bboxLib.pointInside(c,a))return g();c=N([e,c]);return d.trigLib.pointInsidePolygon(a,c)?g():f()};h.mainEnterHandler=function(){h.chart.hideTooltip();!1!==h.currentOptions.expandOnHover&&(h.stopShowItems(),h._rootPanelShowTimeoutId=setTimeout(function(){h.showItemsWithCheck(!0)},
100))};h.mainAreaLeaveHandler=function(){h._toolbarLocked&&h.rootVisuals.main.hover(!0);h.stopShowItems()};h.initFP();return h}p(b,f);b.prototype.selectedChildItem=function(){return this._selectedChildItem};b.prototype.itemsVisible=function(){return this._itemsVisible};b.prototype.children=function(){return this._items};b.prototype.initFP=function(){var a=this,c=function(a,b){d.jsLib.each(a._items,function(a){c(a,b);b.push(a)})};a.items=d.collectionPropFactory(d.UpdatablesCollection,function(){var e=
[];c(a,e);return e},function(c){var e=a.items().items;d.jsLib.each(e,function(a){return a.destroy()});d.jsLib.each(c,function(c){return a.addChildren(c)});a.refresh()},{push:function(c,b){c.push?d.jsLib.each(c,function(c){return a.addChildren(c)}):a.addChildren(c);a.refresh()},splice:function(c,b,g,f){f=a.items().items;var e=f[c].parentItem,h=[],m=e._items.indexOf(f[c]);g=g||[];for(var r=c;r<c+b;r++)h.push(f[r]);d.jsLib.each(h,function(a){return a.destroy()});d.jsLib.each(g,function(a){return e.addChildren(a,
m++)});a.refresh()},remove:function(c){(c=a.items(c))&&c.remove()}})};b.prototype.select=function(a){this.rootVisuals.main.select(a)};b.prototype.hover=function(a){this.rootVisuals.main.hover(a)};b.prototype.refresh=function(){(this.rootVisuals?this.rootVisuals.main:this.chart.rootVisuals.uiItemsFront).isPatched&&this.chart.chartAreaSet.reflow(d.undefVal,!1,!0)};b.prototype.value=function(a){if(d.jsLib.isUndefined(a))return this.getValue();this.setValue(a);return this};b.prototype.getValue=function(){var a=
this._value;return d.jsLib.def(a)?a:this.key};b.prototype.setValue=function(a){this._value=this.currentOptions.value=a};b.prototype.defaultOptions=function(){var a=d.jsLib.merge(d.annotationDefaults(this.chart),K(this.chart)),c=this.userOptions;return!d.jsLib.evalPath(c,"itemsBox.visible")&&d.jsLib.evalPath(c,"label.text")&&c.items?d.jsLib.merge(a,{icon:{name:"system/default/expand-more",xAlignment:"right",fill:"rgb(123,123,123)"},itemsBox:{boxVisible:!1}}):a};b.prototype.normalizeOptions=function(a){a=
f.prototype.normalizeOptions.call(this,a);var c=a.items;if(d.jsLib.isString(c)){var e={},b=function(a){return e[a.trim()]={}};0===c.indexOf("enum_")?(c=d.miUtils.getApiEnum(c.replace("enum_","")))&&d.jsLib.eachKey(c.members,b):d.jsLib.each(c.split(","),b);a.items=e}return a};b.prototype.setRootVisuals=function(){f.prototype.setRootVisuals.call(this);var a=this.rootPanel;this.rootVisuals.main||this.createVisuals();a.attr({transition:!1});return this};b.prototype.fillEventActions=function(){var a=this;
return{showItems:function(c,e,b){if(!a.hasItems)return!0;if(!a._toolbarLocked)return!a._itemsVisible&&a.showItems(),a._toolbarLocked=!0,!1;c=a.chart.rootPanel.events.vclick;!G&&c&&c.trigger({el:b.el,eventArgs:{target:b.el.el,clientX:0,clientY:0}});G=!1;a.showItems();return!1}}};b.prototype.createVisual=function(){return this.renderer.button()};b.prototype.createContentVisual=function(a){return null};b.prototype.createMainVisual=function(a){return this.renderer.button()};b.prototype.getRole=function(){return this.currentOptions.description?
"UiItem":null};b.prototype.getDescription=function(){return this.currentOptions.description};b.prototype.createVisuals=function(){var a=this,c=a.rootPanel,e=a.rootVisuals,b=a.currentOptions,g=b.items,f=a.renderer,k=e.main=a.createMainVisual(a.chart);k.on("mouseenter",function(c){a.chart.chartAreas().each(function(a){return a.mouseOut(c)})});a.hasItems=!d.jsLib.isEmpty(g);if(a.hasItems){b=a._stackedPosition=!0===d.jsLib.evalPath(b,"itemsBox.visible");var l=a.chart.rootVisuals.uiItemsFront;b?(l=e.mainStack=
f.panel({type:"stack:y",yContentAlignment:"center",xContentAlignment:"center"}).add(c),k.add(l)):k.add(c);c=a.createItemsBox(l);a.createUiItems(g);d.jsLib.evalPath(a.currentOptions,"itemsBox.visible")?(a._itemsBoxVisible=!0,a._itemsVisible=!0,a._toolbarLocked=!0,a.updateChildrenVisibility(!0)):(c.visible(!1,!0),a.updateChildrenVisibility(!1),a.subscribeEvents())}else k.add(c)};b.prototype.createItemsBox=function(a){var c=this.rootVisuals,e=this.renderer,b=this.currentOptions;a=c.itemsBox=e.box().add(a);
c.itemsStack=e.panel({type:"stack",orientation:this.toOrientation(b.itemsBox),width:"100%",yContentAlignment:"center",xContentAlignment:"center"}).add(a);return a};b.prototype.createUiItems=function(a,c){void 0===c&&(c=!1);var e=this,b=[],g=function(a,c){for(var e=d.jsLib.def(c.order)?c.order:0,h=0,g=0;g<b.length&&!(b[g].order>e);g++)h=g+1;b.splice(h,0,{key:a,value:c,order:e})};d.jsLib.isArray(a)?d.jsLib.each(a,function(c,e){return g(c,a[e])}):d.jsLib.eachKey(a,function(c){return g(c,a[c])});d.jsLib.each(b,
function(a){return e.createUiItem(a.key,a.value,c)})};b.prototype.createUiItem=function(a,c,e,b){void 0===e&&(e=!1);if(c){var h=this.currentOptions,f=this.rootVisuals&&this.rootVisuals.itemsStack?this.rootVisuals.itemsStack:this.chart.rootVisuals.uiItemsFront;if(!c.exclude&&!1!==c.enable&&(e||!1!==c.visible))return d.jsLib.isObject(c)||(c={label_text:c.toString()}),c=d.jsLib.merge({},{events:{click:"showItems"}},c),c=d.jsLib.merge({},!0===c.ignoreDefault?{}:h.defaultItem,c),c.actions=d.jsLib.extend(h.actions,
c.actions),c.key=a,h=this.chart,e=c.type,e&&d.jsLib.has(w,e)||(e=(e=c.defaultItem)&&e.type,e=(d.jsLib.has(w,e)?w[e][2]:null)||"default",c.type=e),e=w[e],b=(new (e?e[0]:t)(h,void 0,void 0,this)).options(e&&e[1]?e[1](c):c).add(f,b),b.key=a,this._items.push(b),b}};b.prototype.addChildren=function(a,c){var e=this.userOptions.items;if(c=this.createUiItem(a.key,a,!1,c))e[c.key]=a,c.options(a),c.updateParentVisibility(this.isVisible&&this._itemsBoxVisible)};b.prototype.removeChildren=function(a){var c=this._items,
e=this.userOptions.items;c.splice(c.indexOf(a),1);e&&delete e[a.key]};b.prototype.remove=function(){var a=this.parentItem||this;this.destroy();a.refresh()};b.prototype.destroy=function(){var a=this.rootVisuals,c=this.chart.renderer.renderer.documentElement;c.un("vmove",this.documentMoveHandler);c.un("vclick",this.documentClickHandler);this.parentItem&&this.parentItem.removeChildren(this);d.jsLib.each(this._items,function(a){return a.destroy()});this._items=[];a&&a.itemsBox&&a.itemsBox.destroy();f.prototype.destroy.call(this)};
b.prototype.activateAccessibility=function(a,c){this._needFocusActivation=a;this.activateFocus(a,c)};b.prototype.applyOptions=function(a){void 0===a&&(a={});if(!1===a)return this;var c=this.currentOptions,e=this.userOptions,b=this.rootVisuals,g=b.itemsStack,m=b.itemsBox,k=d.jsLib.copy(c.itemsBox),l=!1!==e.boxVisible,n=e.itemsBox&&e.itemsBox.visible;if(this.hasItems&&k){this.correctItemAttrs(k.key,k);!1===k.boxVisible&&(k.fill="none",k.stroke="none");m.attr(k);if(d.jsLib.def(k.visible)){var r=k.visible;
this._toolbarLocked=this._itemsVisible=this._itemsBoxVisible=r;m.visible(r,!0);this.updateChildrenVisibility(r)}m={orientation:this.toOrientation(k)};k.verticalAlign&&(m.yContentAlignment=k.verticalAlign);k.align&&(m.xContentAlignment=k.align);g.attr(m)}f.prototype.applyOptions.call(this,a);b=b.main;g=d.jsLib.extendCopyScopedNegate({},c,T);k=this._eventActions=this._eventActions||this.fillEventActions();c.actions&&d.jsLib.extend(k,c.actions);this.correctItemAttrs(g.key,g,!0);k=d.jsLib.evalPath(g,
"text.val");d.jsLib.def(k)||(k=g.icon&&!g.icon.ingorableForText?null:g.key,g.text=g.text||{});this.text=k;g.text.val=this.processTokens(k)||this.currentOptions.placeholder||"";l||(g.fill="none",g.stroke="none",k=!d.jsLib.isEmpty(this.currentOptions.items),d.jsLib.evalPath(g,"events.click")&&("default"!==g.type||k)||(g.cursor="default"),g.padding=0,m=g.states=g.states||{},k=m.hover=m.hover||{},k.fill="none",k.stroke="none");"label"===g.type&&n&&(g.cursor="default");l&&(g.boxVisible=!0,d.jsLib.extend(g,
d.stylingLib.boxToLayoutBoxAttr(g)),k=(m=g.states)&&m.hover,l=m&&m.select,k&&d.jsLib.extend(k,d.stylingLib.boxToLayoutBoxAttr(k)),l&&d.jsLib.extend(l,d.stylingLib.boxToLayoutBoxAttr(l)));b.attr(g);d.jsLib.has(c,"value")?(this._denyTriggerEvents=!0,this.value(c.value),this._denyTriggerEvents=!1,delete e.value):d.jsLib.def(this.currentOptions.value)||(this.currentOptions.value=this.getValue());!0!==a.skipReflow&&this.refresh();this.activateFocus(this._focusActivated,this._tabIndex);return this};b.prototype.change=
function(){var a=this._denyTriggerEvents;this._denyTriggerEvents=!1;this._forceChangeAllow=!0;this.value(this.value());this._denyTriggerEvents=a;this._forceChangeAllow=!1;return this};b.prototype.completeUserOptions=function(){return this.userOptions};b.prototype.triggerOptionsApplied=function(){this.chart.triggerOptionsApplied("uiitem",this)};b.prototype.transformRootAttr=function(a){return d.jsLib.extendCopyScopedNegate({"stroke-width":0},a,U)};b.prototype.positionApplied=function(a){var c=this;
if(c.hasItems){var e=c.currentOptions.itemsBox||{},b=e.position;if(a&&a[2]){var g=a[2]-30;d.jsLib.each(c._items,function(c){c.rootVisuals.main.attr({maxWidth:g});c.positionApplied(a)})}if(c._stackedPosition)c.updateStackedPosition(b||"bottom");else{var f=function(){var a=D(d.cachedPositionInfo(c),2);if(a[0])return"bottomLeft";var e=D(a[1],4);a=e[3];e="b"===e[2]?"top":"bottom";if("bottom"===e){var b=c.rootVisuals.main.getGlobalBbox();b=b.y+b.height;var h=c.chart.rootVisuals.uiItemsFront.height.px,
g=l.height.px;e=b>h/2&&b+g>h?"top":e}"l"===a&&(e+="Left");"r"===a&&(e+="Right");return e},k=c.rootVisuals;e=d.jsLib.parseMargin(e.margin);var l=k.itemsBox;b=b&&"none"!==b?b:f();b=W(b,e);l.state.needRecalculation&&l.update();l.attr(d.getAlignToOffsets(l,k.main,b[0][0],b[0][1],b[2]))}}};b.prototype.updateStackedPosition=function(a){var c=this.currentOptions;a=a.toLowerCase();var e=-1<a.indexOf("right"),b=-1<a.indexOf("left");a=-1<a.indexOf("top");a=d.jsLib.has(c,"reversed")?c.reversed:b||a;var g=d.jsLib.detect(["orientation",
"layout"],c)?this.toOrientation(c):b||e?"x":"y";e=a!==this._isStackReversed;b=this.rootVisuals.mainStack;g={xContentAlignment:c.align||"center",orientation:g};c.verticalAlign&&(g.yContentAlignment=c.verticalAlign);b.attr(g);e&&(this._isStackReversed=a,b.reverse())};b.prototype.toOrientation=function(a){return a?a.orientation?a.orientation:a.layout&&"vertical"===a.layout?"y":"x":"x"};b.prototype.showItemsWithCheck=function(a){this._toolbarLocked||this.showItems(a)};b.prototype.showItems=function(a){var c=
this.rootVisuals,e=c.main,b=c.itemsBox;!this._itemsBoxVisible&&this.hasItems&&(this._toolbarLocked=!1,a=d.jsLib.def(a)?a:!this._itemsVisible,c.mouseArea&&c.mouseArea.attr({fill:a?"white":"none"}),this._itemsVisible=a,b.visible(a,!0),e.hover(a),this.select(a),b.isPatched&&b.patch())};b.prototype.subscribeEvents=function(){var a=this.chart.renderer.renderer.documentElement;a.on("vmove",this.documentMoveHandler);a.on("vclick",this.documentClickHandler)};b.prototype.visible=function(a){var c=this.rootVisuals.itemsBox,
e=f.prototype.visible.call(this,a);this._itemsBoxVisible&&(c.visible(this.isVisible),this.updateChildrenVisibility(this.isVisible));a?this._needFocusActivation&&this.activateFocus(this._needFocusActivation,this._tabIndex):this.activateFocus(!1);return e};b.prototype.activateFocus=function(a,c){this._tabIndex=c;this.skipFocusActivation(a)||(this.subscribeUiItemEvents(a),this.subscribeDocEvents(a),this._focusActivated=a)};b.prototype.skipFocusActivation=function(a){return a===this._focusActivated&&
a!==this._ownVisibility?!0:!1};b.prototype.subscribeUiItemEvents=function(a){var c=this;c.rootPanel.useMainElementForEvents(!0);a&&c._ownVisibility?(c.rootPanel.attr({tabindex:c.currentOptions.tabIndex||c._tabIndex,role:c.getRole(),"aria-label":c.getDescription()}),c.rootPanel.on("vchangefocus",function(a){c.focusObtained(a.eventArgs.hasFocus)})):(c.rootPanel.attr({tabindex:null,role:null,"aria-label":null}),c.rootPanel.un("vchangefocus"));c.rootPanel.useMainElementForEvents(!1)};b.prototype.subscribeDocEvents=
function(a){var c=this,b=c.chart.renderer.renderer.documentElement;a?(c._keyUpHandler||c._keyDownHandler||(c._keyUpHandler=function(a){c.keyUpHandler(a)},c._keyDownHandler=function(a){c.keyDownHandler(a)}),b.on("keydown",c._keyDownHandler),b.on("keyup",c._keyUpHandler)):c._keyUpHandler&&c._keyDownHandler&&(b.un("keydown",c._keyDownHandler),b.un("keyup",c._keyUpHandler))};b.prototype.vkeyEnterHandler=function(){this._selectedChildItem?(this._selectedChildItem.rootVisuals.main.click(),this.unselectChildItem(),
this.hover(!this.currentOptions.normalStateOnItemSelect),this.rootPanel.el.el.focus(),this.showItems(!1),this._childItemEnterPressed=!0):(this.rootVisuals.main.click(),this.hover(this.hoverOnEnter()),this.currentOptions.autoSelectFirstItem&&this.selectChildItem(!0))};b.prototype.hoverOnEnter=function(){return d.jsLib.def(this.currentOptions.hoverOnEnter)?this.currentOptions.hoverOnEnter:!0};b.prototype.focusObtained=function(a){if(this._focusObtained=a)this.unselectChildItem(),clearTimeout(this._keyUpTimeoutId);
this._items&&this._items.length&&(this._childItemEnterPressed?this._childItemEnterPressed=!1:this.showItemsWithCheck(a))};b.prototype.afterChildItemSelected=function(a){};b.prototype.selectChildItem=function(a,c){if(this._items&&this._items.length){clearTimeout(this._keyUpTimeoutId);var b=0;this._selectedChildItem&&(b=this._items.indexOf(this._selectedChildItem),a?b++:b--,b>=this._items.length?b=0:0>b&&(b=this._items.length-1),this.unselectChildItem());this._selectedChildItem=this.items(b);this._selectedChildItem.hover(!0);
a=this._selectedChildItem.rootVisuals.main.el;a.attr({tabindex:this._tabIndex});c||a.el.focus();this.afterChildItemSelected(this._selectedChildItem)}};b.prototype.unselectChildItem=function(){this._selectedChildItem&&(this._selectedChildItem.hover(!1),this._selectedChildItem.rootVisuals.main.el.attr({tabindex:null}),this._selectedChildItem=null)};b.prototype.keyUpHandler=function(a){var c=this.currentOptions,b=c.invertKeys;c=c.multiple;a=a.keyCode;if(this._focusObtained||this._selectedChildItem)if(a===
q.Enter)this.vkeyEnterHandler();else if(this.itemsVisible()||!c)if(a===q.Esc)this.showItems(!1),this.hover(!this.currentOptions.normalStateOnItemSelect),this.unselectChildItem();else{this._toolbarLocked=!0;c=q.Right;var h=q.Up,d=q.Left,f=q.Down;b&&(c=q.Left,h=q.Down,d=q.Right,f=q.Up);a===c||a===h?this.selectChildItem(!1):a!==d&&a!==f||this.selectChildItem(!0)}};b.prototype.keyDownHandler=function(a){var c=this,b=a.keyCode;c._itemsVisible&&(b===q.Tab?c._keyUpTimeoutId=setTimeout(function(){c._focusObtained||
(c._toolbarLocked=!1,c.unselectChildItem(),c.showItemsWithCheck(!1))},150):O(a)&&a.preventDefault())};b.prototype.updateChildrenVisibility=function(a){var c=a&&this._itemsBoxVisible;d.jsLib.each(this._items,function(a){a.updateParentVisibility(c);a.updateChildrenVisibility(c)})};b.prototype.updateParentVisibility=function(a){this.isVisible=(this._parentVisibility=a)&&this._ownVisibility};b.prototype.setVisible=function(a){this._ownVisibility=a;this.isVisible=this._parentVisibility&&this._ownVisibility};
b.prototype.isDescendant=function(a,c){for(a=a.parentNode;a;){if(a===c)return!0;a=a.parentNode}return!1};b.prototype.stopShowItems=function(){this._rootPanelShowTimeoutId&&(clearTimeout(this._rootPanelShowTimeoutId),this._rootPanelShowTimeoutId=null)};b.prototype.hideItemsBox=function(){this.stopShowItems();this.showItemsWithCheck(!1)};b.prototype.processTokens=function(a){return a};b.prototype.correctItemAttrs=function(a,c,b,h){d.jsLib.has(c,"icon")&&this.correctIcon(c,b,h);d.jsLib.has(c,"label")&&
this.correctLabel(c);d.jsLib.has(c,"outline")&&this.correctOutline(c);d.jsLib.has(c,"events")&&this.correctEvents(a,c.events,b);b&&(c.states=this.correctStates(a,c));d.jsLib.has(c,"tooltip")&&(c.title=c.tooltip)};b.prototype.correctOutline=function(a){var c=a.outline;"none"===c.color?(a.stroke="none",a["stroke-width"]=0):d.jsLib.extendScoped(a,d.stylingLib.lineToAttr(c),V)};b.prototype.correctIcon=function(a,c,b){var e=a.icon;if(!e||"none"===e)return null;d.jsLib.isString(e)&&(e={name:e});if(c||!b.icon)e=
d.jsLib.merge(e.path?{width:"auto",height:"auto",outerShape:"none",fill:"#727272"}:{width:16,height:16,outerShape:"none",fill:"#727272"},e),c||(b.icon=null);a.icon=d.jsLib.extend(e,d.stylingLib.shapeToAttr(e))};b.prototype.correctLabel=function(a){var c=a.label;if(c){if(d.jsLib.isString(c)){var b=c;c={}}else c=d.stylingLib.labelToAttr(c),b=d.jsLib.evalPath(a,"label.text");b=this.evalText(b);d.jsLib.def(b)&&(c.val=b);a.text=c}else a.text=null};b.prototype.correctEvents=function(a,c,b){var e=this,g=
e._eventActions;d.jsLib.eachKey(c,function(a){var b=c[a];d.jsLib.has(g,b)&&(c[a]=g[b]);var h=c[a];c[a]=function(a){return h.call(e,e.value(),e,a)}})};b.prototype.correctStates=function(a,c){var b=this,h={},g=c.states;d.jsLib.eachKey(g,function(e){var d=g[e];d&&"none"!==d?(b.correctItemAttrs(a,d,!1,c),h[e]=d):g[e]=null});return h};return b}(d.Annotation),X=d.jsLib.plainArray(["radio","option"]),u=function(f){function b(){return null!==f&&f.apply(this,arguments)||this}p(b,f);b.prototype.defaultOptions=
function(){var a=this.userOptions;d.jsLib.def(a.boxVisible)&&(this._boxVisible=a.boxVisible)&&delete a.boxVisible;d.jsLib.def(this._value)&&"boolean"===typeof this._value||(this._value=!1);return d.jsLib.merge(f.prototype.defaultOptions.call(this),this._boxVisible?{}:{outline:{color:"none"},fill:"none",padding:[0],margin:[0],radius:0,states:{hover:{fill:"none"}}})};b.prototype.createMainVisual=function(){var a=this.currentOptions;return this.renderer.button({type:a.type,triggerSelectIfFalse:a.triggerSelectIfFalse})};
b.prototype.setValue=function(a){var c=this.getValue();f.prototype.setValue.call(this,a);(this._forceChangeAllow||c!==a)&&this.rootVisuals.main.select(a,this._forceChangeAllow)};b.prototype.correctEvents=function(a,c,b){var e=this;if(b){var g=c.change;c.change=function(a,c,b){a=b.isSelected;f.prototype.setValue.call(e,a);g&&(!c||!c._denyTriggerEvents&&c.chart.inited)&&g.call(c,a,c,b);d.jsLib.epa(c,["parentItem","itemChanged"])&&c.parentItem.itemChanged(a,c,b)}}f.prototype.correctEvents.call(this,
a,c,b)};return b}(t),Y={simple:function(){return{outline:{color:"none"},fill:"none",cursor:"default",margin:1,padding:[0],align:"left",states:{hover:{fill:"none"}},defaultItem:{events:{}},itemsBox:{outline:{color:"none"},fill:"none",layout:"vertical",align:"left"}}},dropdown:function(){return{padding:[1],margin:1,fill:"rgb(255,255,255)",outline:{color:"rgb(123,123,123)"},radius:2,corners:"round",align:"left",autoWrap:"default",expandOnHover:!1,label:{text:"%value",style:{textOverflow:"ellipsis",autoWrap:"default"}},
icon:{ingorableForText:!0,name:"system/default/expand-more",width:14,height:14,xAlignment:"right",fill:"#a5a5a5"},states:{hover:{outline:{color:"#7ba8e5"},fill:"#eff8ff"}},itemsBox:{margin:[-1,0,0,0],fill:"rgb(255,255,255)",layout:"vertical",align:"left",outline:{color:"rgb(123,123,123)"}},defaultItem:{margin:[0],height:18,autoWrap:"default",label:{color:"rgb(0,0,0)",style:{fontWeight:"normal",textOverflow:"ellipsis",autoWrap:"default"}},outline:{width:1,color:"rgb(255,255,255)"},icon:{ingorableForText:!0,
name:"none"},events:{},states:{hover:{fill:"rgb(144,144,144)",label:{color:"rgb(255,255,255)"},outline:{width:1,color:"rgb(144,144,144)"}},select:{icon:{name:"system/default/check",width:14,height:14,xAlignment:"right",fill:"rgb(123,123,123)"}}}}}}},v=function(f){function b(){return null!==f&&f.apply(this,arguments)||this}p(b,f);b.prototype.showItems=function(a){var c=this.rootVisuals.scroll;!this.itemsVisible()&&a&&c.moveVerticalSliderToPosition(0);return f.prototype.showItems.call(this,a)};b.prototype.afterChildItemSelected=
function(a){var c=this.rootVisuals,b=c.scroll,d=b.globalY;c=c.scroll.height.px;var g=a.rootVisuals.main;a=g.globalY;g=g.height.px;this.itemsVisible()&&(c=a+g-(d+c),0<c&&b.increaseVerticalScrollPosition(c),c=a-g-d,0>c&&b.increaseVerticalScrollPosition(c))};b.prototype.createItemsBox=function(a){var c=this,b=c.rootVisuals,d=c.renderer,g=c.currentOptions;a=b.itemsBox=d.box({zIndex:2}).add(a);b.scroll=d.panel({type:"scroll",width:"100%",height:g.scrollPanelHeight,scrollBarWidth:g.scrollBarWidth||"6px",
frontPanel:c.chart.rootVisuals.uiItemsFront}).add(a);b.scroll.scrollHandler(function(a){a||c.rootPanel.el.el.focus();c._scrolling=a});b.itemsStack=d.panel({type:"stack",orientation:c.toOrientation(g.itemsBox),width:"100%",yContentAlignment:"center",xContentAlignment:"center"}).add(b.scroll);return a};b.prototype.focusObtained=function(a){!a&&this._scrolling||f.prototype.focusObtained.call(this,a)};b.prototype.positionApplied=function(a){f.prototype.positionApplied.call(this,a);var c=this.userOptions,
b=this.rootVisuals.itemsBox;this.rootVisuals.scroll.checkAddScroll()&&f.prototype.positionApplied.call(this,a);"*"===d.jsLib.evalPath(c,"itemsBox.width")&&(a=this.rootPanel.getBbox().width,d.jsLib.setPathVal(c,"itemsBox.width",a),b.attr({width:a}))};return b}(function(f){function b(){var a=null!==f&&f.apply(this,arguments)||this;a._singleSelection=!0;a._hideAfterSelect=!1;a._selectedItems={};return a}p(b,f);b.prototype.vkeyEnterHandler=function(){this.selectedChildItem()&&!this._hideAfterSelect&&
this.showItems(!1);f.prototype.vkeyEnterHandler.call(this)};b.prototype.defaultOptions=function(){var a=this.userOptions,c=d.jsLib.evalPath(a,"defaultItem.type");c=this._theme=!c||"radio"!==c&&"checkbox"!==c&&"toggle"!==c&&"button"!==c?"dropdown":"simple";var b=d.jsLib.merge(d.annotationDefaults(),K(),Y[c]());a.multiple&&(b.defaultItem.multiple=!0);"dropdown"===c&&d.jsLib.evalPath(a,"itemsBox.visible")&&(b.icon=null);return b};b.prototype.selectChildItem=function(a){var c=this.currentOptions.multiple,
b=d.jsLib.keys(this._selectedItems)[0];c||this._selectedChildItem||this.itemsVisible()||(this._selectedChildItem=this._selectedItems[b]);f.prototype.selectChildItem.call(this,a,!this.itemsVisible());this._selectedChildItem&&!this.itemsVisible()&&(this._selectedChildItem.rootVisuals.main.click(),this.unselectChildItem(),this.hover(!0))};b.prototype.checkForAutoSize=function(){this._autoSized=!0;if("dropdown"===this._theme){var a=this.userOptions,c=this.rootVisuals,b=this.rootPanel,h=c.main;c=c.itemsBox;
var g=d.jsLib.evalPath(a,"itemsBox.width"),f=a.width;if(!f){var k=[];g?k.push(g):d.jsLib.each(this._items,function(a){k.push(a.rootVisuals.main.textVisual.setPreliminarySize().getBbox().width+40)});b.setPreliminarySize().getBbox();if((f=d.jsLib.evalPath(a,"label.text"))&&-1<f.indexOf("%value")){var l="",n=0;d.jsLib.each(this._items,function(a){a=a.text||"";a.length>n&&(l=a,n=a.length)});var r=f.replace("%value",l);f=h.textVisual;var p=f.val();f.val(r);r=f.setPreliminarySize().getBbox().width+40;f.val(p);
k.push(r)}f=a.width=d.jsLib.max(k);h.attr({width:f});b.attr({width:f})}g||(d.jsLib.setPathVal(a,"itemsBox.width",f),c.attr({width:f}));d.jsLib.evalPath(a,"label.width")||(b=f-30,d.jsLib.setPathVal(a,"label.width",b),h.attr({text:{width:b}}));d.jsLib.setPathVal(a,"defaultItem.width","*");d.jsLib.each(this._items,function(a){a.rootVisuals.main.attr({width:"*"});a.rootPanel.attr({width:"*"})})}};b.prototype.applyOptions=function(a){void 0===a&&(a={});if(!1===a)return this;var c=this.currentOptions;d.jsLib.has(c,
"multiple")&&(this._singleSelection=!c.multiple);this._singleSelection&&!d.jsLib.evalPath(c,"itemsBox.visible")&&(this._hideAfterSelect=!0);!this._value&&c.selectFirstIfEmpty&&!c.value&&this._items.length&&(c.value=this._items[0].key);f.prototype.applyOptions.call(this,a);this._autoSized||this.checkForAutoSize();return this};b.prototype.correctEvents=function(a,c,b){if(b&&d.jsLib.has(c,"change")){var e=this._eventActions,g=c.change;this._changeHandler=d.jsLib.has(e,g)?e[g]:g;delete c.change}f.prototype.correctEvents.call(this,
a,c,b)};b.prototype.selectedItems=function(){return this._selectedItems};b.prototype.selectedItem=function(){for(var a in this._selectedItems)return a;return null};b.prototype.clearSelection=function(){for(var a in this._selectedItems)this._selectedItems[a].visual?this._selectedItems[a].visual.select(!1):this._selectedItems[a].rootVisuals&&this._selectedItems[a].rootVisuals.main.select(!1);this._selectedItems={}};b.prototype.getValue=function(){var a=this._selectedItems,c=[],b;for(b in a)c.push(b);
return c.join(",")};b.prototype.setValue=function(a){f.prototype.setValue.call(this,a);var c=this,b=c._items;this.clearSelection();if(!a)return this;d.jsLib.each(a.split(","),function(a){var e=d.jsLib.find(b,function(c){return c.key===a});e?e.value(!0):(c.currentOptions.placeholder=a,c.updatePlaceholder())});return c};b.prototype.itemChanged=function(a,c,b){var e=this,g=c.key;c=e._items;if(e._singleSelection){if(!a)return;d.jsLib.each(c,function(a){a.key===g?(e._selectedItems={},e._selectedItems[g]=
a):a.value(!1)})}else{c=d.jsLib.find(c,function(a){return a.key===g});if(!c)return;a?e._selectedItems[g]=c:delete e._selectedItems[g]}e._hideAfterSelect&&e.showItems(!1);e.updatePlaceholder();e.currentOptions.value=e.value();!e._denyTriggerEvents&&e.chart.inited&&e._changeHandler&&e._changeHandler(e.value(),e)};b.prototype.updatePlaceholder=function(){this.rootVisuals.main.attr({text:this.processTokens(this.text)||this.currentOptions.placeholder||"",states:{}})};b.prototype.processTokens=function(a){if(!a||
0>a.indexOf("%value"))return a;var c=[],b;for(b in this._selectedItems)c.push(this._selectedItems[b].text);return a.replace("%value",c.join(","))};return b}(t)),x=function(d){function b(){return null!==d&&d.apply(this,arguments)||this}p(b,d);b.prototype.defaultOptions=function(){var a=this.userOptions.mode;a=a?a.toLowerCase():null;var c=d.prototype.defaultOptions.call(this);"file"===a&&(c.hoverOnEnter=!1);return c};b.prototype.activateFocus=function(a,c){var b=this.currentOptions.mode;"range"===(b?
b.toLowerCase():null)?this.rootVisuals.main.activateFocus(a,c):d.prototype.activateFocus.call(this,a,c)};b.prototype.focusObtained=function(a){var c=this.currentOptions.mode;c=c?c.toLowerCase():null;"file"===c||"color"===c?d.prototype.focusObtained.call(this,a):(this.rootVisuals.main.setHtmlElementTabIndex(this.rootPanel.attr("tabindex")),this.rootVisuals.main.displayHtmlInput(!0))};b.prototype.createMainVisual=function(){var a=this.currentOptions.mode;if(a){a=a.toLowerCase();if("file"===a)return this.renderer.file();
if("color"===a)return this.renderer.color();if("range"===a)return this.renderer.range()}return this.renderer.input()};b.prototype.getValue=function(){return this.rootVisuals.main.value()};b.prototype.setValue=function(a){var c=this.getValue();d.prototype.setValue.call(this,a);c!==a&&this.rootVisuals.main.value(a)};return b}(t),H=function(d){function b(){return null!==d&&d.apply(this,arguments)||this}p(b,d);b.prototype.defaultOptions=function(){var a=d.prototype.defaultOptions.call(this);a.hoverOnEnter=
!1;return a};b.prototype.activateFocus=function(a,c){d.prototype.activateFocus.call(this,a,c)};b.prototype.createMainVisual=function(){return this.renderer.file()};b.prototype.getValue=function(){return this.rootVisuals.main.value()};b.prototype.setValue=function(a){};return b}(t),I=function(d){function b(){return null!==d&&d.apply(this,arguments)||this}p(b,d);b.prototype.isDisabled=function(){return this.rootVisuals.main.isDisabled()};b.prototype.disable=function(a){this.rootVisuals.main.disable(a)};
b.prototype.activateFocus=function(a,c){this.rootVisuals.main.activateFocus(a,c)};b.prototype.createMainVisual=function(a){return this.renderer.range(void 0,a,this)};b.prototype.getValue=function(){return this.rootVisuals.main.value()};b.prototype.setValue=function(a){this.rootVisuals.main.value(a)};b.prototype.positionApplied=function(a){d.prototype.positionApplied.call(this,a)};return b}(t),A=function(f){L(f);var b=f.defaultItem.type;"option"===b&&(f.selectFirstIfEmpty=!0);d.jsLib.has(X,b)&&!f.multiple&&
(f.defaultItem.triggerSelectIfFalse=!0);return f},L=function(d){var b=d.defaultItem=d.defaultItem||{};b.type=b.type||"option";return d},w={option:[u,null,null],radio:[u,null,"select"],checkbox:[u,null,null],toggle:[u,null,null],select:[v,A,null],scroll:[v,A,null],selectMultiple:[v,function(d){L(d);d.multiple=!0;return d},null],input:[x,null,null],file:[H,null,null],range:[I,null,null],label:[t,null,null]},W=function(d,b,a){void 0===a&&(a=[0,0]);var c=["top|left","bottom|left"],e=[b[3],b[0],b[3],b[3],
-b[2]];switch(d){case "left":c=["middle|left","middle|right"];e=[b[3],b[0],-b[1],b[0]];break;case "right":c=["middle|right","middle|left"];e=[-b[1],b[0],b[3],b[0]];break;case "top":c=["top|center","bottom|center"];e=[b[3],b[0],b[3],-b[2]];break;case "bottom":c=["bottom|center","top|center"];e=[b[3],-b[2],b[3],b[0]];break;case "center":case "middle":case "middleCenter":c=["middle|center","middle|center"];e=[b[3],b[0],b[3],b[0]];break;case "topRight":c=["top|right","bottom|right"];e=[-b[1],b[0],-b[1],
-b[2]];break;case "bottomLeft":c=["bottom|left","top|left"];e=[b[3],-b[2],b[3],b[0]];break;case "bottomRight":c=["bottom|right","top|right"],e=[-b[1],-b[2],-b[1],b[0]]}return[c,[e[0]+a[0],e[1]+a[1]],[e[2]+a[0],e[3]+a[1]]]},q;(function(d){d[d.Tab=9]="Tab";d[d.Enter=13]="Enter";d[d.Esc=27]="Esc";d[d.Left=37]="Left";d[d.Up=38]="Up";d[d.Right=39]="Right";d[d.Down=40]="Down"})(q||(q={}));var Z=function(f){f=f?d.jsLib.evalPath(f.renderer,"errorReporting.chart"):{};return{cursor:"pointer",padding:[3,6],
radius:0,fill:(f?f.boxDefaults():d.consts.boxDefaults()).fill,text:{yContentAlignment:"middle",yAlignment:"middle",animation:{duration:0}},style:"user-select: none;",states:{hover:{fill:"rgb(220,220,220)"}}}},aa=d.jsLib.plainArray(["venter","vdown","vclick","vleave"]);u=function(f){function b(a,c){var b=f.call(this,a,c)||this;b._eventsHandler=function(a){var c=b._events;switch(a.customEventType||a.type){case "venter":(a=c.mouseover||c.mouseOver)&&a(b);b.setHoverState(!0);break;case "vleave":(a=c.mouseout||
c.mouseOut)&&a(b);b.setHoverState(!1);break;case "vdown":b.setActiveState();break;case "vclick":b.click(),a.stopPropagation(),a.preventDefault()}};return b}p(b,f);b.prototype.applyDestroy=function(){var a=this.isPatched;f.prototype.applyDestroy.call(this);a&&this.destroyMouseArea()};b.prototype.hover=function(a){d.jsLib.isUndefined(a)&&(a=!this.isHovered);this.setHoverState(a)};b.prototype.select=function(a,c){var b=a;d.jsLib.isUndefined(a)&&(b=!this.isSelected);if(c||b!==this.isSelected)this.isSelected=
b,this.setCurrentState(),this.triggerSelected()};b.prototype.init=function(){f.prototype.init.call(this);this._events={};this._states={};this._triggerSelectIfFalse=this.isHovered=this.isSelected=!1};b.prototype.defaultConfig=function(){return d.jsLib.extend(f.prototype.defaultConfig.call(this),Z(this.layout))};b.prototype.fillProperties=function(a){a=a||{};d.jsLib.has(a,"events")&&(this._events=a.events||{},delete a.events);var c=d.jsLib.has(a,"state");if(c){var b=a.state;d.jsLib.has(b,"select")&&
(b=b.select,this.isSelected!==b&&(this.isSelected=b));delete a.state}if(d.jsLib.has(a,"states")||c){b=d.jsLib.merge(this._prevStates||{},a.states?d.jsLib.cloneDeep(a.states):{});delete a.states;var h=d.jsLib.cloneDeep(a);h=b.normal=b.normal?d.jsLib.merge(d.jsLib.cloneDeep(b.normal),h):h;this._prevStates=d.jsLib.cloneDeep(b);b.active&&(b.active=d.jsLib.merge(d.jsLib.cloneDeep(h),b.active));b.select&&(b.select=d.jsLib.merge(d.jsLib.cloneDeep(h),b.select));b.hoverNormal=d.jsLib.merge(d.jsLib.cloneDeep(h),
b.hover||{});b.hoverSelect=d.jsLib.merge(b.select?d.jsLib.cloneDeep(b.select):{},b.hover);this._states=b;this.setCurrentState(!0)}if(!this._currentState||c)this.setCurrentState(!0),d.jsLib.extend(a,this._currentState);d.jsLib.has(a,"icon")&&(c=a.icon,"none"===c&&(c=null),(d.jsLib.isNull(c)||"none"===c.name&&!c.path)&&this._icon&&(this._icon.applyDestroy(),this._icon.patch(),this._icon=c=null),c&&(this._icon=this._icon||this.layout.icon().add(this),this._icon.attr(d.jsLib.extendCopy(c,{zIndex:1}))),
delete a.icon);if((c=a.text)&&c.val){b=a.margin||[0,0,0,0];var g=this._icon;if(g){h=g.getIconSize();var m=g.xAlignment||"left";g=g.yAlignment;if(h){var k=3;g||"right"!==m?"top"===g?k=0:"bottom"===g&&(k=2):k=1;b[k]=b[k]+h+4}}c.margin=b}d.jsLib.has(a,"triggerSelectIfFalse")&&(this._triggerSelectIfFalse=a.triggerSelectIfFalse,delete a.triggerSelectIfFalse);f.prototype.fillProperties.call(this,a)};b.prototype.rectAttrsApplied=function(a){this._mouseArea?(a=d.jsLib.extendScopedNegate({},a,{fill:void 0}),
this._mouseArea.attr(a)):(this._mouseArea=this.renderer.path(d.jsLib.extendCopy(a,{fill:"rgb(255,255,255)",zIndex:2,opacity:0})).add(this.el),this.subscribeEvents())};b.prototype.destroyMouseArea=function(){this._mouseArea&&(this._mouseArea.destroy(),this._mouseArea=null)};b.prototype.subscribeEvents=function(){var a=this;d.jsLib.eachKey(aa,function(c){return a._mouseArea.on(c,a._eventsHandler)})};b.prototype.setCurrentState=function(a){var c=this._states;this._currentState=this.isSelected&&c.select?
this.isHovered?c.hoverSelect:c.select:this.isHovered?c.hoverNormal:c.normal;!a&&this.applyCurrentState()};b.prototype.applyCurrentState=function(){this.attr(this._currentState);this.isPatched&&this.refresh()};b.prototype.setHoverState=function(a){a!==this.isHovered&&(this.isHovered=a,this.setCurrentState(),this.triggerHovered())};b.prototype.setActiveState=function(){var a=this._states.active;a&&(this._currentState=a,this.applyCurrentState())};b.prototype.generateClick=function(){var a=this._events.click;
return a?a(this):null};b.prototype.click=function(){var a=!this._triggerSelectIfFalse||!this.isSelected;!1===this.generateClick()&&(a=!1);a&&(this.isSelected=!this.isSelected);var c=!this.isHovered;c&&(this.isHovered=!0);this.setCurrentState();a&&this.triggerSelected();c&&this.triggerHovered()};b.prototype.extendDefault=function(a,c){return d.jsLib.merge(a,c)};b.prototype.triggerSelected=function(){var a=this._events.change;a&&a(this)};b.prototype.triggerHovered=function(){var a=this._events.hover;
a&&a(this)};return b}(d.TextBox);v=function(f){function b(){return null!==f&&f.apply(this,arguments)||this}p(b,f);b.prototype.defaultConfig=function(){return d.jsLib.extendCopy(f.prototype.defaultConfig.call(this),{stroke:"none",fill:"none",states:{hover:{fill:"none"}}})};return b}(u);x=function(f){function b(){return null!==f&&f.apply(this,arguments)||this}p(b,f);b.prototype.defaultConfig=function(){return d.jsLib.merge(f.prototype.defaultConfig.call(this),{icon:{name:"system/default/checkbox-blank",
width:16,height:16,fill:"rgb(0, 0, 0)","fill-rule":"evenodd",yAlignment:"middle"},states:{select:{icon:{name:"system/default/checkbox"}}}})};return b}(v);H=function(f){function b(){return null!==f&&f.apply(this,arguments)||this}p(b,f);b.prototype.defaultConfig=function(){return d.jsLib.merge(f.prototype.defaultConfig.call(this),{icon:{name:"system/default/toggle-off",size:32,fill:"#8e8e93",transform:{translate:[0,-.5]}},states:{select:{icon:{name:"system/default/toggle-on",fill:"#44db5e"}}}})};return b}(x);
I=function(f){function b(){return null!==f&&f.apply(this,arguments)||this}p(b,f);b.prototype.defaultConfig=function(){return d.jsLib.merge(f.prototype.defaultConfig.call(this),{icon:{name:"system/default/radio-button-blank",width:16,height:16,fill:"rgb(0, 0, 0)","fill-rule":"evenodd",yAlignment:"middle"},states:{select:{icon:{name:"system/default/radio-button"}}}})};b.prototype.init=function(){f.prototype.init.call(this);this._triggerSelectIfFalse=!0};return b}(v);A=function(f){function b(){return null!==
f&&f.apply(this,arguments)||this}p(b,f);b.prototype.getLowermostElement=function(){return this._htmlElement};b.prototype.value=function(a){var c="value";"button"===this._type&&(c="innerText");if(void 0===a)return this._htmlElement?this._htmlElement.el[c]:null;this._value=a;this._htmlElement&&(this._htmlElement.el[c]=a);if(this._svgElement){c=this._svgElement.childNodes[1];var b=this.attrs["text-align"]||"left";c.attr({text:a});a=c.getBbox();var d=this._svgElement.childNodes[0].getBbox();b={left:0,
center:.5,right:1}[b];b={x:b?(d.width-a.width)*b:2};0>a.y&&(b.y=(d.height-a.height)/2-a.y);c.attr(b)}};b.prototype.applyPatch=function(a){f.prototype.applyPatch.call(this,a);this.patchInput(a)};b.prototype.emptyPatch=function(){f.prototype.emptyPatch.call(this);this.patchInput()};b.prototype.applyDestroy=function(){f.prototype.applyDestroy.call(this);this._htmlElement&&this._htmlElement.destroy();this._svgElement&&this._svgElement.destroy()};b.prototype.init=function(){f.prototype.init.call(this);
this._events={};this._type=null};b.prototype.fillProperties=function(a){a=a||{};d.jsLib.has(a,"events")&&(this._events=a.events||{},delete a.events);d.jsLib.has(a,"mode")&&(this._type=a.mode||"text",this._type=this._type.toLowerCase?this._type.toLowerCase():"text");f.prototype.fillProperties.call(this,a)};b.prototype.defaultConfig=function(){return d.jsLib.merge(f.prototype.defaultConfig.call(this),{width:150,height:20})};b.prototype.patchInput=function(a){var c=this;c._htmlElement?c.applyStyles():
(c._htmlElement=this.createHtmlElement(),c.attach(c._htmlElement,{}),c._svgElement=this.createSvgElement(),c._svgElement&&c.attach(c._svgElement,{}),c.applyStyles(a),d.jsLib.eachKey(c._events,function(a){c.on(a,c._events[a])}),c.value(c._value))};b.prototype.createHtmlElement=function(){var a=this,c=a._type;if("button"===c)return a.renderer.element("button");c=a.renderer.element("input",{type:c});c.on("blur",function(){a._svgElement.childNodes[1].attr({text:a._htmlElement.el.value});a.displayHtmlInput(!1)});
return c};b.prototype.setHtmlElementTabIndex=function(a){this._htmlElement.attr({tabindex:a})};b.prototype.displayHtmlInput=function(a){var c=this._svgElement.getBbox();a?(this._htmlElement.attr({width:c.width+"px",height:c.height+"px",visibility:"visible"}),this._htmlElement.el.focus()):this._htmlElement.attr({width:"0px",height:"0px",visibility:"hidden"})};b.prototype.createSvgElement=function(){var a=this,c=a._type;if(!c||"text"===c)return c=a.renderer.element("g",{cursor:"text"}),a.renderer.element("rect",
{fill:"#ffffff"}).add(c),a.renderer.element("text",{fill:"#323232",strokeWidth:0}).add(c),c.on("click",function(){a.displayHtmlInput(!0)}),c};b.prototype.applyStyles=function(a){var c=this.getGlobalBbox();a=d.stylingLib.annotationToHtmlAttr(d.jsLib.extendCopy(a,{offsetX:c.x,offsetY:c.y,width:0,height:0,visibility:"hidden"}));this._htmlElement.attr(a);c=d.dmUtils.snapToPanel(this,[0,0,c.width,c.height],1);this._svgElement&&this._svgElement.childNodes[0].attr({x:c[0],y:c[1],width:c[2],height:c[3]})};
return b}(d.Panel);var B=function(f){function b(){return null!==f&&f.apply(this,arguments)||this}p(b,f);b.prototype.applyPatch=function(a){f.prototype.applyPatch.call(this,a);this.patchInput(a)};b.prototype.emptyPatch=function(){f.prototype.emptyPatch.call(this);this.patchInput()};b.prototype.applyDestroy=function(){f.prototype.applyDestroy.call(this);this.htmlElement&&this.htmlElement.destroy()};b.prototype.fillProperties=function(a){delete a.text;var c=this;d.jsLib.has(a,"events")||(a.events={});
a.events.click&&(c._clickEventHandler=a.events.click);a.events.click=function(){for(var a=[],b=0;b<arguments.length;b++)a[b]=arguments[b];c.buttonClickHandler(a)};a.events.change&&(c._changeEventHandler=a.events.change);delete a.events.change;f.prototype.fillProperties.call(this,a)};b.prototype.buttonClickHandler=function(){for(var a=[],c=0;c<arguments.length;c++)a[c]=arguments[c];this.htmlElement.el.focus();this.htmlElement.el.click();this._clickEventHandler&&this._clickEventHandler(a)};b.prototype.inputChangeHandler=
function(){for(var a=[],c=0;c<arguments.length;c++)a[c]=arguments[c];this._changeEventHandler&&this._changeEventHandler(a)};b.prototype.patchInput=function(a){var c=this;c.htmlElement||(c.htmlElement=this.createHtmlElement(),c.attach(c.htmlElement,{}),c.htmlElement.on("change",function(){for(var a=[],b=0;b<arguments.length;b++)a[b]=arguments[b];c.inputChangeHandler(a)}));c.applyStyles()};b.prototype.applyStyles=function(){var a=this.getGlobalBbox();a=d.stylingLib.annotationToHtmlAttr({width:0,height:0,
left:a.x,top:a.y+a.height-2,zIndex:-1});this.htmlElement.attr(a)};return b}(u),ba=function(f){function b(){return null!==f&&f.apply(this,arguments)||this}p(b,f);b.prototype.value=function(){return d.jsLib.epa(this.htmlElement,["el","files"])};b.prototype.createHtmlElement=function(){return this.renderer.element("input",{type:"file",accept:this._accept})};b.prototype.defaultConfig=function(){return d.jsLib.extendCopy(f.prototype.defaultConfig.call(this),{width:34,height:30,icon:{name:"material/editor/attach-file",
width:20,height:20,fill:"rgb(60, 60, 60)","fill-rule":"evenodd",yAlignment:"middle"}})};b.prototype.fillProperties=function(a){this._accept=a.accept;f.prototype.fillProperties.call(this,a)};return b}(B);B=function(f){function b(){return null!==f&&f.apply(this,arguments)||this}p(b,f);b.prototype.value=function(){return this.htmlElement.el.value};b.prototype.fillProperties=function(a){f.prototype.fillProperties.call(this,a);void 0!==a.innerPadding&&(this.innerPadding=a.innerPadding,delete a.innerPadding)};
b.prototype.defaultConfig=function(){return d.jsLib.extendCopy(f.prototype.defaultConfig.call(this),{width:34,height:30,icon:{},innerPadding:5})};b.prototype.patchInput=function(a){f.prototype.patchInput.call(this,a);a=this.getBbox();this.colorRect=this.layout.renderer.rect(this.innerPadding,this.innerPadding,a.width-2*this.innerPadding,a.height-2*this.innerPadding).add(this);this.colorRect.attr({fill:this.value()})};b.prototype.createHtmlElement=function(){return this.renderer.element("input",{type:"color"})};
b.prototype.inputChangeHandler=function(){for(var a=[],c=0;c<arguments.length;c++)a[c]=arguments[c];try{f.prototype.inputChangeHandler.apply(this,M(a))}catch(e){}this.colorRect.attr({fill:this.value()})};return b}(B);var ca=function(f){f=f?d.jsLib.evalPath(f.renderer,"errorReporting.chart"):{};return{height:20,sliderPathSize:3,min:0,max:1,width:220,value:0,layout:"auto",state:{sizeOffset:3,normal:{cursor:"ew-resize",zIndex:2,val:[{fill:"rgb(72,72,72)",strokeWidth:0,type:"shape",mode:"circle",animation:200}]},
hover:{zIndex:3,val:[{fill:"rgb(72,72,72)",animation:200}]},active:{zIndex:3,val:[{fill:"rgb(72,72,72)",animation:200}]},disabled:{cursor:"normal",val:[{borderColor:(f?f.boxDefaults():d.consts.boxDefaults()).fill,fill:"rgb(208,216,220)",strokeWidth:2}]}},path:{state:{normal:{fill:"rgb(208,216,220)",strokeWidth:"0px"},hover:{},active:{},disabled:{}}},decorator:{state:{normal:{fill:"rgb(72,72,72)",strokeWidth:"0px"},hover:{},active:{},disabled:{fill:"rgb(208,216,220)"}}},overlay:{type:"circle",config:{zIndex:5,
fill:"white",opacity:.001}}}},da=function(f){function b(){var a=null!==f&&f.apply(this,arguments)||this;a._focusedSlider=null;a._focusProcessing=!1;return a}p(b,f);b.prototype.init=function(){f.prototype.init.call(this);this._min=0;this._max=1;this._debounce=new d.idleDefer};b.prototype.value=function(a){if(void 0!==a){d.jsLib.isArray(a)||(a=[a]);this._firstValue=a[0];this._secondValue=a[1];this._startedFirstValue=this.converValueToScrollValue(this._firstValue);this._startedSecondValue=this.converValueToScrollValue(this._secondValue);
if(!this._firstSlider)return;this.setSliderValues(this._startedFirstValue,this._startedSecondValue);this.uiParent._denyTriggerEvents||this.triggerOptionsChangeEvent(null);return null}a=this.converScrollValueToValue(this.getValueForSlider(this._firstSlider));var c=this.converScrollValueToValue(this.getValueForSlider(this._secondSlider));return null===c?a:c<a?[c,a]:[a,c]};b.prototype.isDisabled=function(){return this._disabled};b.prototype.disable=function(a){this._disabled=a;this._selectedSlider=null;
this._decoratoreSelected=!1;this.setDisabledState(this._disabled)};b.prototype.applyPatch=function(a){this.drawSliderItems();this.updatePathDecoratorPosition(!1);if(d.isTouchDevice())this.on("touchstart",function(a){a.eventArgs.preventDefault()});this.activateFocusForSliders(this._accessibilityEnabled,this._tabIndex);f.prototype.applyPatch.call(this,a)};b.prototype.applyDestroy=function(){f.prototype.applyDestroy.call(this);var a=this.layout.renderer.documentElement;a.un("vmove",this._docVMoveHandler);
a.un("vup",this._docVUpHan