(()=>{var e,t,r,o,a={51762:(e,t,r)=>{"use strict";var o=r(36446),a=r(43054);r.p="undefined"!=typeof chrome?chrome.runtime.getURL(""):"/";location.origin;const i="https://static.wetab.link",s={"zh-CN":"中文简体"};Object.keys(s);const n=new class{constructor(){(0,o.Z)(this,"model",void 0),(0,o.Z)(this,"processor",void 0)}async initModel(){self.postMessage({type:"initModel",payload:{status:"loading"}}),a.OBj.backends.onnx.wasm.wasmPaths=`${i}/hitab/widget-ai-image/wasm/`,a.OBj.remoteHost=i,a.OBj.remotePathTemplate="hitab/widget-ai-image/briaai/RMBG-1.4/",a.OBj.allowLocalModels=!1,this.model=await a.$Sz.from_pretrained("briaai/RMBG-1.4",{config:{model_type:"custom"}});try{this.processor=await a.Za9.from_pretrained("/briaai/RMBG-1.4",{config:{do_normalize:!0,do_pad:!1,do_rescale:!0,do_resize:!0,image_mean:[.5,.5,.5],feature_extractor_type:"ImageFeatureExtractor",image_std:[1,1,1],resample:2,rescale_factor:.00392156862745098,size:{width:1024,height:1024}}})}catch(e){self.postMessage({type:"initModel",payload:{status:"failed"}})}self.postMessage({type:"initModel",payload:{status:"success"}})}async runModel(e){const t=await a.OPz.fromURL(e),{pixel_values:r}=await this.processor(t),{output:o}=await this.model({input:r});return await a.OPz.fromTensor(o[0].mul(255).to("uint8")).resize(t.width,t.height)}};self.onmessage=async e=>{const{type:t,payload:r}=e.data;switch(t){case"initModel":await n.initModel();break;case"runModel":self.postMessage({type:"runModel",payload:{status:"loading"}});try{const e=await n.runModel(r.url);self.postMessage({type:"runModel",payload:{sourceImage:e,status:"success"}})}catch(e){self.postMessage({type:"runModel",payload:{status:"failed"}})}}}},50495:()=>{},27147:()=>{},31418:()=>{},68741:()=>{},70319:()=>{},78386:()=>{},73342:()=>{},95926:()=>{}},i={};function s(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={exports:{}};return a[e](r,r.exports,s),r.exports}s.m=a,s.x=()=>{var e=s.O(void 0,[3058,467],(()=>s(51762)));return e=s.O(e)},e=[],s.O=(t,r,o,a)=>{if(!r){var i=1/0;for(p=0;p<e.length;p++){for(var[r,o,a]=e[p],n=!0,l=0;l<r.length;l++)(!1&a||i>=a)&&Object.keys(s.O).every((e=>s.O[e](r[l])))?r.splice(l--,1):(n=!1,a<i&&(i=a));if(n){e.splice(p--,1);var c=o();void 0!==c&&(t=c)}}return t}a=a||0;for(var p=e.length;p>0&&e[p-1][2]>a;p--)e[p]=e[p-1];e[p]=[r,o,a]},r=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,s.t=function(e,o){if(1&o&&(e=this(e)),8&o)return e;if("object"==typeof e&&e){if(4&o&&e.__esModule)return e;if(16&o&&"function"==typeof e.then)return e}var a=Object.create(null);s.r(a);var i={};t=t||[null,r({}),r([]),r(r)];for(var n=2&o&&e;"object"==typeof n&&!~t.indexOf(n);n=r(n))Object.getOwnPropertyNames(n).forEach((t=>i[t]=()=>e[t]));return i.default=()=>e,s.d(a,i),a},s.d=(e,t)=>{for(var r in t)s.o(t,r)&&!s.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},s.f={},s.e=e=>Promise.all(Object.keys(s.f).reduce(((t,r)=>(s.f[r](e,t),t)),[])),s.u=e=>"assets/js/"+{467:"b92b0f99",3058:"20bdd85a"}[e]+".js",s.miniCssF=e=>{},s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;s.g.importScripts&&(e=s.g.location+"");var t=s.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");r.length&&(e=r[r.length-1].src)}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),s.p=e+"../../"})(),(()=>{var e={8884:1};s.f.i=(t,r)=>{e[t]||importScripts(s.p+s.u(t))};var t=globalThis.webpackChunkinfinity_hitab_client=globalThis.webpackChunkinfinity_hitab_client||[],r=t.push.bind(t);t.push=t=>{var[o,a,i]=t;for(var n in a)s.o(a,n)&&(s.m[n]=a[n]);for(i&&i(s);o.length;)e[o.pop()]=1;r(t)}})(),o=s.x,s.x=()=>Promise.all([s.e(3058),s.e(467)]).then(o);s.x()})();