Loading
function(e,t,n){"use strict";n.d(t,{n1:()=>p,N$:()=>R,C7:()=>O});var i=n(3388),r=n(241827),s=n(297987),a=n(408713),o=n(419711),l=n(790637);class u{get currentNode(){return this._currentNode}set currentNode(e){if(!(0,r.sD)(this.root,e))throw Error("Cannot set currentNode to a node that is not contained by the root node.");let t=[],n=e,i=e;for(this._currentNode=e;n&&n!==this.root;)if(n.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let e=n,r=this._doc.createTreeWalker(e,this.whatToShow,{acceptNode:this._acceptNode});t.push(r),r.currentNode=i,this._currentSetFor.add(r),n=i=e.host}else n=n.parentNode;let s=this._doc.createTreeWalker(this.root,this.whatToShow,{acceptNode:this._acceptNode});t.push(s),s.currentNode=i,this._currentSetFor.add(s),this._walkerStack=t}get doc(){return this._doc}firstChild(){let e=this.currentNode,t=this.nextNode();return(0,r.sD)(e,t)?(t&&(this.currentNode=t),t):(this.currentNode=e,null)}lastChild(){let e=this._walkerStack[0].lastChild();return e&&(this.currentNode=e),e}nextNode(){let e=this._walkerStack[0].nextNode();if(e){if(e.shadowRoot){var t;let n;if("function"==typeof this.filter?n=this.filter(e):(null==(t=this.filter)?void 0:t.acceptNode)&&(n=this.filter.acceptNode(e)),n===NodeFilter.FILTER_ACCEPT)return this.currentNode=e,e;let i=this.nextNode();return i&&(this.currentNode=i),i}return e&&(this.currentNode=e),e}if(!(this._walkerStack.length>1))return null;{this._walkerStack.shift();let e=this.nextNode();return e&&(this.currentNode=e),e}}previousNode(){let e=this._walkerStack[0];if(e.currentNode===e.root){if(this._currentSetFor.has(e)&&(this._currentSetFor.delete(e),this._walkerStack.length>1)){this._walkerStack.shift();let e=this.previousNode();return e&&(this.currentNode=e),e}return null}let t=e.previousNode();if(t){if(t.shadowRoot){var n;let e;if("function"==typeof this.filter?e=this.filter(t):(null==(n=this.filter)?void 0:n.acceptNode)&&(e=this.filter.acceptNode(t)),e===NodeFilter.FILTER_ACCEPT)return t&&(this.currentNode=t),t;let i=this.lastChild();return i&&(this.currentNode=i),i}return t&&(this.currentNode=t),t}if(!(this._walkerStack.length>1))return null;{this._walkerStack.shift();let e=this.previousNode();return e&&(this.currentNode=e),e}}nextSibling(){return null}previousSibling(){return null}parentNode(){return null}constructor(e,t,n,i){this._walkerStack=[],this._currentSetFor=new Set,this._acceptNode=e=>{if(e.nodeType===Node.ELEMENT_NODE){var t;let n=e.shadowRoot;if(n){let e=this._doc.createTreeWalker(n,this.whatToShow,{acceptNode:this._acceptNode});return this._walkerStack.unshift(e),NodeFilter.FILTER_ACCEPT}if("function"==typeof this.filter)return this.filter(e);if(null==(t=this.filter)?void 0:t.acceptNode)return this.filter.acceptNode(e);if(null===this.filter)return NodeFilter.FILTER_ACCEPT}return NodeFilter.FILTER_SKIP},this._doc=e,this.root=t,this.filter=null!=i?i:null,this.whatToShow=null!=n?n:NodeFilter.SHOW_ALL,this._currentNode=t,this._walkerStack.unshift(e.createTreeWalker(t,n,this._acceptNode));const r=t.shadowRoot;if(r){const e=this._doc.createTreeWalker(r,this.whatToShow,{acceptNode:this._acceptNode});this._walkerStack.unshift(e)}}}var d=n(885714),c=n(805447),_=n(64700);let h=_.createContext(null),f="react-aria-focus-scope-restore",E=null;function p(e){var t,n,o,l,u,c,p,O,b,L;let w,M,x,U,{children:k,contain:G,restoreFocus:V,autoFocus:F}=e,B=(0,_.useRef)(null),j=(0,_.useRef)(null),H=(0,_.useRef)([]),{parentNode:W}=(0,_.useContext)(h)||{},Y=(0,_.useMemo)(()=>new D({scopeRef:H}),[H]);(0,i.N)(()=>{let e=W||P.root;if(P.getTreeNode(e.scopeRef)&&E&&!T(E,e.scopeRef)){let t=P.getTreeNode(E);t&&(e=t)}e.addChild(Y),P.addNode(Y)},[Y,W]),(0,i.N)(()=>{let e=P.getTreeNode(H);e&&(e.contain=!!G)},[G]),(0,i.N)(()=>{var e;let t=null==(e=B.current)?void 0:e.nextSibling,n=[],i=e=>e.stopPropagation();for(;t&&t!==j.current;)n.push(t),t.addEventListener(f,i),t=t.nextSibling;return H.current=n,()=>{for(let e of n)e.removeEventListener(f,i)}},[k]),t=H,n=V,o=G,(0,i.N)(()=>{if(n||o)return;let e=t.current,i=(0,s.TW)(e?e[0]:void 0),a=e=>{let n=(0,r.wt)(e);A(n,t.current)?E=t:I(n)||(E=null)};return i.addEventListener("focusin",a,!1),null==e||e.forEach(e=>e.addEventListener("focusin",a,!1)),()=>{i.removeEventListener("focusin",a,!1),null==e||e.forEach(e=>e.removeEventListener("focusin",a,!1))}},[t,n,o]),l=H,u=G,w=(0,_.useRef)(void 0),M=(0,_.useRef)(void 0),(0,i.N)(()=>{let e=l.current;if(!u){M.current&&(cancelAnimationFrame(M.current),M.current=void 0);return}let t=(0,s.TW)(e?e[0]:void 0),n=e=>{if("Tab"!==e.key||e.altKey||e.ctrlKey||e.metaKey||!g(l)||e.isComposing)return;let n=(0,r.bq)(t),i=l.current;if(!i||!A(n,i))return;let s=R(m(i),{tabbable:!0},i);if(!n)return;s.currentNode=n;let a=e.shiftKey?s.previousNode():s.nextNode();a||(s.currentNode=e.shiftKey?i[i.length-1].nextElementSibling:i[0].previousElementSibling,a=e.shiftKey?s.previousNode():s.nextNode()),e.preventDefault(),a&&S(a,!0)},i=e=>{(!E||T(E,l))&&A((0,r.wt)(e),l.current)?(E=l,w.current=(0,r.wt)(e)):g(l)&&!I((0,r.wt)(e),l)?w.current?w.current.focus():E&&E.current&&C(E.current):g(l)&&(w.current=(0,r.wt)(e))},o=e=>{M.current&&cancelAnimationFrame(M.current),M.current=requestAnimationFrame(()=>{let n=(0,d.ME)(),i=("virtual"===n||null===n)&&(0,a.m0)()&&(0,a.H8)(),s=(0,r.bq)(t);if(!i&&s&&g(l)&&!I(s,l)){E=l;let t=(0,r.wt)(e);if(t&&t.isConnected){var o;w.current=t,null==(o=w.current)||o.focus()}else E.current&&C(E.current)}})};return t.addEventListener("keydown",n,!1),t.addEventListener("focusin",i,!1),null==e||e.forEach(e=>e.addEventListener("focusin",i,!1)),null==e||e.forEach(e=>e.addEventListener("focusout",o,!1)),()=>{t.removeEventListener("keydown",n,!1),t.removeEventListener("focusin",i,!1),null==e||e.forEach(e=>e.removeEventListener("focusin",i,!1)),null==e||e.forEach(e=>e.removeEventListener("focusout",o,!1))}},[l,u]),(0,i.N)(()=>()=>{M.current&&cancelAnimationFrame(M.current)},[M]),c=H,p=V,O=G,x=(0,_.useRef)("u">typeof document?(0,r.bq)((0,s.TW)(c.current?c.current[0]:void 0)):null),(0,i.N)(()=>{let e=c.current,t=(0,s.TW)(e?e[0]:void 0);if(!p||O)return;let n=()=>{(!E||T(E,c))&&A((0,r.bq)(t),c.current)&&(E=c)};return t.addEventListener("focusin",n,!1),null==e||e.forEach(e=>e.addEventListener("focusin",n,!1)),()=>{t.removeEventListener("focusin",n,!1),null==e||e.forEach(e=>e.removeEventListener("focusin",n,!1))}},[c,O]),(0,i.N)(()=>{let e=(0,s.TW)(c.current?c.current[0]:void 0);if(!p)return;let t=t=>{if("Tab"!==t.key||t.altKey||t.ctrlKey||t.metaKey||!g(c)||t.isComposing)return;let n=e.activeElement;if(!I(n,c)||!y(c))return;let i=P.getTreeNode(c);if(!i)return;let r=i.nodeToRestore,s=R(e.body,{tabbable:!0});s.currentNode=n;let a=t.shiftKey?s.previousNode():s.nextNode();if(r&&r.isConnected&&r!==e.body||(r=void 0,i.nodeToRestore=void 0),(!a||!I(a,c))&&r){s.currentNode=r;do a=t.shiftKey?s.previousNode():s.nextNode();while(I(a,c));(t.preventDefault(),t.stopPropagation(),a)?S(a,!0):I(r)?S(r,!0):n.blur()}};return O||e.addEventListener("keydown",t,!0),()=>{O||e.removeEventListener("keydown",t,!0)}},[c,p,O]),(0,i.N)(()=>{var e;let t=(0,s.TW)(c.current?c.current[0]:void 0);if(!p)return;let n=P.getTreeNode(c);if(n)return n.nodeToRestore=null!=(e=x.current)?e:void 0,()=>{let e=P.getTreeNode(c);if(!e)return;let n=e.nodeToRestore,i=(0,r.bq)(t);if(p&&n&&(i&&I(i,c)||i===t.body&&y(c))){let e=P.clone();requestAnimationFrame(()=>{if(t.activeElement===t.body){let t=e.getTreeNode(c);for(;t;){if(t.nodeToRestore&&t.nodeToRestore.isConnected)return void v(t.nodeToRestore);t=t.parent}for(t=e.getTreeNode(c);t;){if(t.scopeRef&&t.scopeRef.current&&P.getTreeNode(t.scopeRef))return void v(N(t.scopeRef.current,!0));t=t.parent}}})}}},[c,p]),b=H,L=F,U=_.useRef(L),(0,_.useEffect)(()=>{if(U.current){E=b;let e=(0,s.TW)(b.current?b.current[0]:void 0);!A((0,r.bq)(e),E.current)&&b.current&&C(b.current)}U.current=!1},[b]),(0,_.useEffect)(()=>{let e=(0,r.bq)((0,s.TW)(H.current?H.current[0]:void 0)),t=null;if(A(e,H.current)){for(let n of P.traverse())n.scopeRef&&A(e,n.scopeRef.current)&&(t=n);t===P.getTreeNode(H)&&(E=t.scopeRef)}},[H]),(0,i.N)(()=>()=>{var e,t,n;let i=null!=(n=null==(t=P.getTreeNode(H))||null==(e=t.parent)?void 0:e.scopeRef)?n:null;(H===E||T(H,E))&&(!i||P.getTreeNode(i))&&(E=i),P.removeTreeNode(H)},[H]);let K=(0,_.useMemo)(()=>{var e;return e=H,{focusNext(t={}){var n;let i=e.current,{from:a,tabbable:o,wrap:l,accept:u}=t,d=a||(0,r.bq)((0,s.TW)(null!=(n=i[0])?n:void 0)),c=i[0].previousElementSibling,_=R(m(i),{tabbable:o,accept:u},i);_.currentNode=A(d,i)?d:c;let h=_.nextNode();return!h&&l&&(_.currentNode=c,h=_.nextNode()),h&&S(h,!0),h},focusPrevious(t={}){var n;let i=e.current,{from:a,tabbable:o,wrap:l,accept:u}=t,d=a||(0,r.bq)((0,s.TW)(null!=(n=i[0])?n:void 0)),c=i[i.length-1].nextElementSibling,_=R(m(i),{tabbable:o,accept:u},i);_.currentNode=A(d,i)?d:c;let h=_.previousNode();return!h&&l&&(_.currentNode=c,h=_.previousNode()),h&&S(h,!0),h},focusFirst(t={}){let n=e.current,{tabbable:i,accept:r}=t,s=R(m(n),{tabbable:i,accept:r},n);s.currentNode=n[0].previousElementSibling;let a=s.nextNode();return a&&S(a,!0),a},focusLast(t={}){let n=e.current,{tabbable:i,accept:r}=t,s=R(m(n),{tabbable:i,accept:r},n);s.currentNode=n[n.length-1].nextElementSibling;let a=s.previousNode();return a&&S(a,!0),a}}},[]),$=(0,_.useMemo)(()=>({focusManager:K,parentNode:Y}),[Y,K]);return _.createElement(h.Provider,{value:$},_.createElement("span",{"data-focus-scope-start":!0,hidden:!0,ref:B}),k,_.createElement("span",{"data-focus-scope-end":!0,hidden:!0,ref:j}))}function m(e){return e[0].parentElement}function g(e){let t=P.getTreeNode(E);for(;t&&t.scopeRef!==e;){if(t.contain)return!1;t=t.parent}return!0}function A(e,t){return!!e&&!!t&&t.some(t=>t.contains(e))}function I(e,t=null){if(e instanceof Element&&e.closest("[data-react-aria-top-layer]"))return!0;for(let{scopeRef:n}of P.traverse(P.getTreeNode(t)))if(n&&A(e,n.current))return!0;return!1}function T(e,t){var n;let i=null==(n=P.getTreeNode(t))?void 0:n.parent;for(;i;){if(i.scopeRef===e)return!0;i=i.parent}return!1}function S(e,t=!1){if(null==e||t){if(null!=e)try{e.focus()}catch{}}else try{(0,c.l)(e)}catch{}}function N(e,t=!0){let n=e[0].previousElementSibling,i=m(e),r=R(i,{tabbable:t},e);r.currentNode=n;let s=r.nextNode();return t&&!s&&((r=R(i=m(e),{tabbable:!1},e)).currentNode=n,s=r.nextNode()),s}function C(e,t=!0){S(N(e,t))}function y(e){let t=P.getTreeNode(E);for(;t&&t.scopeRef!==e;){if(t.nodeToRestore)return!1;t=t.parent}return(null==t?void 0:t.scopeRef)===e}function v(e){e.dispatchEvent(new CustomEvent(f,{bubbles:!0,cancelable:!0}))&&S(e)}function R(e,t,n){var i,r,a;let d=(null==t?void 0:t.tabbable)?o.A:o.t,c=(null==e?void 0:e.nodeType)===Node.ELEMENT_NODE?e:null,_=(0,s.TW)(c),h=(i=e||_,r=NodeFilter.SHOW_ELEMENT,a={acceptNode(e){var i;return(null==t||null==(i=t.from)?void 0:i.contains(e))||(null==t?void 0:t.tabbable)&&"INPUT"===e.tagName&&"radio"===e.getAttribute("type")&&(!function(e){if(e.checked)return!0;let t=[];if(e.form){var n,i;let r=null==(i=e.form)||null==(n=i.elements)?void 0:n.namedItem(e.name);t=[...null!=r?r:[]]}else t=[...(0,s.TW)(e).querySelectorAll(`input[type="radio"][name="${CSS.escape(e.name)}"]`)].filter(e=>!e.form);return!!t&&!t.some(e=>e.checked)}(e)||"INPUT"===h.currentNode.tagName&&"radio"===h.currentNode.type&&h.currentNode.name===e.name)?NodeFilter.FILTER_REJECT:d(e)&&(!n||A(e,n))&&(!(null==t?void 0:t.accept)||t.accept(e))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}},(0,l.Nf)()?new u(_,i,r,a):_.createTreeWalker(i,r,a));return(null==t?void 0:t.from)&&(h.currentNode=t.from),h}function O(e,t={}){return{focusNext(n={}){let i=e.current;if(!i)return null;let{from:a,tabbable:o=t.tabbable,wrap:l=t.wrap,accept:u=t.accept}=n,d=a||(0,r.bq)((0,s.TW)(i)),c=R(i,{tabbable:o,accept:u});i.contains(d)&&(c.currentNode=d);let _=c.nextNode();return!_&&l&&(c.currentNode=i,_=c.nextNode()),_&&S(_,!0),_},focusPrevious(n=t){let i=e.current;if(!i)return null;let{from:a,tabbable:o=t.tabbable,wrap:l=t.wrap,accept:u=t.accept}=n,d=a||(0,r.bq)((0,s.TW)(i)),c=R(i,{tabbable:o,accept:u});if(i.contains(d))c.currentNode=d;else{let e=b(c);return e&&S(e,!0),null!=e?e:null}let _=c.previousNode();if(!_&&l){c.currentNode=i;let e=b(c);if(!e)return null;_=e}return _&&S(_,!0),null!=_?_:null},focusFirst(n=t){let i=e.current;if(!i)return null;let{tabbable:r=t.tabbable,accept:s=t.accept}=n,a=R(i,{tabbable:r,accept:s}).nextNode();return a&&S(a,!0),a},focusLast(n=t){let i=e.current;if(!i)return null;let{tabbable:r=t.tabbable,accept:s=t.accept}=n,a=b(R(i,{tabbable:r,accept:s}));return a&&S(a,!0),null!=a?a:null}}}function b(e){let t,n;do(t=e.lastChild())&&(n=t);while(t);return n}class L{get size(){return this.fastMap.size}getTreeNode(e){return this.fastMap.get(e)}addTreeNode(e,t,n){let i=this.fastMap.get(null!=t?t:null);if(!i)return;let r=new D({scopeRef:e});i.addChild(r),r.parent=i,this.fastMap.set(e,r),n&&(r.nodeToRestore=n)}addNode(e){this.fastMap.set(e.scopeRef,e)}removeTreeNode(e){if(null===e)return;let t=this.fastMap.get(e);if(!t)return;let n=t.parent;for(let e of this.traverse())e!==t&&t.nodeToRestore&&e.nodeToRestore&&t.scopeRef&&t.scopeRef.current&&A(e.nodeToRestore,t.scopeRef.current)&&(e.nodeToRestore=t.nodeToRestore);let i=t.children;n&&(n.removeChild(t),i.size>0&&i.forEach(e=>n&&n.addChild(e))),this.fastMap.delete(t.scopeRef)}*traverse(e=this.root){if(null!=e.scopeRef&&(yield e),e.children.size>0)for(let t of e.children)yield*this.traverse(t)}clone(){var e,t;let n=new L;for(let i of this.traverse())n.addTreeNode(i.scopeRef,null!=(t=null==(e=i.parent)?void 0:e.scopeRef)?t:null,i.nodeToRestore);return n}constructor(){this.fastMap=new Map,this.root=new D({scopeRef:null}),this.fastMap.set(null,this.root)}}class D{addChild(e){this.children.add(e),e.parent=this}removeChild(e){this.children.delete(e),e.parent=void 0}constructor(e){this.children=new Set,this.contain=!1,this.scopeRef=e.scopeRef}}let P=new L}