this.BX=this.BX||{};(function(e,t,n,i){"use strict";var s=function(){function e(t){babelHelpers.classCallCheck(this,e);this.popupWindow=null;this.params=t||{};this.text=this.params.text||"";this.id=this.params.id||"";this.className=this.params.className||"";this.events=this.params.events||{};this.contextEvents={};for(var n in this.events){if(i.Type.isFunction(this.events[n])){this.contextEvents[n]=this.events[n].bind(this)}}this.buttonNode=i.Dom.create("span",{props:{className:"popup-window-button"+(this.className.length>0?" "+this.className:""),id:this.id},events:this.contextEvents,text:this.text})}babelHelpers.createClass(e,[{key:"render",value:function e(){return this.buttonNode}},{key:"getId",value:function e(){return this.id}},{key:"getContainer",value:function e(){return this.buttonNode}},{key:"getName",value:function e(){return this.text}},{key:"setName",value:function e(t){this.text=t||"";if(this.buttonNode){i.Dom.clean(this.buttonNode);i.Dom.adjust(this.buttonNode,{text:this.text})}}},{key:"setClassName",value:function e(t){if(this.buttonNode){if(i.Type.isString(this.className)&&this.className!==""){i.Dom.removeClass(this.buttonNode,this.className)}i.Dom.addClass(this.buttonNode,t)}this.className=t}},{key:"addClassName",value:function e(t){if(this.buttonNode){i.Dom.addClass(this.buttonNode,t);this.className=this.buttonNode.className}}},{key:"removeClassName",value:function e(t){if(this.buttonNode){i.Dom.removeClass(this.buttonNode,t);this.className=this.buttonNode.className}}}]);return e}();function o(e,t,n){a(e,t);t.set(e,n)}function a(e,t){if(t.has(e)){throw new TypeError("Cannot initialize the same private elements twice on an object")}}var l=new WeakMap;var r=new WeakMap;var u=function(e){babelHelpers.inherits(t,e);function t(){var e;babelHelpers.classCallCheck(this,t);e=babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(t).call(this));o(babelHelpers.assertThisInitialized(e),l,{writable:true,value:void 0});o(babelHelpers.assertThisInitialized(e),r,{writable:true,value:void 0});return e}babelHelpers.createClass(t,[{key:"left",get:function e(){return babelHelpers.classPrivateFieldGet(this,l)},set:function e(t){if(i.Type.isNumber(t)){babelHelpers.classPrivateFieldSet(this,l,t)}}},{key:"top",get:function e(){return babelHelpers.classPrivateFieldGet(this,r)},set:function e(t){if(i.Type.isNumber(t)){babelHelpers.classPrivateFieldSet(this,r,t)}}}]);return t}(n.BaseEvent);var h=Object.freeze({LARGE:"large",SMALL:"small"});var p,d,c,f,m,g,v,b,y;function C(e,t){w(e,t);t.add(e)}function w(e,t){if(t.has(e)){throw new TypeError("Cannot initialize the same private elements twice on an object")}}function P(e,t,n){if(!t.has(e)){throw new TypeError("attempted to get private field on non-instance")}return n}var M={onPopupWindowInit:{namespace:"BX.Main.Popup",eventName:"onInit"},onPopupWindowIsInitialized:{namespace:"BX.Main.Popup",eventName:"onAfterInit"},onPopupFirstShow:{namespace:"BX.Main.Popup",eventName:"onFirstShow"},onPopupShow:{namespace:"BX.Main.Popup",eventName:"onShow"},onAfterPopupShow:{namespace:"BX.Main.Popup",eventName:"onAfterShow"},onPopupClose:{namespace:"BX.Main.Popup",eventName:"onClose"},onPopupAfterClose:{namespace:"BX.Main.Popup",eventName:"onAfterClose"},onPopupDestroy:{namespace:"BX.Main.Popup",eventName:"onDestroy"},onPopupFullscreenLeave:{namespace:"BX.Main.Popup",eventName:"onFullscreenLeave"},onPopupFullscreenEnter:{namespace:"BX.Main.Popup",eventName:"onFullscreenEnter"},onPopupDragStart:{namespace:"BX.Main.Popup",eventName:"onDragStart"},onPopupDrag:{namespace:"BX.Main.Popup",eventName:"onDrag"},onPopupDragEnd:{namespace:"BX.Main.Popup",eventName:"onDragEnd"},onPopupResizeStart:{namespace:"BX.Main.Popup",eventName:"onResizeStart"},onPopupResize:{namespace:"BX.Main.Popup",eventName:"onResize"},onPopupResizeEnd:{namespace:"BX.Main.Popup",eventName:"onResizeEnd"}};n.EventEmitter.registerAliases(M);var T=new WeakMap;var k=new WeakSet;var H=new WeakSet;var I=function(e){babelHelpers.inherits(o,e);babelHelpers.createClass(o,null,[{key:"setOptions",value:function e(t){if(!i.Type.isPlainObject(t)){return}for(var n in t){this.options[n]=t[n]}}},{key:"getOption",value:function e(t,n){if(!i.Type.isUndefined(this.options[t])){return this.options[t]}else if(!i.Type.isUndefined(n)){return n}else{return this.defaultOptions[t]}}}]);function o(e){var s;babelHelpers.classCallCheck(this,o);s=babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(o).call(this));C(babelHelpers.assertThisInitialized(s),H);C(babelHelpers.assertThisInitialized(s),k);s.setEventNamespace("BX.Main.Popup");var a=Array.prototype.slice.call(arguments),l=a[0],r=a[1],u=a[2];s.compatibleMode=u&&i.Type.isBoolean(u.compatibleMode)?u.compatibleMode:true;if(i.Type.isPlainObject(e)&&!r&&!u){u=e;l=e.id;r=e.bindElement;s.compatibleMode=false}u=u||{};s.params=u;if(!i.Type.isStringFilled(l)){l="popup-window-"+i.Text.getRandom().toLowerCase()}s.emit("onInit",new n.BaseEvent({compatData:[l,r,u]}));s.uniquePopupId=l;s.params.zIndex=i.Type.isNumber(u.zIndex)?parseInt(u.zIndex):0;s.params.zIndexAbsolute=i.Type.isNumber(u.zIndexAbsolute)?parseInt(u.zIndexAbsolute):0;s.buttons=u.buttons&&i.Type.isArray(u.buttons)?u.buttons:[];s.offsetTop=o.getOption("offsetTop");s.offsetLeft=o.getOption("offsetLeft");s.firstShow=false;s.bordersWidth=20;s.bindElementPos=null;s.closeIcon=null;s.resizeIcon=null;s.angle=null;s.angleArrowElement=null;s.overlay=null;s.titleBar=null;s.bindOptions=babelHelpers["typeof"](u.bindOptions)==="object"?u.bindOptions:{};s.autoHide=u.autoHide===true;s.disableScroll=u.disableScroll===true||u.isScrollBlock===true;s.autoHideHandler=i.Type.isFunction(u.autoHideHandler)?u.autoHideHandler:null;s.handleAutoHide=s.handleAutoHide.bind(babelHelpers.assertThisInitialized(s));s.handleOverlayClick=s.handleOverlayClick.bind(babelHelpers.assertThisInitialized(s));s.isAutoHideBinded=false;s.closeByEsc=u.closeByEsc===true;s.isCloseByEscBinded=false;s.toFrontOnShow=true;s.cacheable=true;s.destroyed=false;s.fixed=false;s.width=null;s.height=null;s.minWidth=null;s.minHeight=null;s.maxWidth=null;s.maxHeight=null;s.padding=null;s.contentPadding=null;s.background=null;s.contentBackground=null;s.borderRadius=null;s.contentBorderRadius=null;s.targetContainer=i.Type.isElementNode(u.targetContainer)?u.targetContainer:document.body;s.dragOptions={cursor:"",callback:function e(){},eventName:""};s.dragged=false;s.dragPageX=0;s.dragPageY=0;s.animationShowClassName=null;s.animationCloseClassName=null;s.animationCloseEventType=null;s.handleDocumentMouseMove=s.handleDocumentMouseMove.bind(babelHelpers.assertThisInitialized(s));s.handleDocumentMouseUp=s.handleDocumentMouseUp.bind(babelHelpers.assertThisInitialized(s));s.handleDocumentKeyUp=s.handleDocumentKeyUp.bind(babelHelpers.assertThisInitialized(s));s.handleResizeWindow=s.handleResizeWindow.bind(babelHelpers.assertThisInitialized(s));s.handleResize=s.handleResize.bind(babelHelpers.assertThisInitialized(s));s.handleMove=s.handleMove.bind(babelHelpers.assertThisInitialized(s));s.onTitleMouseDown=s.onTitleMouseDown.bind(babelHelpers.assertThisInitialized(s));s.handleFullScreen=s.handleFullScreen.bind(babelHelpers.assertThisInitialized(s));s.subscribeFromOptions(u.events);var m="popup-window";if(u.titleBar){m+=" popup-window-with-titlebar"}if(u.className&&i.Type.isStringFilled(u.className)){m+=" "+u.className}if(u.darkMode){m+=" popup-window-dark"}if(u.titleBar){s.titleBar=i.Tag.render(p||(p=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t\n\t\t\t'])),l)}if(u.closeIcon){var g="popup-window-close-icon"+(u.titleBar?" popup-window-titlebar-close-icon":"");if(Object.values(h).includes(u.closeIconSize)&&u.closeIconSize!==h.SMALL){g+=" --".concat(u.closeIconSize)}s.closeIcon=i.Tag.render(d||(d=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t\n\t\t\t'])),g,s.handleCloseIconClick.bind(babelHelpers.assertThisInitialized(s)));if(i.Type.isPlainObject(u.closeIcon)){i.Dom.style(s.closeIcon,u.closeIcon)}}s.contentContainer=i.Tag.render(c||(c=babelHelpers.taggedTemplateLiteral([''])),l);s.popupContainer=i.Tag.render(f||(f=babelHelpers.taggedTemplateLiteral(['',""])),m,l,[s.titleBar,s.contentContainer,s.closeIcon]);s.targetContainer.appendChild(s.popupContainer);s.zIndexComponent=t.ZIndexManager.register(s.popupContainer,u.zIndexOptions);s.buttonsContainer=null;if(u.contentColor&&i.Type.isStringFilled(u.contentColor)){if(u.contentColor==="white"||u.contentColor==="gray"){m+=" popup-window-content-"+u.contentColor}s.setContentColor(u.contentColor)}if(u.angle){s.setAngle(u.angle)}if(u.overlay){s.setOverlay(u.overlay)}s.setOffset(u);s.setBindElement(r);s.setTitleBar(u.titleBar);s.setContent(u.content);s.setButtons(u.buttons);s.setWidth(u.width);s.setHeight(u.height);s.setMinWidth(u.minWidth);s.setMinHeight(u.minHeight);s.setMaxWidth(u.maxWidth);s.setMaxHeight(u.maxHeight);s.setResizeMode(u.resizable);s.setPadding(u.padding);s.setContentPadding(u.contentPadding);s.setBorderRadius(u.borderRadius);s.setContentBorderRadius(u.contentBorderRadius);s.setBackground(u.background);s.setContentBackground(u.contentBackground);s.setAnimation(u.animation);s.setCacheable(u.cacheable);s.setToFrontOnShow(u.toFrontOnShow);s.setFixed(u.fixed);if(u.contentNoPaddings){s.setContentPadding(0)}if(u.noAllPaddings){s.setPadding(0);s.setContentPadding(0)}if(u.bindOnResize!==false){i.Event.bind(window,"resize",s.handleResizeWindow)}s.emit("onAfterInit",new n.BaseEvent({compatData:[l,babelHelpers.assertThisInitialized(s)]}));return s}babelHelpers.createClass(o,[{key:"subscribeFromOptions",value:function e(t){babelHelpers.get(babelHelpers.getPrototypeOf(o.prototype),"subscribeFromOptions",this).call(this,t,M)}},{key:"getId",value:function e(){return this.uniquePopupId}},{key:"isCompatibleMode",value:function e(){return this.compatibleMode}},{key:"setContent",value:function e(t){if(!this.contentContainer||!t){return}if(i.Type.isElementNode(t)){i.Dom.clean(this.contentContainer);var n=i.Type.isDomNode(t.parentNode);this.contentContainer.appendChild(t);if(this.isCompatibleMode()||n){t.style.display="block"}}else if(i.Type.isString(t)){this.contentContainer.innerHTML=t}else{this.contentContainer.innerHTML=" "}}},{key:"setButtons",value:function e(t){this.buttons=t&&i.Type.isArray(t)?t:[];if(this.buttonsContainer){i.Dom.remove(this.buttonsContainer)}var n=i.Reflection.getClass("BX.UI.Button");if(this.buttons.length>0&&this.contentContainer){var o=[];for(var a=0;a',""])),o))}}},{key:"getButtons",value:function e(){return this.buttons}},{key:"getButton",value:function e(t){for(var n=0;n0&&i.Type.isNumber(r)){l+=r-o.defaultOptions.angleLeftOffset}this.angleArrowElement=i.Tag.render(g||(g=babelHelpers.taggedTemplateLiteral([''])));if(this.background){this.angleArrowElement.style.background=this.background}this.angle={element:i.Tag.render(v||(v=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t\t
\n\t\t\t\t\t\t',"\n\t\t\t\t\t
\n\t\t\t\t"])),n,n,s,this.angleArrowElement),position:s,offset:0,defaultOffset:Math.max(l,a)};this.getPopupContainer().appendChild(this.angle.element)}if(babelHelpers["typeof"](t)==="object"&&t.position&&["top","right","bottom","left","hide"].includes(t.position)){i.Dom.removeClass(this.angle.element,n+"-"+this.angle.position);i.Dom.addClass(this.angle.element,n+"-"+t.position);this.angle.position=t.position}if(babelHelpers["typeof"](t)==="object"&&i.Type.isNumber(t.offset)){var u=t.offset;var h,p;if(this.angle.position==="top"){h=o.getOption("angleMinTop");p=this.getPopupContainer().offsetWidth-o.getOption("angleMaxTop");p=p=0){this[t]=n;this.getResizableContainer().style[t]=n+"px";this.getContentContainer().style.overflowX="auto";this.getPopupContainer().classList.add("popup-window-fixed-width");if(this.getTitleContainer()&&i.Browser.isIE11()){this.getTitleContainer().style[t]=n+"px"}}else if(n===null||n===false){this[t]=null;this.getResizableContainer().style.removeProperty(i.Text.toKebabCase(t));var o=s.some((function(e){return this.getResizableContainer().style.getPropertyValue(i.Text.toKebabCase(e))!==""}),this);if(!o){this.getContentContainer().style.removeProperty("overflow-x");this.getPopupContainer().classList.remove("popup-window-fixed-width")}if(this.getTitleContainer()&&i.Browser.isIE11()){this.getTitleContainer().style.removeProperty(i.Text.toKebabCase(t))}}}},{key:"setHeightProperty",value:function e(t,n){var s=["height","minHeight","maxHeight"];if(s.indexOf(t)===-1){return}if(i.Type.isNumber(n)&&n>=0){this[t]=n;this.getResizableContainer().style[t]=n+"px";this.getContentContainer().style.overflowY="auto";this.getPopupContainer().classList.add("popup-window-fixed-height")}else if(n===null||n===false){this[t]=null;this.getResizableContainer().style.removeProperty(i.Text.toKebabCase(t));var o=s.some((function(e){return this.getResizableContainer().style.getPropertyValue(i.Text.toKebabCase(e))!==""}),this);if(!o){this.getContentContainer().style.removeProperty("overflow-y");this.getPopupContainer().classList.remove("popup-window-fixed-height")}}}},{key:"setPadding",value:function e(t){if(i.Type.isNumber(t)&&t>=0){this.padding=t;this.getPopupContainer().style.padding=t+"px"}else if(t===null){this.padding=null;this.getPopupContainer().style.removeProperty("padding")}}},{key:"getPadding",value:function e(){return this.padding}},{key:"setContentPadding",value:function e(t){if(i.Type.isNumber(t)&&t>=0){this.contentPadding=t;this.getContentContainer().style.padding=t+"px"}else if(t===null){this.contentPadding=null;this.getContentContainer().style.removeProperty("padding")}}},{key:"getContentPadding",value:function e(){return this.contentPadding}},{key:"setBorderRadius",value:function e(t){if(i.Type.isStringFilled(t)){this.borderRadius=t;this.getPopupContainer().style.setProperty("--popup-window-border-radius",t)}else if(t===null){this.borderRadius=null;this.getPopupContainer().style.removeProperty("--popup-window-border-radius")}}},{key:"setContentBorderRadius",value:function e(t){if(i.Type.isStringFilled(t)){this.contentBorderRadius=t;this.getContentContainer().style.setProperty("--popup-window-content-border-radius",t)}else if(t===null){this.contentBorderRadius=null;this.getContentContainer().style.removeProperty("--popup-window-content-border-radius")}}},{key:"setContentColor",value:function e(t){if(i.Type.isString(t)&&this.contentContainer){this.contentContainer.style.backgroundColor=t}else if(t===null){this.contentContainer.style.style.removeProperty("background-color")}}},{key:"setBackground",value:function e(t){if(i.Type.isStringFilled(t)){this.background=t;this.getPopupContainer().style.background=t;if(this.angleArrowElement){this.angleArrowElement.style.background=t}}else if(t===null){this.background=null;this.getPopupContainer().style.removeProperty("background");if(this.angleArrowElement){this.angleArrowElement.style.removeProperty("background")}}}},{key:"getBackground",value:function e(){return this.background}},{key:"setContentBackground",value:function e(t){if(i.Type.isStringFilled(t)){this.contentBackground=t;this.getContentContainer().style.background=t}else if(t===null){this.contentBackground=null;this.getContentContainer().style.removeProperty("background")}}},{key:"getContentBackground",value:function e(){return this.contentBackground}},{key:"isDestroyed",value:function e(){return this.destroyed}},{key:"setCacheable",value:function e(t){this.cacheable=t!==false}},{key:"isCacheable",value:function e(){return this.cacheable}},{key:"setToFrontOnShow",value:function e(t){this.toFrontOnShow=t!==false}},{key:"shouldFrontOnShow",value:function e(){return this.toFrontOnShow}},{key:"setFixed",value:function e(t){if(i.Type.isBoolean(t)){this.fixed=t;if(t){i.Dom.addClass(this.getPopupContainer(),"--fixed")}else{i.Dom.removeClass(this.getPopupContainer(),"--fixed")}}}},{key:"isFixed",value:function e(){return this.fixed}},{key:"setResizeMode",value:function e(t){if(t===true||i.Type.isPlainObject(t)){if(!this.resizeIcon){this.resizeIcon=i.Tag.render(b||(b=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t\t\n\t\t\t\t'])),this.handleResizeMouseDown.bind(this));this.getPopupContainer().appendChild(this.resizeIcon)}this.setMinWidth(t.minWidth);this.setMinHeight(t.minHeight)}else if(t===false&&this.resizeIcon){i.Dom.remove(this.resizeIcon);this.resizeIcon=null}}},{key:"getTargetContainer",value:function e(){return this.targetContainer}},{key:"isTargetDocumentBody",value:function e(){return this.getTargetContainer()===document.body}},{key:"getPopupContainer",value:function e(){return this.popupContainer}},{key:"getContentContainer",value:function e(){return this.contentContainer}},{key:"getResizableContainer",value:function e(){return i.Browser.isIE11()?this.getContentContainer():this.getPopupContainer()}},{key:"getTitleContainer",value:function e(){return this.titleBar}},{key:"onTitleMouseDown",value:function e(t){this._startDrag(t,{cursor:"move",callback:this.handleMove,eventName:"Drag"})}},{key:"handleResizeMouseDown",value:function e(t){this._startDrag(t,{cursor:"nwse-resize",eventName:"Resize",callback:this.handleResize});if(this.isTargetDocumentBody()){this.resizeContentPos=i.Dom.getPosition(this.getResizableContainer());this.resizeContentOffset=this.resizeContentPos.left-i.Dom.getPosition(this.getPopupContainer()).left}else{this.resizeContentPos=this.getPositionRelativeToTarget(this.getResizableContainer());this.resizeContentOffset=this.resizeContentPos.left-this.getPositionRelativeToTarget(this.getPopupContainer()).left}this.resizeContentPos.offsetX=0;this.resizeContentPos.offsetY=0}},{key:"handleResize",value:function e(t,n,i,s){this.resizeContentPos.offsetX+=t;this.resizeContentPos.offsetY+=n;var o=this.resizeContentPos.width+this.resizeContentPos.offsetX;var a=this.resizeContentPos.height+this.resizeContentPos.offsetY;var l=this.isTargetDocumentBody()?document.documentElement.scrollWidth:this.getTargetContainer().scrollWidth;if(this.resizeContentPos.left+o+this.resizeContentOffset>=l){o=l-this.resizeContentPos.left-this.resizeContentOffset}o=Math.max(o,this.getMinWidth());a=Math.max(a,this.getMinHeight());if(this.getMaxWidth()!==null){o=Math.min(o,this.getMaxWidth())}if(this.getMaxHeight()!==null){a=Math.min(a,this.getMaxHeight())}this.setWidth(o);this.setHeight(a)}},{key:"isTopAngle",value:function e(){return this.angle!==null&&this.angle.position==="top"}},{key:"isBottomAngle",value:function e(){return this.angle!==null&&this.angle.position==="bottom"}},{key:"isTopOrBottomAngle",value:function e(){return this.angle!==null&&(this.angle.position==="top"||this.angle.position==="bottom")}},{key:"getAngleHeight",value:function e(){return this.isTopOrBottomAngle()?o.getOption("angleTopOffset"):0}},{key:"setOffset",value:function e(t){if(!i.Type.isPlainObject(t)){return}if(i.Type.isNumber(t.offsetLeft)){this.offsetLeft=t.offsetLeft+o.getOption("offsetLeft")}if(i.Type.isNumber(t.offsetTop)){this.offsetTop=t.offsetTop+o.getOption("offsetTop")}}},{key:"setTitleBar",value:function e(t){if(!this.titleBar){return}if(babelHelpers["typeof"](t)==="object"&&i.Type.isDomNode(t.content)){this.titleBar.innerHTML="";this.titleBar.appendChild(t.content)}else if(typeof t==="string"){this.titleBar.innerHTML="";this.titleBar.appendChild(i.Dom.create("span",{props:{className:"popup-window-titlebar-text"},text:t}))}if(this.params.draggable){this.titleBar.style.cursor="move";i.Event.bind(this.titleBar,"mousedown",this.onTitleMouseDown)}}},{key:"setClosingByEsc",value:function e(t){t=i.Type.isBoolean(t)?t:true;if(t){this.closeByEsc=true;this.bindClosingByEsc()}else{this.closeByEsc=false;this.unbindClosingByEsc()}}},{key:"bindClosingByEsc",value:function e(){if(this.closeByEsc&&!this.isCloseByEscBinded){i.Event.bind(document,"keyup",this.handleDocumentKeyUp);this.isCloseByEscBinded=true}}},{key:"unbindClosingByEsc",value:function e(){if(this.isCloseByEscBinded){i.Event.unbind(document,"keyup",this.handleDocumentKeyUp);this.isCloseByEscBinded=false}}},{key:"setAutoHide",value:function e(t){t=i.Type.isBoolean(t)?t:true;if(t){this.autoHide=true;this.bindAutoHide()}else{this.autoHide=false;this.unbindAutoHide()}}},{key:"bindAutoHide",value:function e(){if(this.autoHide&&!this.isAutoHideBinded&&this.isShown()){this.isAutoHideBinded=true;if(this.isCompatibleMode()){i.Event.bind(this.getPopupContainer(),"click",this.handleContainerClick)}if(this.overlay&&this.overlay.element){i.Event.bind(this.overlay.element,"click",this.handleOverlayClick)}else{if(this.isCompatibleMode()){i.Event.bind(document,"click",this.handleAutoHide)}else{document.addEventListener("click",this.handleAutoHide,true)}}}}},{key:"unbindAutoHide",value:function e(){if(this.isAutoHideBinded){this.isAutoHideBinded=false;if(this.isCompatibleMode()){i.Event.unbind(this.getPopupContainer(),"click",this.handleContainerClick)}if(this.overlay&&this.overlay.element){i.Event.unbind(this.overlay.element,"click",this.handleOverlayClick)}else{if(this.isCompatibleMode()){i.Event.unbind(document,"click",this.handleAutoHide)}else{document.removeEventListener("click",this.handleAutoHide,true)}}}}},{key:"handleAutoHide",value:function e(t){if(this.isDestroyed()){return}if(this.autoHideHandler!==null){if(this.autoHideHandler(t)){this._tryCloseByEvent(t)}}else if(t.target!==this.getPopupContainer()&&!this.getPopupContainer().contains(t.target)){this._tryCloseByEvent(t)}}},{key:"_tryCloseByEvent",value:function e(t){var n=this;if(this.isCompatibleMode()){this.tryCloseByEvent(t)}else{setTimeout((function(){n.tryCloseByEvent(t)}),0)}}},{key:"tryCloseByEvent",value:function e(t){if(t.button===0){this.close()}}},{key:"handleOverlayClick",value:function e(t){this.tryCloseByEvent(t);t.stopPropagation()}},{key:"setOverlay",value:function e(t){if(this.overlay===null){this.overlay={element:i.Tag.render(y||(y=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t\t\n\t\t\t\t'])),this.getId())};this.resizeOverlay();this.targetContainer.appendChild(this.overlay.element);this.getZIndexComponent().setOverlay(this.overlay.element)}if(t&&i.Type.isNumber(t.opacity)&&t.opacity>=0&&t.opacity<=100){this.overlay.element.style.opacity=parseFloat(t.opacity/100).toPrecision(3)}if(t&&t.backgroundColor){this.overlay.element.style.backgroundColor=t.backgroundColor}}},{key:"removeOverlay",value:function e(){if(this.overlay!==null&&this.overlay.element!==null){i.Dom.remove(this.overlay.element);this.getZIndexComponent().setOverlay(null)}if(this.overlayTimeout){clearInterval(this.overlayTimeout);this.overlayTimeout=null}this.overlay=null}},{key:"hideOverlay",value:function e(){if(this.overlay!==null&&this.overlay.element!==null){if(this.overlayTimeout){clearInterval(this.overlayTimeout);this.overlayTimeout=null}this.overlay.element.style.display="none"}}},{key:"showOverlay",value:function e(){var t=this;if(this.overlay!==null&&this.overlay.element!==null){this.overlay.element.style.display="block";var n=this.getPopupContainer().offsetHeight;this.overlayTimeout=setInterval((function(){if(n!==t.getPopupContainer().offsetHeight){t.resizeOverlay();n=t.getPopupContainer().offsetHeight}}),1e3)}}},{key:"resizeOverlay",value:function e(){if(this.overlay!==null&&this.overlay.element!==null){var t;var n;if(this.isTargetDocumentBody()){t=document.documentElement.scrollWidth;n=Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)}else{t=this.getTargetContainer().scrollWidth;n=this.getTargetContainer().scrollHeight}this.overlay.element.style.width=t+"px";this.overlay.element.style.height=n+"px"}}},{key:"getZindex",value:function e(){return this.getZIndexComponent().getZIndex()}},{key:"getZIndexComponent",value:function e(){return this.zIndexComponent}},{key:"setDisableScroll",value:function e(t){var n=i.Type.isBoolean(t)?t:true;if(n){this.disableScroll=true;P(this,k,S).call(this)}else{this.disableScroll=false;P(this,H,E).call(this)}}},{key:"show",value:function e(){var t=this;if(this.isShown()||this.isDestroyed()){return}this.emit("onBeforeShow");this.showOverlay();this.getPopupContainer().style.display="block";if(this.shouldFrontOnShow()){this.bringToFront()}if(!this.firstShow){this.emit("onFirstShow",new n.BaseEvent({compatData:[this]}));this.firstShow=true}this.emit("onShow",new n.BaseEvent({compatData:[this]}));if(this.disableScroll){P(this,k,S).call(this)}this.adjustPosition();this.animateOpening((function(){if(t.isDestroyed()){return}i.Dom.removeClass(t.getPopupContainer(),t.animationShowClassName);t.emit("onAfterShow",new n.BaseEvent({compatData:[t]}))}));this.bindClosingByEsc();if(this.isCompatibleMode()){setTimeout((function(){t.bindAutoHide()}),100)}else{this.bindAutoHide()}}},{key:"close",value:function e(){var t=this;if(this.isDestroyed()||!this.isShown()){return}this.emit("onClose",new n.BaseEvent({compatData:[this]}));if(this.isDestroyed()){return}if(this.disableScroll){P(this,H,E).call(this)}this.animateClosing((function(){if(t.isDestroyed()){return}t.hideOverlay();t.getPopupContainer().style.display="none";i.Dom.removeClass(t.getPopupContainer(),t.animationCloseClassName);t.unbindClosingByEsc();if(t.isCompatibleMode()){setTimeout((function(){t.unbindAutoHide()}),0)}else{t.unbindAutoHide()}t.emit("onAfterClose",new n.BaseEvent({compatData:[t]}));if(!t.isCacheable()){t.destroy()}}))}},{key:"bringToFront",value:function e(){if(this.isShown()){t.ZIndexManager.bringToFront(this.getPopupContainer())}}},{key:"toggle",value:function e(){this.isShown()?this.close():this.show()}},{key:"animateOpening",value:function e(t){i.Dom.removeClass(this.getPopupContainer(),this.animationCloseClassName);if(this.animationShowClassName!==null){i.Dom.addClass(this.getPopupContainer(),this.animationShowClassName);if(this.animationCloseEventType!==null){var n=this.animationCloseEventType+"end";this.getPopupContainer().addEventListener(n,(function e(){this.removeEventListener(n,e);t()}))}else{t()}}else{t()}}},{key:"animateClosing",value:function e(t){i.Dom.removeClass(this.getPopupContainer(),this.animationShowClassName);if(this.animationCloseClassName!==null){i.Dom.addClass(this.getPopupContainer(),this.animationCloseClassName);if(this.animationCloseEventType!==null){var n=this.animationCloseEventType+"end";this.getPopupContainer().addEventListener(n,(function e(){this.removeEventListener(n,e);t()}))}else{t()}}else{t()}}},{key:"setAnimation",value:function e(t){if(i.Type.isPlainObject(t)){this.animationShowClassName=i.Type.isStringFilled(t.showClassName)?t.showClassName:null;this.animationCloseClassName=i.Type.isStringFilled(t.closeClassName)?t.closeClassName:null;this.animationCloseEventType=t.closeAnimationType==="animation"||t.closeAnimationType==="transition"?t.closeAnimationType:null}else if(i.Type.isStringFilled(t)){var n=t;if(n==="fading"){this.animationShowClassName="popup-window-show-animation-opacity";this.animationCloseClassName="popup-window-close-animation-opacity";this.animationCloseEventType="animation"}else if(n==="fading-slide"){this.animationShowClassName="popup-window-show-animation-opacity-transform";this.animationCloseClassName="popup-window-close-animation-opacity";this.animationCloseEventType="animation"}else if(n==="scale"){this.animationShowClassName="popup-window-show-animation-scale";this.animationCloseClassName="popup-window-close-animation-opacity";this.animationCloseEventType="animation"}}else if(t===false||t===null){this.animationShowClassName=null;this.animationCloseClassName=null;this.animationCloseEventType=null}}},{key:"isShown",value:function e(){return!this.isDestroyed()&&this.getPopupContainer().style.display==="block"}},{key:"destroy",value:function e(){var s=this;if(this.destroyed){return}if(this.disableScroll){P(this,H,E).call(this)}this.destroyed=true;this.emit("onDestroy",new n.BaseEvent({compatData:[this]}));this.unbindClosingByEsc();if(this.isCompatibleMode()){setTimeout((function(){s.unbindAutoHide()}),0)}else{this.unbindAutoHide()}i.Event.unbindAll(this);i.Event.unbind(document,"mousemove",this.handleDocumentMouseMove);i.Event.unbind(document,"mouseup",this.handleDocumentMouseUp);i.Event.unbind(window,"resize",this.handleResizeWindow);this.removeOverlay();t.ZIndexManager.unregister(this.popupContainer);this.zIndexComponent=null;i.Dom.remove(this.popupContainer);this.popupContainer=null;this.contentContainer=null;this.closeIcon=null;this.titleBar=null;this.buttonsContainer=null;this.angle=null;this.angleArrowElement=null;this.resizeIcon=null}},{key:"adjustPosition",value:function e(t){if(t&&babelHelpers["typeof"](t)==="object"){this.bindOptions=t}var n=this.getBindElementPos(this.bindElement);if(!this.bindOptions.forceBindPosition&&this.bindElementPos!==null&&n.top===this.bindElementPos.top&&n.left===this.bindElementPos.left){return}this.bindElementPos=n;var s=n.windowSize?n.windowSize:this.getWindowSize();var a=n.windowScroll?n.windowScroll:this.getWindowScroll();var l=n.popupWidth?n.popupWidth:this.popupContainer.offsetWidth;var r=n.popupHeight?n.popupHeight:this.popupContainer.offsetHeight;var h=o.getOption("angleTopOffset");var p=this.bindElementPos.left+this.offsetLeft-(this.isTopOrBottomAngle()?o.getOption("angleLeftOffset"):0);if(!this.bindOptions.forceLeft&&p+l+this.bordersWidth>=s.innerWidth+a.scrollLeft&&s.innerWidth+a.scrollLeft-l-this.bordersWidth>0){var d=p;p=s.innerWidth+a.scrollLeft-l-this.bordersWidth;if(this.isTopOrBottomAngle()){this.setAngle({offset:d-p+this.angle.defaultOffset})}}else if(this.isTopOrBottomAngle()){this.setAngle({offset:this.angle.defaultOffset+(p<0?p:0)})}if(p<0){p=0}var c=0;if(this.bindOptions.position&&this.bindOptions.position==="top"){c=this.bindElementPos.top-r-this.offsetTop-(this.isBottomAngle()?h:0);if(c<0||!this.bindOptions.forceTop&&cs.innerHeight+a.scrollTop&&this.bindElementPos.top-r-this.getAngleHeight()>=0){c=this.bindElementPos.top-r;if(this.isTopOrBottomAngle()){c-=h;this.setAngle({position:"bottom"})}c+=o.getOption("positionTopXOffset")}else if(this.isBottomAngle()){c+=h;this.setAngle({position:"top"})}}if(c<0){c=0}var f=new u;f.left=p;f.top=c;this.emit("onBeforeAdjustPosition",f);i.Dom.adjust(this.popupContainer,{style:{top:f.top+"px",left:f.left+"px"}})}},{key:"enterFullScreen",value:function e(){if(o.fullscreenStatus){if(document.cancelFullScreen){document.cancelFullScreen()}else if(document.mozCancelFullScreen){document.mozCancelFullScreen()}else if(document.webkitCancelFullScreen){document.webkitCancelFullScreen()}}else{if(this.contentContainer.requestFullScreen){this.contentContainer.requestFullScreen();i.Event.bind(window,"fullscreenchange",this.handleFullScreen)}else if(this.contentContainer.mozRequestFullScreen){this.contentContainer.mozRequestFullScreen();i.Event.bind(window,"mozfullscreenchange",this.handleFullScreen)}else if(this.contentContainer.webkitRequestFullScreen){this.contentContainer.webkitRequestFullScreen();i.Event.bind(window,"webkitfullscreenchange",this.handleFullScreen)}else{console.log("fullscreen mode is not supported")}}}},{key:"handleFullScreen",value:function e(t){if(o.fullscreenStatus){i.Event.unbind(window,"fullscreenchange",this.handleFullScreen);i.Event.unbind(window,"webkitfullscreenchange",this.handleFullScreen);i.Event.unbind(window,"mozfullscreenchange",this.handleFullScreen);o.fullscreenStatus=false;if(!this.isDestroyed()){i.Dom.removeClass(this.contentContainer,"popup-window-fullscreen");this.emit("onFullscreenLeave");this.adjustPosition()}}else{o.fullscreenStatus=true;if(!this.isDestroyed()){i.Dom.addClass(this.contentContainer,"popup-window-fullscreen");this.emit("onFullscreenEnter");this.adjustPosition()}}}},{key:"handleCloseIconClick",value:function e(t){this.tryCloseByEvent(t);t.stopPropagation()}},{key:"handleContainerClick",value:function e(t){t.stopPropagation()}},{key:"handleDocumentKeyUp",value:function e(t){var n=this;if(t.keyCode===27){N(this.getZindex(),(function(){n.close()}))}}},{key:"handleResizeWindow",value:function e(){if(this.isShown()){this.adjustPosition();if(this.overlay!==null){this.resizeOverlay()}}}},{key:"handleMove",value:function e(t,n,i,s){var o=parseInt(this.popupContainer.style.left)+t;var a=parseInt(this.popupContainer.style.top)+n;if(babelHelpers["typeof"](this.params.draggable)==="object"&&this.params.draggable.restrict){if(o<0){o=0}var l;var r;if(this.isTargetDocumentBody()){l=document.documentElement.scrollWidth;r=document.documentElement.scrollHeight}else{l=this.getTargetContainer().scrollWidth;r=this.getTargetContainer().scrollHeight}var u=this.popupContainer.offsetWidth;var h=this.popupContainer.offsetHeight;if(o>l-u){o=l-u}if(a>r-h){a=r-h}if(a<0){a=0}}this.popupContainer.style.left=o+"px";this.popupContainer.style.top=a+"px"}},{key:"_startDrag",value:function e(t,n){n=n||{};if(i.Type.isStringFilled(n.cursor)){this.dragOptions.cursor=n.cursor}if(i.Type.isStringFilled(n.eventName)){this.dragOptions.eventName=n.eventName}if(i.Type.isFunction(n.callback)){this.dragOptions.callback=n.callback}this.dragPageX=t.pageX;this.dragPageY=t.pageY;this.dragged=false;i.Event.bind(document,"mousemove",this.handleDocumentMouseMove);i.Event.bind(document,"mouseup",this.handleDocumentMouseUp);if(document.body.setCapture){document.body.setCapture()}document.body.ondrag=function(){return false};document.body.onselectstart=function(){return false};document.body.style.cursor=this.dragOptions.cursor;document.body.style.MozUserSelect="none";this.popupContainer.style.MozUserSelect="none";if(this.shouldFrontOnShow()){this.bringToFront()}t.preventDefault()}},{key:"handleDocumentMouseMove",value:function e(t){if(this.dragPageX===t.pageX&&this.dragPageY===t.pageY){return}this.dragOptions.callback(t.pageX-this.dragPageX,t.pageY-this.dragPageY,t.pageX,t.pageY);this.dragPageX=t.pageX;this.dragPageY=t.pageY;if(!this.dragged){this.emit("on".concat(this.dragOptions.eventName,"Start"),new n.BaseEvent({compatData:[this]}));this.dragged=true}this.emit("on".concat(this.dragOptions.eventName),new n.BaseEvent({compatData:[this]}))}},{key:"handleDocumentMouseUp",value:function e(t){if(document.body.releaseCapture){document.body.releaseCapture()}i.Event.unbind(document,"mousemove",this.handleDocumentMouseMove);i.Event.unbind(document,"mouseup",this.handleDocumentMouseUp);document.body.ondrag=null;document.body.onselectstart=null;document.body.style.cursor="";document.body.style.MozUserSelect="";this.popupContainer.style.MozUserSelect="";this.emit("on".concat(this.dragOptions.eventName,"End"),new n.BaseEvent({compatData:[this]}));this.dragged=false;t.preventDefault()}}]);return o}(n.EventEmitter);function S(){var e=this.getTargetContainer();var t=T.get(e);if(!t){t=new Set;T.set(e,t)}t.add(this);i.Dom.addClass(e,"popup-window-disable-scroll")}function E(){var e=this.getTargetContainer();var t=T.get(e)||null;if(t){t["delete"](this)}if(t===null||t.size===0){i.Dom.removeClass(e,"popup-window-disable-scroll")}}babelHelpers.defineProperty(I,"options",{});babelHelpers.defineProperty(I,"defaultOptions",{angleLeftOffset:40,positionTopXOffset:-11,angleTopOffset:10,popupZindex:1e3,popupOverlayZindex:1100,angleMinLeft:10,angleMaxLeft:30,angleMinRight:10,angleMaxRight:30,angleMinBottom:23,angleMaxBottom:25,angleMinTop:23,angleMaxTop:25,offsetLeft:0,offsetTop:0});var B=-1;var D=null;function N(e,t){if(e===false){if(D&&D.length>0){for(var n=0;nB){B=e;D=[t]}else if(e===B){D.push(t)}}}var O=function(){function e(){babelHelpers.classCallCheck(this,e);throw new Error("You cannot make an instance of PopupManager.")}babelHelpers.createClass(e,null,[{key:"create",value:function e(t){var n=Array.prototype.slice.call(arguments),s=n[0],o=n[1],a=n[2];var l=s;var r=true;if(i.Type.isPlainObject(s)&&!o&&!a){r=false;l=s.id;if(!i.Type.isStringFilled(l)){throw new Error('BX.Main.Popup.Manager: "id" parameter is required.')}}var u=this.getPopupById(l);if(u===null){u=r?new I(s,o,a):new I(t);u.subscribe("onShow",this.handlePopupShow);u.subscribe("onClose",this.handlePopupClose)}return u}},{key:"handleOnAfterInit",value:function e(t){t.getTarget().subscribeOnce("onDestroy",this.handlePopupDestroy);this._popups.forEach((function(e){if(e.getId()===t.getTarget().getId()){console.error("Duplicate id (".concat(e.getId(),") for the BX.Main.Popup instance."))}}));this._popups.push(t.getTarget())}},{key:"handlePopupDestroy",value:function e(t){this._popups=this._popups.filter((function(e){return e!==t.getTarget()}))}},{key:"handlePopupShow",value:function e(t){if(this._currentPopup!==null){this._currentPopup.close()}this._currentPopup=t.getTarget()}},{key:"handlePopupClose",value:function e(){this._currentPopup=null}},{key:"getCurrentPopup",value:function e(){return this._currentPopup}},{key:"isPopupExists",value:function e(t){return this.getPopupById(t)!==null}},{key:"isAnyPopupShown",value:function e(){for(var t=0,n=this._popups.length;t'"]/g;var R={"<":"<",">":">","'":"'",'"':"""};function F(e){if(i.Type.isString(e)){return e.replace(L,(function(e){return R[e]}))}return e}n.EventEmitter.registerAliases(A);var X=function(e){babelHelpers.inherits(t,e);function t(e){var n;babelHelpers.classCallCheck(this,t);n=babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(t).call(this));n.setEventNamespace("BX.Main.Menu.Item");e=e||{};n.options=e;n.id=e.id||i.Text.getRandom();n.text="";n.allowHtml=false;if(i.Type.isStringFilled(e.html)||i.Type.isElementNode(e.html)){n.text=e.html;n.allowHtml=true}else if(i.Type.isStringFilled(e.text)){n.text=e.text;if(n.text.match(/<[^>]+>/)){console.warn('BX.Main.MenuItem: use "html" option for the html item content.',n.getText())}}n.title=i.Type.isStringFilled(e.title)?e.title:"";n.delimiter=e.delimiter===true;n.href=i.Type.isStringFilled(e.href)?e.href:null;n.target=i.Type.isStringFilled(e.target)?e.target:null;n.dataset=i.Type.isPlainObject(e.dataset)?e.dataset:null;n.className=i.Type.isStringFilled(e.className)?e.className:null;n.menuShowDelay=i.Type.isNumber(e.menuShowDelay)?e.menuShowDelay:300;n.subMenuOffsetX=i.Type.isNumber(e.subMenuOffsetX)?e.subMenuOffsetX:4;n._items=i.Type.isArray(e.items)?e.items:[];n.disabled=e.disabled===true;n.cacheable=e.cacheable===true;n.onclick=i.Type.isStringFilled(e.onclick)||i.Type.isFunction(e.onclick)?e.onclick:null;n.subscribeFromOptions(e.events,A);n.menuWindow=null;n.subMenuWindow=null;n.layout={item:null,text:null};n.getLayout();n.events={};n.items=[];for(var s in e){if(e.hasOwnProperty(s)&&typeof n[s]==="undefined"){n[s]=e[s]}}return n}babelHelpers.createClass(t,[{key:"getLayout",value:function e(){if(this.layout.item){return this.layout}if(this.delimiter){if(i.Type.isStringFilled(this.getText())){this.layout.item=i.Dom.create("span",{props:{className:["popup-window-delimiter-section",this.className?this.className:""].join(" ")},children:[this.layout.text=i.Tag.render(W||(W=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t\t\t\t',"\n\t\t\t\t\t\t"])),this.allowHtml?this.getText():F(this.getText()))]})}else{this.layout.item=i.Tag.render(x||(x=babelHelpers.taggedTemplateLiteral([''])))}}else{this.layout.item=i.Dom.create(this.href?"a":"span",{props:{className:["menu-popup-item",this.className?this.className:"menu-popup-no-icon",this.hasSubMenu()?"menu-popup-item-submenu":""].join(" ")},attrs:{title:this.title,onclick:i.Type.isString(this.onclick)?this.onclick:"",target:this.target?this.target:""},dataset:this.dataset,events:i.Type.isFunction(this.onclick)?{click:this.onItemClick.bind(this)}:null,children:[i.Dom.create("span",{props:{className:"menu-popup-item-icon"}}),this.layout.text=i.Tag.render(z||(z=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t\t\t',"\n\t\t\t\t\t"])),this.allowHtml?this.getText():F(this.getText()))]});if(this.href){this.layout.item.href=this.href}if(this.isDisabled()){this.disable()}i.Event.bind(this.layout.item,"mouseenter",this.onItemMouseEnter.bind(this));i.Event.bind(this.layout.item,"mouseleave",this.onItemMouseLeave.bind(this))}return this.layout}},{key:"getContainer",value:function e(){return this.getLayout().item}},{key:"getTextContainer",value:function e(){return this.getLayout().text}},{key:"getText",value:function e(){return this.text}},{key:"setText",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;if(i.Type.isString(t)||i.Type.isElementNode(t)){this.allowHtml=n;this.text=t;if(i.Type.isElementNode(t)){i.Dom.clean(this.getTextContainer());if(this.allowHtml){i.Dom.append(t,this.getTextContainer())}else{this.getTextContainer().innerHTML=F(t.outerHTML)}}else{this.getTextContainer().innerHTML=this.allowHtml?t:F(t)}}}},{key:"hasSubMenu",value:function e(){return this.subMenuWindow!==null||this._items.length}},{key:"showSubMenu",value:function e(){if(!this.getMenuWindow().getPopupWindow().isShown()){return}this.addSubMenu(this._items);if(this.subMenuWindow){i.Dom.addClass(this.layout.item,"menu-popup-item-open");this.closeSiblings();this.closeChildren();var t=this.subMenuWindow.getPopupWindow();if(!t.isShown()){this.emit("SubMenu:onShow");t.show()}this.adjustSubMenu()}}},{key:"addSubMenu",value:function e(t){if(this.subMenuWindow!==null||!i.Type.isArray(t)||!t.length){return}var n=this.getMenuWindow().getRootMenuWindow()||this.getMenuWindow();var s=Object.assign({},n.params);delete s.events;var o=i.Type.isPlainObject(n.params.subMenuOptions)?n.params.subMenuOptions:{};var a=Object.assign({},s,o);a.autoHide=false;a.menuShowDelay=this.menuShowDelay;a.cacheable=this.isCacheable();a.targetContainer=this.getMenuWindow().getPopupWindow().getTargetContainer();a.bindOptions={forceTop:true,forceLeft:true,forceBindPosition:true};delete a.angle;delete a.overlay;this.subMenuWindow=new U("popup-submenu-"+this.id,this.layout.item,t,a);this.subMenuWindow.setParentMenuWindow(this.getMenuWindow());this.subMenuWindow.setParentMenuItem(this);this.subMenuWindow.getPopupWindow().subscribe("onDestroy",this.handleSubMenuDestroy.bind(this));i.Dom.addClass(this.layout.item,"menu-popup-item-submenu");return this.subMenuWindow}},{key:"closeSubMenu",value:function e(){this.clearSubMenuTimeout();if(this.subMenuWindow){i.Dom.removeClass(this.layout.item,"menu-popup-item-open");this.closeChildren();var t=this.subMenuWindow.getPopupWindow();if(t.isShown()){this.emit("SubMenu:onClose")}this.subMenuWindow.close()}}},{key:"closeSiblings",value:function e(){var t=this.menuWindow.getMenuItems();for(var n=0;n0){var m=Math.ceil(f/n.height)*n.height;if(m>n.top){m-=Math.ceil((m-n.top)/n.height)*n.height}if(n.bottom>u-m){m-=n.bottom-(u-m)+this.getPopupPadding()}s+=m;o+=m}if(n.left+i+l>d){var g=n.left-l-this.subMenuOffsetX;if(g>0){i=-l-this.subMenuOffsetX;a="right"}}t.setBindElement(this.layout.item);t.setOffset({offsetLeft:i,offsetTop:-s});t.setAngle({position:a,offset:o});t.adjustPosition()}},{key:"getBoundingClientRect",value:function e(){var t=this.getMenuWindow().getPopupWindow();if(t.isTargetDocumentBody()){return this.layout.item.getBoundingClientRect()}else{var n=t.getPositionRelativeToTarget(this.layout.item);var i=this.getMenuWindow().getPopupWindow().getTargetContainer();return new DOMRect(n.left-i.scrollLeft,n.top-i.scrollTop,n.width,n.height)}}},{key:"getPopupPadding",value:function e(){if(!i.Type.isNumber(this.popupPadding)){if(this.subMenuWindow){var t=this.subMenuWindow.layout.menuContainer;this.popupPadding=parseInt(i.Dom.style(t,"paddingTop"),10)}else{this.popupPadding=0}}return this.popupPadding}},{key:"getSubMenu",value:function e(){return this.subMenuWindow}},{key:"getId",value:function e(){return this.id}},{key:"setMenuWindow",value:function e(t){this.menuWindow=t}},{key:"getMenuWindow",value:function e(){return this.menuWindow}},{key:"getMenuShowDelay",value:function e(){return this.menuShowDelay}},{key:"enable",value:function e(){this.disabled=false;this.getContainer().classList.remove("menu-popup-item-disabled")}},{key:"disable",value:function e(){this.disabled=true;this.closeSubMenu();this.getContainer().classList.add("menu-popup-item-disabled")}},{key:"isDisabled",value:function e(){return this.disabled}},{key:"setCacheable",value:function e(t){this.cacheable=t!==false}},{key:"isCacheable",value:function e(){return this.cacheable}},{key:"onItemClick",value:function e(t){this.onclick.call(this.menuWindow,t,this)}},{key:"onItemMouseEnter",value:function e(t){if(this.isDisabled()){return}var i=new n.BaseEvent({data:{mouseEvent:t}});n.EventEmitter.emit(this,"onMouseEnter",i,{thisArg:this});if(i.isDefaultPrevented()){return}this.clearSubMenuTimeout();if(this.hasSubMenu()){this.subMenuTimeout=setTimeout(function(){this.showSubMenu()}.bind(this),this.menuShowDelay)}else{this.subMenuTimeout=setTimeout(function(){this.closeSiblings()}.bind(this),this.menuShowDelay)}}},{key:"onItemMouseLeave",value:function e(t){if(this.isDisabled()){return}var i=new n.BaseEvent({data:{mouseEvent:t}});n.EventEmitter.emit(this,"onMouseLeave",i,{thisArg:this});if(i.isDefaultPrevented()){return}this.clearSubMenuTimeout()}},{key:"clearSubMenuTimeout",value:function e(){if(this.subMenuTimeout){clearTimeout(this.subMenuTimeout)}this.subMenuTimeout=null}},{key:"handleSubMenuDestroy",value:function e(){this.subMenuWindow=null}}]);return t}(n.EventEmitter);var j,_;var U=function(){function e(t){babelHelpers.classCallCheck(this,e);var n=Array.prototype.slice.call(arguments),s=n[0],o=n[1],a=n[2],l=n[3];if(i.Type.isPlainObject(t)&&!o&&!a&&!l){l=t;l.compatibleMode=false;s=t.id;o=t.bindElement;a=t.items;if(!i.Type.isStringFilled(s)){s="menu-popup-"+i.Text.getRandom()}}this.id=s;this.bindElement=o;this.menuItems=[];this.itemsContainer=null;this.params=l&&babelHelpers["typeof"](l)==="object"?l:{};this.parentMenuWindow=null;this.parentMenuItem=null;if(a&&i.Type.isArray(a)){for(var r=0;r',"\n\t\t"])),t);this.layout.menuContainer=i.Tag.render(_||(_=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\n\t\t"])),this.layout.itemsContainer);this.itemsContainer=this.layout.itemsContainer;l.content=this.layout.menuContainer;l.events={onClose:this.handlePopupClose.bind(this),onDestroy:this.handlePopupDestroy.bind(this)};var r=l.compatibleMode===false?this.getId():"menu-popup-"+this.getId();var u=new I(r,this.bindElement,l);if(this.params&&this.params.events){u.subscribeFromOptions(this.params.events)}return u}},{key:"getPopupWindow",value:function e(){return this.popupWindow}},{key:"show",value:function e(){this.getPopupWindow().show()}},{key:"close",value:function e(){this.getPopupWindow().close()}},{key:"destroy",value:function e(){this.getPopupWindow().destroy()}},{key:"toggle",value:function e(){if(this.getPopupWindow().isShown()){this.close()}else{this.show()}}},{key:"getId",value:function e(){return this.id}},{key:"handlePopupClose",value:function e(){for(var t=0;t=0){this.menuItems.splice(o,0,s)}else{this.menuItems.push(s)}return s}},{key:"removeMenuItem",value:function e(t){var n=this.getMenuItem(t);if(!n){return}for(var i=0;i0?" "+n.className:""),id:n.id},text:n.text,events:n.contextEvents});return n}return t}(s);var K=function(e){babelHelpers.inherits(t,e);function t(){babelHelpers.classCallCheck(this,t);return babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(t).apply(this,arguments))}return t}(q);var G=function(e){babelHelpers.inherits(t,e);function t(e){var n;babelHelpers.classCallCheck(this,t);n=babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(t).call(this,e));n.buttonNode=i.Dom.create("span",{props:{className:n.className.length>0?n.className:"",id:n.id},events:n.contextEvents,text:n.text});return n}return t}(s);var J=function(e){babelHelpers.inherits(t,e);function t(){babelHelpers.classCallCheck(this,t);return babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(t).apply(this,arguments))}return t}(G);var Q=function(e){babelHelpers.inherits(t,e);function t(){babelHelpers.classCallCheck(this,t);return babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(t).apply(this,arguments))}return t}(U);var $=function(e){babelHelpers.inherits(t,e);function t(){babelHelpers.classCallCheck(this,t);return babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(t).apply(this,arguments))}return t}(X);var ee=function(){function e(t){babelHelpers.classCallCheck(this,e);this.id=t.id||"bx-inp-popup-"+Math.round(Math.random()*1e6);this.handler=t.handler||false;this.values=t.values||false;this.pInput=t.input;this.bValues=!!this.values;this.defaultValue=t.defaultValue||"";this.openTitle=t.openTitle||"";this.className=t.className||"";this.noMRclassName=t.noMRclassName||"ec-no-rm";this.emptyClassName=t.noMRclassName||"ec-label";var n=this;this.curInd=false;if(this.bValues){this.pInput.onfocus=this.pInput.onclick=function(e){if(this.value==n.defaultValue){this.value="";this.className=n.className}n.ShowPopup();return e.preventDefault()};this.pInput.onblur=function(){if(n.bShowed){setTimeout((function(){n.ClosePopup(true)}),200)}n.OnChange()}}else{this.pInput.className=this.noMRclassName;this.pInput.onblur=this.OnChange.bind(this)}}babelHelpers.createClass(e,[{key:"ShowPopup",value:function e(){if(this.bShowed){return}var t=this;if(!this.oPopup){var s=i.Dom.create("DIV",{props:{className:"bxecpl-loc-popup "+this.className}});for(var o=0,a=this.values.length;o