var e=new WeakMap,t=new WeakMap,a={},r=0,n=function(n,i,o){void 0===i&&(i=function(e){return"undefined"==typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body}(n)),void 0===o&&(o="data-aria-hidden");var u=Array.isArray(n)?n:[n];a[o]||(a[o]=new WeakMap);var d=a[o],c=[],f=new Set,s=function(e){e&&!f.has(e)&&(f.add(e),s(e.parentNode))};u.forEach(s);var h=function(a){!a||u.indexOf(a)>=0||Array.prototype.forEach.call(a.children,(function(a){if(f.has(a))h(a);else{var r=a.getAttribute("aria-hidden"),n=null!==r&&"false"!==r,i=(e.get(a)||0)+1,u=(d.get(a)||0)+1;e.set(a,i),d.set(a,u),c.push(a),1===i&&n&&t.set(a,!0),1===u&&a.setAttribute(o,"true"),n||a.setAttribute("aria-hidden","true")}}))};return h(i),f.clear(),r++,function(){c.forEach((function(a){var r=e.get(a)-1,n=d.get(a)-1;e.set(a,r),d.set(a,n),r||(t.has(a)||a.removeAttribute("aria-hidden"),t.delete(a)),n||a.removeAttribute(o)})),--r||(e=new WeakMap,e=new WeakMap,t=new WeakMap,a={})}};export{n as hideOthers};
//# sourceMappingURL=index.js.map
