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)}function r(e,t){let n=e=>e.replace(/\\/g,`/`).replace(/\/+$/,``)||(e.startsWith(`/`)?`/`:``),r=n(e),i=n(t);if(r===i)return`.`;let a=r.endsWith(`/`)?r:`${r}/`;return i.startsWith(a)?i.slice(a.length):null}function i(e){if(e===``||e===`.`)return!0;if(e.startsWith(`/`)||/^[A-Za-z]:/.test(e))return!1;let t=e.replace(/\\/g,`/`).split(`/`),n=0;for(let e of t)if(!(e===``||e===`.`))if(e===`..`){if(--n,n<0)return!1}else n+=1;return!0}export{n as i,r as n,t as r,i as t};