!function(){if(document.getElementById("ai-image-trigger"))return;const e=document.createElement("div");e.id="ai-image-trigger",e.style.cssText="\n        position: fixed; top: 220px; right: 8px; z-index: 2147483647; cursor: pointer;\n        background: linear-gradient(135deg, #8b5cf6, #ec4899); width: 48px; height: 48px; border-radius: 50%;\n        box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4); display: flex; align-items: center; justify-content: center;\n        transition: transform 0.2s;\n    ",e.innerHTML='<img src="https://gh.llkk.cc/https://raw.githubusercontent.com/Tarikul-Islam-Anik/Animated-Fluent-Emojis/master/Emojis/People/Artist.png" alt="图标" width="30" height="30" style="vertical-align:middle;">',e.onclick=async()=>{await new Promise(e=>{let t=0;const n=600,i=3e4,o=setInterval(()=>{const a=document.body.scrollHeight;window.scrollBy(0,n),t+=n,(window.innerHeight+window.scrollY>=a||t>=i)&&(clearInterval(o),window.scrollTo(0,0),setTimeout(e,200))},60)}),t.style.display="block",await n()},e.onmouseover=()=>e.style.transform="scale(1.1)",e.onmouseout=()=>e.style.transform="scale(1)",document.body.appendChild(e);const t=document.createElement("iframe");async function n(){const e=function(){if(window.OzonStrategies)for(const e in window.OzonStrategies){const t=window.OzonStrategies[e];if(t.matches(window.location.href))return t}return null}();if(e)try{window.scrollBy(0,1e3),setTimeout(()=>window.scrollBy(0,-1e3),100);const n=e.scrape(),i={main:n.global_data.media_gallery.main_images.map(e=>({original:e,current:e})),sku:[],detail:n.global_data.media_gallery.detail_images.map(e=>({original:e,current:e}))},o=new Set;n.sku_matrix.forEach(e=>{e.sku_image_url&&!o.has(e.sku_image_url)&&(o.add(e.sku_image_url),i.sku.push({original:e.sku_image_url,current:e.sku_image_url}))}),t.contentWindow.postMessage({action:"INIT_DATA",data:i,title:n.global_data.product_name},"*")}catch(n){console.error("采集失败",n)}}t.src=chrome.runtime.getURL("ui/panel.html"),t.style.cssText="\n        position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; border: none;\n        z-index: 2147483647; display: none; background: transparent;\n    ",document.body.appendChild(t),window.addEventListener("message",e=>{"HIDE_PANEL"===e.data.action&&(t.style.display="none")}),chrome.runtime.onMessage.addListener(e=>{"context_add_image"===e.action&&(t.style.display="block",t.contentWindow.postMessage({action:"ADD_TEMP_IMAGE",url:e.url},"*")),"toggle_ui"===e.action&&(t.style.display="block",n())})}();
