(()=>{"use strict";const t="wendaokj";location.href.match("youtube.com"),location.href.match("translate.google.com")&&function(){const t=history.pushState;history.pushState=function(e,o,n){let a=n.match(/tl=([a-z-]+)/);return a&&a[1]&&(null===top||void 0===top||top.postMessage({cmd:"google_translate_tl",tl:a[1]},"*")),t.apply(this,[e,o,n])};const e=history.replaceState;history.replaceState=function(t,o,n){let a=n.match(/tl=([a-z-]+)/);return a&&a[1]&&(null===top||void 0===top||top.postMessage({cmd:"google_translate_tl",tl:a[1]},"*")),e.apply(this,[t,o,n])}}(),function(){if(location.href.match(/google\.com\/search/)){let t=0,e=setInterval(()=>{t++,t>50&&clearInterval(e);const o=document.querySelectorAll('[jsdata^="j0Opre"]');if(o.length>0){clearInterval(e);const t={};o.forEach(e=>{const o=(e.getAttribute("jsdata")||"").split(";")[2];o&&(t[o]=function(t){const e=window.W_jd[t],o=Object.getOwnPropertySymbols(e);let n=null;for(const t of o)if(void 0===t.description){n=t;break}if(n){const t=e[n];if(t&&t.hasOwnProperty("Np"))return t.Np[1].Np;console.error("使用 Symbol() 访问到的值不是一个对象，或者该对象没有 Np 属性。")}else console.error("对象中未找到没有描述的 Symbol() 键。")}(o))}),window.postMessage({cmd:"google-nps",data:t},"*")}},100)}}(),function(){var e;if(location.href.match(`1688.com.*kj_agent_plugin=${t}`)){let e=0;const o=()=>{e>0||(e++,window.dispatchEvent(new CustomEvent("service-plugin-dock-event",{detail:{type:"register",name:t}})))};window._ServicePluginDockInit?o():window.addEventListener("service-plugin-dock-event-init",t=>o(),!1);let n=setInterval(()=>{e>0&&clearInterval(n),o()},1e3)}parent!=window&&location.href.match("1688.com")&&(window.addEventListener("message",t=>{"kj-agent-plugin-reply"==t.data.cmd&&window.addEventListener("click",t=>{var e;const o=t.target.closest("a");if(o&&o.href.match("detail.1688.com/offer")){const n=null===(e=o.href.match(/offer\/(\d+)\.html/))||void 0===e?void 0:e[1];n&&(t.preventDefault(),t.stopPropagation(),window.parent.postMessage({cmd:"open-1688-offer",data:{offerId:n}},"*"))}},!0)}),null===(e=window.parent)||void 0===e||e.postMessage({cmd:"check-1688-kj-agent-plugin"},"*"))}()})();