"use strict";function geById(e){return document.getElementById(e)}function ge(e){return document.querySelector(e)}function geAll(e){return document.querySelectorAll(e)}function ce(e,s){s=s||{};let n=document.createElement(e);for(let t in s){if("vkh_tooltip"===t){VKH_Tooltip.create(n,s[t][0],s[t][1]);continue}if("[object Object]"===Object.prototype.toString.call(s[t])){for(let e in s[t])n[t][e]=s[t][e];continue}n[t]=s[t]}return n}function each(s,n){if(Array.isArray(s)){for(const[t,i]of s.entries()){let e=n(t,i);if(e===false){break}}return}for(let t in s){let e=n(t,s[t]);if(false===e){break}}}function addClass(e,t){if("string"===typeof e){e=geById(e)}if(!e){return}e.classList.add(t)}function removeClass(e,t){if("string"===typeof e){e=geById(e)}if(!e){return}e.classList.remove(t)}function toggleClass(e,t,s){if("string"===typeof e){e=geById(e)}if(!e){return}e.classList.toggle(t,s)}function hasClass(e,t){if("string"===typeof e){e=geById(e)}if(!e){return}e.classList.contains(e,t)}let my_ext={messages:{isStart:false,list:{},callback_last_id:0,callback_pref:"___12345my_ext_messages_callback_",listener:function(){if(my_ext.messages.isStart)return;my_ext.messages.isStart=true;chrome.runtime.onMessage.addListener(function(e,t,s){if(e.to!="vk"||e.from!="bg")return true;if(!e.type||!my_ext.messages.list[e.type])return;my_ext.messages.list[e.type](e.details)})},on:function(e,t){if(my_ext.messages.list[e]==t)return;my_ext.messages.list[e]=t;my_ext.messages.listener()},off:function(e){if(!my_ext.messages.list[e])return;delete my_ext.messages.list[e]},sendToBG:function(t,s){t.from="vk";t.to="bg";if(undefined!==s){t.clb_type=my_ext.messages.callback_pref+ ++my_ext.messages.callback_last_id+"_"+Math.random();my_ext.messages.list[t.clb_type]=function(e){s(e);if(my_ext.messages.list[t.clb_type]){delete my_ext.messages.list[t.clb_type]}}}chrome.runtime.sendMessage(t)}},mutationObserver:{object:false,list:{},add:function(e,t){if(my_ext.mutationObserver.list[e]&&my_ext.mutationObserver.list[e]==t)return;my_ext.mutationObserver.list[e]=t;t();my_ext.mutationObserver.reload()},remove:function(e){delete my_ext.mutationObserver.list[e];my_ext.mutationObserver.reload()},start:async function(){my_ext.mutationObserver.object=new MutationObserver(function(e){for(let e in my_ext.mutationObserver.list)my_ext.mutationObserver.list[e]()});setTimeout(()=>{my_ext.mutationObserver.object.observe(document.body,{childList:true,subtree:true,characterData:false})},100)},reload:function(){if(my_ext.mutationObserver.object){my_ext.mutationObserver.object.disconnect()}my_ext.mutationObserver.start()}},plugins:{list:{},get:function(e){return my_ext.plugins.list[e]},toggle:function(e,t){t=t===true;toggleClass(document.documentElement,"my_ext_plugin___"+e,t);let s=my_ext.plugins.get(e);if(t===true){if(s.css&&!geById("#my_ext_style___"+e)){document.head.append(ce("style",{id:"my_ext_style___"+e,innerText:s.css()}))}if(s.vk&&s.vk.messages){each(s.vk.messages,function(e,t){my_ext.messages.on(e,t)})}if(s.vk&&s.vk.on)s.vk.on();return}if(s.vk&&s.vk.messages){each(s.vk.messages,function(e,t){my_ext.messages.off(e,t)})}if(s.vk&&s.vk.off)s.vk.off()}}};my_ext.messages.listener();document.addEventListener("DOMContentLoaded",function(){let e=null;e=document.createElement("script");e.src=chrome.runtime.getURL("source/lib/fontawesome/brands.js");e["async"]=false;document.head.appendChild(e);e=document.createElement("script");e.src=chrome.runtime.getURL("source/lib/fontawesome/fontawesome.js");e["async"]=false;document.head.appendChild(e);e=document.createElement("script");e.src=chrome.runtime.getURL("source/lib/fontawesome/regular.js");e["async"]=false;document.head.appendChild(e);e=document.createElement("script");e.src=chrome.runtime.getURL("source/lib/fontawesome/solid.js");e["async"]=false;document.head.appendChild(e);e=document.createElement("script");e.src=chrome.runtime.getURL("source/vk-broadcast.js");e["async"]=false;e.onload=()=>{my_ext.messages.sendToBG({type:"my_ext_get_data",details:{response_data:["plugins_storage"]}},function(s){each(my_ext_plugins_list,function(e,t){if(my_ext.plugins.list[e]){console.error("Плагин "+e+" уже подключен");return}my_ext.plugins.list[e]=t;my_ext.plugins.toggle(e,s.plugins_storage[e]&&s.plugins_storage[e].enabled||false)});my_ext_plugins_list=null})};document.head.appendChild(e)});