PageSourceSearch

https://aeroproject.ru/bitrix/js/main/popup/dist/main.popup.bundle.min.js?179060715975890

js aeroproject.ru collected 2026-10-02 19:21:14 UTC 75,890 bytes, 43 lines download raw bytes

1this.BX=this.BX||{};(function(e,t,n,i,s,o,a,l,u){"use strict";class r extends a.BaseEvent{#e;#t;get left(){return this.#e}set left(e){if(t.Type.isNumber(e)){this.#e=e}}get top(){return this.#t}set top(e){if(t.Type.isNumber(e)){this.#t=e}}}const h=Object.freeze({LARGE:"large",SMALL:"small"});let p=function(){function e(n){babelHelpers.classCallCheck(this,e);this.popupWindow=null;this.params=n||{};this.text=this.params.text||"";this.id=this.params.id||"";this.className=this.params.className||"";this.events=this.params.events||{};this.contextEvents={};for(const e of Object.keys(this.events)){if(t.Type.isFunction(this.events[e])){this.contextEvents[e]=this.events[e].bind(this)}}const i=this.className.length>0?` ${this.className}`:"";this.buttonNode=t.Dom.create("button",{props:{className:`popup-window-button${i}`,id:this.id},attrs:{tabindex:"0",type:"button"},events:this.contextEvents,text:this.text})}return 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(n){this.text=n||"";if(this.buttonNode){t.Dom.clean(this.buttonNode);t.Dom.adjust(this.buttonNode,{text:this.text})}}},{key:"setClassName",value:function e(n){if(this.buttonNode){if(t.Type.isString(this.className)&&this.className!==""){t.Dom.removeClass(this.buttonNode,this.className)}t.Dom.addClass(this.buttonNode,n)}this.className=n}},{key:"addClassName",value:function e(n){if(this.buttonNode){t.Dom.addClass(this.buttonNode,n);this.className=this.buttonNode.className}}},{key:"removeClassName",value:function e(n){if(this.buttonNode){t.Dom.removeClass(this.buttonNode,n);this.className=this.buttonNode.className}}}])}();var c;function d(e,t,n){return t=babelHelpers.getPrototypeOf(t),babelHelpers.possibleConstructorReturn(e,f()?Reflect.construct(t,[],babelHelpers.getPrototypeOf(e).constructor):t.apply(e,n))}function f(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(f=function(){return!!e})()}function m(e,t,n,i){var s=babelHelpers.get(babelHelpers.getPrototypeOf(e.prototype),t,n);return"function"==typeof s?function(e){return s.apply(n,e)}:s}function g(e,t){y(e,t),t.add(e)}function b(e,t,n){y(e,t),t.set(e,n)}function y(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function v(e,t){return e.get(w(e,t))}function C(e,t,n){return e.set(w(e,t),n),n}function w(e,t,n){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}const P={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"}};a.EventEmitter.registerAliases(P);const M=new WeakMap;function T(e,n,i){let s=t.Type.isString(e)?e:undefined;let o=n;let a=i;let l=a&&t.Type.isBoolean(a.compatibleMode)?a.compatibleMode:true;if(t.Type.isPlainObject(e)&&!o&&!a){a=e;s=e.id;o=e.bindElement;l=false}a||={};if(!t.Type.isStringFilled(s)){s=`popup-window-${t.Text.getRandom().toLowerCase()}`}return{popupId:s,bindElement:o,params:a,compatibleMode:l}}const k=new Set(["alertdialog","dialog","window"]);var S=new WeakMap;var I=new WeakMap;var D=new WeakSet;let E=function(e){function n(e,t,i){var s;babelHelpers.classCallCheck(this,n);s=d(this,n);g(s,D);b(s,S,null);babelHelpers.defineProperty(s,"firstShow",false);babelHelpers.defineProperty(s,"bordersWidth",20);babelHelpers.defineProperty(s,"bindElementPos",null);babelHelpers.defineProperty(s,"closeIcon",null);babelHelpers.defineProperty(s,"resizeIcon",null);babelHelpers.defineProperty(s,"angle",null);babelHelpers.defineProperty(s,"angleArrowElement",null);babelHelpers.defineProperty(s,"overlay",null);babelHelpers.defineProperty(s,"overlayTimeout",null);babelHelpers.defineProperty(s,"titleBar",null);babelHelpers.defineProperty(s,"isAutoHideBound",false);babelHelpers.defineProperty(s,"isCloseByEscBound",false);babelHelpers.defineProperty(s,"toFrontOnShow",true);
1babelHelpers.defineProperty(s,"cacheable",true);babelHelpers.defineProperty(s,"destroyed",false);babelHelpers.defineProperty(s,"fixed",false);babelHelpers.defineProperty(s,"width",null);babelHelpers.defineProperty(s,"height",null);babelHelpers.defineProperty(s,"minWidth",null);babelHelpers.defineProperty(s,"minHeight",null);babelHelpers.defineProperty(s,"maxWidth",null);babelHelpers.defineProperty(s,"maxHeight",null);babelHelpers.defineProperty(s,"padding",null);babelHelpers.defineProperty(s,"contentPadding",null);babelHelpers.defineProperty(s,"background",null);babelHelpers.defineProperty(s,"contentBackground",null);babelHelpers.defineProperty(s,"borderRadius",null);babelHelpers.defineProperty(s,"contentBorderRadius",null);babelHelpers.defineProperty(s,"targetContainer",document.body);babelHelpers.defineProperty(s,"dragOptions",{cursor:"",callback(){},eventName:""});babelHelpers.defineProperty(s,"dragged",false);babelHelpers.defineProperty(s,"dragPageX",0);babelHelpers.defineProperty(s,"dragPageY",0);babelHelpers.defineProperty(s,"animationShowClassName",null);babelHelpers.defineProperty(s,"animationCloseClassName",null);b(s,I,false);babelHelpers.defineProperty(s,"buttonsContainer",null);babelHelpers.defineProperty(s,"resizeContentOffset",0);babelHelpers.defineProperty(s,"handleAutoHide",(e=>{if(s.isDestroyed()){return}if(s.autoHideHandler!==null){if(s.autoHideHandler(e)){s._tryCloseByEvent(e)}}else if(e.target!==s.getPopupContainer()&&!s.getPopupContainer().contains(e.target)){s._tryCloseByEvent(e)}}));babelHelpers.defineProperty(s,"handleDocumentKeyUp",(e=>{if(e.keyCode===27&&!s.isDestroyed()){j(s.getZindex(),(()=>{s.close()}))}}));s.setEventNamespace("BX.Main.Popup");const{popupId:o,bindElement:l,params:u,compatibleMode:r}=T(e,t,i);s.compatibleMode=r;s.params=u;s.emit("onInit",new a.BaseEvent({compatData:[o,l,u]}));s.initializeState(o,u);w(D,s,B).call(s);s.subscribeFromOptions(u.events||{});w(D,s,O).call(s,o,u);w(D,s,H).call(s,l,u);w(D,s,W).call(s,u.focusTrap);s.emit("onAfterInit",new a.BaseEvent({compatData:[o,s]}));return s}babelHelpers.inherits(n,e);return babelHelpers.createClass(n,[{key:"initializeState",value:function e(i,s){this.uniquePopupId=i;this.buttons=s.buttons&&t.Type.isArray(s.buttons)?s.buttons:[];this.offsetTop=n.getOption("offsetTop");this.offsetLeft=n.getOption("offsetLeft");this.bindOptions=t.Type.isObject(s.bindOptions)?s.bindOptions:{};this.autoHide=s.autoHide===true;this.disableScroll=s.disableScroll===true||s.isScrollBlock===true;this.autoHideHandler=t.Type.isFunction(s.autoHideHandler)?s.autoHideHandler:null;this.closeByEsc=s.closeByEsc===true;this.blockBackgroundEsc=s.blockBackgroundEsc!==false;this.designSystemContext=s.darkMode?"--ui-context-content-dark":"--ui-context-content-light";this.setTargetContainer(s.targetContainer)}},{key:"subscribeFromOptions",value:function e(t){m(n,"subscribeFromOptions",this)([t,P])}},{key:"getId",value:function e(){return this.uniquePopupId}},{key:"isCompatibleMode",value:function e(){return this.compatibleMode}},{key:"setContent",value:function e(n){if(!this.contentContainer||!n){return}if(t.Type.isElementNode(n)){t.Dom.clean(this.contentContainer);const e=n;const i=t.Type.isDomNode(e.parentNode);t.Dom.append(e,this.contentContainer);if(this.isCompatibleMode()||i){e.style.display="block"}}else if(t.Type.isString(n)){this.contentContainer.innerHTML=n}else{this.contentContainer.innerHTML="&nbsp;"}}},{key:"setButtons",value:function e(n){this.buttons=n&&t.Type.isArray(n)?n:[];if(this.buttonsContainer){t.Dom.remove(this.buttonsContainer)}const i=t.Reflection.getClass("BX.UI.Button");if(this.buttons.length>0&&this.contentContainer){const e=[];for(let t=0;t<this.buttons.length;t++){const n=this.buttons[t];if(n instanceof p){n.popupWindow=this;e.push(n.render())}else if(i&&n instanceof i){n.setContext(this);e.push(n.render())}}this.buttonsContainer=t.Tag.render`<div class="popup-window-buttons">${e}</div>`;this.contentContainer.insertAdjacentElement("afterend",this.buttonsContainer)}}},{key:"getButtons",value:function e(){return this.buttons}},{key:"getButton",value:function e(t){for(let e=0;e<this.buttons.length;e++){const n=this.buttons[e];if(n.getId()===t){return n}}return null}},{key:"setBindElement",value:function e(n){if(n===null){this.bindElement=null}
1else if(t.Type.isObject(n)){if(t.Type.isDomNode(n)||t.Type.isNumber(n.top)&&t.Type.isNumber(n.left)){this.bindElement=n}else if(t.Type.isNumber(n.clientX)&&t.Type.isNumber(n.clientY)){this.bindElement={left:n.pageX,top:n.pageY,bottom:n.pageY}}}}},{key:"getBindElementPos",value:function e(n){if(t.Type.isDomNode(n)){if(this.isTargetDocumentBody()){return this.isFixed()?n.getBoundingClientRect():t.Dom.getPosition(n)}return this.getPositionRelativeToTarget(n)}if(n&&t.Type.isObject(n)){const e=n;if(!t.Type.isNumber(e.bottom)){e.bottom=e.top}return e}const i=this.getWindowSize();const s=this.getWindowScroll();const o=this.getPopupContainer().offsetWidth;const a=this.getPopupContainer().offsetHeight;this.bindOptions.forceTop=true;return{left:i.innerWidth/2-o/2+s.scrollLeft,top:i.innerHeight/2-a/2+(this.isFixed()?0:s.scrollTop),bottom:i.innerHeight/2-a/2+(this.isFixed()?0:s.scrollTop),windowSize:i,windowScroll:s,popupWidth:o,popupHeight:a}}},{key:"getPositionRelativeToTarget",value:function e(t){let n=t.offsetLeft;let i=t.offsetTop;let s=t.offsetParent;while(s&&s!==this.getTargetContainer()){n+=s.offsetLeft;i+=s.offsetTop;s=s.offsetParent}const o=t.getBoundingClientRect();return new DOMRect(n,i,o.width,o.height)}},{key:"getWindowSize",value:function e(){if(this.isTargetDocumentBody()){return{innerWidth:window.innerWidth,innerHeight:window.innerHeight}}return{innerWidth:this.getTargetContainer().offsetWidth,innerHeight:this.getTargetContainer().offsetHeight}}},{key:"getWindowScroll",value:function e(){if(this.isTargetDocumentBody()){return{scrollLeft:window.pageXOffset,scrollTop:window.pageYOffset}}return{scrollLeft:this.getTargetContainer().scrollLeft,scrollTop:this.getTargetContainer().scrollTop}}},{key:"setAngle",value:function e(n){if(n===false){this.removeAngle();return}const i=t.Type.isObject(n)?n:{};if(this.angle===null){this.createAngle(i)}this.setAnglePosition(i.position);if(t.Type.isNumber(i.offset)){this.setAngleOffset(i.offset)}}},{key:"removeAngle",value:function e(){if(this.angle!==null){t.Dom.remove(this.angle.element)}this.angle=null;this.angleArrowElement=null}},{key:"createAngle",value:function e(i){const s="popup-window-angly";const o=this.bindOptions.position==="top"?"bottom":"top";const a=n.getOption(o==="top"?"angleMinTop":"angleMinBottom");let l=t.Type.isNumber(i.offset)?i.offset:0;const u=n.getOption("angleLeftOffset",null);if(l>0&&t.Type.isNumber(u)){l+=u-n.defaultOptions.angleLeftOffset}this.angleArrowElement=t.Tag.render`<div class="popup-window-angly--arrow"></div>`;if(this.background){this.angleArrowElement.style.background=this.background}this.angle={element:t.Tag.render`
2				<div class="${s} ${s}-${o}">
3					${this.angleArrowElement}
4				</div>
5			`,position:o,offset:0,defaultOffset:Math.max(l,a)};this.getPopupContainer().appendChild(this.angle.element)}},{key:"setAnglePosition",value:function e(n){if(!n||!["top","right","bottom","left","hide"].includes(n)){return}const i="popup-window-angly";t.Dom.removeClass(this.angle.element,`${i}-${this.angle.position}`);t.Dom.addClass(this.angle.element,`${i}-${n}`);this.angle.position=n}},{key:"setAngleOffset",value:function e(t){switch(this.angle.position){case"top":this.setVerticalAngleOffset(t,"angleMinTop","angleMaxTop","left");break;case"bottom":this.setVerticalAngleOffset(t,"angleMinBottom","angleMaxBottom","marginLeft");break;case"right":this.setSideAngleOffset(t,"angleMinRight","angleMaxRight");break;case"left":this.setSideAngleOffset(t,"angleMinLeft","angleMaxLeft");break}}},{key:"setVerticalAngleOffset",value:function e(t,n,i,s){this.angle.offset=this.calculateAngleOffset(t,n,i,this.getPopupContainer().offsetWidth);const o=this.angle.element.style;o.left=s==="left"?`${this.angle.offset}px`:"0px";o.marginLeft=s==="marginLeft"?`${this.angle.offset}px`:"0px";o.removeProperty("top")}},{key:"setSideAngleOffset",value:function e(t,n,i){this.angle.offset=this.calculateAngleOffset(t,n,i,this.getPopupContainer().offsetHeight);this.angle.element.style.top=`${this.angle.offset}px`;this.angle.element.style.removeProperty("left");this.angle.element.style.removeProperty("margin-left")}},{key:"calculateAngleOffset",value:function e(t,i,s,o){const a=n.getOption(i);const l=o-n.getOption(s);const u=l<a?Math.max(a,t):l;return Math.min(Math.max(a,t),u)}},{key:"getWidth",value:function e(){return this.width}}
5,{key:"setWidth",value:function e(t){this.setWidthProperty("width",t)}},{key:"getHeight",value:function e(){return this.height}},{key:"setHeight",value:function e(t){this.setHeightProperty("height",t)}},{key:"getMinWidth",value:function e(){return this.minWidth}},{key:"setMinWidth",value:function e(t){this.setWidthProperty("minWidth",t)}},{key:"getMinHeight",value:function e(){return this.minHeight}},{key:"setMinHeight",value:function e(t){this.setHeightProperty("minHeight",t)}},{key:"getMaxWidth",value:function e(){return this.maxWidth}},{key:"setMaxWidth",value:function e(t){this.setWidthProperty("maxWidth",t)}},{key:"getMaxHeight",value:function e(){return this.maxHeight}},{key:"setMaxHeight",value:function e(t){this.setHeightProperty("maxHeight",t)}},{key:"setWidthProperty",value:function e(n,i){const s=["width","minWidth","maxWidth"];if(!s.includes(n)){return}if(t.Type.isNumber(i)&&i>=0){this[n]=i;this.getResizableContainer().style[n]=`${i}px`;this.getContentContainer().style.overflowX="auto";t.Dom.addClass(this.getPopupContainer(),"popup-window-fixed-width")}else if(i===null||i===false){this[n]=null;this.getResizableContainer().style.removeProperty(t.Text.toKebabCase(n));const e=s.some((e=>this.getResizableContainer().style.getPropertyValue(t.Text.toKebabCase(e))!==""));if(!e){this.getContentContainer().style.removeProperty("overflow-x");t.Dom.removeClass(this.getPopupContainer(),"popup-window-fixed-width")}}}},{key:"setHeightProperty",value:function e(n,i){const s=["height","minHeight","maxHeight"];if(!s.includes(n)){return}if(t.Type.isNumber(i)&&i>=0){this[n]=i;this.getResizableContainer().style[n]=`${i}px`;this.getContentContainer().style.overflowY="auto";t.Dom.addClass(this.getPopupContainer(),"popup-window-fixed-height")}else if(i===null||i===false){this[n]=null;this.getResizableContainer().style.removeProperty(t.Text.toKebabCase(n));const e=s.some((e=>this.getResizableContainer().style.getPropertyValue(t.Text.toKebabCase(e))!==""));if(!e){this.getContentContainer().style.removeProperty("overflow-y");t.Dom.removeClass(this.getPopupContainer(),"popup-window-fixed-height")}}}},{key:"setPadding",value:function e(n){if(t.Type.isNumber(n)&&n>=0){this.padding=n;this.getPopupContainer().style.padding=`${n}px`}else if(n===null){this.padding=null;this.getPopupContainer().style.removeProperty("padding")}}},{key:"getPadding",value:function e(){return this.padding}},{key:"setContentPadding",value:function e(n){if(t.Type.isNumber(n)&&n>=0){this.contentPadding=n;this.getContentContainer().style.padding=`${n}px`}else if(n===null){this.contentPadding=null;this.getContentContainer().style.removeProperty("padding")}}},{key:"getContentPadding",value:function e(){return this.contentPadding}},{key:"setBorderRadius",value:function e(n){if(t.Type.isStringFilled(n)){this.borderRadius=n;this.getPopupContainer().style.setProperty("--popup-window-border-radius",n)}else if(n===null){this.borderRadius=null;this.getPopupContainer().style.removeProperty("--popup-window-border-radius")}}},{key:"getBorderRadius",value:function e(){return this.borderRadius}},{key:"setContentBorderRadius",value:function e(n){if(t.Type.isStringFilled(n)){this.contentBorderRadius=n;this.getContentContainer().style.setProperty("--popup-window-content-border-radius",n)}else if(n===null){this.contentBorderRadius=null;this.getContentContainer().style.removeProperty("--popup-window-content-border-radius")}}},{key:"getContentBorderRadius",value:function e(){return this.contentBorderRadius}},{key:"setContentColor",value:function e(n){if(t.Type.isString(n)&&this.contentContainer){this.contentContainer.style.backgroundColor=n}else if(n===null){this.contentContainer.style.removeProperty("background-color")}}},{key:"setBackground",value:function e(n){if(t.Type.isStringFilled(n)){this.background=n;this.getPopupContainer().style.background=n;if(this.angleArrowElement){this.angleArrowElement.style.background=n}}else if(n===null){this.background=null;this.getPopupContainer().style.removeProperty("background");if(this.angleArrowElement){this.angleArrowElement.style.removeProperty("background")}}}}
5,{key:"getBackground",value:function e(){return this.background}},{key:"setContentBackground",value:function e(n){if(t.Type.isStringFilled(n)){this.contentBackground=n;this.getContentContainer().style.background=n}else if(n===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:"getFocusTrap",value:function e(){return v(S,this)}},{key:"setToFrontOnShow",value:function e(t){this.toFrontOnShow=t!==false}},{key:"shouldFrontOnShow",value:function e(){return this.toFrontOnShow}},{key:"setFixed",value:function e(n){if(t.Type.isBoolean(n)){this.fixed=n;if(n){t.Dom.addClass(this.getPopupContainer(),"--fixed")}else{t.Dom.removeClass(this.getPopupContainer(),"--fixed")}}}},{key:"isFixed",value:function e(){return this.fixed}},{key:"setResizeMode",value:function e(n){if(n===true||t.Type.isPlainObject(n)){if(!this.resizeIcon){this.resizeIcon=t.Tag.render`
6					<div class="popup-window-resize" onmousedown="${this.handleResizeMouseDown.bind(this)}"></div>
7				`;this.getPopupContainer().appendChild(this.resizeIcon)}this.setMinWidth(n.minWidth);this.setMinHeight(n.minHeight)}else if(n===false&&this.resizeIcon){t.Dom.remove(this.resizeIcon);this.resizeIcon=null}}},{key:"getDesignSystemContext",value:function e(){return this.designSystemContext}},{key:"setDesignSystemContext",value:function e(n){if(t.Type.isString(n)){if(this.popupContainer!==null){t.Dom.removeClass(this.popupContainer,this.designSystemContext);t.Dom.addClass(this.popupContainer,n)}this.designSystemContext=n}}},{key:"setTargetContainer",value:function e(n){const i=t.Type.isElementNode(n)?n:document.body;if(i===this.targetContainer){return}this.targetContainer=i;if(this.getPopupContainer()){u.ZIndexManager.unregister(this.getPopupContainer());this.getTargetContainer().append(this.getPopupContainer());u.ZIndexManager.register(this.getPopupContainer())}if(this.overlay){t.Dom.append(this.overlay.element,this.getTargetContainer())}}},{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 this.getPopupContainer()}},{key:"getTitleContainer",value:function e(){return this.titleBar}},{key:"onTitleMouseDown",value:function e(t){w(D,this,z).call(this,t,{cursor:"move",callback:this.handleMove,eventName:"Drag"})}},{key:"handleResizeMouseDown",value:function e(n){w(D,this,z).call(this,n,{cursor:"nwse-resize",eventName:"Resize",callback:this.handleResize});if(this.isTargetDocumentBody()){this.resizeContentPos=t.Dom.getPosition(this.getResizableContainer());this.resizeContentOffset=this.resizeContentPos.left-t.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;let o=this.resizeContentPos.width+this.resizeContentPos.offsetX;let a=this.resizeContentPos.height+this.resizeContentPos.offsetY;const 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()?n.getOption("angleTopOffset"):0}},{key:"setOffset",value:function e(i){if(!t.Type.isPlainObject(i)){return}if(t.Type.isNumber(i.offsetLeft)){this.offsetLeft=i.offsetLeft+n.getOption("offsetLeft")}if(t.Type.isNumber(i.offsetTop)){this.offsetTop=i.offsetTop+n.getOption("offsetTop")}}},{key:"setTitleBar",value:function e(n){if(!this.titleBar){return}const i=t.Type.isObject(n)&&!t.Type.isDomNode(n)?n.content:n;if(t.Type.isDomNode(i)){this.titleBar.innerHTML="";this.titleBar.appendChild(i)}else if(t.Type.isString(i)){this.titleBar.innerHTML="";this.titleBar.appendChild(t.Dom.create("span",{props:{id:`popup-window-titlebar-text-${this.getId()}`,className:"popup-window-titlebar-text"},text:i}));if(!t.Type.isStringFilled(t.Dom.attr(this.getPopupContainer(),"aria-label"))){t.Dom.attr(this.getPopupContainer(),"aria-label",i)}}}},{key:"setDraggable",value:function e(n){this.params.draggable=n;const i=t.Type.isObject(n)&&n.element?n.element:this.titleBar;if(!n||!i){return}t.Dom.style(i,"cursor","move");t.Event.bind(i,"mousedown",this.onTitleMouseDown)}},{key:"setClosingByEsc",value:function e(n){const i=t.Type.isBoolean(n)?n:true;if(i){this.closeByEsc=true;this.bindClosingByEsc()}else{this.closeByEsc=false;this.unbindClosingByEsc()}}},{key:"bindClosingByEsc",value:function e(){if(this.closeByEsc&&!this.isCloseByEscBound){t.Event.bind(this.targetContainer.ownerDocument,"keyup",this.handleDocumentKeyUp,true);this.isCloseByEscBound=true}}},{key:"unbindClosingByEsc",value:function e(){if(this.isCloseByEscBound){t.Event.unbind(this.targetContainer.ownerDocument,"keyup",this.handleDocumentKeyUp,true);this.isCloseByEscBound=false}}},{key:"setAutoHide",value:function e(n){const i=t.Type.isBoolean(n)?n:true;if(i){this.autoHide=true;this.bindAutoHide()}else{this.autoHide=false;this.unbindAutoHide()}}},{key:"bindAutoHide",value:function e(){if(this.autoHide&&!this.isAutoHideBound&&this.isShown()){this.isAutoHideBound=true;if(this.isCompatibleMode()){t.Event.bind(this.getPopupContainer(),"click",this.handleContainerClick)}if(!this.hasOverlay()){t.Event.bind(this.targetContainer.ownerDocument,"click",this.handleAutoHide,!this.isCompatibleMode())}}}},{key:"unbindAutoHide",value:function e(){if(this.isAutoHideBound){this.isAutoHideBound=false;if(this.isCompatibleMode()){t.Event.unbind(this.getPopupContainer(),"click",this.handleContainerClick)}if(!this.hasOverlay()){const e=this.targetContainer.ownerDocument;t.Event.unbind(e,"click",this.handleAutoHide,!this.isCompatibleMode())}}}},{key:"_tryCloseByEvent",value:function e(t){if(this.isCompatibleMode()){this.tryCloseByEvent(t)}else{setTimeout((()=>{this.tryCloseByEvent(t)}),0)}}},{key:"tryCloseByEvent",value:function e(t){if(t.button===0){this.close()}}},{key:"handleOverlayClick",value:function e(t){if(this.autoHide){this.tryCloseByEvent(t);t.stopPropagation()}}},{key:"setOverlay",value:function e(n){if(this.overlay===null){this.unbindAutoHide();this.overlay={element:t.Tag.render`
8					<div
9						class="popup-window-overlay"
10						id="popup-window-overlay-${this.getId()}"
11						onclick="${this.handleOverlayClick.bind(this)}"
12						aria-hidden="true"
13					></div>
14				`};this.resizeOverlay();t.Dom.append(this.overlay.element,this.getTargetContainer());this.getZIndexComponent().setOverlay(this.overlay.element);if(v(S,this)!==null){t.Dom.attr(this.overlay.element,"data-focus-trap",v(S,this).getId())}w(D,this,F).call(this)}if(t.Type.isObject(n)&&t.Type.isNumber(n.opacity)&&n.opacity>=0&&n.opacity<=100){const e=(n.opacity/100).toPrecision(3);t.Dom.style(this.overlay.element,"opacity",e)}if(t.Type.isObject(n)&&n.backgroundColor){t.Dom.style(this.overlay.element,"background-color",n.backgroundColor)}if(t.Type.isObject(n)&&n.blur){t.Dom.style(this.overlay.element,"backdrop-filter",n.blur)}}},{key:"isModal",value:function e(){return this.hasOverlay()}},{key:"hasOverlay",value:function e(){return this.overlay!==null&&this.overlay.element!==null}},{key:"removeOverlay",value:function e(){if(this.overlay!==null&&this.overlay.element!==null){t.Dom.remove(this.overlay.element);this.getZIndexComponent().setOverlay(null)}if(this.overlayTimeout){clearInterval(this.overlayTimeout);this.overlayTimeout=null}this.overlay=null;w(D,this,F).call(this)}},{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(){if(this.overlay!==null&&this.overlay.element!==null){this.overlay.element.style.display="block";let e=this.getPopupContainer().offsetHeight;this.overlayTimeout=setInterval((()=>{if(e!==this.getPopupContainer().offsetHeight){this.resizeOverlay();e=this.getPopupContainer().offsetHeight}}),1e3)}}},{key:"resizeOverlay",value:function e(){if(this.overlay!==null&&this.overlay.element!==null){let e=0;let t=0;if(this.isTargetDocumentBody()){e=document.documentElement.scrollWidth;t=Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)}else{e=this.getTargetContainer().scrollWidth;t=this.getTargetContainer().scrollHeight}this.overlay.element.style.width=`${e}px`;this.overlay.element.style.height=`${t}px`}}},{key:"getZindex",value:function e(){return this.getZIndexComponent().getZIndex()}},{key:"getZIndexComponent",value:function e(){return this.zIndexComponent}},{key:"setDisableScroll",value:function e(n){const i=t.Type.isBoolean(n)?n:true;if(i){this.disableScroll=true;w(D,this,A).call(this)}else{this.disableScroll=false;w(D,this,L).call(this)}}},{key:"show",value:function e(){if(this.isShown()||this.isDestroyed()){return}this.emit("onBeforeShow");this.showOverlay();this.getPopupContainer().style.display="block";t.Dom.addClass(this.getPopupContainer(),"--open");v(S,this)?.captureActiveElement();if(this.shouldFrontOnShow()){this.bringToFront()}if(!this.firstShow){this.emit("onFirstShow",new a.BaseEvent({compatData:[this]}));this.firstShow=true}this.emit("onShow",new a.BaseEvent({compatData:[this]}));if(this.disableScroll){w(D,this,A).call(this)}this.adjustPosition();this.animateOpening((()=>{if(this.isDestroyed()){return}t.Dom.removeClass(this.getPopupContainer(),this.animationShowClassName);this.emit("onAfterShow",new a.BaseEvent({compatData:[this]}));v(S,this)?.activate()}));this.bindClosingByEsc();if(this.isCompatibleMode()){setTimeout((()=>{this.bindAutoHide()}),100)}else{this.bindAutoHide()}}},{key:"close",value:function e(){if(this.isDestroyed()||!this.isShown()){return}this.emit("onClose",new a.BaseEvent({compatData:[this]}));if(this.isDestroyed()){return}if(this.disableScroll){w(D,this,L).call(this)}v(S,this)?.deactivate();this.animateClosing((()=>{if(this.isDestroyed()){return}this.hideOverlay();this.getPopupContainer().style.display="none";t.Dom.removeClass(this.getPopupContainer(),"--open");t.Dom.removeClass(this.getPopupContainer(),this.animationCloseClassName);this.unbindClosingByEsc();if(this.isCompatibleMode()){setTimeout((()=>{this.unbindAutoHide()}),0)}else{this.unbindAutoHide()}this.emit("onAfterClose",new a.BaseEvent({compatData:[this]}));if(!this.isCacheable()){this.destroy()}}))}},{key:"bringToFront",value:function e(){if(this.isShown()){u.ZIndexManager.bringToFront(this.getPopupContainer())}}},{key:"toggle",value:function e(){if(this.isShown()){this.close()}else{this.show()}}},{key:"bindAnimationEnd",value:function e(t,n){void w(D,this,R).call(this,t,n)}},{key:"animateOpening",value:function e(n){t.Dom.removeClass(this.getPopupContainer(),this.animationCloseClassName);if(this.animationShowClassName===null){n()}else{t.Dom.addClass(this.getPopupContainer(),this.animationShowClassName);if(v(I,this)){this.bindAnimationEnd(this.animationShowClassName,n)}else{n()}}}},{key:"animateClosing",value:function e(n){t.Dom.removeClass(this.getPopupContainer(),this.animationShowClassName);if(this.animationCloseClassName===null){n()}else{t.Dom.addClass(this.getPopupContainer(),this.animationCloseClassName);if(v(I,this)){this.bindAnimationEnd(this.animationCloseClassName,n)}else{n()}}}},{key:"setAnimation",value:function e(n){if(t.Type.isPlainObject(n)){this.animationShowClassName=t.Type.isStringFilled(n.showClassName)?n.showClassName:null;this.animationCloseClassName=t.Type.isStringFilled(n.closeClassName)?n.closeClassName:null;C(I,this,n.closeAnimationType==="animation"||n.closeAnimationType==="transition")}else if(t.Type.isStringFilled(n)){const e=n;switch(e){case"fading":this.animationShowClassName="popup-window-show-animation-opacity";this.animationCloseClassName="popup-window-close-animation-opacity";C(I,this,true);break;case"fading-slide":this.animationShowClassName="popup-window-show-animation-opacity-transform";this.animationCloseClassName="popup-window-close-animation-opacity";C(I,this,true);break;case"scale":this.animationShowClassName="popup-window-show-animation-scale";this.animationCloseClassName="popup-window-close-animation-opacity";C(I,this,true);break}}else if(n===false||n===null){this.animationShowClassName=null;this.animationCloseClassName=null;C(I,this,false)}}},{key:"isShown",value:function e(){return!this.isDestroyed()&&this.getPopupContainer()?.style.display==="block"}}
14,{key:"shouldBlockBackgroundEsc",value:function e(){return this.blockBackgroundEsc}},{key:"destroy",value:function e(){if(this.destroyed){return}if(this.disableScroll){w(D,this,L).call(this)}this.destroyed=true;this.emit("onDestroy",new a.BaseEvent({compatData:[this]}));this.unbindClosingByEsc();if(this.isCompatibleMode()){setTimeout((()=>{this.unbindAutoHide()}),0)}else{this.unbindAutoHide()}t.Event.unbindAll(this);t.Event.unbind(document,"mousemove",this.handleDocumentMouseMove);t.Event.unbind(document,"mouseup",this.handleDocumentMouseUp);t.Event.unbind(window,"resize",this.handleResizeWindow);this.removeOverlay();u.ZIndexManager.unregister(this.popupContainer);this.zIndexComponent=null;v(S,this)?.destroy();C(S,this,null);t.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(n){if(n&&t.Type.isObject(n)){this.bindOptions=n}const i=this.getBindElementPos(this.bindElement);if(this.hasUnchangedBindPosition(i)){return}this.updateBindElementPosition(i);const s=i.windowSize??this.getWindowSize();const o=i.windowScroll??this.getWindowScroll();const a=i.popupWidth??this.popupContainer.offsetWidth;const l=i.popupHeight??this.popupContainer.offsetHeight;const u=this.calculatePopupLeft(a,s,o);const h=this.calculatePopupTop(l,s,o);const p=new r;p.left=u;p.top=h;this.emit("onBeforeAdjustPosition",p);t.Dom.adjust(this.popupContainer,{style:{top:`${p.top}px`,left:`${p.left}px`}})}},{key:"hasUnchangedBindPosition",value:function e(t){return!this.bindOptions.forceBindPosition&&this.bindElementPos!==null&&t.top===this.bindElementPos.top&&t.left===this.bindElementPos.left}},{key:"updateBindElementPosition",value:function e(t){const n=t.top===0&&t.left===0&&t.width===0&&t.height===0;if(!n||this.bindElementPos===null){this.bindElementPos=t}}},{key:"calculatePopupLeft",value:function e(t,i,s){let o=this.bindElementPos.left+this.offsetLeft-(this.isTopOrBottomAngle()?n.getOption("angleLeftOffset"):0);if(!this.bindOptions.forceLeft&&o+t+this.bordersWidth>=i.innerWidth+s.scrollLeft&&i.innerWidth+s.scrollLeft-t-this.bordersWidth>0){const e=o;o=i.innerWidth+s.scrollLeft-t-this.bordersWidth;if(this.isTopOrBottomAngle()){this.setAngle({offset:e-o+this.angle.defaultOffset})}}else if(this.isTopOrBottomAngle()){this.setAngle({offset:this.angle.defaultOffset+(o<0?o:0)})}if(o<0){o=0}return o}},{key:"calculatePopupTop",value:function e(t,i,s){const o=n.getOption("angleTopOffset");if(this.bindOptions.position==="top"){return this.calculatePopupTopFromAbove(t,s,o)}return this.calculatePopupTopFromBelow(t,i,s,o)}},{key:"calculatePopupTopFromAbove",value:function e(t,i,s){let o=this.bindElementPos.top-t-this.offsetTop-(this.isBottomAngle()?s:0);if(o<0||!this.bindOptions.forceTop&&o<i.scrollTop){o=this.bindElementPos.bottom+this.offsetTop;if(this.angle!==null){o+=s;this.setAngle({position:"top"})}}else if(this.isTopAngle()){o=o-s+n.getOption("positionTopXOffset");this.setAngle({position:"bottom"})}else{o+=n.getOption("positionTopXOffset")}return o<0?0:o}},{key:"calculatePopupTopFromBelow",value:function e(t,i,s,o){let a=this.bindElementPos.bottom+this.offsetTop+this.getAngleHeight();if(!this.bindOptions.forceTop&&a+t>i.innerHeight+s.scrollTop&&this.bindElementPos.top-t-this.getAngleHeight()>=0){a=this.bindElementPos.top-t;if(this.isTopOrBottomAngle()){a-=o;this.setAngle({position:"bottom"})}a+=n.getOption("positionTopXOffset")}else if(this.isBottomAngle()){a+=o;this.setAngle({position:"top"})}return a<0?0:a}},{key:"enterFullScreen",value:function e(){if(n.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();t.Event.bind(window,"fullscreenchange",this.handleFullScreen)}else if(this.contentContainer.mozRequestFullScreen){this.contentContainer.mozRequestFullScreen();t.Event.bind(window,"mozfullscreenchange",this.handleFullScreen)}else if(this.contentContainer.webkitRequestFullScreen){this.contentContainer.webkitRequestFullScreen();t.Event.bind(window,"webkitfullscreenchange",this.handleFullScreen)}else{console.error("fullscreen mode is not supported")}}},{key:"handleFullScreen",value:function e(){if(n.fullscreenStatus){t.Event.unbind(window,"fullscreenchange",this.handleFullScreen);t.Event.unbind(window,"webkitfullscreenchange",this.handleFullScreen);t.Event.unbind(window,"mozfullscreenchange",this.handleFullScreen);n.fullscreenStatus=false;if(!this.isDestroyed()){t.Dom.removeClass(this.contentContainer,"popup-window-fullscreen");
14this.emit("onFullscreenLeave");this.adjustPosition()}}else{n.fullscreenStatus=true;if(!this.isDestroyed()){t.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:"handleResizeWindow",value:function e(){if(this.isShown()){this.adjustPosition();if(this.overlay!==null){this.resizeOverlay()}}}},{key:"handleMove",value:function e(n,i,s,o){let a=parseInt(this.popupContainer.style.left,10)+n;let l=parseInt(this.popupContainer.style.top,10)+i;if(t.Type.isObject(this.params.draggable)&&this.params.draggable.restrict){if(a<0){a=0}let e=0;let t=0;if(this.isTargetDocumentBody()){e=document.documentElement.scrollWidth;t=document.documentElement.scrollHeight}else{e=this.getTargetContainer().scrollWidth;t=this.getTargetContainer().scrollHeight}const n=this.popupContainer.offsetWidth;const i=this.popupContainer.offsetHeight;if(a>e-n){a=e-n}if(l>t-i){l=t-i}if(l<0){l=0}}this.popupContainer.style.left=`${a}px`;this.popupContainer.style.top=`${l}px`}},{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${this.dragOptions.eventName}Start`,new a.BaseEvent({compatData:[this]}));this.dragged=true}this.emit(`on${this.dragOptions.eventName}`,new a.BaseEvent({compatData:[this]}))}},{key:"handleDocumentMouseUp",value:function e(n){if(document.body.releaseCapture){document.body.releaseCapture()}t.Event.unbind(document,"mousemove",this.handleDocumentMouseMove);t.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${this.dragOptions.eventName}End`,new a.BaseEvent({compatData:[this]}));this.dragged=false;n.preventDefault()}}],[{key:"setOptions",value:function e(n){if(!t.Type.isPlainObject(n)){return}for(const[e,t]of Object.entries(n)){this.options[e]=t}}},{key:"getOption",value:function e(n,i){if(!t.Type.isUndefined(this.options[n])){return this.options[n]}if(!t.Type.isUndefined(i)){return i}return this.defaultOptions[n]}},{key:"shouldUseFocusTrapByDefault",value:function e(){if(!l.AccessibilitySettings.useFocusTrapInDialogs()){return false}const t=l.FocusNavigator.getActiveElement();const n=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);if(t===null){return true}const i=t.tagName==="TEXTAREA"||t.tagName==="INPUT"&&!n.has(t.type)||t.isContentEditable;return!i}}])}(a.EventEmitter);c=E;function B(){this.handleDocumentMouseMove=this.handleDocumentMouseMove.bind(this);this.handleDocumentMouseUp=this.handleDocumentMouseUp.bind(this);this.handleResizeWindow=this.handleResizeWindow.bind(this);this.handleResize=this.handleResize.bind(this);this.handleMove=this.handleMove.bind(this);this.onTitleMouseDown=this.onTitleMouseDown.bind(this);this.handleFullScreen=this.handleFullScreen.bind(this)}function x(e){let n="popup-window";if(e.titleBar){n+=" popup-window-with-titlebar"}if(t.Type.isStringFilled(e.className)){n+=` ${e.className}`}if(e.darkMode){n+=" popup-window-dark"}return`${n} ${this.designSystemContext}`}function N(e){if(!e.closeIcon){return null}let n=`popup-window-close-icon${e.titleBar?" popup-window-titlebar-close-icon":""}`;if(e.closeIconSize&&Object.values(h).includes(e.closeIconSize)&&e.closeIconSize!==h.SMALL){n+=` --${e.closeIconSize}`}const i=t.Tag.render`
15			<button
16				tabindex="0"
17				type="button"
18				aria-label="${t.Loc.getMessage("MAIN_POPUP_CLOSE")}"
19				class="${n}"
20				onclick="${this.handleCloseIconClick.bind(this)}"
21			>
22				<span class="ui-icon-set --cross-l --hoverable-default" style="--ui-icon-set__icon-size: 24px;"></span>
23			</button>
24		`;if(t.Type.isPlainObject(e.closeIcon)){t.Dom.style(i,e.closeIcon)}return i}function O(e,n){const i=w(D,this,x).call(this,n);const s=`popup-window-titlebar-${e}`;if(n.titleBar){this.titleBar=t.Tag.render`<div class="popup-window-titlebar" id="${s}"></div>`}this.closeIcon=w(D,this,N).call(this,n);this.contentContainer=t.Tag.render`
25			<div id="popup-window-content-${e}" role="presentation" class="popup-window-content"></div>
26		`;this.popupContainer=t.Tag.render`
27			<div
28				class="${i}"
29				id="${e}"
30				style="display: none; position: absolute; left: 0; top: 0;"
31				tabindex="-1"
32				role="${t.Type.isStringFilled(n.role)?n.role:"dialog"}"
33			>${[this.titleBar,this.contentContainer,this.closeIcon]}</div>
34		`;if(t.Type.isStringFilled(n.ariaLabel)){t.Dom.attr(this.popupContainer,"aria-label",n.ariaLabel)}if(t.Type.isStringFilled(n.ariaLabelledBy)){t.Dom.attr(this.popupContainer,"aria-labelledby",n.ariaLabelledBy)}if(t.Type.isStringFilled(n.ariaDescribedBy)){t.Dom.attr(this.popupContainer,"aria-describedby",n.ariaDescribedBy)}this.getTargetContainer().append(this.popupContainer);this.zIndexComponent=u.ZIndexManager.register(this.popupContainer,n.zIndexOptions);if(t.Type.isStringFilled(n.contentColor)){this.setContentColor(n.contentColor)}if(n.angle){this.setAngle(n.angle)}if(n.overlay){this.setOverlay(n.overlay)}}function H(e,n){this.setOffset({offsetTop:n.offsetTop,offsetLeft:n.offsetLeft});this.setBindElement(e);this.setTitleBar(n.titleBar);this.setDraggable(n.draggable);this.setContent(n.content);this.setButtons(n.buttons);this.setWidth(n.width);this.setHeight(n.height);this.setMinWidth(n.minWidth);this.setMinHeight(n.minHeight);this.setMaxWidth(n.maxWidth);this.setMaxHeight(n.maxHeight);this.setResizeMode(n.resizable);this.setPadding(n.padding);this.setContentPadding(n.contentPadding);this.setBorderRadius(n.borderRadius);this.setContentBorderRadius(n.contentBorderRadius);
34this.setBackground(n.background);this.setContentBackground(n.contentBackground);this.setAnimation(n.animation);this.setCacheable(n.cacheable);this.setToFrontOnShow(n.toFrontOnShow);this.setFixed(n.fixed);this.setDesignSystemContext(n.designSystemContext);if(n.contentNoPaddings){this.setContentPadding(0)}if(n.noAllPaddings){this.setPadding(0);this.setContentPadding(0)}if(n.bindOnResize!==false){t.Event.bind(window,"resize",this.handleResizeWindow)}}function W(e){if(e===false||t.Type.isNil(e)&&!c.shouldUseFocusTrapByDefault()){return}const n={initialFocus:["[data-autofocus]","container"],isolateOutside:this.isModal()};const i=t.Type.isPlainObject(e)?e:{};C(S,this,new l.FocusTrap(this.popupContainer,{...n,...i}));if(this.isModal()){t.Dom.attr(this.overlay.element,"data-focus-trap",v(S,this).getId())}}function F(){if(this.popupContainer===null){return}const e=t.Dom.attr(this.popupContainer,"role");const n=t.Type.isString(e)&&k.has(e);t.Dom.attr(this.popupContainer,"aria-modal",n&&this.isModal()?true:null)}function A(){const e=this.getTargetContainer();let n=M.get(e);if(!n){n=new Set;M.set(e,n)}n.add(this);t.Dom.addClass(e,"popup-window-disable-scroll")}function L(){const e=this.getTargetContainer();const n=M.get(e)||null;if(n){n.delete(this)}if(n===null||n.size===0){t.Dom.removeClass(e,"popup-window-disable-scroll")}}async function R(e,n){const i=this.getPopupContainer();await Promise.all([t.Animation.waitTransitionEnd(i),t.Animation.waitAnimationEnd(i)]);if(t.Dom.hasClass(i,e)){n()}}function z(e,n){const i=n||{};if(t.Type.isStringFilled(i.cursor)){this.dragOptions.cursor=i.cursor}if(t.Type.isStringFilled(i.eventName)){this.dragOptions.eventName=i.eventName}if(t.Type.isFunction(i.callback)){this.dragOptions.callback=i.callback}this.dragPageX=e.pageX;this.dragPageY=e.pageY;this.dragged=false;t.Event.bind(document,"mousemove",this.handleDocumentMouseMove);t.Event.bind(document,"mouseup",this.handleDocumentMouseUp);if(document.body.setCapture){document.body.setCapture()}document.body.ondrag=()=>false;document.body.onselectstart=()=>false;document.body.style.cursor=this.dragOptions.cursor;document.body.style.MozUserSelect="none";this.popupContainer.style.MozUserSelect="none";if(this.shouldFrontOnShow()){this.bringToFront()}e.preventDefault()}babelHelpers.defineProperty(E,"options",{});babelHelpers.defineProperty(E,"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});let X=-1;let $=null;function j(e,t){if(e===false){if($&&$.length>0){for(const e of $){e()}$=null;X=-1}}else{if($===null){$=[];X=-1;setTimeout((()=>{j(false)}),10)}if(e>X){X=e;$=[t]}else if(e===X){$.push(t)}}}const _={onSubMenuShow:{namespace:"BX.Main.Menu.Item",eventName:"SubMenu:onShow"},onSubMenuClose:{namespace:"BX.Main.Menu.Item",eventName:"SubMenu:onClose"}};const U=/["'<>]/g;const V={"<":"&lt;",">":"&gt;","'":"&#39;",'"':"&quot;"};function K(e){if(t.Type.isStringFilled(e.html)||t.Type.isElementNode(e.html)){return{text:e.html,allowHtml:true}}if(t.Type.isStringFilled(e.text)){if(/<[^>]+>/.test(e.text)){console.warn('BX.Main.MenuItem: use "html" option for the html item content.',e.text)}return{text:e.text,allowHtml:false}}return{text:"",allowHtml:false}}function Y(e){if(t.Type.isString(e)){return e.replaceAll(U,(e=>V[e]))}return e}a.EventEmitter.registerAliases(_);class Z extends a.EventEmitter{options;id;text;allowHtml;title;delimiter;href;target;dataset;className;menuShowDelay;subMenuOffsetX;disabled;cacheable;focusable;attrs;onclick;menuWindow=null;subMenuWindow=null;layout={item:null,text:null};events;items;#n=[];#i=false;constructor(e){super();this.setEventNamespace("BX.Main.Menu.Item");const n=e||{};this.options=n;this.id=n.id||t.Text.getRandom();const i=K(n);this.text=i.text;this.allowHtml=i.allowHtml;this.title=t.Type.isStringFilled(n.title)?n.title:"";this.delimiter=n.delimiter===true;this.href=t.Type.isStringFilled(n.href)?n.href:null;this.target=t.Type.isStringFilled(n.target)?n.target:null;this.dataset=t.Type.isPlainObject(n.dataset)?n.dataset:null;this.className=t.Type.isStringFilled(n.className)?n.className:null;this.menuShowDelay=t.Type.isNumber(n.menuShowDelay)?n.menuShowDelay:300;this.subMenuOffsetX=t.Type.isNumber(n.subMenuOffsetX)?n.subMenuOffsetX:4;this.#n=t.Type.isArray(n.items)?n.items:[];this.disabled=n.disabled===true;this.cacheable=n.cacheable===true;this.focusable=!this.delimiter&&n.focusable!==false;this.attrs=t.Type.isPlainObject(n.attrs)?n.attrs:null;this.onclick=t.Type.isStringFilled(n.onclick)||t.Type.isFunction(n.onclick)?n.onclick:null;this.subscribeFromOptions(n.events,_);this.getLayout();this.events={};this.items=[];this.#s(n);this.focused??=false;this.subMenuTimeout??=null}#s(e){for(const t of Object.keys(e)){if(!(t in this)){this[t]=e[t]}}}getLayout(){if(this.layout.item){return this.layout}this.layout=this.delimiter?this.#o():this.#a();this.#l();this.#u();return this.layout}#o(){if(!t.Type.isStringFilled(this.getText())){return{item:t.Tag.render`<span class="popup-window-delimiter" aria-hidden="true"></span>`,text:null}}const e=this.allowHtml?this.getText():Y(this.getText());const n=t.Tag.render`
35			<span class="popup-window-delimiter-text">${e}</span>
36		`;return{item:t.Dom.create("span",{props:{className:["popup-window-delimiter-section",this.className||""].join(" ")},attrs:{"aria-hidden":"true"},children:[n]}),text:n}}#a(){const e=t.Tag.render`
37			<span class="menu-popup-item-text">${this.allowHtml?this.getText():Y(this.getText())}</span>
38		`;const n=t.Dom.create(this.href?"a":"span",{props:{className:["menu-popup-item",this.className||"menu-popup-no-icon",this.hasSubMenu()?"menu-popup-item-submenu":""].join(" ")},attrs:{title:this.title,onclick:t.Type.isString(this.onclick)?this.onclick:"",target:this.target||""},dataset:this.dataset,events:t.Type.isFunction(this.onclick)?{click:this.onItemClick.bind(this)}:null,children:[t.Dom.create("span",{props:{className:"menu-popup-item-icon"}}),e]});return{item:n,text:e}}#l(){const e=this.layout.item;if(this.delimiter){return}if(t.Type.isPlainObject(this.attrs)){t.Dom.attr(e,this.attrs)}if(this.isFocusable()){t.Dom.attr(e,"tabindex","-1");t.Dom.attr(e,"role","menuitem")}else{t.Dom.attr(e,"aria-hidden","true")}if(this.hasSubMenu()){t.Dom.attr(e,"aria-haspopup","true");
38t.Dom.attr(e,"aria-expanded","false")}if(this.href){e.href=this.href}if(this.isDisabled()){this.disable()}}#u(){if(!this.delimiter){t.Event.bind(this.layout.item,l.RESTORE_FOCUS_EVENT,this.#r.bind(this))}t.Event.bind(this.layout.item,"mouseenter",this.#h.bind(this));t.Event.bind(this.layout.item,"mouseleave",this.#p.bind(this));t.Event.bind(this.layout.item,"focusin",this.#c.bind(this))}getContainer(){return this.getLayout().item}removeLayout(){if(this.layout.item){t.Dom.remove(this.layout.item)}this.layout={item:null,text:null}}getTextContainer(){return this.getLayout().text}getText(){return this.text}getTextContent(){if(t.Type.isString(this.text)){return this.text}if(t.Type.isElementNode(this.text)){return this.text.textContent||""}return""}setText(e,n=false){if(t.Type.isString(e)||t.Type.isElementNode(e)){this.allowHtml=n;this.text=e;if(t.Type.isElementNode(e)){t.Dom.clean(this.getTextContainer());if(this.allowHtml){t.Dom.append(e,this.getTextContainer())}else{this.getTextContainer().innerHTML=Y(e.outerHTML)}}else{this.getTextContainer().innerHTML=this.allowHtml?e:Y(e)}}}hasSubMenu(){return this.subMenuWindow!==null||this.#n.length>0}showSubMenu(e=null){if(!this.getMenuWindow().isShown()){return}this.addSubMenu(this.#n);if(this.getSubMenu()!==null){this.closeSiblings(e);this.closeChildren(e);if(!this.getSubMenu().isShown()){this.emit("SubMenu:onShow");this.getSubMenu().setLastInputModality(e);this.getSubMenu().show()}t.Dom.attr(this.layout.item,"aria-controls",this.getSubMenu().getId());this.adjustSubMenu()}}addSubMenu(e){if(this.subMenuWindow!==null||!t.Type.isArray(e)||e.length===0){return null}const n=this.getMenuWindow().getRootMenuWindow()||this.getMenuWindow();const i=n.getParams();const s={...i};delete s.events;const o=t.Type.isPlainObject(i.subMenuOptions)?i.subMenuOptions:{};const a={...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};a.focusTrap={initialFocus:false};delete a.angle;delete a.overlay;this.subMenuWindow=new pe(`popup-submenu-${this.id}`,this.layout.item,e,a);this.subMenuWindow.setParentMenuWindow(this.getMenuWindow());this.subMenuWindow.setParentMenuItem(this);this.subMenuWindow.subscribe("onShow",this.#d.bind(this));this.subMenuWindow.subscribe("onClose",this.#f.bind(this));this.subMenuWindow.subscribe("onDestroy",this.#m.bind(this));t.Dom.addClass(this.layout.item,"menu-popup-item-submenu");t.Dom.attr(this.layout.item,"aria-haspopup","true");return this.subMenuWindow}closeSubMenu(e=null){this.#g();if(this.getSubMenu()!==null){this.closeChildren(e);if(this.getSubMenu().isShown()){this.emit("SubMenu:onClose")}this.getSubMenu().setLastInputModality(e);this.getSubMenu().close()}}closeSiblings(e=null){const t=this.menuWindow.getMenuItems();for(const n of t){if(n!==this){n.closeSubMenu(e)}}}closeChildren(e=null){if(this.getSubMenu()!==null){const t=this.getSubMenu().getMenuItems();for(const n of t){n.closeSubMenu(e)}}}destroySubMenu(){if(this.getSubMenu()!==null){t.Dom.removeClass(this.layout.item,"menu-popup-item-open menu-popup-item-submenu");t.Dom.attr(this.layout.item,"aria-haspopup",null);this.destroyChildren();this.getSubMenu().destroy();this.subMenuWindow=null;this.#n=[]}}destroyChildren(){if(this.getSubMenu()!==null){const e=this.getSubMenu().getMenuItems();for(const t of e){t.destroySubMenu()}}}adjustSubMenu(){if(this.getSubMenu()===null||!this.layout.item){return}const e=this.getSubMenu().getPopupWindow();const t=this.getBoundingClientRect();let n=t.width+this.subMenuOffsetX;let i=t.height+this.getPopupPadding();let s=t.height/2-this.getPopupPadding();let o="left";const a=e.getPopupContainer().offsetWidth;const l=e.getPopupContainer().offsetHeight;const u=t.top+l;const r=this.getMenuWindow().getPopupWindow().getTargetContainer();const h=this.getMenuWindow().getPopupWindow().isTargetDocumentBody();const p=h?document.documentElement.clientWidth:r.offsetWidth;const c=h?document.documentElement.clientHeight:r.offsetHeight;const d=u-c;if(d>0){let e=Math.ceil(d/t.height)*t.height;if(e>t.top){e-=Math.ceil((e-t.top)/t.height)*t.height}if(t.bottom>u-e){e-=t.bottom-(u-e)+this.getPopupPadding()}i+=e;s+=e}if(t.left+n+a>p){const e=t.left-a-this.subMenuOffsetX;if(e>0){n=-a-this.subMenuOffsetX;o="right"}}e.setBindElement(this.layout.item);e.setOffset({offsetLeft:n,offsetTop:-i});e.setAngle({position:o,offset:s});e.adjustPosition()}getBoundingClientRect(){const e=this.getMenuWindow().getPopupWindow();if(e.isTargetDocumentBody()){return this.layout.item.getBoundingClientRect()}const t=e.getPositionRelativeToTarget(this.layout.item);const n=this.getMenuWindow().getPopupWindow().getTargetContainer();return new DOMRect(t.left-n.scrollLeft,t.top-n.scrollTop,t.width,t.height)}getPopupPadding(){if(!t.Type.isNumber(this.popupPadding)){if(this.subMenuWindow){const e=this.subMenuWindow.getLayout().menuContainer;this.popupPadding=parseInt(t.Dom.style(e,"paddingTop"),10)}else{this.popupPadding=0}}return this.popupPadding}getSubMenu(){return this.subMenuWindow}getId(){return this.id}setMenuWindow(e){this.menuWindow=e}getMenuWindow(){return this.menuWindow}getMenuShowDelay(){return this.menuShowDelay}enable(){this.disabled=false;t.Dom.removeClass(this.getContainer(),"menu-popup-item-disabled");t.Dom.attr(this.getContainer(),"aria-disabled",null)}disable(){this.disabled=true;this.closeSubMenu();t.Dom.addClass(this.getContainer(),"menu-popup-item-disabled");t.Dom.attr(this.getContainer(),"aria-disabled","true")}isDisabled(){return this.disabled}isFocusable(){return this.focusable}setCacheable(e){this.cacheable=e!==false}isCacheable(){return this.cacheable}isDelimiter(){return this.delimiter}focus(e=false){if(this.isFocused()||this.isDelimiter()||!this.isFocusable()){return}this.focused=true;t.Dom.addClass(this.getContainer(),`--focus${e?" --focus-visible":""}`);t.Dom.attr(this.getContainer(),"tabindex","0");if(this.getMenuWindow().getFocusTrap()!==null){this.getContainer().focus({preventScroll:!e})}this.getMenuWindow().emit("Item:onFocus",{item:this})}blur(){if(!this.isFocused()||this.isDelimiter()||!this.isFocusable()){return}this.focused=false;t.Dom.removeClass(this.getContainer(),"--focus --focus-visible");t.Dom.attr(this.getContainer(),"tabindex","-1");this.getMenuWindow().emit("Item:onBlur",{item:this})}isFocused(){return this.focused}onItemClick(e){this.onclick.call(this.menuWindow,e,this)}#c(){this.#i=true;setTimeout((()=>{this.#i=false}),100)}#h(e){if(this.getMenuWindow()?.shouldIgnoreMouseEnter()||this.#i){return}const t=new a.BaseEvent({data:{mouseEvent:e}});a.EventEmitter.emit(this,"onMouseEnter",t,{thisArg:this});if(t.isDefaultPrevented()){return}this.focus();this.#g();if(this.hasSubMenu()){this.subMenuTimeout=setTimeout((()=>{this.showSubMenu("pointer")}),this.menuShowDelay)}else{this.subMenuTimeout=setTimeout((()=>{this.closeSiblings("pointer")}),this.menuShowDelay)}}#p(e){const t=new a.BaseEvent({data:{mouseEvent:e}});a.EventEmitter.emit(this,"onMouseLeave",t,{thisArg:this});if(t.isDefaultPrevented()){return}this.blur();this.#g()}#r(e){e.preventDefault();const t=this.getMenuWindow().getMenuItems().some((e=>e.isFocused()));if(!t){this.focus(l.FocusMonitor.Instance.getLastInputModality()==="keyboard")}}
38#g(){if(this.subMenuTimeout){clearTimeout(this.subMenuTimeout)}this.subMenuTimeout=null}#d(){t.Dom.addClass(this.layout.item,"menu-popup-item-open");t.Dom.attr(this.layout.item,"aria-expanded","true")}#f(){t.Dom.removeClass(this.layout.item,"menu-popup-item-open");t.Dom.attr(this.layout.item,"aria-expanded","false");t.Dom.attr(this.layout.item,"aria-controls",null)}#m(){this.#f();this.subMenuWindow=null}}const q=new Intl.Collator(undefined,{sensitivity:"base"});class G{#b=null;#y=false;#v;#C="";#w=null;#P=null;#M="first";constructor(e,n={}){this.#b=e;this.#b.subscribe("onShow",this.#T.bind(this));this.#b.subscribe("onDestroy",this.#k.bind(this));this.#v=this.#S.bind(this);this.#P=t.Type.isFunction(n.onTab)?n.onTab:null;this.setInitialFocusPosition(n.initialFocusPosition)}getMenu(){return this.#b}enable(){if(!this.isEnabled()){this.bindEvents()}this.#y=true}disable(){if(this.isEnabled()){this.unbindEvents()}this.#y=false}isEnabled(){return this.#y}bindEvents(){t.Event.bind(this.getMenu().getMenuContainer(),"keydown",this.#v)}unbindEvents(){t.Event.unbind(this.getMenu().getMenuContainer(),"keydown",this.#v)}setInitialFocusPosition(e){if(e==="first"||e==="last"){this.#M=e}}#T(){this.enable();if(this.#b.getParentMenuWindow()===null){if(l.FocusMonitor.Instance.getLastInputModality()==="keyboard"&&this.#b.getFocusTrap()!==null){if(this.#M==="last"){this.focusLast()}else{this.focusFirst()}}}else if(this.#b.getLastInputModal()==="keyboard"){this.focusFirst()}}#k(){this.disable();this.#b=null}#S(e){if(!this.getMenu().isShown()){return}if(e.metaKey||e.ctrlKey||e.altKey){return}const t=e.target;if(t?.tagName==="TEXTAREA"||t instanceof HTMLInputElement){return}e.preventDefault();switch(e.key){case"ArrowDown":{this.focusNext();break}case"ArrowUp":{this.focusPrevious();break}case"ArrowLeft":{this.#I();break}case"ArrowRight":{this.#D(this.getMenu().getFocusedItem());break}case"Home":case"PageUp":{this.focusFirst();break}case"End":case"PageDown":{this.focusLast();break}case" ":case"Enter":case"Space":{this.#E();break}case"Tab":{this.#B(e);break}default:{this.#x(e);break}}}#I(){const e=this.getMenu().getFocusedItem();const t=e?.getMenuWindow()?.getParentMenuItem();if(t){t.focus(true);t.closeSubMenu("keyboard")}}#E(){const e=this.getMenu().getFocusedItem();if(!e){return}if(e.hasSubMenu()){this.#D(e)}else{e.getContainer().click()}}#B(e){if(this.#P===null){const e=this.getMenu().getRootMenuWindow()||this.getMenu();e.close();return}this.#P(e,this.#b)}#x(e){if(!this.#N(e)){return}this.#C+=e.key;this.focusByText(this.#C);clearTimeout(this.#w);this.#w=setTimeout((()=>{this.#C=""}),200)}#D(e){if(!e||!e.hasSubMenu()){return}if(e.getSubMenu()?.isShown()){e.getSubMenu().getNavigation().focusFirst()}else{e.showSubMenu("keyboard")}e.blur()}#N(e){if(e.key===" "&&this.#C.length>0){return true}return e.key.length===1&&/^[\p{Letter}\p{Number}]$/u.test(e.key)}focusByText(e){const t=this.getItems();const n=this.getMenu().getFocusedItem();const i=e.toLowerCase();const s=t.filter((e=>{const t=e.getTextContent().trim().toLowerCase().slice(0,Math.max(0,i.length));return q.compare(i,t)===0}));if(s.length===0){return null}const o=s.indexOf(n);if(o>=0){const e=s[(o+1)%s.length];e.focus(true);return e}const a=t.indexOf(n);const l=s.find((e=>t.indexOf(e)>a))??s[0];l.focus(true);return l}focusNext(e=true){const t=this.getMenu().getFocusedItem();const n=this.getItems();if(n.length===0){return null}if(!t){n[0].focus(true);return n[0]}const i=this.getMenuItemPosition(t.getId());if(i===-1){n[0].focus(true);return n[0]}if(i+1<n.length){const e=i+1;n[e].focus(true);return n[e]}if(e){n[0].focus(true);return n[0]}return null}focusPrevious(e=true){const t=this.getMenu().getFocusedItem();const n=this.getItems();if(n.length===0){return null}if(!t){n[n.length-1].focus(true);return n[n.length-1]}const i=this.getMenuItemPosition(t.getId());if(i===-1){n[n.length-1].focus(true);return n[n.length-1]}if(i-1>=0){const e=i-1;n[e].focus(true);return n[e]}if(e){const e=n.length-1;n[e].focus(true);return n[e]}return null}focusFirst(){const e=this.getItems();if(e.length>0){e[0].focus(true);return e[0]}return null}focusLast(){const e=this.getItems();if(e.length>0){e[e.length-1].focus(true);return e[e.length-1]}return null}getItems(){return this.getMenu().getMenuItems().filter((e=>e.isFocusable()&&l.InteractivityChecker.isVisible(e.getContainer())))}getMenuItemPosition(e){const t=this.getItems();for(const[n,i]of t.entries()){if(i.getId()&&i.getId()===e){return n}}return-1}}function J(e,t,n){return t=babelHelpers.getPrototypeOf(t),babelHelpers.possibleConstructorReturn(e,Q()?Reflect.construct(t,[],babelHelpers.getPrototypeOf(e).constructor):t.apply(e,n))}function Q(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Q=function(){return!!e})()}function ee(e,t){ne(e,t),t.add(e)}function te(e,t,n){ne(e,t),t.set(e,n)}function ne(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function ie(e,t){return e.get(oe(e,t))}function se(e,t,n){return e.set(oe(e,t),n),n}function oe(e,t,n){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}var ae=new WeakMap;var le=new WeakMap;var ue=new WeakMap;var re=new WeakMap;var he=new WeakSet;let pe=function(e){function n(e,i,s,o){var a;babelHelpers.classCallCheck(this,n);a=J(this,n);
38ee(a,he);babelHelpers.defineProperty(a,"menuItems",[]);babelHelpers.defineProperty(a,"itemsContainer",null);babelHelpers.defineProperty(a,"parentMenuWindow",null);babelHelpers.defineProperty(a,"parentMenuItem",null);te(a,ae,null);te(a,le,null);te(a,ue,null);te(a,re,true);a.setEventNamespace("BX.Main.Menu");let l=t.Type.isString(e)?e:null;let u=i;let r=s;let h=o;if(t.Type.isPlainObject(e)&&!u&&!r&&!h){h=e;h.compatibleMode=false;l=e.id;u=e.bindElement;r=e.items;if(!t.Type.isStringFilled(l)){l=`menu-popup-${t.Text.getRandom()}`}}a.emit("onInit",{id:l,bindElement:u,menuItems:r,params:h});a.id=l;a.bindElement=u;a.params=t.Type.isObject(h)?h:{};if(r&&t.Type.isArray(r)){for(const e of r){a.addMenuItemInternal(e,null)}}a.layout={menuContainer:null,itemsContainer:null};a.popupWindow=oe(he,a,ce).call(a);se(ae,a,new G(a,h?.navigationOptions));a.subscribe("Item:onFocus",oe(he,a,ve).bind(a));a.subscribe("Item:onBlur",oe(he,a,Ce).bind(a));return a}babelHelpers.inherits(n,e);return babelHelpers.createClass(n,[{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:"isShown",value:function e(){return this.getPopupWindow().isShown()}},{key:"getId",value:function e(){return this.id}},{key:"getParams",value:function e(){return this.params}},{key:"getLayout",value:function e(){return this.layout}},{key:"getNavigation",value:function e(){return ie(ae,this)}},{key:"getFocusTrap",value:function e(){return this.getPopupWindow().getFocusTrap()}},{key:"setLastInputModality",value:function e(t){se(ue,this,t)}},{key:"getLastInputModal",value:function e(){return ie(ue,this)}},{key:"shouldIgnoreMouseEnter",value:function e(){return ie(re,this)}},{key:"containsTarget",value:function e(t){const n=this.getPopupWindow().getPopupContainer();if(this.getPopupWindow().isShown()&&(t===n||n.contains(t))){return true}return this.getMenuItems().some((e=>e.getSubMenu()&&e.getSubMenu().containsTarget(t)))}},{key:"setParentMenuWindow",value:function e(t){if(t instanceof n){this.parentMenuWindow=t}}},{key:"getParentMenuWindow",value:function e(){return this.parentMenuWindow}},{key:"isRootMenu",value:function e(){return this.getParentMenuWindow()===null}},{key:"getRootMenuWindow",value:function e(){let t=null;let n=this.getParentMenuWindow();while(n!==null){t=n;n=n.getParentMenuWindow()}return t}},{key:"setParentMenuItem",value:function e(t){if(t instanceof Z){this.parentMenuItem=t}}},{key:"getParentMenuItem",value:function e(){return this.parentMenuItem}},{key:"addMenuItem",value:function e(n,i){const s=this.addMenuItemInternal(n,i);if(!s){return null}const o=s.getLayout();const a=this.getMenuItem(i);if(a===null){t.Dom.append(o.item,this.itemsContainer)}else{const e=a.getLayout();t.Dom.insertBefore(o.item,e.item)}return s}},{key:"addMenuItemInternal",value:function e(n,i){if(!n||!n.delimiter&&!t.Type.isStringFilled(n.text)&&!t.Type.isStringFilled(n.html)&&!t.Type.isElementNode(n.html)||n.id&&this.getMenuItem(n.id)!==null){return null}if(t.Type.isNumber(this.params.menuShowDelay)){const e=n;e.menuShowDelay=this.params.menuShowDelay}const s=new Z(n);s.setMenuWindow(this);const o=this.getMenuItemPosition(i);if(o>=0){this.menuItems.splice(o,0,s)}else{this.menuItems.push(s)}return s}},{key:"removeMenuItem",value:function e(t,n){const i=n??{destroyEmptyPopup:true};const s=this.getMenuItem(t);if(!s){return}for(let e=0;e<this.menuItems.length;e++){if(this.menuItems[e]===s){s.destroySubMenu();this.menuItems.splice(e,1);break}}if(this.menuItems.length===0){const e=s.getMenuWindow();if(e){const t=e.getParentMenuItem();if(t){t.destroySubMenu()}else if(i.destroyEmptyPopup){e.destroy()}}}s.removeLayout()}},{key:"getMenuItem",value:function e(t){for(let e=0;e<this.menuItems.length;e++){if(this.menuItems[e].getId()&&this.menuItems[e].getId()===t){return this.menuItems[e]}}return null}},{key:"getMenuItems",value:function e(){return this.menuItems}},{key:"getMenuItemPosition",value:function e(t){if(t){for(let e=0;e<this.menuItems.length;e++){if(this.menuItems[e].getId()&&this.menuItems[e].getId()===t){return e}}}return-1}},{key:"getMenuContainer",value:function e(){return this.getPopupWindow().getPopupContainer()}},{key:"getFocusedItem",value:function e(){return ie(le,this)}},{key:"clearFocus",value:function e(){if(ie(le,this)){ie(le,this).blur();se(le,this,null)}}}])}(a.EventEmitter);function ce(){const e=[];for(let t=0;t<this.menuItems.length;t++){const n=this.menuItems[t];const i=n.getLayout();e.push(i.item)}const n={closeByEsc:true,angle:false,autoHide:true,offsetTop:1,offsetLeft:0,animation:"fading"};const i=Object.assign(n,this.params);i.noAllPaddings=true;i.darkMode=false;i.autoHideHandler=oe(he,this,ye).bind(this);i.role="menu";if(t.Type.isNil(i.focusTrap)&&E.shouldUseFocusTrapByDefault()){i.focusTrap={initialFocus:"container"}}this.layout.itemsContainer=t.Tag.render`
39			<div class="menu-popup-items" role="presentation">${e}</div>
40		`;this.layout.menuContainer=t.Tag.render`
41			<div class="menu-popup" role="presentation">${this.layout.itemsContainer}</div>
42		`;this.itemsContainer=this.layout.itemsContainer;i.content=this.layout.menuContainer;i.events={onBeforeShow:oe(he,this,de).bind(this),onShow:oe(he,this,fe).bind(this),onAfterShow:oe(he,this,me).bind(this),onClose:oe(he,this,ge).bind(this),onDestroy:oe(he,this,be).bind(this)};
42const s=i.compatibleMode===false?this.getId():`menu-popup-${this.getId()}`;const o=new E(s,this.bindElement,i);if(this.params&&this.params.events){o.subscribeFromOptions(this.params.events)}return o}function de(){this.emit("onBeforeShow");se(re,this,true)}function fe(){this.emit("onShow")}function me(){this.emit("onAfterShow");se(re,this,false)}function ge(){this.emit("onClose");for(let e=0;e<this.menuItems.length;e++){const t=this.menuItems[e];t.blur();t.closeSubMenu()}}function be(){this.emit("onDestroy");for(let e=0;e<this.menuItems.length;e++){const t=this.menuItems[e];t.blur();t.destroySubMenu()}}function ye(e){return!this.containsTarget(e.target)}function ve(e){const{item:t}=e.getData();if(ie(le,this)===t){return}this.clearFocus();se(le,this,t)}function Ce(){this.clearFocus()}class we{static Data={};static currentItem=null;constructor(){throw new Error("You cannot make an instance of MenuManager.")}static show(e,t,n,i){if(this.currentItem!==null){this.currentItem.getPopupWindow().close()}this.currentItem=this.create(e,t,n,i);this.currentItem.getPopupWindow().show()}static create(e,t,n,i){const s=this.resolveMenuId(e,t,n,i);if(!this.Data[s]){const o=new pe(e,t,n,i);o.getPopupWindow().subscribe("onDestroy",(()=>{we.destroy(s)}));this.Data[s]=o}return this.Data[s]}static resolveMenuId(e,n,i,s){if(t.Type.isPlainObject(e)&&!n&&!i&&!s){if(!t.Type.isStringFilled(e.id)){throw new Error('BX.Main.Menu.create: "id" parameter is required.')}return e.id}return e}static getCurrentMenu(){return this.currentItem}static getMenuById(e){return this.Data[e]||null}static getMenus(){return Object.values(this.Data)}static onPopupDestroy(e){this.destroy(e.getId())}static destroy(e){const t=this.getMenuById(e);if(t){if(this.currentItem===t){this.currentItem=null}delete this.Data[e];t.getPopupWindow().destroy()}}}class Pe{static _popups=[];static _currentPopup=null;constructor(){throw new Error("You cannot make an instance of PopupManager.")}static create(e,n,i){if(t.Type.isPlainObject(e)&&!n&&!i){if(!t.Type.isStringFilled(e.id)){throw new Error('BX.Main.Popup.Manager: "id" parameter is required.')}return this.getPopupById(e.id)??Pe.#O(new E(e))}const s=t.Type.isString(e)?e:null;const o=s===null?null:this.getPopupById(s);return o??Pe.#O(new E(s,n,i))}static#O(e){e.subscribe("onShow",Pe.#H);e.subscribe("onClose",Pe.#W);return e}static handleOnAfterInit=e=>{e.getTarget().subscribeOnce("onDestroy",this.#F);this._popups.forEach((t=>{if(t.getId()===e.getTarget().getId()){console.error(`Duplicate id (${t.getId()}) for the BX.Main.Popup instance.`)}}));this._popups.push(e.getTarget())};static#F=e=>{const t=e.getTarget();this._popups=this._popups.filter((e=>e!==t));if(this._currentPopup===t){this._currentPopup=null}};static#H=e=>{if(this._currentPopup!==null){this._currentPopup.close()}this._currentPopup=e.getTarget()};static#W=()=>{this._currentPopup=null};static getCurrentPopup(){return this._currentPopup}static isPopupExists(e){return this.getPopupById(e)!==null}static isAnyPopupShown(){for(let e=0,t=this._popups.length;e<t;e++){if(this._popups[e].isShown()){return true}}return false}static isAnyPopupBlockingBackgroundEscShown(){for(let e=0,t=this._popups.length;e<t;e++){if(this._popups[e].isShown()&&this._popups[e].shouldBlockBackgroundEsc()){return true}}return false}static getPopupById(e){for(let t=0;t<this._popups.length;t++){if(this._popups[t].getId()===e){return this._popups[t]}}return null}static getMaxZIndex(){let e=0;this.getPopups().forEach((t=>{e=Math.max(e,t.getZindex())}));return e}static getPopups(){return this._popups}}a.EventEmitter.subscribe("BX.Main.Popup:onAfterInit",Pe.handleOnAfterInit);class Me extends p{constructor(e){super(e);const n=this.className.length>0?` ${this.className}`:"";this.buttonNode=t.Dom.create("button",{props:{className:`popup-window-button popup-window-button-link${n}`,id:this.id},attrs:{tabindex:"0",type:"button"},text:this.text,events:this.contextEvents})}}class Te extends p{constructor(e){super(e);this.buttonNode=t.Dom.create("span",{props:{className:this.className.length>0?this.className:"",id:this.id},events:this.contextEvents,text:this.text})}}class ke{id;handler;values;pInput;bValues;defaultValue;openTitle;className;noMRclassName;emptyClassName;curInd;bShowed;oPopup;oEC;constructor(e){this.id=e.id||`bx-inp-popup-${Math.round(Math.random()*1e6)}`;this.handler=e.handler||false;this.values=e.values||false;this.pInput=e.input;this.bValues=Boolean(this.values);this.defaultValue=e.defaultValue||"";this.openTitle=e.openTitle||"";this.className=e.className||"";this.noMRclassName=e.noMRclassName||"ec-no-rm";this.emptyClassName=e.noMRclassName||"ec-label";this.curInd=false;if(this.bValues){const e=e=>{if(this.pInput.value===this.defaultValue){this.pInput.value="";this.pInput.className=this.className}this.ShowPopup();return e.preventDefault()};this.pInput.onfocus=e;this.pInput.onclick=e;this.pInput.onblur=()=>{if(this.bShowed){setTimeout((()=>{this.ClosePopup(true)}),200)}this.OnChange()}}else{this.pInput.className=this.noMRclassName;this.pInput.onblur=this.OnChange.bind(this)}}getValues(){return this.values===false?[]:this.values}ShowPopup(){if(this.bShowed){return}if(!this.oPopup){const e=e=>{this.pInput.value=this.getValues()[e].NAME;this.curInd=e;this.OnChange();this.ClosePopup(true)};const n=t.Dom.create("DIV",{props:{className:`bxecpl-loc-popup ${this.className}`}});const i=this.getValues();for(let s=0,o=i.length;s<o;s++){const o=i[s];const a=t.Dom.create("DIV",{props:{id:`bxecmr_${s}`},text:o.NAME,events:{mouseover(){t.Dom.addClass(this,"bxecplloc-over")},mouseout(){t.Dom.removeClass(this,"bxecplloc-over")},click(){const t=this.id.slice("bxecmr_".length);e(t)}}});t.Dom.append(a,n);if(o.DESCRIPTION){a.title=o.DESCRIPTION}if(o.CLASS_NAME){t.Dom.addClass(a,o.CLASS_NAME)}if(o.URL){const e=t.Dom.create("a",{props:{href:o.URL,className:"bxecplloc-view",target:"_blank",title:this.openTitle}});t.Dom.append(e,a)}}this.oPopup=new E(this.id,this.pInput,{autoHide:true,offsetTop:1,offsetLeft:0,closeByEsc:true,content:n,events:{onClose:this.ClosePopup.bind(this)}})}this.oPopup.show();this.pInput.select();this.bShowed=true;
42a.EventEmitter.emit(this,"onInputPopupShow",new a.BaseEvent({compatData:[this]}))}ClosePopup(e){this.bShowed=false;if(this.pInput.value===""){this.OnChange()}a.EventEmitter.emit(this,"onInputPopupClose",new a.BaseEvent({compatData:[this]}));if(e===true){this.oPopup.close()}}OnChange(){let e=this.pInput.value;if(this.bValues){if(this.pInput.value===""||this.pInput.value===this.defaultValue){this.pInput.value=this.defaultValue;this.pInput.className=this.emptyClassName;e=""}else{this.pInput.className=""}}if(Number.isNaN(Number.parseInt(this.curInd,10))||this.curInd!==false&&e!==this.getValues()[this.curInd].NAME){this.curInd=false}else{this.curInd=Number.parseInt(this.curInd,10)}a.EventEmitter.emit(this,"onInputPopupChanged",new a.BaseEvent({compatData:[this,this.curInd,e]}));if(this.handler&&t.Type.isFunction(this.handler)){this.handler({ind:this.curInd,value:e})}}Set(e,t,n){this.curInd=e;if(this.curInd===false){this.pInput.value=t}else{this.pInput.value=this.getValues()[this.curInd].NAME}if(n!==false){this.OnChange()}}Get(e){let n=false;const i=t.Type.isUndefined(e)?this.curInd:e;const s=i===false?undefined:this.getValues()[i];if(s){n=s.ID}return n}GetIndex(e){const n=this.getValues();for(let i=0,s=n.length;i<s;i++){const s=n[i].ID;const o=t.Type.isNumber(s)||t.Type.isNumber(e)?Number(s)===Number(e):s===e;if(o){return i}}return false}Deactivate(e){if(this.pInput.value===""||this.pInput.value===this.defaultValue){if(e){this.pInput.value="";this.pInput.className=this.noMRclassName}else if(this.oEC.bUseMR){this.pInput.value=this.defaultValue;this.pInput.className=this.emptyClassName}}this.pInput.disabled=e}}class Se extends Z{}class Ie extends pe{}class De extends E{}class Ee extends p{}class Be extends Me{}class xe extends Te{}const Ne=t.Reflection.namespace("BX");Ne.PopupWindow=E;Ne.PopupWindowManager=Pe;Ne.PopupMenuWindow=pe;Ne.PopupMenu=we;Ne.PopupMenuItem=Z;Ne.PopupWindowButton=p;Ne.PopupWindowButtonLink=Me;Ne.PopupWindowCustomButton=Te;window.BXInputPopup=ke;e.CloseIconSize=h;e.Menu=pe;e.MenuItem=Z;e.MenuManager=we;e.Popup=E;e.PopupManager=Pe;e.PopupMenu=we;e.PopupMenuItem=Se;e.PopupMenuWindow=Ie;e.PopupWindow=De;e.PopupWindowButton=Ee;e.PopupWindowButtonLink=Be;e.PopupWindowCustomButton=xe;e.PopupWindowManager=Pe})(this.BX.Main=this.BX.Main||{},BX,window,window,BX,window,BX.Event,BX.UI.Accessibility,BX);
43//# sourceMappingURL=main.popup.bundle.map.js

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.