import{a as c}from"./vrwecVo1.js";import{j as e,g as n,h as u}from"./Dyk1ealw.js";import{b as h,g as d}from"./BCu6PYO-.js";const o=new Set;function b(){for(const a of o)if(a())return!0;return!1}function v(a){let s=u(!1),r=u(null),t=!1;return o.add(a),c(()=>o.delete(a)),h(({cancel:f,to:l,type:i})=>{a()&&!t&&(f(),i!=="leave"&&(e(r,l?.url?l.url.pathname+l.url.search+l.url.hash:null,!0),e(s,!0))),t=!1}),{get showModal(){return n(s)},bypass(){t=!0},confirm(){e(s,!1),n(r)&&(t=!0,d(n(r)),e(r,null))},cancel(){e(s,!1),e(r,null)}}}export{v as c,b as h};
