var aiDetect=(function(){"use strict";function p(e){return e}const g={matches:["https://matrix.tencent.com/ai-detect/*"],main(){console.log("[yixh] AI Detect Content Script Loaded");const e=async()=>{try{const i=(await chrome.storage.local.get("__storage_article_content_for_ai__")).__storage_article_content_for_ai__;if(i){const r=document.querySelector(".txt-input textarea");if(r)return r.value=i,r.dispatchEvent(new Event("input",{bubbles:!0})),console.log("[yixh] Article content injected successfully"),setTimeout(()=>{const u=document.querySelector(".btn-primary")||Array.from(document.querySelectorAll("button")).find(b=>b.textContent?.includes("检测"));u&&(u.click(),console.log("[yixh] Detection started automatically"))},500),chrome.storage.local.remove("__storage_article_content_for_ai__"),!0}}catch(n){console.error("[yixh] Error injecting content:",n)}return!1};e();const t=new MutationObserver(()=>{e()&&t.disconnect()});t.observe(document.body,{childList:!0,subtree:!0}),setTimeout(()=>t.disconnect(),5e3)}};function s(e,...t){}const m={debug:(...e)=>s(console.debug,...e),log:(...e)=>s(console.log,...e),warn:(...e)=>s(console.warn,...e),error:(...e)=>s(console.error,...e)},l=globalThis.browser?.runtime?.id?globalThis.browser:globalThis.chrome;var d=class h extends Event{static EVENT_NAME=c("wxt:locationchange");constructor(t,n){super(h.EVENT_NAME,{}),this.newUrl=t,this.oldUrl=n}};function c(e){return`${l?.runtime?.id}:ai-detect:${e}`}const v=typeof globalThis.navigation?.addEventListener=="function";function f(e){let t,n=!1;return{run(){n||(n=!0,t=new URL(location.href),v?globalThis.navigation.addEventListener("navigate",i=>{const r=new URL(i.destination.url);r.href!==t.href&&(window.dispatchEvent(new d(r,t)),t=r)},{signal:e.signal}):e.setInterval(()=>{const i=new URL(location.href);i.href!==t.href&&(window.dispatchEvent(new d(i,t)),t=i)},1e3))}}}var E=class o{static SCRIPT_STARTED_MESSAGE_TYPE=c("wxt:content-script-started");id;abortController;locationWatcher=f(this);constructor(t,n){this.contentScriptName=t,this.options=n,this.id=Math.random().toString(36).slice(2),this.abortController=new AbortController,this.stopOldScripts(),this.listenForNewerScripts()}get signal(){return this.abortController.signal}abort(t){return this.abortController.abort(t)}get isInvalid(){return l.runtime?.id==null&&this.notifyInvalidated(),this.signal.aborted}get isValid(){return!this.isInvalid}onInvalidated(t){return this.signal.addEventListener("abort",t),()=>this.signal.removeEventListener("abort",t)}block(){return new Promise(()=>{})}setInterval(t,n){const i=setInterval(()=>{this.isValid&&t()},n);return this.onInvalidated(()=>clearInterval(i)),i}setTimeout(t,n){const i=setTimeout(()=>{this.isValid&&t()},n);return this.onInvalidated(()=>clearTimeout(i)),i}requestAnimationFrame(t){const n=requestAnimationFrame((...i)=>{this.isValid&&t(...i)});return this.onInvalidated(()=>cancelAnimationFrame(n)),n}requestIdleCallback(t,n){const i=requestIdleCallback((...r)=>{this.signal.aborted||t(...r)},n);return this.onInvalidated(()=>cancelIdleCallback(i)),i}addEventListener(t,n,i,r){n==="wxt:locationchange"&&this.isValid&&this.locationWatcher.run(),t.addEventListener?.(n.startsWith("wxt:")?c(n):n,i,{...r,signal:this.signal})}notifyInvalidated(){this.abort("Content script context invalidated"),m.debug(`Content script "${this.contentScriptName}" context invalidated`)}stopOldScripts(){document.dispatchEvent(new CustomEvent(o.SCRIPT_STARTED_MESSAGE_TYPE,{detail:{contentScriptName:this.contentScriptName,messageId:this.id}})),window.postMessage({type:o.SCRIPT_STARTED_MESSAGE_TYPE,contentScriptName:this.contentScriptName,messageId:this.id},"*")}verifyScriptStartedEvent(t){const n=t.detail?.contentScriptName===this.contentScriptName,i=t.detail?.messageId===this.id;return n&&!i}listenForNewerScripts(){const t=n=>{!(n instanceof CustomEvent)||!this.verifyScriptStartedEvent(n)||this.notifyInvalidated()};document.addEventListener(o.SCRIPT_STARTED_MESSAGE_TYPE,t),this.onInvalidated(()=>document.removeEventListener(o.SCRIPT_STARTED_MESSAGE_TYPE,t))}};function _(){}function a(e,...t){}const S={debug:(...e)=>a(console.debug,...e),log:(...e)=>a(console.log,...e),warn:(...e)=>a(console.warn,...e),error:(...e)=>a(console.error,...e)};return(async()=>{try{const{main:e,...t}=g;return await e(new E("ai-detect",t))}catch(e){throw S.error('The content script "ai-detect" crashed on startup!',e),e}})()})();
aiDetect;