// All material copyright Esri, All Rights Reserved, unless otherwise specified. // See https://js.arcgis.com/4.30/esri/copyright.txt for details. //>>built define(["exports","./dom"],function(J,n){function R(c,e){var d=Object.keys(c);if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(c);e&&(h=h.filter(function(k){return Object.getOwnPropertyDescriptor(c,k).enumerable}));d.push.apply(d,h)}return d}function S(c){for(var e=1;eW?V?a.slice(a.indexOf(r)+1).find(function(P){return n.isTabbable(P)}):a.slice(0,a.indexOf(r)).reverse().find(function(P){return n.isTabbable(P)}):g[W+(V?1:-1)]}}});q=x.filter(function(m){return 0=q.length&&!F("fallbackFocus"))throw Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(x.find(function(m){return m.posTabIndexesFound})&& 1p?a=l?q[q.length-1].lastTabbableNode:q[0].firstTabbableNode:l?(l=U(q,function(r){return b===r.firstTabbableNode}),0>l&&(v.container===b||n.isFocusable(b,k.tabbableOptions)&&!n.isTabbable(b,k.tabbableOptions)&&!v.nextTabbableNode(b,!1))&&(l=p),0<=l?(f=q[0===l?q.length-1:l-1],a=0<= n.getTabIndex(b)?f.lastTabbableNode:f.lastDomTabbableNode):D(f)||(a=v.nextTabbableNode(b,!1))):(l=U(q,function(r){return b===r.lastTabbableNode}),0>l&&(v.container===b||n.isFocusable(b,k.tabbableOptions)&&!n.isTabbable(b,k.tabbableOptions)&&!v.nextTabbableNode(b))&&(l=p),0<=l?(f=q[l===q.length-1?0:l+1],a=0<=n.getTabIndex(b)?f.firstTabbableNode:f.firstDomTabbableNode):D(f)||(a=v.nextTabbableNode(b)))}else a=F("fallbackFocus");return a},M=function(a){var b=K(a);0<=C(b,a)||(E(k.clickOutsideDeactivates, a)?z.deactivate({returnFocus:k.returnFocusOnDeactivate}):E(k.allowOutsideClick,a)||a.preventDefault())},Z=function(a){var b=K(a),f=0<=C(b,a);if(f||b instanceof Document)f&&(w=b);else{a.stopImmediatePropagation();a=!0;if(w)if(0{n.focusElement(k);return!1},...e?.focusTrapOptions,document:d.ownerDocument,tabbableOptions:n.tabbableOptions,trapStack:la}))};J.deactivateFocusTrap=function(c,e){c.focusTrap?.deactivate(e)};J.updateFocusTrapElements=function(c){c.focusTrap?.updateContainerElements(c.el)}});