(function(){"use strict";BX.namespace("BX.SidePanel");BX.SidePanel.Slider=function(t,e){e=BX.type.isPlainObject(e)?e:{};this.options=e;this.contentCallback=BX.type.isFunction(e.contentCallback)?e.contentCallback:null;this.contentCallbackInvoved=false;this.contentClassName=BX.type.isNotEmptyString(e.contentClassName)?e.contentClassName:null;this.url=this.contentCallback?t:this.refineUrl(t);this.offset=null;this.hideControls=e.hideControls===true;this.width=BX.type.isNumber(e.width)?e.width:null;this.cacheable=e.cacheable!==false;this.autoFocus=e.autoFocus!==false;this.printable=e.printable===true;this.allowChangeHistory=e.allowChangeHistory!==false;this.allowChangeTitle=BX.type.isBoolean(e.allowChangeTitle)?e.allowChangeTitle:null;this.data=new BX.SidePanel.Dictionary(BX.type.isPlainObject(e.data)?e.data:{});this.customLeftBoundary=null;this.customRightBoundary=null;this.setCustomLeftBoundary(e.customLeftBoundary);this.setCustomRightBoundary(e.customRightBoundary);this.title=null;this.setTitle(e.title);this.iframe=null;this.iframeSrc=null;this.iframeId=null;this.requestMethod=BX.type.isNotEmptyString(e.requestMethod)&&e.requestMethod.toLowerCase()==="post"?"post":"get";this.requestParams=BX.type.isPlainObject(e.requestParams)?e.requestParams:{};this.opened=false;this.hidden=false;this.destroyed=false;this.loaded=false;this.handleFrameKeyDown=this.handleFrameKeyDown.bind(this);this.handleFrameFocus=this.handleFrameFocus.bind(this);this.handlePopupInit=this.handlePopupInit.bind(this);this.layout={overlay:null,container:null,loader:null,content:null,closeBtn:null,printBtn:null};this.cache=new BX.Cache.MemoryCache;this.loader=BX.type.isNotEmptyString(e.loader)||BX.type.isElementNode(e.loader)?e.loader:BX.type.isNotEmptyString(e.typeLoader)?e.typeLoader:"default-loader";this.animation=null;this.animationDuration=BX.type.isNumber(e.animationDuration)?e.animationDuration:200;this.startParams={translateX:100,opacity:0};this.endParams={translateX:0,opacity:40};this.currentParams=null;this.overlayAnimation=false;this.label=new BX.SidePanel.Label(this,{iconClass:"side-panel-label-icon-close",iconTitle:BX.Loc.getMessage("MAIN_SIDEPANEL_CLOSE"),onclick:function(t,e){e.close()}});var i=BX.type.isPlainObject(e.label)?e.label:{};this.label.setText(i.text);this.label.setColor(i.color);this.label.setBgColor(i.bgColor,i.opacity);this.newWindowLabel=null;this.copyLinkLabel=null;if(!this.isSelfContained()){if(e.newWindowLabel===true){this.newWindowLabel=new BX.SidePanel.Label(this,{iconClass:"side-panel-label-icon-new-window",iconTitle:BX.Loc.getMessage("MAIN_SIDEPANEL_NEW_WINDOW"),bgColor:["#d9dcdf",100],onclick:function(t,e){Object.assign(document.createElement("a"),{target:"_blank",href:e.getUrl()}).click()}})}if(e.copyLinkLabel===true){this.copyLinkLabel=new BX.SidePanel.Label(this,{iconClass:"side-panel-label-icon-copy-link",iconTitle:BX.Loc.getMessage("MAIN_SIDEPANEL_COPY_LINK"),bgColor:["#d9dcdf",100]});BX.clipboard.bindCopyClick(this.copyLinkLabel.getIconBox(),{text:function(){var t=document.createElement("a");t.href=this.getUrl();return t.href}.bind(this)})}}if(this.url.indexOf("crm.activity.planner/slider.php")!==-1&&e.events&&BX.type.isFunction(e.events.onOpen)&&e.events.compatibleEvents!==false){var n=e.events.onOpen;delete e.events.onOpen;e.events.onLoad=function(t){n(t.getSlider())}}if(e.events){for(var s in e.events){if(BX.type.isFunction(e.events[s])){BX.addCustomEvent(this,BX.SidePanel.Slider.getEventFullName(s),e.events[s])}}}};BX.SidePanel.Slider.getEventFullName=function(t){return"SidePanel.Slider:"+t};BX.SidePanel.Slider.prototype={open:function(){if(this.isOpen()){return false}if(!this.canOpen()){return false}if(this.isDestroyed()){return false}this.createLayout();BX.addClass(this.getOverlay(),"side-panel-overlay-open side-panel-overlay-opening");this.adjustLayout();BX.ZIndexManager.bringToFront(this.getOverlay());this.opened=true;this.fireEvent("onOpenStart");this.animateOpening();return true},close:function(t,e){if(!this.isOpen()){return false}if(!this.canClose()){return false}this.fireEvent("onCloseStart");this.opened=false;if(this.isDestroyed()){return false}if(this.animation){this.animation.stop()}if(t===true||BX.browser.IsMobile()){this.currentParams=this.startParams;this.completeAnimation(e)}else{this.animation=new BX.easing({duration:this.animationDuration,start:this.currentParams,finish:this.startParams,transition:BX.easing.transitions.linear,step:BX.delegate((function(t){this.currentParams=t;this.animateStep(t)}),this),complete:BX.delegate((function(){this.completeAnimation(e)}),this)});this.animation.animate()}return true},getUrl:function(){return this.url},focus:function(){this.getWindow().focus()},isOpen:function(){return this.opened},setZindex:function(t){},getZindex:function(){var t=BX.ZIndexManager.getComponent(this.getOverlay());return t.getZIndex()},setOffset:function(t){if(BX.type.isNumber(t)||t===null){this.offset=t}},getOffset:function(){return this.offset},setWidth:function(t){if(BX.type.isNumber(t)){this.width=t}},getWidth:function(){return this.width},setTitle:function(t){if(BX.type.isNotEmptyString(t)){this.title=t}},getTitle:function(){return this.title},getData:function(){return this.data},isSelfContained:function(){return this.contentCallback!==null},isPostMethod:function(){return this.requestMethod==="post"},getRequestParams:function(){return this.requestParams},getFrameId:function(){if(this.iframeId===null){this.iframeId="iframe_"+BX.util.getRandomString(10).toLowerCase()}return this.iframeId},getWindow:function(){return this.iframe?this.iframe.contentWindow:window},getFrameWindow:function(){return this.iframe?this.iframe.contentWindow:null},isHidden:function(){return this.hidden},isCacheable:function(){return this.cacheable},isFocusable:function(){return this.autoFocus},isPrintable:function(){return this.printable},isDestroyed:function(){return this.destroyed},isLoaded:function(){return this.loaded},canChangeHistory:function(){return this.allowChangeHistory&&!this.isSelfContained()&&!this.getUrl().match(/^\/bitrix\/(components|tools)\//i)},canChangeTitle:function(){if(this.allowChangeTitle===null){if(this.getTitle()!==null){return true}return this.canChangeHistory()}return this.allowChangeTitle},setCacheable:function(t){this.cacheable=t!==false},setAutoFocus:function(t){this.autoFocus=t!==false},setPrintable:function(t){this.printable=t!==false;this.printable?this.showPrintBtn():this.hidePrintBtn()},getLoader:function(){return this.loader},showLoader:function(){var t=this.getLoader();if(!this.layout.loader){this.createLoader(t)}this.layout.loader.style.opacity=1;this.layout.loader.style.display="block"},closeLoader:function(){if(this.layout.loader){this.layout.loader.style.display="none";this.layout.loader.style.opacity=0}},showCloseBtn:function(){this.getLabel().showIcon()},hideCloseBtn:function(){this.getLabel().hideIcon()},showOrLightenCloseBtn:function(){if(BX.Type.isStringFilled(this.getLabel().getText())){this.getLabel().showIcon()}else{this.getLabel().lightenIcon()}},hideOrDarkenCloseBtn:function(){if(BX.Type.isStringFilled(this.getLabel().getText())){this.getLabel().hideIcon()}else{this.getLabel().darkenIcon()}},showPrintBtn:function(){this.getPrintBtn().classList.add("side-panel-print-visible")},hidePrintBtn:function(){this.getPrintBtn().classList.remove("side-panel-print-visible")},showExtraLabels:function(){this.getExtraLabelsContainer().style.removeProperty("display")},hideExtraLabels:function(){this.getExtraLabelsContainer().style.display="none"},setContentClass:function(t){if(BX.type.isNotEmptyString(t)){this.removeContentClass();this.contentClassName=t;this.getContentContainer().classList.add(t)}},removeContentClass:function(){if(this.contentClassName!==null){this.getContentContainer().classList.remove(this.contentClassName);this.contentClassName=null}},applyHacks:function(){},applyPostHacks:function(){},resetHacks:function(){},resetPostHacks:function(){},getTopBoundary:function(){return 0},calculateLeftBoundary:function(){var t=this.getCustomLeftBoundary();if(t!==null){return t}return this.getLeftBoundary()},getLeftBoundary:function(){var t=BX.browser.IsMobile()?window.innerWidth:document.documentElement.clientWidth;return t<1160?this.getMinLeftBoundary():300},getMinLeftBoundary:function(){return this.hideControls&&this.getCustomLeftBoundary()!==null?0:65},getLeftBoundaryOffset:function(){var t=this.getOffset()!==null?this.getOffset():0;return Math.max(this.calculateLeftBoundary(),this.getMinLeftBoundary())+t},setCustomLeftBoundary:function(t){if(BX.type.isNumber(t)||t===null){this.customLeftBoundary=t}},getCustomLeftBoundary:function(){return this.customLeftBoundary},setCustomRightBoundary:function(t){if(BX.type.isNumber(t)||t===null){this.customRightBoundary=t}},getCustomRightBoundary:function(){return this.customRightBoundary},calculateRightBoundary:function(){const t=this.getCustomRightBoundary();if(t!==null){return-window.pageXOffset+t}return this.getRightBoundary()},getRightBoundary:function(){return-window.pageXOffset},destroy:function(){if(this.isDestroyed()){return}this.firePageEvent("onDestroy");this.fireFrameEvent("onDestroy");var t=this.getFrameWindow();if(t){t.removeEventListener("keydown",this.handleFrameKeyDown);t.removeEventListener("focus",this.handleFrameFocus)}BX.Event.EventEmitter.unsubscribe("BX.Main.Popup:onInit",this.handlePopupInit);BX.ZIndexManager.unregister(this.layout.overlay);BX.remove(this.layout.overlay);this.layout.container=null;this.layout.overlay=null;this.layout.content=null;this.layout.closeBtn=null;this.layout.printBtn=null;this.layout.loader=null;this.iframe=null;this.destroyed=true;if(this.options.events){for(var e in this.options.events){BX.removeCustomEvent(this,BX.SidePanel.Slider.getEventFullName(e),this.options.events[e])}}return true},hide:function(){this.hidden=true;this.getContainer().style.display="none";this.getOverlay().style.display="none"},unhide:function(){this.hidden=false;this.getContainer().style.removeProperty("display");this.getOverlay().style.removeProperty("display")},reload:function(){if(this.isSelfContained()){this.contentCallbackInvoved=false;this.showLoader();this.setContent()}else{this.showLoader();this.getFrameWindow().location.reload()}},adjustLayout:function(){var t=window.pageYOffset||document.documentElement.scrollTop;var e=BX.browser.IsMobile()?window.innerHeight:document.documentElement.clientHeight;var i=this.getTopBoundary();var n=i-t>0;i=n?i:t;var s=n>0?e-i+t:e;var a=this.getLeftBoundaryOffset();var o=this.calculateRightBoundary();this.getOverlay().style.left=window.pageXOffset+"px";this.getOverlay().style.top=i+"px";this.getOverlay().style.right=o+"px";this.getOverlay().style.height=s+"px";this.getContainer().style.width="calc(100% - "+a+"px)";this.getContainer().style.height=s+"px";if(this.getWidth()!==null){this.getContainer().style.maxWidth=this.getWidth()+"px"}this.getLabel().adjustLayout()},createLayout:function(){if(this.layout.overlay!==null&&this.layout.overlay.parentNode){return}if(this.isSelfContained()){this.getContentContainer().style.overflow="auto";document.body.appendChild(this.getOverlay());this.setContent();BX.Event.EventEmitter.subscribe("BX.Main.Popup:onInit",this.handlePopupInit)}else{this.getContentContainer().appendChild(this.getFrame());document.body.appendChild(this.getOverlay());this.setFrameSrc()}BX.ZIndexManager.register(this.getOverlay())},getFrame:function(){if(this.iframe!==null){return this.iframe}this.iframe=BX.create("iframe",{attrs:{src:"about:blank",frameborder:"0"},props:{className:"side-panel-iframe",name:this.getFrameId(),id:this.getFrameId()},events:{load:this.handleFrameLoad.bind(this)}});return this.iframe},getOverlay:function(){if(this.layout.overlay!==null){return this.layout.overlay}this.layout.overlay=BX.create("div",{props:{className:"side-panel side-panel-overlay"},events:{mousedown:this.handleOverlayClick.bind(this)},children:[this.getContainer()]});return this.layout.overlay},unhideOverlay:function(){this.getOverlay().classList.remove("side-panel-overlay-hidden")},hideOverlay:function(){this.getOverlay().classList.add("side-panel-overlay-hidden")},hideShadow:function(){this.getContainer().classList.remove("side-panel-show-shadow")},showShadow:function(){this.getContainer().classList.add("side-panel-show-shadow")},setOverlayAnimation:function(t){if(BX.type.isBoolean(t)){this.overlayAnimation=t}},getOverlayAnimation:function(){return this.overlayAnimation},getContainer:function(){if(this.layout.container!==null){return this.layout.container}this.layout.container=BX.create("div",{props:{className:"side-panel side-panel-container"},children:this.hideControls?[this.getContentContainer()]:[this.getContentContainer(),this.getLabelsContainer(),this.getPrintBtn()]});return this.layout.container},getContentContainer:function(){if(this.layout.content!==null){return this.layout.content}this.layout.content=BX.create("div",{props:{className:"side-panel-content-container"+(this.contentClassName!==null?" "+this.contentClassName:"")}});return this.layout.content},getLabelsContainer:function(){return this.cache.remember("labels-container",function(){return BX.create("div",{props:{className:"side-panel-labels"},children:[this.getLabel().getContainer(),this.getExtraLabelsContainer()]})}.bind(this))},getExtraLabelsContainer:function(){return this.cache.remember("icon-labels",function(){return BX.create("div",{props:{className:"side-panel-extra-labels"},children:[this.newWindowLabel?this.newWindowLabel.getContainer():null,this.copyLinkLabel?this.copyLinkLabel.getContainer():null]})}.bind(this))},getCloseBtn:function(){return this.getLabel().getIconBox()},getLabel:function(){return this.label},getNewWindowLabel:function(){return this.newWindowLabel},getCopyLinkLabel:function(){return this.copyLinkLabel},getPrintBtn:function(){if(this.layout.printBtn!==null){return this.layout.printBtn}this.layout.printBtn=BX.create("span",{props:{className:"side-panel-print",title:BX.message("MAIN_SIDEPANEL_PRINT")},events:{click:this.handlePrintBtnClick.bind(this)}});return this.layout.printBtn},setContent:function(){if(this.contentCallbackInvoved){return}this.contentCallbackInvoved=true;BX.cleanNode(this.getContentContainer());var t=this.contentCallback(this);var e=t&&(Object.prototype.toString.call(t)==="[object Promise]"||t.toString()==="[object BX.Promise]");if(!e){t=Promise.resolve(t)}t.then(function(t){if(this.isDestroyed()){return}if(BX.type.isPlainObject(t)&&BX.type.isNotEmptyString(t.html)){BX.html(this.getContentContainer(),t.html).then(function(){this.removeLoader();this.loaded=true;this.firePageEvent("onLoad")}.bind(this),function(t){this.removeLoader();this.getContentContainer().innerHTML=t}.bind(this))}else{if(BX.type.isDomNode(t)){this.getContentContainer().appendChild(t)}else if(BX.type.isNotEmptyString(t)){this.getContentContainer().innerHTML=t}this.removeLoader();this.loaded=true;this.firePageEvent("onLoad")}}.bind(this),function(t){this.removeLoader();this.getContentContainer().innerHTML=t}.bind(this))},setFrameSrc:function(){if(this.iframeSrc===this.getUrl()){return}var t=BX.util.add_url_param(this.getUrl(),{IFRAME:"Y",IFRAME_TYPE:"SIDE_SLIDER"});if(this.isPostMethod()){var e=document.createElement("form");e.method="POST";e.action=t;e.target=this.getFrameId();e.style.display="none";BX.util.addObjectToForm(this.getRequestParams(),e);document.body.appendChild(e);e.submit();BX.remove(e)}else{this.iframeSrc=this.getUrl();this.iframe.src=t}},createLoader:function(t){BX.remove(this.layout.loader);t=BX.type.isNotEmptyString(t)||BX.type.isElementNode(t)?t:"default-loader";var e=["task-new-loader","task-edit-loader","task-view-loader","crm-entity-details-loader","crm-button-view-loader","crm-webform-view-loader","create-mail-loader","view-mail-loader"];var i=null;if(BX.type.isElementNode(t)){this.layout.loader=this.createHTMLLoader(t)}else if(BX.util.in_array(t,e)&&this.loaderExists(t)){this.layout.loader=this.createOldLoader(t)}else if(t.charAt(0)==="/"){this.layout.loader=this.createSvgLoader(t)}else if(i=t.match(/^([a-z0-9-_.]+):([a-z0-9-_.]+)$/i)){var n=i[1];var s=i[2];var a="/bitrix/images/"+n+"/slider/"+s+".svg";this.layout.loader=this.createSvgLoader(a)}else{t="default-loader";this.layout.loader=this.createDefaultLoader()}this.getContainer().appendChild(this.layout.loader)},createSvgLoader:function(t){return BX.create("div",{props:{className:"side-panel-loader"},children:[BX.create("div",{props:{className:"side-panel-loader-container"},style:{backgroundImage:'url("'+t+'")'}})]})},createDefaultLoader:function(){return BX.create("div",{props:{className:"side-panel-loader"},children:[BX.create("div",{props:{className:"side-panel-default-loader-container"},html:''+""+""})]})},createOldLoader:function(t){if(t==="crm-entity-details-loader"){return BX.create("div",{props:{className:"side-panel-loader "+t},children:[BX.create("img",{attrs:{src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAMAAABhq6zVAAAAA1BMVEX"+"///+nxBvIAAAAAXRSTlMAQObYZgAAAAtJREFUeAFjGMQAAACcAAG25ruvAAAAAElFTkSuQmCC"},props:{className:"side-panel-loader-mask top"}}),BX.create("div",{props:{className:"side-panel-loader-bg left"},children:[BX.create("img",{attrs:{src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAMAAABhq6zVAAAAA1B"+"MVEX///+nxBvIAAAAAXRSTlMAQObYZgAAAAtJREFUeAFjGMQAAACcAAG25ruvAAAAAElFTkSuQmCC"},props:{className:"side-panel-loader-mask left"}})]}),BX.create("div",{props:{className:"side-panel-loader-bg right"},children:[BX.create("img",{attrs:{src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAMAAABhq6zVAAAAA1BM"+"VEX///+nxBvIAAAAAXRSTlMAQObYZgAAAAtJREFUeAFjGMQAAACcAAG25ruvAAAAAElFTkSuQmCC"},props:{className:"side-panel-loader-mask right"}})]})]})}else{return BX.create("div",{props:{className:"side-panel-loader "+t},children:[BX.create("img",{attrs:{src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAMAAABhq6zVAAAAA1BMVEX"+"///+nxBvIAAAAAXRSTlMAQObYZgAAAAtJREFUeAFjGMQAAACcAAG25ruvAAAAAElFTkSuQmCC"},props:{className:"side-panel-loader-mask left"}}),BX.create("img",{attrs:{src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAMAAABhq6zVAAAAA"+"1BMVEX///+nxBvIAAAAAXRSTlMAQObYZgAAAAtJREFUeAFjGMQAAACcAAG25ruvAAAAAElFTkSuQmCC"},props:{className:"side-panel-loader-mask right"}})]})}},createHTMLLoader:function(t){return BX.create("div",{children:[t]})},loaderExists:function(t){if(!BX.type.isNotEmptyString(t)){return false}for(var e=0;e");var s="";var a=document.head.querySelectorAll("link, style");for(var o=0;ohtml, body { background: #fff !important; height: 100%; }";n.write(s);n.write("");n.write(this.getContentContainer().innerHTML);n.write("");n.close();i.focus();i.print();setTimeout((function(){document.body.removeChild(e);window.focus()}),1e3)}else{this.focus();this.getFrameWindow().print()}},injectPrintStyles:function(){var t=this.getFrameWindow().document;var e="";var i=t.body.classList;for(var n=0;n=0&&e<=100?e:95;var s=BX.util.hex2rgb(n);t="rgba("+s.r+","+s.g+","+s.b+","+e/100+")"}this.bgColor=t;this.getContainer().style.backgroundColor=t}else if(t===null){this.bgColor=t;this.getContainer().style.removeProperty("backgroundColor")}},getBgColor:function(){return this.bgColor},setText:function(t){if(BX.type.isNotEmptyString(t)){this.text=t;this.getTextContainer().textContent=t}else if(t===null){this.text=t;this.getTextContainer().textContent=""}},getText:function(){return this.text},setIconClass:function(t){if(BX.Type.isStringFilled(t)){BX.Dom.removeClass(this.getIconContainer(),this.iconClass);this.iconClass=t;BX.Dom.addClass(this.getIconContainer(),this.iconClass)}else if(t===null){BX.Dom.removeClass(this.getIconContainer(),this.iconClass);this.iconClass=t}},getIconClass:function(){return this.iconClass},setIconTitle:function(t){if(BX.Type.isStringFilled(t)||t===null){BX.Dom.attr(this.getIconBox(),"title",t);this.iconTitle=t}},getIconTitle:function(){return this.iconTitle},setOnclick:function(t){if(BX.Type.isFunction(t)||t===null){this.onclick=t}},getOnclick:function(){return this.onclick},getSlider:function(){return this.slider},moveAt:function(t){if(BX.type.isNumber(t)&&t>=0){this.getSlider().getLabelsContainer().style.top=BX.SidePanel.Label.MIN_TOP_OFFSET+t*BX.SidePanel.Label.INTERVAL_TOP_OFFSET+"px"}}}})(); //# sourceMappingURL=slider.map.js