PageSourceSearch

https://orientation.boston.northeastern.edu/wp-content/plugins/ui-…//dist/js/focus-trap.js?ver=%5E7.6.2

js northeastern.edu collected 2026-10-09 21:43:14 UTC 16,959 bytes, 2 lines download raw bytes

vendor: 4,336 bytes, lines 1-2
1/*! For license information please see focus-trap.js.LICENSE.txt */
2var e={d:(t,n)=>{for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},t={};e.d(t,{K:()=>B});var n=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],o=n.join(","),r="undefined"===typeof Element,a=r?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,i=!r&&Element.prototype.getRootNode?function(e){var t;return null===e||void 0===e||null===(t=e.getRootNode)||void 0===t?void 0:t.call(e)}:function(e){return null===e||void 0===e?void 0:e.ownerDocument},u=function e(t,n){var o;void 0===n&&(n=!0);var r=null===t||void 0===t||null===(o=t.getAttribute)||void 0===o?void 0:o.call(t,"inert");return""===r||"true"===r||n&&t&&e(t.parentNode)},c=function(e,t,n){if(u(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(o));return t&&a.call(e,o)&&r.unshift(e),r=r.filter(n)},l=function e(t,n,r){for(var i=[],c=Array.from(t);c.length;){var l=c.shift();if(!u(l,!1))if("SLOT"===l.tagName){var s=l.assignedElements(),d=e(s.length?s:l.children,!0,r);r.flatten?i.push.apply(i,d):i.push({scopeParent:l,candidates:d})}else{a.call(l,o)&&r.filter(l)&&(n||!t.includes(l))&&i.push(l);var f=l.shadowRoot||"function"===typeof r.getShadowRoot&&r.getShadowRoot(l),v=!u(f,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(l));if(f&&v){var b=e(!0===f?l.children:f.children,!0,r);r.flatten?i.push.apply(i,b):i.push({scopeParent:l,candidates:b})}else c.unshift.apply(c,l.children)}}return i},s=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},d=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||function(e){var t,n=null===e||void 0===e||null===(t=e.getAttribute)||void 0===t?void 0:t.call(e,"contenteditable");return""===n||"true"===n}(e))&&!s(e)?0:e.tabIndex},f=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},v=function(e){return"INPUT"===e.tagName},b=function(e){return function(e){return v(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||i(e),o=function(e){return n.querySelectorAll('input[type="radio"][name="'+e+'"]')};if("undefined"!==typeof window&&"undefined"!==typeof window.CSS&&"function"===typeof window.CSS.escape)t=o(window.CSS.escape(e.name));else try{t=o(e.name)}catch(e){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",e.message),!1}var r=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]}(t,e.form);return!r||r===e}(e)},p=function(e){var t=e.getBoundingClientRect(),n=t.width,o=t.height;return 0===n&&0===o},h=function(e,t){var n=t.displayCheck,o=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var r=a.call(e,"details>summary:first-of-type")?e.parentElement:e;if(a.call(r,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return p(e)}else{if("function"===typeof o){for(var u=e;e;){var c=e.parentElement,l=i(e);if(c&&!c.shadowRoot&&!0===o(c))return p(e);e=e.assignedSlot?e.assignedSlot:c||l===e.ownerDocument?c:l.host}e=u}if(function(e){var t,n,o,r,a=e&&i(e),u=null===(t=a)||void 0===t?void 0:t.host,c=!1;if(a&&a!==e)for(c=!!(null!==(n=u)&&void 0!==n&&null!==(o=n.ownerDocument)&&void 0!==o&&o.contains(u)||null!==e&&void 0!==e&&null!==(r=e.ownerDocument)&&void 0!==r&&r.contains(e));!c&&u;){var l,s,d;c=!(null===(s=u=null===(l=a=i(u))||void 0===l?void 0:l.host)||void 0===s||null===(d=s.ownerDocument)||void 0===d||!d.contains(u))}return c}(e))return!e.getClientRects().length;if("legacy-full"!==n)return!0}return!1},m=function(e,t){return!(t.disabled||u(t)||function(e){return v(e)&&"hidden"===e.type}(t)||h(t,e)||function(e){return"DETAILS"===e.tagName&&Array.prototype.slice.apply(e.children).some((function(e){return"SUMMARY"===e.tagName}))}
2(t)||function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if("FIELDSET"===t.tagName&&t.disabled){for(var n=0;n<t.children.length;n++){var o=t.children.item(n);if("LEGEND"===o.tagName)return!!a.call(t,"fieldset[disabled] *")||!o.contains(e)}return!0}t=t.parentElement}return!1}(t))},y=function(e,t){return!(b(t)||d(t)<0||!m(e,t))},w=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},g=function e(t){var n=[],o=[];return t.forEach((function(t,r){var a=!!t.scopeParent,i=a?t.scopeParent:t,u=function(e,t){var n=d(e);return n<0&&t&&!s(e)?0:n}(i,a),c=a?e(t.candidates):i;0===u?a?n.push.apply(n,c):n.push(i):o.push({documentOrder:r,tabIndex:u,item:t,isScope:a,content:c})})),o.sort(f).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},N=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==a.call(e,o)&&y(t,e)},E=n.concat("iframe").join(","),O=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==a.call(e,E)&&m(t,e)};function S(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n<t;n++)o[n]=e[n];return o}function F(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function T(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function k(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?T(Object(n),!0).forEach((function(t){F(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):T(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function R(e){return function(e){if(Array.isArray(e))return S(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return S(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?S(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var D=function(e,t){if(e.length>0){var n=e[e.length-1];n!==t&&n.pause()}var o=e.indexOf(t);-1===o||e.splice(o,1),e.push(t)},P=function(e,t){var n=e.indexOf(t);-1!==n&&e.splice(n,1),e.length>0&&e[e.length-1].unpause()},I=function(e){return"Tab"===(null===e||void 0===e?void 0:e.key)||9===(null===e||void 0===e?void 0:e.keyCode)},A=function(e){return I(e)&&!e.shiftKey},x=function(e){return I(e)&&e.shiftKey},C=function(e){return setTimeout(e,0)},G=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return"function"===typeof e?e.apply(void 0,n):e},L=function(e){return e.target.shadowRoot&&"function"===typeof e.composedPath?e.composedPath()[0]:e.target},j=[],B=function(e,t){var n,o=(null===t||void 0===t?void 0:t.document)||document,r=(null===t||void 0===t?void 0:t.trapStack)||j,a=k({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:A,isKeyBackward:x},t),i={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},u=function(e,t,n){return e&&void 0!==e[t]?e[t]:a[n||t]},s=function(e,t){var n="function"===typeof(null===t||void 0===t?void 0:t.composedPath)?t.composedPath():void 0;return i.containerGroups.findIndex((function(t){var o=t.container,r=t.tabbableNodes;return o.contains(e)||(null===n||void 0===n?void 0:n.includes(o))||r.find((function(t){return t===e}))}))},f=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.hasFallback,r=void 0!==n&&n,i=t.params,u=void 0===i?[]:i,c=a[e];if("function"===typeof c&&(c=c.apply(void 0,R(u))),!0===c&&(c=void 0),!c){
vendor: 6,232 bytes, line 2
2if(void 0===c||!1===c)return c;throw new Error("`".concat(e,"` was specified but was not a node, or did not return a node"))}var l=c;if("string"===typeof c){try{l=o.querySelector(c)}catch(t){throw new Error("`".concat(e,'` appears to be an invalid selector; error="').concat(t.message,'"'))}if(!l&&!r)throw new Error("`".concat(e,"` as selector refers to no known node"))}return l},v=function(){var e=f("initialFocus",{hasFallback:!0});if(!1===e)return!1;if(void 0===e||e&&!O(e,a.tabbableOptions))if(s(o.activeElement)>=0)e=o.activeElement;else{var t=i.tabbableGroups[0];e=t&&t.firstTabbableNode||f("fallbackFocus")}else null===e&&(e=f("fallbackFocus"));if(!e)throw new Error("Your focus-trap needs to have at least one focusable element");return e},b=function(){if(i.containerGroups=i.containers.map((function(e){var t=function(e,t){var n;return n=(t=t||{}).getShadowRoot?l([e],t.includeContainer,{filter:y.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:w}):c(e,t.includeContainer,y.bind(null,t)),g(n)}(e,a.tabbableOptions),n=function(e,t){return(t=t||{}).getShadowRoot?l([e],t.includeContainer,{filter:m.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):c(e,t.includeContainer,m.bind(null,t))}(e,a.tabbableOptions),o=t.length>0?t[0]:void 0,r=t.length>0?t[t.length-1]:void 0,i=n.find((function(e){return N(e)})),u=n.slice().reverse().find((function(e){return N(e)})),s=!!t.find((function(e){return d(e)>0}));return{container:e,tabbableNodes:t,focusableNodes:n,posTabIndexesFound:s,firstTabbableNode:o,lastTabbableNode:r,firstDomTabbableNode:i,lastDomTabbableNode:u,nextTabbableNode:function(e){var o=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=t.indexOf(e);return r<0?o?n.slice(n.indexOf(e)+1).find((function(e){return N(e)})):n.slice(0,n.indexOf(e)).reverse().find((function(e){return N(e)})):t[r+(o?1:-1)]}}})),i.tabbableGroups=i.containerGroups.filter((function(e){return e.tabbableNodes.length>0})),i.tabbableGroups.length<=0&&!f("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(i.containerGroups.find((function(e){return e.posTabIndexesFound}))&&i.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},p=function(e){var t=e.activeElement;if(t)return t.shadowRoot&&null!==t.shadowRoot.activeElement?p(t.shadowRoot):t},h=function(e){!1!==e&&e!==p(document)&&(e&&e.focus?(e.focus({preventScroll:!!a.preventScroll}),i.mostRecentlyFocusedNode=e,function(e){return e.tagName&&"input"===e.tagName.toLowerCase()&&"function"===typeof e.select}(e)&&e.select()):h(v()))},E=function(e){var t=f("setReturnFocus",{params:[e]});return t||!1!==t&&e},S=function(e){var t=e.target,n=e.event,o=e.isBackward,r=void 0!==o&&o;t=t||L(n),b();var u=null;if(i.tabbableGroups.length>0){var c=s(t,n),l=c>=0?i.containerGroups[c]:void 0;if(c<0)u=r?i.tabbableGroups[i.tabbableGroups.length-1].lastTabbableNode:i.tabbableGroups[0].firstTabbableNode;else if(r){var v=i.tabbableGroups.findIndex((function(e){var n=e.firstTabbableNode;return t===n}));if(v<0&&(l.container===t||O(t,a.tabbableOptions)&&!N(t,a.tabbableOptions)&&!l.nextTabbableNode(t,!1))&&(v=c),v>=0){var p=0===v?i.tabbableGroups.length-1:v-1,h=i.tabbableGroups[p];u=d(t)>=0?h.lastTabbableNode:h.lastDomTabbableNode}else I(n)||(u=l.nextTabbableNode(t,!1))}else{var m=i.tabbableGroups.findIndex((function(e){var n=e.lastTabbableNode;return t===n}));if(m<0&&(l.container===t||O(t,a.tabbableOptions)&&!N(t,a.tabbableOptions)&&!l.nextTabbableNode(t))&&(m=c),m>=0){var y=m===i.tabbableGroups.length-1?0:m+1,w=i.tabbableGroups[y];u=d(t)>=0?w.firstTabbableNode:w.firstDomTabbableNode}else I(n)||(u=l.nextTabbableNode(t))}}else u=f("fallbackFocus");return u},F=function(e){var t=L(e);s(t,e)>=0||(G(a.clickOutsideDeactivates,e)?n.deactivate({returnFocus:a.returnFocusOnDeactivate}):G(a.allowOutsideClick,e)||e.preventDefault())},T=function(e){var t=L(e),n=s(t,e)>=0;if(n||t instanceof Document)n&&(i.mostRecentlyFocusedNode=t);else{var o;e.stopImmediatePropagation();var r=!0;if(i.mostRecentlyFocusedNode)if(d(i.mostRecentlyFocusedNode)>0){var u=s(i.mostRecentlyFocusedNode),c=i.containerGroups[u].tabbableNodes;if(c.length>0){var l=c.findIndex((function(e){return e===i.mostRecentlyFocusedNode}));l>=0&&(a.isKeyForward(i.recentNavEvent)?l+1<c.length&&(o=c[l+1],r=!1):l-1>=0&&(o=c[l-1],r=!1))}}else i.containerGroups.some((function(e){return e.tabbableNodes.some((function(e){return d(e)>0}))}))||(r=!1);else r=!1;r&&(o=S({target:i.mostRecentlyFocusedNode,isBackward:a.isKeyBackward(i.recentNavEvent)})),h(o||(i.mostRecentlyFocusedNode||v()))}i.recentNavEvent=void 0},B=function(e){(a.isKeyForward(e)||a.isKeyBackward(e))&&function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];i.recentNavEvent=e;var n=S({event:e,isBackward:t});n&&(I(e)&&e.preventDefault(),h(n))}(e,a.isKeyBackward(e))},K=function(e){var t;"Escape"!==(null===(t=e)||void 0===t?void 0:t.key)&&"Esc"!==(null===t||void 0===t?void 0:t.key)&&27!==(null===t||void 0===t?void 0:t.keyCode)||!1===G(a.escapeDeactivates,e)||(e.preventDefault(),n.deactivate())},U=function(e){var t=L(e);s(t,e)>=0||G(a.clickOutsideDeactivates,e)||G(a.allowOutsideClick,e)||(e.preventDefault(),e.stopImmediatePropagation())},M=function(){if(i.active)return D(r,n),i.delayInitialFocusTimer=a.delayInitialFocus?C((function(){h(v())})):h(v()),o.addEventListener("focusin",T,!0),o.addEventListener("mousedown",F,{capture:!0,passive:!1}),o.addEventListener("touchstart",F,{capture:!0,passive:!1}),o.addEventListener("click",U,{capture:!0,passive:!1}),o.addEventListener("keydown",B,{capture:!0,passive:!1}),o.addEventListener("keydown",K),n},q=function(){if(i.active)return o.removeEventListener("focusin",T,!0),o.removeEventListener("mousedown",F,!0),o.removeEventListener("touchstart",F,!0),o.removeEventListener("click",U,!0),o.removeEventListener("keydown",B,!0),o.removeEventListener("keydown",K),n},Y="undefined"!==typeof window&&"MutationObserver"in window?new MutationObserver((function(e){e.some((function(e){return Array.from(e.removedNodes
2).some((function(e){return e===i.mostRecentlyFocusedNode}))}))&&h(v())})):void 0,$=function(){Y&&(Y.disconnect(),i.active&&!i.paused&&i.containers.map((function(e){Y.observe(e,{subtree:!0,childList:!0})})))};return(n={get active(){return i.active},get paused(){return i.paused},activate:function(e){if(i.active)return this;var t=u(e,"onActivate"),n=u(e,"onPostActivate"),r=u(e,"checkCanFocusTrap");r||b(),i.active=!0,i.paused=!1,i.nodeFocusedBeforeActivation=o.activeElement,null===t||void 0===t||t();var a=function(){r&&b(),M(),$(),null===n||void 0===n||n()};return r?(r(i.containers.concat()).then(a,a),this):(a(),this)},deactivate:function(e){if(!i.active)return this;var t=k({onDeactivate:a.onDeactivate,onPostDeactivate:a.onPostDeactivate,checkCanReturnFocus:a.checkCanReturnFocus},e);clearTimeout(i.delayInitialFocusTimer),i.delayInitialFocusTimer=void 0,q(),i.active=!1,i.paused=!1,$(),P(r,n);var o=u(t,"onDeactivate"),c=u(t,"onPostDeactivate"),l=u(t,"checkCanReturnFocus"),s=u(t,"returnFocus","returnFocusOnDeactivate");null===o||void 0===o||o();var d=function(){C((function(){s&&h(E(i.nodeFocusedBeforeActivation)),null===c||void 0===c||c()}))};return s&&l?(l(E(i.nodeFocusedBeforeActivation)).then(d,d),this):(d(),this)},pause:function(e){if(i.paused||!i.active)return this;var t=u(e,"onPause"),n=u(e,"onPostPause");return i.paused=!0,null===t||void 0===t||t(),q(),$(),null===n||void 0===n||n(),this},unpause:function(e){if(!i.paused||!i.active)return this;var t=u(e,"onUnpause"),n=u(e,"onPostUnpause");return i.paused=!1,null===t||void 0===t||t(),b(),M(),$(),null===n||void 0===n||n(),this}
2,updateContainerElements:function(e){var t=[].concat(e).filter(Boolean);return i.containers=t.map((function(e){return"string"===typeof e?o.querySelector(e):e})),i.active&&b(),$(),this}}).updateContainerElements(e),n},K=t.K;export{K as createFocusTrap};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.