var t,e={exports:{}};function r(){return t?e.exports:(t=1,e.exports=r={single_source_shortest_paths:function(t,e,n){var o={},s={};s[e]=0;var u,a,i,c,f,p,h,d=r.PriorityQueue.make();for(d.push(e,0);!d.empty();)for(i in a=(u=d.pop()).value,c=u.cost,f=t[a]||{})f.hasOwnProperty(i)&&(p=c+f[i],h=s[i],(void 0===s[i]||h>p)&&(s[i]=p,d.push(i,p),o[i]=a));if(void 0!==n&&void 0===s[n]){var l=["Could not find a path from ",e," to ",n,"."].join("");throw new Error(l)}return o},extract_shortest_path_from_predecessor_list:function(t,e){for(var r=[],n=e;n;)r.push(n),t[n],n=t[n];return r.reverse(),r},find_path:function(t,e,n){var o=r.single_source_shortest_paths(t,e,n);return r.extract_shortest_path_from_predecessor_list(o,n)},PriorityQueue:{make:function(t){var e,n=r.PriorityQueue,o={};for(e in t=t||{},n)n.hasOwnProperty(e)&&(o[e]=n[e]);return o.queue=[],o.sorter=t.sorter||n.default_sorter,o},default_sorter:function(t,e){return t.cost-e.cost},push:function(t,e){var r={value:t,cost:e};this.queue.push(r),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}});var r}const n=new WeakMap;function o(t,e,r,o){if(!t&&!n.has(e))return!1;const s=n.get(e)??new WeakMap;n.set(e,s);const u=s.get(r)??new Set;s.set(r,u);const a=u.has(o);return t?u.add(o):u.delete(o),a&&t}function s(t,e,r,n={}){if(Array.isArray(e)){for(const o of e)s(t,o,r,n);return}const u=e,{signal:a,base:i=document}=n;if(a?.aborted)return;const{once:c,...f}=n,p=i instanceof Document?i.documentElement:i,h=Boolean("object"==typeof n?n.capture:n),d=e=>{const n=function(t,e){let r=t.target;if(r instanceof Text&&(r=r.parentElement),r instanceof Element&&t.currentTarget instanceof Node){const n=r.closest(e);if(n&&t.currentTarget.contains(n))return n}}(e,String(t));if(n){const t=Object.assign(e,{delegateTarget:n});r.call(p,t),c&&(p.removeEventListener(u,d,f),o(!1,p,r,l))}},l=JSON.stringify({selector:t,type:u,capture:h});o(!0,p,r,l)||p.addEventListener(u,d,f),a?.addEventListener("abort",()=>{o(!1,p,r,l)})}export{s as d,r};
