import{R as i,C as t,i as a}from"./core-BDPGcIsz.js";class o extends i{constructor(e){super(e.rid),this.available=!0,this.currentVersion=e.currentVersion,this.version=e.version,this.date=e.date,this.body=e.body,this.rawJson=e.rawJson}async download(e,n){r(n);const s=new t;e&&(s.onmessage=e);const l=await a("plugin:updater|download",{onEvent:s,rid:this.rid,...n});this.downloadedBytes=new i(l)}async install(){if(!this.downloadedBytes)throw new Error("Update.install called before Update.download");await a("plugin:updater|install",{updateRid:this.rid,bytesRid:this.downloadedBytes.rid}),this.downloadedBytes=void 0}async downloadAndInstall(e,n){r(n);const s=new t;e&&(s.onmessage=e),await a("plugin:updater|download_and_install",{onEvent:s,rid:this.rid,...n})}async close(){var e;await((e=this.downloadedBytes)==null?void 0:e.close()),await super.close()}}async function w(d){r(d);const e=await a("plugin:updater|check",{...d});return e?new o(e):null}function r(d){d!=null&&d.headers&&(d.headers=Array.from(new Headers(d.headers).entries()))}export{o as Update,w as check};
