"use strict";if(1!==window.USW){let filledInfo;window.USW=1;const ORIGIN=location.origin,send=(type,data)=>postMessage({type,data},ORIGIN),onReady=async()=>{if(send("usw-remove-stylus-button"),"/api/oauth/style/new"===location.pathname){filledInfo=!0;const styleId=+new URLSearchParams(location.search).get("vendor_data"),data=await API.data.get("usw"+styleId);send("usw-fill-new-style",data)}},HANDLERS={__proto__:null,"usw-ready":onReady,async"usw-style-info-request"(data){switch(data.requestType){case"installed":{const updateUrl=`${ORIGIN}/api/style/${data.styleID}.user.css`,style=await API.styles.find({updateUrl});data.installed=!!style,send("usw-style-info-response",data);break}}}};filledInfo||onReady(),addEventListener("message",({data,origin})=>{if(chrome.runtime.id&&data&&origin===ORIGIN){const e=HANDLERS[data.type];e&&e(data)}})}