1void 0===window.JThemeSelector&&(window.JThemeSelector=function(id,params,result){var _private={inited:!1,id:id};Object.defineProperties(this,{inited:{get:function(){return _private.inited},set:function(value){value&&(_private.inited=!0)}},id:{get:function(){return _private.id}}}),this.params=function(key){if("object"==typeof params&&void 0!==key&&Object.keys(params).indexOf(key)>-1)return params[key]},this.result=function(key){if("object"==typeof result&&void 0!==key&&Object.keys(result).indexOf(key)>-1)return result[key]},this.init()},window.JThemeSelector.prototype={node:null,get color(){return this.isDefaultColor?"default":BX.hasClass(document.body,"theme-dark")?"dark":"light"},set color(value){if(this.node&&("light"===value||"dark"===value||"default"===value)){let color=value;"default"===value&&(color=this.defaultColor);let item=this.node.querySelector(".theme-selector__item--"+color),changed;if(item&&!BX.hasClass(item,"current")){BX.addClass(item,"current"),this.node.setAttribute("title",BX.message("TS_T_"+color));let items=Array.prototype.slice.call(this.node.querySelectorAll(".theme-selector__item.current:not(.theme-selector__item--"+color+")"));if(items.length)for(let i=0;i<items.length;++i)BX.removeClass(items[i],"current")}if(!BX.hasClass(document.body,"theme-"+value)){BX.removeClass(document.body,"theme-default theme-dark theme-light"),BX.addClass(document.body,"theme-"+value);let items=Array.prototype.slice.call(document.querySelectorAll('.style-switcher [data-option-id="THEME_VIEW_COLOR"]'));if(items.length)for(let i=0;i<items.length;++i){let val=items[i].getAttribute("data-option-value");val&&val.toLowerCase()===value?BX.addClass(items[i],"current"):BX.removeClass(items[i],"current")}let fd=new FormData;fd.set("color",value),this.sendAction("setColor",fd),BX.onCustomEvent("onChangeThemeColor",[{value:value}])}}},get isDefaultColor(){return BX.hasClass(document.body,"theme-default")},get defaultColor(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"},init:function(){this.inited||(this.inited=!0,this.node=BX("theme-selector--"+this.id),this.node&&(this.node.theme_selector=this,this.bindEvents(),this.color=this.color))},bindEvents:function(){this.node&&("function"==typeof this.handlers.onNodeClick&&BX.bind(this.node,"click",BX.proxy(this.handlers.onNodeClick,this)),"function"==typeof this.handlers.onChangePrefersColorScheme&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",BX.proxy(this.handlers.onChangePrefersColorScheme,this)),"function"==typeof this.handlers.onChangeThemeColor&&BX.addCustomEvent("onChangeThemeColor",BX.proxy(this.handlers.onChangeThemeColor,this)))},unbindEvents:function(){this.node&&("function"==typeof this.handlers.onNodeClick&&BX.unbind(this.node,"click",BX.proxy(this.handlers.onNodeClick,this)),"function"==typeof this.handlers.onChangePrefersColorScheme&&window.matchMedia("(prefers-color-scheme: dark)").removeEventListener("change",BX.proxy(this.handlers.onChangePrefersColorScheme,this)),"function"==typeof this.handlers.onChangeThemeColor&&BX.removeCustomEvent("onChangeThemeColor",BX.proxy(this.handlers.onChangeThemeColor,this)))},sendAction:function(componentAction,data,onsuccess,onfailure,oncomplete){let componentName="aspro:theme.selector.lite",promise;data.set("is_ajax_post","Y"),data.set("sessid",BX.message("bitrix_sessid")),data.set("lang",BX.message("LANGUAGE_ID")),data.set("SITE_ID",this.result("SITE_ID")),data.set("SIGNED_PARAMS",this.result("SIGNED_PARAMS")),BX.ajax.runComponentAction(componentName,componentAction,{mode:"ajax",data:data}).then(BX.proxy((function(response){"function"==typeof onsuccess&&onsuccess(response),"function"==typeof oncomplete&&oncomplete()}),this),BX.proxy((function(response){console.error(response);let message="";for(let i=0;i<response.errors.length;++i)"object"==typeof response.errors[i]&&response.errors[i].message.length&&(!message.length||response.errors[i].message.length<message.length)&&(message=response.errors[i].message);"function"==typeof onfailure&&onfailure(message),"function"==typeof oncomplete&&oncomplete()}),this))},handlers:{onNodeClick:function(event){let color=this.isDefaultColor?this.defaultColor:this.color;this.color="light"===color?"dark":"light"},onChangePrefersColorScheme:function(event){this.isDefaultColor&&(event||(event=window.event),this.color="default")},onChangeThemeColor:function(eventdata){"object"==typeof eventdata&&eventdata&&"value"in eventdata&&(this.color=eventdata.value)}}}); 2//# sourceMappingURL=script.min.js.map
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.