if(void 0===window.JNotice){let e='\n \n \n ',t='\n \n \n \n \n \n \n ';window.JNoticeSurface=function(e){var t={inited:!1};Object.defineProperties(this,{inited:{get:function(){return t.inited},set:function(e){e&&(t.inited=!0)}}}),this.config=function(t){if("object"==typeof e&&void 0!==t&&Object.keys(e).indexOf(t)>-1)return e[t]},this.init()},window.JNoticeSurface.prototype={node:null,inner:null,notices:[],bUseJquery:!1,get side(){return"left"===this.config("side")?"left":"right"},get reverse(){return Boolean(this.config("reverse"))},get classname(){return"notice-surface--"+this.side+(this.reverse?" notice-surface--reverse":"")},init:function(){this.inited||(this.inited=!0,this.node=BX.create({tag:"div",attrs:{class:"notice-surface "+this.classname},html:'
'}),this.node.noticeSurface=this,this.inner=this.node.querySelector(".notice-surface__inner"),this.bUseJquery="function"==typeof jQuery,BX.ready(BX.delegate((function(){BX.append(this.node,document.body)}),this)))},search:function(e){if(void 0!==e&&e instanceof window.JNotice)for(var t in this.notices)if(this.notices[t]===e)return t;return!1},create:function(e){var t=new JNotice(e);return t.appendTo(this),t},append:function(e){if(void 0!==e&&e instanceof window.JNotice){if(e.removed||e.inserted&&e.surface!==this)return!1;var t=this.search(e);return t||(this.notices.push(e),t=this.notices.length-1,BX.prepend(e.node,this.inner)),e.inserted||e.appendTo(this),t}return!1},remove:function(e){if(void 0!==e&&void 0!==this.notices[e]){var t=this.notices[e];delete this.notices[e],this.notices.splice(e,1),BX.remove(t.node),t.remove()}},clear:function(){for(i in this.notices)void 0!==this.notices[i]&&this.notices[i].remove();this.notices=[]},getItemName:function(e){let t=e.item,i="",n=t.querySelector(".js-popup-title");if(n&&(i=n.textContent),!1!==e.useDataItem){var o=t.querySelector("[data-item]");if(o&&(o=this.bUseJquery?jQuery(o).data("item"):BX.data(o,"item"))){if(!this.bUseJquery)try{"object"==typeof(o=JSON.parse(o.toString()))&&o||(o={})}catch(e){o={}}o&&(i=o.NAME)}}return i},getItemImg:function(e){let t=e.item,i="";if(image=t.querySelector("meta[itemprop=image]"))i=image.getAttribute("content");else if(image=t.querySelector(".image-list__link link[itemprop=image]"))i=image.getAttribute("href");else if(image=t.querySelector(".image-list-wrapper img")){i=image.getAttribute("src");let e=this.bUseJquery?jQuery(image).data("src"):BX.data(image,"src");e&&!BX.hasClass(image,"lazyloaded")&&(i=e)}else if(image=t.querySelector(".detail-info__image")){let e=this.bUseJquery?jQuery(image).data("src"):BX.data(image,"src");e&&(i=e)}return i},getMoreContent:function(e){let t="";if(e.length>1){var i=e.length-1,n=[BX.message("NOTICE_PRODUCT1"),BX.message("NOTICE_PRODUCT2"),BX.message("NOTICE_PRODUCT0")];t='
'+BX.message("NOTICE_MORE").replace("#COUNT#",i).replace("#PRODUCTS#",n[i%100>4&&i%100<20?2:[2,0,1,1,1,2][Math.min(i%10,5)]])+"
"}return t},onRequestError:function(t){var i={title:BX.message("NOTICE_REQUEST_ERROR"),detail:t.status+" "+t.statusText,image:e};return this.create({closeable:!0,autoclose:3e3,type:"requesterror",content:i})},onResultError:function(t){var i={title:BX.message("NOTICE_ERROR"),detail:t.error,image:e};return this.create({closeable:!0,autoclose:3e3,type:"resulterror",content:i})},onAuth:function(e){if("object"==typeof e&&e&&BX.message("USER_ID")){var i={title:e.register?BX.message("NOTICE_REGISTERED"):BX.message("NOTICE_AUTHORIZED"),detail:e.login?e.login:e.fullname,image:e.image?e.image:t};return this.create({closeable:!0,autoclose:3e3,type:"auth",content:i,link:arAsproOptions.THEME.PERSONAL_PAGE_URL})}},onAdd2cart:function(e){if("object"==typeof e&&e.length)for(i in e){var t=e[i];if(t instanceof Node&&(t=t.closest(".js-popup-block"))){var n={title:BX.message("NOTICE_ADDED2CART"),detail:this.getItemName({item:t}),image:this.getItemImg({item:t})};return n.detail+=this.getMoreContent(e),this.create({closeable:!0,autoclose:3e3,type:"add2cart",link:arAsproOptions.THEME.BASKET_PAGE_URL,content:n})}}},onAdd2Compare:function(e){if("object"==typeof e&&e.length)for(i in e){var t=e[i];if(t instanceof Node&&(t=t.closest(".js-popup-block"))){var n={title:BX.message("NOTICE_ADDED2COMPARE"),detail:this.getItemName({item:t,useDataItem:!1}),image:this.getItemImg({item:t,useDataItem:!1})};return n.detail+=this.getMoreContent(e),this.create({closeable:!0,autoclose:3e3,type:"add2compare",link:arAsproOptions.THEME.COMPARE_PAGE_URL,content:n})}}}},window.JNoticeSurface.get=function(e){var t=".notice-surface.notice-surface--"+("left"===(e="object"==typeof e?e:{}).side?"left":"right")+(Boolean(e.reverse)?".notice-surface--reverse":":not(.notice-surface--reverse)"),i=document.querySelector(t);return i=i?i.noticeSurface:new window.JNoticeSurface(e)},window.JNotice=function(e){var t={surface:!1,inited:!1,removed:!1};Object.defineProperties(this,{surface:{get:function(){return t.surface},set:function(e){void 0!==e&&e instanceof window.JNoticeSurface&&!this.inserted&&!this.removed&&(t.surface=e,e.append(this),this.show(),BX.onCustomEvent("onAppendNotice",{notice:this}))}},inserted:{get:function(){return t.surface instanceof window.JNoticeSurface}},inited:{get:function(){return t.inited},set:function(e){e&&(t.inited=!0)}},removed:{get:function(){return t.removed},set:function(e){e&&(t.removed=!0)}}}),this.config=function(t){if("object"==typeof e&&void 0!==t&&Object.keys(e).indexOf(t)>-1)return e[t]},this.init()},window.JNotice.prototype={node:null,inner:null,closer:null,handlers:{onClickNode:function(e){e||(e=window.event);var t=e.target||e.srcElement;if(void 0!==t&&t&&!t.closest("a")&&!t.closest(".notice__closer")){BX.PreventDefault(e);var i=t.closest(".notice");i&&(i=i.notice).link.length&&(location.href=i.link)}},onMouseEnterNode:function(e){e||(e=window.event);var t=e.target||e.srcElement;if(void 0!==t&&t){var i=t.closest(".notice");i&&(i=i.notice).autoclose&&(i.closed||i.stopAutoClose())}},onMouseLeaveNode:function(e){e||(e=window.event);var t=e.target||e.srcElement;if(void 0!==t&&t){var i=t.closest(".notice");i&&(i=i.notice,BX.removeClass(i.node,"animate--notice-click"),i.closed||i.startAutoClose())}},onMouseDownNode:function(e){e||(e=window.event);var t=e.target||e.srcElement;if(void 0!==t&&t){var i=t.closest(".notice");i&&(i=i.notice,BX.addClass(i.node,"animate--notice-click"))}},onMouseUpNode:function(e){e||(e=window.event);var t=e.target||e.srcElement;if(void 0!==t&&t){var i=t.closest(".notice");i&&(i=i.notice,BX.removeClass(i.node,"animate--notice-click"))}},onClickCloser:function(e){e||(e=window.event);var t=e.target||e.srcElement;if(void 0!==t&&t){for(var i=null,n=t;n;){if(n.matches(".notice")){i=n;break}n=n.parentElement||n.parentNode}i&&(i=i.notice,BX.addClass(i.node,"notice--closed"),i.remove())}}},get visible(){return!BX.hasClass(this.node,"notice--hidden")&&this.inserted},get closed(){return BX.hasClass(this.node,"notice--closed")},get closeable(){return Boolean(this.config("closeable"))},get autoclose(){var e=parseInt(this.config("autoclose"));return e||0},get classname(){var e=this.config("classname");return"string"==typeof e?e:""},get type(){var e=this.config("type");return"string"==typeof e?e:""},get link(){var e=this.config("link");return"string"==typeof e?e:""},get content(){var e=this.config("content");if("function"==typeof e&&(e=e()),"object"==typeof e){var t=void 0!==e.title&&e.title?"function"==typeof e.title?e.title():e.title.toString():"",i=void 0!==e.detail&&e.detail?"function"==typeof e.detail?e.detail():e.detail.toString():"",n=void 0!==e.image&&e.image?"function"==typeof e.image?e.image():e.image.toString():"",o=void 0!==e.image_link&&e.image_link?"function"==typeof e.image_link?e.image_link():e.image_link.toString():"",s=n.match(/^]/);(t.length||i.length||n.length)&&(e='
',n&&(e+='"),(t||i)&&(e+='
',t&&(e+='
'+t+"
"),i&&(e+='
'+i+"
"),e+="
"),e+="
")}return void 0===e?"":e.toString()},init:function(){if(!this.inited){this.inited=!0;var e=this.closeable?'':"";this.node=BX.create({tag:"div",attrs:{class:"notice notice--hidden"+(this.classname.length?" "+this.classname:"")+(this.link.length?" notice--link":"")},dataset:{type:this.type},html:e+'
'+this.content+"
"}),this.node.notice=this,this.inner=this.node.querySelector(".notice__inner"),this.closeable&&(this.closer=this.node.querySelector(".notice__closer")),this.bindEvents(),BX.onCustomEvent("onInitNotice",{notice:this})}},bindEvents:function(){this.node&&("function"==typeof this.handlers.onClickNode&&this.node.addEventListener("click",this.handlers.onClickNode),"function"==typeof this.handlers.onMouseEnterNode&&this.node.addEventListener("mouseenter",this.handlers.onMouseEnterNode),"function"==typeof this.handlers.onMouseLeaveNode&&this.node.addEventListener("mouseleave",this.handlers.onMouseLeaveNode),"function"==typeof this.handlers.onMouseEnterNode&&this.node.addEventListener("mousedown",this.handlers.onMouseDownNode),"function"==typeof this.handlers.onMouseLeaveNode&&this.node.addEventListener("mouseup",this.handlers.onMouseUpNode)),this.closeable&&this.closer&&"function"==typeof this.handlers.onClickCloser&&this.closer.addEventListener("click",this.handlers.onClickCloser)},unbindEvents:function(){this.node&&("function"==typeof this.handlers.onClickNode&&this.node.removeEventListener("click",this.handlers.onClickNode),"function"==typeof this.handlers.onMouseEnterNode&&this.node.removeEventListener("mouseenter",this.handlers.onMouseEnterNode),"function"==typeof this.handlers.onMouseLeaveNode&&this.node.removeEventListener("mouseleave",this.handlers.onMouseLeaveNode),"function"==typeof this.handlers.onMouseEnterNode&&this.node.removeEventListener("mousedown",this.handlers.onMouseDownNode),"function"==typeof this.handlers.onMouseLeaveNode&&this.node.removeEventListener("mouseup",this.handlers.onMouseUpNode)),this.closer&&"function"==typeof this.handlers.onClickCloser&&this.closer.removeEventListener("click",this.handlers.onClickCloser)},callback:function(e){"function"==typeof e&&e()},appendTo:function(e){this.surface=e},show:function(e){this.visible?this.callback(e):(BX.addClass(this.node,"animate--notice-show"),BX.removeClass(this.node,"notice--hidden"),setTimeout(BX.delegate((function(){BX.removeClass(this.node,"animate--notice-show"),this.startAutoClose(),this.callback(e)}),this),600),BX.onCustomEvent("onShowNotice",{notice:this}))},hide:function(e){if(this.visible){var t=this;setTimeout((function(){t.node.style.height=t.node.getBoundingClientRect().height+"px",t.node.style.opacity=1,setTimeout((function(){BX.addClass(t.node,"animate--notice-hide"),setTimeout((function(){BX.addClass(t.node,"notice--hidden"),BX.removeClass(t.node,"animate--notice-hide"),t.callback(e)}),700)}),25),BX.onCustomEvent("onHideNotice",{notice:t})}),100)}else this.callback(e)},remove:function(){this.removed||(this.removed=!0,this.hide(BX.delegate((function(){this.unbindEvents(),this.inserted&&this.surface.remove(this.surface.search(this)),BX.onCustomEvent("onRemoveNotice",{notice:this})}),this)))},startAutoClose:function(){this.stopAutoClose(),this.autoclose&&(this.autocloseTimer=setTimeout(BX.delegate((function(){this.remove()}),this),this.autoclose))},stopAutoClose:function(){void 0!==this.autocloseTimer&&this.autocloseTimer&&(clearTimeout(this.autocloseTimer),this.autocloseTimer=!1)}}}