(()=>(t,a)=>{(async()=>{if(!document.URL.startsWith("https://t.bilibili.com/")&&!document.URL.startsWith("https://space.bilibili.com/")){return}a.applyStyle("feedsTranslateStyle");const{getTranslator:e}=await a.importAsync("feeds-translate-providers");const n=Vue.extend({template:`\n
\n
\n翻译\n
\n\n
翻译自{{activeTranslator.name}}:
\n
{{result}}
\n
\n`,props:{card:{type:Object,required:true}},data(){return{result:"",working:false,activeTranslator:{}}},computed:{translated(){return this.result!==""}},methods:{async translate(){const a=this.card;try{this.working=true;const n=(await a.getText()).replace(/#(.+?)#/g,"");const r=this.activeTranslator=e();this.result=await r.translate(n,{targetLanguage:(()=>{if(t.i18n){return languageNameToCode[t.i18nLanguage]}if(t.feedsTranslateLanguage!==""){return t.feedsTranslateLanguage}return})()})}catch(t){logError(t)}finally{this.working=false}}}});const r=t=>{if(t.text.replace(/#(.+?)#/g,"")===""){return}if(dq(t.element,".card-content .translate-container")){return}const a=t.element.querySelector(".card-content");const e=new n({propsData:{card:_.clone(t)}}).$mount();a.insertAdjacentElement("beforeend",e.$el)};const{forEachFeedsCard:s}=await a.importAsync("feeds-apis");s({added:r})})()})();