function e(){let e=null,t=null,n=new Set,r=!1,i=null;function a(){for(let e of n)e()}function o(){e!==null&&(e=null,a())}return{install({bridge:n}){if(n&&n.onboarding)return r?i??void 0:(r=!0,t=n,i=n.onboarding.onShow(t=>{e=t,a()}),n.onboarding.signalReady(),()=>{i?.(),i=null,r=!1,t=null,o()})},getSnapshot(){return e},subscribe(e){return n.add(e),()=>{n.delete(e)}},async confirm(e){let n=t;if(!n)return{ok:!1,error:`Not attached to desktop bridge`};try{let t=await n.onboarding.confirm(e);return t.ok&&o(),t}catch(e){return{ok:!1,error:e instanceof Error?e.message:`Unknown error`}}},async cancel(){let e=t;if(!e)return{ok:!1,error:`Not attached to desktop bridge`};try{let t=await e.onboarding.cancel();return t.ok&&o(),t}catch(e){return{ok:!1,error:e instanceof Error?e.message:`Unknown error`}}},dismiss(){o()}}}var t=e();function n(e){return t.install(e)}export{n,t};