1/** 2 * Focus trap 3 * 4 * @external "focus-trap" 5 * @version 6.5.1 6 * @see {@link https://github.com/focus-trap/focus-trap/blob/master/LICENSE| Documentation} 7 */ 8! function(e, t) { 9 "object" == typeof exports && "undefined" != typeof module ? t(exports, require("tabbable")) : "function" == typeof define && define.amd ? define(["exports", "tabbable"], t) : (e = "undefined" != typeof globalThis ? globalThis : e || self, function() { 10 var n = e.focusTrap, 11 a = e.focusTrap = {}; 12 t(a, e.tabbable), a.noConflict = function() { 13 return e.focusTrap = n, a 14 } 15 }()) 16}(this, (function(e, t) { 17 "use strict"; 18 19 function n(e, t) { 20 var n = Object.keys(e); 21 if (Object.getOwnPropertySymbols) { 22 var a = Object.getOwnPropertySymbols(e); 23 t && (a = a.filter((function(t) { 24 return Object.getOwnPropertyDescriptor(e, t).enumerable 25 }))), n.push.apply(n, a) 26 } 27 return n 28 } 29 30 function a(e, t, n) { 31 return t in e ? Object.defineProperty(e, t, { 32 value: n, 33 enumerable: !0, 34 configurable: !0, 35 writable: !0 36 }) : e[t] = n, e 37 } 38 var r, o, i = (o = [], { 39 activateTrap: function(e) { 40 if (o.length > 0) { 41 var t = o[o.length - 1]; 42 t !== e && t.pause() 43 } 44 var n = o.indexOf(e); - 1 === n || o.splice(n, 1), o.push(e) 45 }, 46 deactivateTrap: function(e) { 47 var t = o.indexOf(e); - 1 !== t && o.splice(t, 1), o.length > 0 && o[o.length - 1].unpause() 48 } 49 }), 50 c = function(e) { 51 return setTimeout(e, 0) 52 }, 53 u = function(e, t) { 54 var n = -1; 55 return e.every((function(e, a) { 56 return !t(e) || (n = a, !1) 57 })), n 58 }, 59 s = function(e) { 60 for (var t = arguments.length, n = new Array(t > 1 ? t - 1 : 0), a = 1; a < t; a++) n[a - 1] = arguments[a]; 61 return "function" == typeof e ? e.apply(void 0, n) : e 62 }; 63 e.createFocusTrap = function(e, o) { 64 var l, f = document, 65 b = function(e) { 66 for (var t = 1; t < arguments.length; t++) { 67 var r = null != arguments[t] ? arguments[t] : {}; 68 t % 2 ? n(Object(r), !0).forEach((function(t) { 69 a(e, t, r[t]) 70 })) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : n(Object(r)).forEach((function(t) { 71 Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t)) 72 })) 73 } 74 return e 75 }({ 76 returnFocusOnDeactivate: !0, 77 escapeDeactivates: !0, 78 delayInitialFocus: !0 79 }, o), 80 v = { 81 containers: [], 82 tabbableGroups: [], 83 nodeFocusedBeforeActivation: null, 84 mostRecentlyFocusedNode: null, 85 active: !1, 86 paused: !1 87 }, 88 p = function(e, t, n) { 89 return e && void 0 !== e[t] ? e[t] : b[n || t] 90 }, 91 d = function(e) { 92 return v.containers.some((function(t) { 93 return t.contains(e) 94 })) 95 }, 96 h = function(e) { 97 var t = b[e]; 98 if (!t) return null; 99 var n = t; 100 if ("string" == typeof t && !(n = f.querySelector(t))) throw new Error("`".concat(e, "` refers to no known node")); 101 if ("function" == typeof t && !(n = t())) throw new Error("`".concat(e, "` did not return a node")); 102 return n 103 }, 104 y = function() { 105 var initialFocusNode; 106 if (null !== h("initialFocus")) initialFocusNode = h("initialFocus"); 107 else if (d(f.activeElement)) initialFocusNode = f.activeElement; 108 else { 109 var firstTabbableGroup = v.tabbableGroups[0]; 110 initialFocusNode = firstTabbableGroup && firstTabbableGroup.firstTabbableNode || h("fallbackFocus"); 111 } 112 if (!initialFocusNode || !initialFocusNode.focus) { 113 console.log("Your focus-trap needs to have at least one focusable element") 114 }; 115 return initialFocusNode; 116 }, 117 // Ensure that there is at least one container with a tabbable node 118 g = function() { 119 v.tabbableGroups = v.containers.map(function(container) { 120 var tabbableNodes = t.tabbable(container); 121 if (tabbableNodes.length > 0) { 122 return { 123 container: container, 124 firstTabbableNode: tabbableNodes[0], 125 lastTabbableNode: tabbableNodes[tabbableNodes.length - 1] 126 }; 127 } 128 }).filter(function(group) { 129 return !!group; 130 }); 131 132 // Check if there are no tabbable groups and no fallback focus 133 if (v.tabbableGroups.length <= 0 && !h("fallbackFocus")) { 134 console.log("Error: Your focus-trap must have at least one container with at least one tabbable node in it at all times"); 135 } 136 }, 137 m = function e(t) { 138 t !== f.activeElement && (t && t.focus ? (t.focus({ 139 preventScroll: !!b.preventScroll 140 }), v.mostRecentlyFocusedNode = t, function(e) { 141 return e.tagName && "input" === e.tagName.toLowerCase() && "function" == typeof e.select 142 }(t) && t.select()) : e(y())) 143 }, 144 O = function(e) { 145 var t = h("setReturnFocus"); 146 return t || e 147 }, 148 w = function(e) { 149 d(e.target) || (s(b.clickOutsideDeactivates, e) ? l.deactivate({ 150 returnFocus: b.returnFocusOnDeactivate && !t.isFocusable(e.target) 151 }) : s(b.allowOutsideClick, e) || e.preventDefault()) 152 }, 153 F = function(e) { 154 var t = d(e.target); 155 t || e.target instanceof Document ? t && (v.mostRecentlyFocusedNode = e.target) : (e.stopImmediatePropagation(), m(v.mostRecentlyFocusedNode || y())) 156 }, 157 E = function(e) { 158 if (!1 !== b.escapeDeactivates && function(e) {
159 return "Escape" === e.key || "Esc" === e.key || 27 === e.keyCode 160 }(e)) return e.preventDefault(), void l.deactivate(); 161 (function(e) { 162 return "Tab" === e.key || 9 === e.keyCode 163 })(e) && function(e) { 164 g(); 165 var t = null; 166 if (v.tabbableGroups.length > 0) { 167 var n = u(v.tabbableGroups, (function(t) { 168 return t.container.contains(e.target) 169 })); 170 if (n < 0) t = e.shiftKey ? v.tabbableGroups[v.tabbableGroups.length - 1].lastTabbableNode : v.tabbableGroups[0].firstTabbableNode; 171 else if (e.shiftKey) { 172 var a = u(v.tabbableGroups, (function(t) { 173 var n = t.firstTabbableNode; 174 return e.target === n 175 })); 176 if (a < 0 && v.tabbableGroups[n].container === e.target && (a = n), a >= 0) { 177 var r = 0 === a ? v.tabbableGroups.length - 1 : a - 1; 178 t = v.tabbableGroups[r].lastTabbableNode 179 } 180 } else { 181 var o = u(v.tabbableGroups, (function(t) { 182 var n = t.lastTabbableNode; 183 return e.target === n 184 })); 185 if (o < 0 && v.tabbableGroups[n].container === e.target && (o = n), o >= 0) { 186 var i = o === v.tabbableGroups.length - 1 ? 0 : o + 1; 187 t = v.tabbableGroups[i].firstTabbableNode 188 } 189 } 190 } else t = h("fallbackFocus"); 191 t && (e.preventDefault(), m(t)) 192 }(e) 193 }, 194 T = function(e) { 195 s(b.clickOutsideDeactivates, e) || d(e.target) || s(b.allowOutsideClick, e) || (e.preventDefault(), e.stopImmediatePropagation()) 196 }, 197 k = function() { 198 if (v.active) return i.activateTrap(l), r = b.delayInitialFocus ? c((function() { 199 m(y()) 200 })) : m(y()), f.addEventListener("focusin", F, !0), f.addEventListener("mousedown", w, { 201 capture: !0, 202 passive: !1 203 }), f.addEventListener("touchstart", w, { 204 capture: !0, 205 passive: !1 206 }), f.addEventListener("click", T, { 207 capture: !0, 208 passive: !1 209 }), f.addEventListener("keydown", E, { 210 capture: !0, 211 passive: !1 212 }), l 213 }, 214 D = function() { 215 if (v.active) return f.removeEventListener("focusin", F, !0), f.removeEventListener("mousedown", w, !0), f.removeEventListener("touchstart", w, !0), f.removeEventListener("click", T, !0), f.removeEventListener("keydown", E, !0), l 216 }; 217 return (l = { 218 activate: function(e) { 219 if (v.active) return this; 220 var t = p(e, "onActivate"), 221 n = p(e, "onPostActivate"), 222 a = p(e, "checkCanFocusTrap"); 223 a || g(), v.active = !0, v.paused = !1, v.nodeFocusedBeforeActivation = f.activeElement, t && t(); 224 var r = function() { 225 a && g(), k(), n && n() 226 }; 227 return a ? (a(v.containers.concat()).then(r, r), this) : (r(), this) 228 }, 229 deactivate: function(e) { 230 if (!v.active) return this; 231 clearTimeout(r), D(), v.active = !1, v.paused = !1, i.deactivateTrap(l); 232 var t = p(e, "onDeactivate"), 233 n = p(e, "onPostDeactivate"), 234 a = p(e, "checkCanReturnFocus"); 235 t && t(); 236 var o = p(e, "returnFocus", "returnFocusOnDeactivate"), 237 u = function() { 238 c((function() { 239 o && m(O(v.nodeFocusedBeforeActivation)), n && n() 240 })) 241 }; 242 return o && a ? (a(O(v.nodeFocusedBeforeActivation)).then(u, u), this) : (u(), this) 243 }, 244 pause: function() { 245 return v.paused || !v.active || (v.paused = !0, D()), this 246 }, 247 unpause: function() { 248 return v.paused && v.active ? (v.paused = !1, g(), k(), this) : this 249 }, 250 updateContainerElements: function(e) {
251 var t = [].concat(e).filter(Boolean); 252 return v.containers = t.map((function(e) { 253 return "string" == typeof e ? f.querySelector(e) : e 254 })), v.active && g(), this 255 } 256 }).updateContainerElements(e), l 257 }, Object.defineProperty(e, "__esModule", { 258 value: !0 259 }) 260}));
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.