text: /*!
  * focus-trap 6.1.4
  * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
  */
  import{isFocusable as e,tabbable as t}from"tabbable";function n(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}var r,o,i=(o=[],{activateTrap:function(e){if(o.length>0){var t=o[o.length-1];t!==e&&t.pause()}var n=o.indexOf(e);-1===n||o.splice(n,1),o.push(e)},deactivateTrap:function(e){var t=o.indexOf(e);-1!==t&&o.splice(t,1),o.length>0&&o[o.length-1].unpause()}});function c(o,c){var s=document,l="string"==typeof o?s.querySelector(o):o,f=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){n(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0},c),v={firstTabbableNode:null,lastTabbableNode:null,nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1},d={activate:function(e){if(v.active)return;D(),v.active=!0,v.paused=!1,v.nodeFocusedBeforeActivation=s.activeElement;var t=e&&e.onActivate?e.onActivate:f.onActivate;t&&t();return b(),d},deactivate:p,pause:function(){if(v.paused||!v.active)return;v.paused=!0,y()},unpause:function(){if(!v.paused||!v.active)return;v.paused=!1,D(),b()}};return d;function p(e){if(v.active){clearTimeout(r),y(),v.active=!1,v.paused=!1,i.deactivateTrap(d);var t=e&&void 0!==e.onDeactivate?e.onDeactivate:f.onDeactivate;return t&&t(),(e&&void 0!==e.returnFocus?e.returnFocus:f.returnFocusOnDeactivate)&&u((function(){var e;h((e=v.nodeFocusedBeforeActivation,O("setReturnFocus")||e))})),d}}function b(){if(v.active)return i.activateTrap(d),r=f.delayInitialFocus?u((function(){h(m())})):h(m()),s.addEventListener("focusin",g,!0),s.addEventListener("mousedown",w,{capture:!0,passive:!1}),s.addEventListener("touchstart",w,{capture:!0,passive:!1}),s.addEventListener("click",E,{capture:!0,passive:!1}),s.addEventListener("keydown",k,{capture:!0,passive:!1}),d}function y(){if(v.active)return s.removeEventListener("focusin",g,!0),s.removeEventListener("mousedown",w,!0),s.removeEventListener("touchstart",w,!0),s.removeEventListener("click",E,!0),s.removeEventListener("keydown",k,!0),d}function O(e){var t=f[e],n=t;if(!t)return null;if("string"==typeof t&&!(n=s.querySelector(t)))throw new Error("`"+e+"` refers to no known node");if("function"==typeof t&&!(n=t()))throw new Error("`"+e+"` did not return a node");return n}function m(){var e;if(!(e=null!==O("initialFocus")?O("initialFocus"):l.contains(s.activeElement)?s.activeElement:v.firstTabbableNode||O("fallbackFocus")))throw new Error("Your focus-trap needs to have at least one focusable element");return e}function w(t){l.contains(t.target)||(f.clickOutsideDeactivates?p({returnFocus:f.returnFocusOnDeactivate&&!e(t.target)}):f.allowOutsideClick&&("boolean"==typeof f.allowOutsideClick?f.allowOutsideClick:f.allowOutsideClick(t))||t.preventDefault())}function g(e){l.contains(e.target)||e.target instanceof Document||(e.stopImmediatePropagation(),h(v.mostRecentlyFocusedNode||m()))}function k(e){if(!1!==f.escapeDeactivates&&function(e){return"Escape"===e.key||"Esc"===e.key||27===e.keyCode}(e))return e.preventDefault(),void p();(function(e){return"Tab"===e.key||9===e.keyCode})(e)&&function(e){if(D(),e.shiftKey&&e.target===v.firstTabbableNode)return e.preventDefault(),void h(v.lastTabbableNode);if(!e.shiftKey&&e.target===v.lastTabbableNode)e.preventDefault(),h(v.firstTabbableNode)}(e)}function E(e){f.clickOutsideDeactivates||l.contains(e.target)||f.allowOutsideClick&&("boolean"==typeof f.allowOutsideClick?f.allowOutsideClick:f.allowOutsideClick(e))||(e.preventDefault(),e.stopImmediatePropagation())}function D(){var e=t(l);v.firstTabbableNode=e[0]||m(),v.lastTabbableNode=e[e.length-1]||m()}function h(e){e!==s.activeElement&&(e&&e.focus?(e.focus({preventScroll:!!f.preventScroll}),v.mostRecentlyFocusedNode=e,function(e){return e.tagName&&"input"===e.tagName.toLowerCase()&&"function"==typeof e.select}(e)&&e.select()):h(m()))}}function u(e){return setTimeout(e,0)}export{c as createFocusTrap};
  //# sourceMappingURL=focus-trap.esm.min.js.map
  