import{getCurrentWebview as c,Webview as u}from"./webview-eu60K9o9.js";import{W as w}from"./window-CFz_bT0q.js";import{listen as s,once as p}from"./event-DmfRIRSd.js";import{i as l}from"./index-Bkuhln3H.js";function b(){const i=c();return new o(i.label,{skip:!0})}async function a(){return l("plugin:window|get_all_windows").then(i=>i.map(t=>new o(t,{skip:!0})))}class o{constructor(t,e={}){var r;this.label=t,this.listeners=Object.create(null),e?.skip||l("plugin:webview|create_webview_window",{options:{...e,parent:typeof e.parent=="string"?e.parent:(r=e.parent)===null||r===void 0?void 0:r.label,label:t}}).then(async()=>this.emit("tauri://created")).catch(async n=>this.emit("tauri://error",n))}static async getByLabel(t){var e;const r=(e=(await a()).find(n=>n.label===t))!==null&&e!==void 0?e:null;return r?new o(r.label,{skip:!0}):null}static getCurrent(){return b()}static async getAll(){return a()}async listen(t,e){return this._handleTauriEvent(t,e)?()=>{const r=this.listeners[t];r.splice(r.indexOf(e),1)}:s(t,e,{target:{kind:"WebviewWindow",label:this.label}})}async once(t,e){return this._handleTauriEvent(t,e)?()=>{const r=this.listeners[t];r.splice(r.indexOf(e),1)}:p(t,e,{target:{kind:"WebviewWindow",label:this.label}})}async setBackgroundColor(t){return l("plugin:window|set_background_color",{color:t}).then(()=>l("plugin:webview|set_webview_background_color",{color:t}))}}y(o,[w,u]);function y(i,t){(Array.isArray(t)?t:[t]).forEach(e=>{Object.getOwnPropertyNames(e.prototype).forEach(r=>{var n;typeof i.prototype=="object"&&i.prototype&&r in i.prototype||Object.defineProperty(i.prototype,r,(n=Object.getOwnPropertyDescriptor(e.prototype,r))!==null&&n!==void 0?n:Object.create(null))})})}export{o as WebviewWindow,a as getAllWebviewWindows,b as getCurrentWebviewWindow};
